Loading services/core/java/com/android/server/pm/RemovePackageHelper.java +14 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.pm; import static android.content.pm.PackageManager.UNINSTALL_REASON_UNKNOWN; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; import static android.os.incremental.IncrementalManager.isIncrementalPath; import static android.os.storage.StorageManager.FLAG_STORAGE_CE; import static android.os.storage.StorageManager.FLAG_STORAGE_DE; Loading @@ -29,6 +30,7 @@ import static com.android.server.pm.PackageManagerService.TAG; import android.annotation.NonNull; import android.content.pm.PackageManager; import android.os.Trace; import android.os.UserHandle; import android.os.incremental.IncrementalManager; import android.util.Log; Loading Loading @@ -334,10 +336,19 @@ final class RemovePackageHelper { mPm.mSettings.writeKernelMappingLPr(deletedPs); } } if (removedAppId != -1) { // A user ID was deleted here. Go through all users and remove it // from KeyStore. mAppDataHelper.clearKeystoreData(UserHandle.USER_ALL, removedAppId); // A user ID was deleted here. Go through all users and remove it from KeyStore. final int appIdToRemove = removedAppId; mPm.mInjector.getBackgroundHandler().post(() -> { try { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "clearKeystoreData:" + appIdToRemove); mAppDataHelper.clearKeystoreData(UserHandle.USER_ALL, appIdToRemove); } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } }); } } } services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt +2 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { val domainVerificationManagerInternal: DomainVerificationManagerInternal = mock() val handler = TestHandler(null) val defaultAppProvider: DefaultAppProvider = mock() val backgroundHandler = TestHandler(null) } companion object { Loading Loading @@ -286,6 +287,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { .thenReturn(mocks.domainVerificationManagerInternal) whenever(mocks.injector.handler) { mocks.handler } whenever(mocks.injector.defaultAppProvider) { mocks.defaultAppProvider } whenever(mocks.injector.backgroundHandler) { mocks.backgroundHandler } wheneverStatic { SystemConfig.getInstance() }.thenReturn(mocks.systemConfig) whenever(mocks.systemConfig.availableFeatures).thenReturn(DEFAULT_AVAILABLE_FEATURES_MAP) whenever(mocks.systemConfig.sharedLibraries).thenReturn(DEFAULT_SHARED_LIBRARIES_LIST) Loading Loading
services/core/java/com/android/server/pm/RemovePackageHelper.java +14 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.pm; import static android.content.pm.PackageManager.UNINSTALL_REASON_UNKNOWN; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; import static android.os.incremental.IncrementalManager.isIncrementalPath; import static android.os.storage.StorageManager.FLAG_STORAGE_CE; import static android.os.storage.StorageManager.FLAG_STORAGE_DE; Loading @@ -29,6 +30,7 @@ import static com.android.server.pm.PackageManagerService.TAG; import android.annotation.NonNull; import android.content.pm.PackageManager; import android.os.Trace; import android.os.UserHandle; import android.os.incremental.IncrementalManager; import android.util.Log; Loading Loading @@ -334,10 +336,19 @@ final class RemovePackageHelper { mPm.mSettings.writeKernelMappingLPr(deletedPs); } } if (removedAppId != -1) { // A user ID was deleted here. Go through all users and remove it // from KeyStore. mAppDataHelper.clearKeystoreData(UserHandle.USER_ALL, removedAppId); // A user ID was deleted here. Go through all users and remove it from KeyStore. final int appIdToRemove = removedAppId; mPm.mInjector.getBackgroundHandler().post(() -> { try { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "clearKeystoreData:" + appIdToRemove); mAppDataHelper.clearKeystoreData(UserHandle.USER_ALL, appIdToRemove); } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } }); } } }
services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt +2 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { val domainVerificationManagerInternal: DomainVerificationManagerInternal = mock() val handler = TestHandler(null) val defaultAppProvider: DefaultAppProvider = mock() val backgroundHandler = TestHandler(null) } companion object { Loading Loading @@ -286,6 +287,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { .thenReturn(mocks.domainVerificationManagerInternal) whenever(mocks.injector.handler) { mocks.handler } whenever(mocks.injector.defaultAppProvider) { mocks.defaultAppProvider } whenever(mocks.injector.backgroundHandler) { mocks.backgroundHandler } wheneverStatic { SystemConfig.getInstance() }.thenReturn(mocks.systemConfig) whenever(mocks.systemConfig.availableFeatures).thenReturn(DEFAULT_AVAILABLE_FEATURES_MAP) whenever(mocks.systemConfig.sharedLibraries).thenReturn(DEFAULT_SHARED_LIBRARIES_LIST) Loading