Loading services/core/java/com/android/server/notification/ManagedServices.java +6 −4 Original line number Diff line number Diff line Loading @@ -558,7 +558,7 @@ abstract public class ManagedServices { if (pkgList != null && (pkgList.length > 0)) { boolean anyServicesInvolved = false; // Remove notification settings for uninstalled package if (removingPackage) { if (removingPackage && uidList != null) { int size = Math.min(pkgList.length, uidList.length); for (int i = 0; i < size; i++) { final String pkg = pkgList[i]; Loading @@ -570,12 +570,14 @@ abstract public class ManagedServices { if (mEnabledServicesPackageNames.contains(pkgName)) { anyServicesInvolved = true; } if (uidList != null && uidList.length > 0) { for (int uid : uidList) { if (isPackageAllowed(pkgName, UserHandle.getUserId(uid))) { anyServicesInvolved = true; } } } } if (anyServicesInvolved) { // make sure we're still bound to any of our services who may have just upgraded Loading services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -859,6 +859,19 @@ public class ManagedServicesTest extends UiServiceTestCase { assertTrue(componentsToBind.get(10).contains(ComponentName.unflattenFromString("c/c"))); } @Test public void testOnPackagesChanged_nullValuesPassed_noNullPointers() { for (int approvalLevel : new int[] {APPROVAL_BY_COMPONENT, APPROVAL_BY_PACKAGE}) { ManagedServices service = new TestManagedServices(getContext(), mLock, mUserProfiles, mIpm, approvalLevel); // null uid list service.onPackagesChanged(true, new String[]{"this.is.a.package.name"}, null); // null package list service.onPackagesChanged(true, null, new int[]{103}); } } private void loadXml(ManagedServices service) throws Exception { final StringBuffer xml = new StringBuffer(); xml.append("<" + service.getConfig().xmlTag + ">\n"); Loading Loading
services/core/java/com/android/server/notification/ManagedServices.java +6 −4 Original line number Diff line number Diff line Loading @@ -558,7 +558,7 @@ abstract public class ManagedServices { if (pkgList != null && (pkgList.length > 0)) { boolean anyServicesInvolved = false; // Remove notification settings for uninstalled package if (removingPackage) { if (removingPackage && uidList != null) { int size = Math.min(pkgList.length, uidList.length); for (int i = 0; i < size; i++) { final String pkg = pkgList[i]; Loading @@ -570,12 +570,14 @@ abstract public class ManagedServices { if (mEnabledServicesPackageNames.contains(pkgName)) { anyServicesInvolved = true; } if (uidList != null && uidList.length > 0) { for (int uid : uidList) { if (isPackageAllowed(pkgName, UserHandle.getUserId(uid))) { anyServicesInvolved = true; } } } } if (anyServicesInvolved) { // make sure we're still bound to any of our services who may have just upgraded Loading
services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -859,6 +859,19 @@ public class ManagedServicesTest extends UiServiceTestCase { assertTrue(componentsToBind.get(10).contains(ComponentName.unflattenFromString("c/c"))); } @Test public void testOnPackagesChanged_nullValuesPassed_noNullPointers() { for (int approvalLevel : new int[] {APPROVAL_BY_COMPONENT, APPROVAL_BY_PACKAGE}) { ManagedServices service = new TestManagedServices(getContext(), mLock, mUserProfiles, mIpm, approvalLevel); // null uid list service.onPackagesChanged(true, new String[]{"this.is.a.package.name"}, null); // null package list service.onPackagesChanged(true, null, new int[]{103}); } } private void loadXml(ManagedServices service) throws Exception { final StringBuffer xml = new StringBuffer(); xml.append("<" + service.getConfig().xmlTag + ">\n"); Loading