Merge "Fix LauncherApps package removed Callback failed on multi-users" into sc-dev
This commit is contained in:
@@ -25,6 +25,7 @@ import static android.content.pm.LauncherApps.FLAG_CACHE_BUBBLE_SHORTCUTS;
|
|||||||
import static android.content.pm.LauncherApps.FLAG_CACHE_NOTIFICATION_SHORTCUTS;
|
import static android.content.pm.LauncherApps.FLAG_CACHE_NOTIFICATION_SHORTCUTS;
|
||||||
import static android.content.pm.LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS;
|
import static android.content.pm.LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS;
|
||||||
|
|
||||||
|
import android.annotation.AppIdInt;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
@@ -1232,12 +1233,12 @@ public class LauncherAppsService extends SystemService {
|
|||||||
cookie.user.getIdentifier());
|
cookie.user.getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether or not the given UID is in allow list */
|
/** Returns whether or not the given appId is in allow list */
|
||||||
private static boolean isCallingUidAllowed(int[] allowList, int callingUid) {
|
private static boolean isCallingAppIdAllowed(int[] appIdAllowList, @AppIdInt int appId) {
|
||||||
if (allowList == null) {
|
if (appIdAllowList == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return Arrays.binarySearch(allowList, callingUid) > -1;
|
return Arrays.binarySearch(appIdAllowList, appId) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] getFilteredPackageNames(String[] packageNames, BroadcastCookie cookie) {
|
private String[] getFilteredPackageNames(String[] packageNames, BroadcastCookie cookie) {
|
||||||
@@ -1432,7 +1433,7 @@ public class LauncherAppsService extends SystemService {
|
|||||||
// Handle onPackageRemoved.
|
// Handle onPackageRemoved.
|
||||||
if (Intent.ACTION_PACKAGE_REMOVED_INTERNAL.equals(action)) {
|
if (Intent.ACTION_PACKAGE_REMOVED_INTERNAL.equals(action)) {
|
||||||
final String packageName = getPackageName(intent);
|
final String packageName = getPackageName(intent);
|
||||||
final int[] allowList =
|
final int[] appIdAllowList =
|
||||||
intent.getIntArrayExtra(Intent.EXTRA_VISIBILITY_ALLOW_LIST);
|
intent.getIntArrayExtra(Intent.EXTRA_VISIBILITY_ALLOW_LIST);
|
||||||
// If {@link #EXTRA_REPLACING} is true, that will be onPackageChanged case.
|
// If {@link #EXTRA_REPLACING} is true, that will be onPackageChanged case.
|
||||||
if (packageName != null && !intent.getBooleanExtra(
|
if (packageName != null && !intent.getBooleanExtra(
|
||||||
@@ -1448,7 +1449,8 @@ public class LauncherAppsService extends SystemService {
|
|||||||
if (!isEnabledProfileOf(cookie.user, user, "onPackageRemoved")) {
|
if (!isEnabledProfileOf(cookie.user, user, "onPackageRemoved")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isCallingUidAllowed(allowList, cookie.callingUid)) {
|
if (!isCallingAppIdAllowed(appIdAllowList, UserHandle.getAppId(
|
||||||
|
cookie.callingUid))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user