From c08640473970a24fdfe5ba73ec54e774e9711aa0 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Fri, 25 Mar 2022 16:36:48 -0700 Subject: [PATCH] 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 --- .../com/android/server/accounts/AccountManagerServiceTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java index 2690948ca4491..997a138cf58f0 100644 --- a/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java @@ -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);