Fix AccountManagerServiceTest

Bug: 226979591

AccountManagerServiceTest fails because a PropertyInvalidatedCache
tries to set a system property.  This change puts the caches in test
mode so the test can run.

The change uses the legacy PropertyInvalidatedCache to match a change
that has already gone into master.

Test:
 * atest FrameworksServicesTests:AccountManagerServiceTest

Change-Id: I960120f00290968b4d48ceecd71b22bc8c548e0c
This commit is contained in:
Lee Shombert
2022-03-25 16:36:48 -07:00
parent 1ccb6f2a4c
commit c086404739

View File

@@ -35,6 +35,7 @@ import android.accounts.AccountManagerInternal;
import android.accounts.CantAddAccountActivity;
import android.accounts.IAccountManagerResponse;
import android.app.AppOpsManager;
import android.app.PropertyInvalidatedCache;
import android.app.INotificationManager;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManagerInternal;
@@ -132,6 +133,8 @@ public class AccountManagerServiceTest extends AndroidTestCase {
protected void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
PropertyInvalidatedCache.disableForTestMode();
when(mMockPackageManager.checkSignatures(anyInt(), anyInt()))
.thenReturn(PackageManager.SIGNATURE_MATCH);
final UserInfo ui = new UserInfo(UserHandle.USER_SYSTEM, "user0", 0);