From fdb68fbfce40a048cbe06733be7537b2ff80f6ff Mon Sep 17 00:00:00 2001 From: Jeongeun Song Date: Wed, 25 Aug 2021 10:20:28 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20an=20issue=20LauncherApps=20couldn?= =?UTF-8?q?=E2=80=99t=20get=20onPackageRemoved=20Callback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The system apps which registered listener in LauncherApps couldn't get ACTION_PACKAGE_REMOVED_INTERNAL broadcast because they are not in allowlist of package visibility. They must see all applications so modify the code if the appId is smaller than 10000 it should be always allowed. Bug: 196910947 Test: Register a listener of a system app to LauncherAppsService and verify if can get the broadcast. Change-Id: I39f4365cfa09ffa9afeccd13a8703846db357cbf --- .../core/java/com/android/server/pm/LauncherAppsService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java index 375ffc497eadb..9c11cd4811b4e 100644 --- a/services/core/java/com/android/server/pm/LauncherAppsService.java +++ b/services/core/java/com/android/server/pm/LauncherAppsService.java @@ -1263,7 +1263,7 @@ public class LauncherAppsService extends SystemService { /** Returns whether or not the given appId is in allow list */ private static boolean isCallingAppIdAllowed(int[] appIdAllowList, @AppIdInt int appId) { - if (appIdAllowList == null) { + if (appIdAllowList == null || appId < Process.FIRST_APPLICATION_UID) { return true; } return Arrays.binarySearch(appIdAllowList, appId) > -1;