Merge "Rename the API and remove boolean isInstantApp"

This commit is contained in:
Jackal Guo
2022-04-13 01:26:38 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 23 deletions

View File

@@ -439,10 +439,6 @@ public interface Computer extends PackageDataSnapshot {
boolean getBlockUninstallForUser(@NonNull String packageName, @UserIdInt int userId);
@Nullable
SparseArray<int[]> getBroadcastAllowList(@NonNull String packageName, @UserIdInt int[] userIds,
boolean isInstantApp);
@Nullable
String getInstallerPackageName(@NonNull String packageName);
@@ -479,6 +475,16 @@ public interface Computer extends PackageDataSnapshot {
boolean isPackageSignedByKeySetExactly(@NonNull String packageName, @NonNull KeySet ks);
/**
* See {@link AppsFilterSnapshot#getVisibilityAllowList(PackageStateInternal, int[], ArrayMap)}
*/
@Nullable
SparseArray<int[]> getVisibilityAllowLists(@NonNull String packageName,
@UserIdInt int[] userIds);
/**
* See {@link AppsFilterSnapshot#getVisibilityAllowList(PackageStateInternal, int[], ArrayMap)}
*/
@Nullable
int[] getVisibilityAllowList(@NonNull String packageName, @UserIdInt int userId);

View File

@@ -5024,20 +5024,6 @@ public class ComputerEngine implements Computer {
return mSettings.getBlockUninstall(userId, packageName);
}
@Nullable
@Override
public SparseArray<int[]> getBroadcastAllowList(@NonNull String packageName,
@UserIdInt int[] userIds, boolean isInstantApp) {
if (isInstantApp) {
return null;
}
PackageStateInternal setting = getPackageStateInternal(packageName, Process.SYSTEM_UID);
if (setting == null) {
return null;
}
return mAppsFilter.getVisibilityAllowList(setting, userIds, getPackageStates());
}
@Nullable
@Override
public String getInstallerPackageName(@NonNull String packageName) {
@@ -5316,14 +5302,21 @@ public class ComputerEngine implements Computer {
@Nullable
@Override
public int[] getVisibilityAllowList(@NonNull String packageName, @UserIdInt int userId) {
public SparseArray<int[]> getVisibilityAllowLists(@NonNull String packageName,
@UserIdInt int[] userIds) {
final PackageStateInternal ps =
getPackageStateInternal(packageName, Process.SYSTEM_UID);
if (ps == null) {
return null;
}
final SparseArray<int[]> visibilityAllowList = mAppsFilter.getVisibilityAllowList(ps,
new int[]{userId}, getPackageStates());
return mAppsFilter.getVisibilityAllowList(ps, userIds, getPackageStates());
}
@Nullable
@Override
public int[] getVisibilityAllowList(@NonNull String packageName, @UserIdInt int userId) {
final SparseArray<int[]> visibilityAllowList = getVisibilityAllowLists(packageName,
new int[]{userId});
return visibilityAllowList != null ? visibilityAllowList.get(userId) : null;
}

View File

@@ -3937,8 +3937,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
snapshot.isInstantAppInternal(packageName, userId, Process.SYSTEM_UID);
final int[] userIds = isInstantApp ? EMPTY_INT_ARRAY : new int[] { userId };
final int[] instantUserIds = isInstantApp ? new int[] { userId } : EMPTY_INT_ARRAY;
final SparseArray<int[]> broadcastAllowList = snapshot.getBroadcastAllowList(
packageName, userIds, isInstantApp);
final SparseArray<int[]> broadcastAllowList =
isInstantApp ? null : snapshot.getVisibilityAllowLists(packageName, userIds);
mHandler.post(() -> mBroadcastHelper.sendPackageChangedBroadcast(
packageName, dontKillApp, componentNames, packageUid, reason, userIds,
instantUserIds, broadcastAllowList));