Add strict mode violation tests for getAccounts methods.
Bug: 38270177
Test: cts
Change-Id: Ie1438543fd3fec239d92867659424d8d472e71b4
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
index 795fcd6..c940c3f 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
@@ -2297,9 +2297,32 @@
try {
StrictMode.setThreadPolicy(
new StrictMode.ThreadPolicy.Builder().detectDiskReads().penaltyDeath().build());
+ // getAccounts()
Account[] accounts = am.getAccounts();
assertNotNull(accounts);
assertTrue(accounts.length > 0);
+
+ // getAccountsAndVisibilityForPackage(...)
+ Map<Account, Integer> accountsAndVisibility =
+ am.getAccountsAndVisibilityForPackage(PACKAGE_NAME_PRIVILEGED, ACCOUNT_TYPE);
+ assertNotNull(accountsAndVisibility);
+ assertTrue(accountsAndVisibility.size() > 0);
+
+ // getAccountsByType(...)
+ Account[] accountsByType = am.getAccountsByType(ACCOUNT_TYPE);
+ assertNotNull(accountsByType);
+ assertTrue(accountsByType.length > 0);
+
+ // getAccountsByTypeForPackage(...)
+ Account[] accountsByTypeForPackage =
+ am.getAccountsByTypeForPackage(ACCOUNT_TYPE, PACKAGE_NAME_PRIVILEGED);
+ assertNotNull(accountsByTypeForPackage);
+ assertTrue(accountsByTypeForPackage.length > 0);
+
+ // getAccountsByTypeAndFeatures(...)
+ am.getAccountsByTypeAndFeatures(ACCOUNT_TYPE, null /* features */, null, null);
+ am.getAccountsByTypeAndFeatures(ACCOUNT_TYPE, REQUIRED_FEATURES, null, null);
+
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}