Merge "Renames filterAppAccess to shouldFilterApplication"
This commit is contained in:
committed by
Android (Google) Code Review
commit
25f2141a1a
@@ -2059,7 +2059,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
for (String packageName : packages) {
|
||||
PackageSetting setting = mSettings.mPackages.get(packageName);
|
||||
if (setting != null && filterAppAccessLPr(setting, callingUid, callingUserId)) {
|
||||
if (setting != null
|
||||
&& shouldFilterApplicationLocked(setting, callingUid, callingUserId)) {
|
||||
notifyInstallObserver(packageName);
|
||||
}
|
||||
}
|
||||
@@ -4030,7 +4031,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
// and 2) ephemeral apps that have explicitly interacted with it
|
||||
// * Ephemeral apps can only see their own data and exposed installed apps
|
||||
// * Holding a signature permission allows seeing instant apps
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4097,7 +4098,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final boolean userKeyUnlocked = StorageManager.isUserKeyUnlocked(userId);
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps == null || filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (ps == null || shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
throw new SecurityException("Package " + packageName + " was not found!");
|
||||
}
|
||||
|
||||
@@ -4130,7 +4131,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
PackageParser.Package p = mPackages.get(packageName);
|
||||
if (p != null) {
|
||||
final PackageSetting ps = (PackageSetting) p.mExtras;
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return false;
|
||||
}
|
||||
if (ps != null) {
|
||||
@@ -4187,7 +4188,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, filterCallingUid, userId, flags)) {
|
||||
return null;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, filterCallingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, filterCallingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
return generatePackageInfo(ps, flags, userId);
|
||||
@@ -4205,7 +4206,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, filterCallingUid, userId, flags)) {
|
||||
return null;
|
||||
}
|
||||
if (ps != null && filterAppAccessLPr(ps, filterCallingUid, userId)) {
|
||||
if (ps != null && shouldFilterApplicationLocked(ps, filterCallingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
return generatePackageInfo((PackageSetting)p.mExtras, flags, userId);
|
||||
@@ -4216,7 +4217,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, filterCallingUid, userId, flags)) {
|
||||
return null;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, filterCallingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, filterCallingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
return generatePackageInfo(ps, flags, userId);
|
||||
@@ -4288,7 +4289,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
* @see #canViewInstantApps(int, int)
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
private boolean filterAppAccessLPr(@Nullable PackageSetting ps, int callingUid,
|
||||
private boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid,
|
||||
@Nullable ComponentName component, @ComponentType int componentType, int userId) {
|
||||
// if we're in an isolated process, get the real calling UID
|
||||
if (Process.isIsolated(callingUid)) {
|
||||
@@ -4343,11 +4344,12 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #filterAppAccessLPr(PackageSetting, int, ComponentName, int, int)
|
||||
* @see #shouldFilterApplicationLocked(PackageSetting, int, ComponentName, int, int)
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
private boolean filterAppAccessLPr(@Nullable PackageSetting ps, int callingUid, int userId) {
|
||||
return filterAppAccessLPr(ps, callingUid, null, TYPE_UNKNOWN, userId);
|
||||
private boolean shouldFilterApplicationLocked(
|
||||
@Nullable PackageSetting ps, int callingUid, int userId) {
|
||||
return shouldFilterApplicationLocked(ps, callingUid, null, TYPE_UNKNOWN, userId);
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
@@ -4474,7 +4476,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageParser.Package p = mPackages.get(packageName);
|
||||
if (p != null && p.isMatch(flags)) {
|
||||
PackageSetting ps = (PackageSetting) p.mExtras;
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return -1;
|
||||
}
|
||||
return UserHandle.getUid(userId, p.applicationInfo.uid);
|
||||
@@ -4482,7 +4484,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if ((flags & MATCH_KNOWN_PACKAGES) != 0) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps != null && ps.isMatch(flags)
|
||||
&& !filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
&& !shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return UserHandle.getUid(userId, ps.appId);
|
||||
}
|
||||
}
|
||||
@@ -4504,7 +4506,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageParser.Package p = mPackages.get(packageName);
|
||||
if (p != null && p.isMatch(flags)) {
|
||||
PackageSetting ps = (PackageSetting) p.mExtras;
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
// TODO: Shouldn't this be checking for package installed state for userId and
|
||||
@@ -4514,7 +4516,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if ((flags & MATCH_KNOWN_PACKAGES) != 0) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps != null && ps.isMatch(flags)
|
||||
&& !filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
&& !shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return ps.getPermissionsState().computeGids(userId);
|
||||
}
|
||||
}
|
||||
@@ -4543,7 +4545,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, filterCallingUid, userId, flags)) {
|
||||
return null;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, filterCallingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, filterCallingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
if (ps.pkg == null) {
|
||||
@@ -4601,7 +4603,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, filterCallingUid, userId, flags)) {
|
||||
return null;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, filterCallingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, filterCallingUid, userId)) {
|
||||
return null;
|
||||
}
|
||||
// Note: isEnabledLP() does not apply here - always return info
|
||||
@@ -5024,7 +5026,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (a != null && mSettings.isEnabledAndMatchLPr(a.info, flags, userId)) {
|
||||
PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
|
||||
if (ps == null) return null;
|
||||
if (filterAppAccessLPr(ps, filterCallingUid, component, TYPE_ACTIVITY, userId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, filterCallingUid, component, TYPE_ACTIVITY, userId)) {
|
||||
return null;
|
||||
}
|
||||
return PackageParser.generateActivityInfo(
|
||||
@@ -5072,7 +5075,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (ps == null) {
|
||||
return false;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_ACTIVITY, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_ACTIVITY, callingUserId)) {
|
||||
return false;
|
||||
}
|
||||
for (int i=0; i<a.intents.size(); i++) {
|
||||
@@ -5099,7 +5103,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (a != null && mSettings.isEnabledAndMatchLPr(a.info, flags, userId)) {
|
||||
PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
|
||||
if (ps == null) return null;
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_RECEIVER, userId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_RECEIVER, userId)) {
|
||||
return null;
|
||||
}
|
||||
return PackageParser.generateActivityInfo(
|
||||
@@ -5313,7 +5318,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (s != null && mSettings.isEnabledAndMatchLPr(s.info, flags, userId)) {
|
||||
PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
|
||||
if (ps == null) return null;
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_SERVICE, userId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_SERVICE, userId)) {
|
||||
return null;
|
||||
}
|
||||
return PackageParser.generateServiceInfo(
|
||||
@@ -5337,7 +5343,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (p != null && mSettings.isEnabledAndMatchLPr(p.info, flags, userId)) {
|
||||
PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
|
||||
if (ps == null) return null;
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_PROVIDER, userId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_PROVIDER, userId)) {
|
||||
return null;
|
||||
}
|
||||
return PackageParser.generateProviderInfo(
|
||||
@@ -5609,8 +5616,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final int callingUserId = UserHandle.getUserId(callingUid);
|
||||
final PackageSetting ps1 = (PackageSetting) p1.mExtras;
|
||||
final PackageSetting ps2 = (PackageSetting) p2.mExtras;
|
||||
if (filterAppAccessLPr(ps1, callingUid, callingUserId)
|
||||
|| filterAppAccessLPr(ps2, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps1, callingUid, callingUserId)
|
||||
|| shouldFilterApplicationLocked(ps2, callingUid, callingUserId)) {
|
||||
return PackageManager.SIGNATURE_UNKNOWN_PACKAGE;
|
||||
}
|
||||
return compareSignatures(p1.mSigningDetails.signatures, p2.mSigningDetails.signatures);
|
||||
@@ -5638,7 +5645,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
s1 = ((SharedUserSetting)obj).signatures.mSigningDetails.signatures;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return PackageManager.SIGNATURE_UNKNOWN_PACKAGE;
|
||||
}
|
||||
s1 = ps.signatures.mSigningDetails.signatures;
|
||||
@@ -5657,7 +5664,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
s2 = ((SharedUserSetting)obj).signatures.mSigningDetails.signatures;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return PackageManager.SIGNATURE_UNKNOWN_PACKAGE;
|
||||
}
|
||||
s2 = ps.signatures.mSigningDetails.signatures;
|
||||
@@ -5683,7 +5690,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final int callingUserId = UserHandle.getUserId(callingUid);
|
||||
final PackageSetting ps = (PackageSetting) p.mExtras;
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return false;
|
||||
}
|
||||
switch (type) {
|
||||
@@ -5717,7 +5724,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
signingDetails = ((SharedUserSetting)obj).signatures.mSigningDetails;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return false;
|
||||
}
|
||||
signingDetails = ps.signatures.mSigningDetails;
|
||||
@@ -5834,7 +5841,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return res;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (ps.getInstalled(userId) && !filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (ps.getInstalled(userId)
|
||||
&& !shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return new String[]{ps.name};
|
||||
}
|
||||
}
|
||||
@@ -5856,7 +5864,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return sus.name + ":" + sus.userId;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return null;
|
||||
}
|
||||
return ps.name;
|
||||
@@ -5884,7 +5893,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
names[i] = "shared:" + sus.name;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
names[i] = null;
|
||||
} else {
|
||||
names[i] = ps.name;
|
||||
@@ -5934,7 +5944,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return sus.pkgFlags;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return 0;
|
||||
}
|
||||
return ps.pkgFlags;
|
||||
@@ -5957,7 +5968,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return sus.pkgPrivateFlags;
|
||||
} else if (obj instanceof PackageSetting) {
|
||||
final PackageSetting ps = (PackageSetting) obj;
|
||||
if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return 0;
|
||||
}
|
||||
return ps.pkgPrivateFlags;
|
||||
@@ -7976,7 +7988,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, callingUid, userId, flags)) {
|
||||
continue;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
continue;
|
||||
}
|
||||
final PackageInfo pi = generatePackageInfo(ps, flags, userId);
|
||||
@@ -7991,7 +8003,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, callingUid, userId, flags)) {
|
||||
continue;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
continue;
|
||||
}
|
||||
final PackageInfo pi = generatePackageInfo((PackageSetting)
|
||||
@@ -8125,7 +8137,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, callingUid, userId, flags)) {
|
||||
continue;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
continue;
|
||||
}
|
||||
ai = PackageParser.generateApplicationInfo(ps.pkg, effectiveFlags,
|
||||
@@ -8151,7 +8163,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (filterSharedLibPackageLPr(ps, Binder.getCallingUid(), userId, flags)) {
|
||||
continue;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
continue;
|
||||
}
|
||||
ApplicationInfo ai = PackageParser.generateApplicationInfo(p, flags,
|
||||
@@ -8343,7 +8355,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageSetting ps = mSettings.mPackages.get(providerInfo.packageName);
|
||||
final ComponentName component =
|
||||
new ComponentName(providerInfo.packageName, providerInfo.name);
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_PROVIDER, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, component, TYPE_PROVIDER, userId)) {
|
||||
return null;
|
||||
}
|
||||
return providerInfo;
|
||||
@@ -8383,7 +8395,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageSetting ps = mSettings.mPackages.get(providerInfo.packageName);
|
||||
final ComponentName component =
|
||||
new ComponentName(providerInfo.packageName, providerInfo.name);
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_PROVIDER, userId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_PROVIDER, userId)) {
|
||||
continue;
|
||||
}
|
||||
if (finalList == null) {
|
||||
@@ -8409,7 +8422,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final int callingUserId = UserHandle.getUserId(callingUid);
|
||||
final PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
|
||||
if (ps == null) return null;
|
||||
if (filterAppAccessLPr(ps, callingUid, component, TYPE_UNKNOWN, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_UNKNOWN, callingUserId)) {
|
||||
return null;
|
||||
}
|
||||
final PackageParser.Instrumentation i = mInstrumentation.get(component);
|
||||
@@ -8423,7 +8437,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final int callingUserId = UserHandle.getUserId(callingUid);
|
||||
final PackageSetting ps = mSettings.mPackages.get(targetPackage);
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
return new ParceledListSlice<>(queryInstrumentationInternal(targetPackage, flags));
|
||||
@@ -12274,7 +12288,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (pkgSetting == null) {
|
||||
return false;
|
||||
}
|
||||
if (filterAppAccessLPr(pkgSetting, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(pkgSetting, callingUid, userId)) {
|
||||
return false;
|
||||
}
|
||||
// Do not allow "android" is being disabled
|
||||
@@ -12449,7 +12463,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (ps == null) {
|
||||
return true;
|
||||
}
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return true;
|
||||
}
|
||||
return ps.getHidden(userId);
|
||||
@@ -12641,7 +12655,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageSetting pkgSetting;
|
||||
synchronized (mLock) {
|
||||
pkgSetting = mSettings.mPackages.get(packageName);
|
||||
if (pkgSetting == null || filterAppAccessLPr(pkgSetting, callingUid, userId)) {
|
||||
if (pkgSetting == null
|
||||
|| shouldFilterApplicationLocked(pkgSetting, callingUid, userId)) {
|
||||
Slog.w(TAG, "Could not find package setting for package: " + packageName
|
||||
+ ". Skipping...");
|
||||
unactionedPackages.add(packageName);
|
||||
@@ -12733,7 +12748,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageSetting pkgSetting;
|
||||
synchronized (mLock) {
|
||||
pkgSetting = mSettings.mPackages.get(packageName);
|
||||
if (pkgSetting == null || filterAppAccessLPr(pkgSetting, callingUid, userId)) {
|
||||
if (pkgSetting == null
|
||||
|| shouldFilterApplicationLocked(pkgSetting, callingUid, userId)) {
|
||||
Slog.w(TAG, "Could not find package setting for package: " + packageName
|
||||
+ ". Skipping suspending/un-suspending.");
|
||||
unactionedPackages.add(packageName);
|
||||
@@ -12774,7 +12790,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps == null || filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (ps == null || shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
throw new IllegalArgumentException("Unknown target package: " + packageName);
|
||||
}
|
||||
final PackageUserState packageUserState = ps.readUserState(userId);
|
||||
@@ -12826,7 +12842,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
"isPackageSuspendedForUser for user " + userId);
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps == null || filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (ps == null || shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
throw new IllegalArgumentException("Unknown target package: " + packageName);
|
||||
}
|
||||
return ps.getSuspended(userId);
|
||||
@@ -13294,7 +13310,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps == null
|
||||
|| filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
|| shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
|
||||
}
|
||||
return mSettings.getIntentFilterVerificationStatusLPr(packageName, userId);
|
||||
@@ -13309,7 +13326,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
boolean result = false;
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (filterAppAccessLPr(ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
|
||||
return false;
|
||||
}
|
||||
result = mSettings.updateIntentFilterVerificationStatusLPw(packageName, status, userId);
|
||||
@@ -13329,7 +13347,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
return new ParceledListSlice<>(mSettings.getIntentFilterVerificationsLPr(packageName));
|
||||
@@ -13352,7 +13370,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
final PackageSetting ps = (PackageSetting) pkg.mExtras;
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
final int count = pkg.activities.size();
|
||||
@@ -13388,7 +13406,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
synchronized (mLock) {
|
||||
PackageSetting targetPackageSetting = mSettings.mPackages.get(targetPackage);
|
||||
if (targetPackageSetting == null
|
||||
|| filterAppAccessLPr(
|
||||
|| shouldFilterApplicationLocked(
|
||||
targetPackageSetting, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
throw new IllegalArgumentException("Unknown target package: " + targetPackage);
|
||||
}
|
||||
@@ -13472,7 +13490,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (ps == null) {
|
||||
throw new IllegalArgumentException("Unknown target package " + packageName);
|
||||
}
|
||||
if (filterAppAccessLPr(ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
|
||||
throw new IllegalArgumentException("Unknown target package " + packageName);
|
||||
}
|
||||
if (!Objects.equals(callerPackageName, ps.installerPackageName)) {
|
||||
@@ -18157,7 +18176,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
public boolean getBlockUninstallForUser(String packageName, int userId) {
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps == null || filterAppAccessLPr(ps, Binder.getCallingUid(), userId)) {
|
||||
if (ps == null || shouldFilterApplicationLocked(ps, Binder.getCallingUid(), userId)) {
|
||||
return false;
|
||||
}
|
||||
return mSettings.getBlockUninstallLPr(userId, packageName);
|
||||
@@ -18549,7 +18568,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
true /* requireFullPermission */, false /* checkShell */, "clear application data");
|
||||
|
||||
final PackageSetting ps = mSettings.getPackageLPr(packageName);
|
||||
final boolean filterApp = (ps != null && filterAppAccessLPr(ps, callingUid, userId));
|
||||
final boolean filterApp =
|
||||
(ps != null && shouldFilterApplicationLocked(ps, callingUid, userId));
|
||||
if (!filterApp && mProtectedPackages.isPackageDataProtected(userId, packageName)) {
|
||||
throw new SecurityException("Cannot clear data for a protected package: "
|
||||
+ packageName);
|
||||
@@ -18989,7 +19009,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
final PackageSetting ps = mSettings.getPackageLPr(packageName);
|
||||
if (ps != null
|
||||
&& filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
&& shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -19898,7 +19919,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (!UserHandle.isSameApp(callingUid, pkgSetting.appId)) {
|
||||
// Don't allow apps that don't have permission to modify other apps
|
||||
if (!allowedByPermission
|
||||
|| filterAppAccessLPr(pkgSetting, callingUid, userId)) {
|
||||
|| shouldFilterApplicationLocked(pkgSetting, callingUid, userId)) {
|
||||
throw new SecurityException(
|
||||
"Attempt to change component state; "
|
||||
+ "pid=" + Binder.getCallingPid()
|
||||
@@ -20119,7 +20140,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
// writer
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (!filterAppAccessLPr(ps, callingUid, userId)
|
||||
if (!shouldFilterApplicationLocked(ps, callingUid, userId)
|
||||
&& mSettings.setPackageStoppedStateLPw(this, packageName, stopped,
|
||||
allowedByPermission, callingUid, userId)) {
|
||||
scheduleWritePackageRestrictionsLocked(userId);
|
||||
@@ -20132,7 +20153,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, callingUid, UserHandle.getUserId(callingUid))) {
|
||||
return null;
|
||||
}
|
||||
// InstallerPackageName for Apex is not stored in PackageManager
|
||||
@@ -20161,7 +20183,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
false /* requireFullPermission */, false /* checkShell */, "get enabled");
|
||||
// reader
|
||||
synchronized (mLock) {
|
||||
if (filterAppAccessLPr(mSettings.getPackageLPr(packageName), callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
mSettings.getPackageLPr(packageName), callingUid, userId)) {
|
||||
return COMPONENT_ENABLED_STATE_DISABLED;
|
||||
}
|
||||
return mSettings.getApplicationEnabledSettingLPr(packageName, userId);
|
||||
@@ -20176,7 +20199,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
mPermissionManager.enforceCrossUserPermission(callingUid, userId,
|
||||
false /*requireFullPermission*/, false /*checkShell*/, "getComponentEnabled");
|
||||
synchronized (mLock) {
|
||||
if (filterAppAccessLPr(mSettings.getPackageLPr(component.getPackageName()), callingUid,
|
||||
if (shouldFilterApplicationLocked(
|
||||
mSettings.getPackageLPr(component.getPackageName()), callingUid,
|
||||
component, TYPE_UNKNOWN, userId)) {
|
||||
return COMPONENT_ENABLED_STATE_DISABLED;
|
||||
}
|
||||
@@ -21923,7 +21947,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (pkg == null
|
||||
|| ps == null
|
||||
|| filterAppAccessLPr(ps, callingUid, user.getIdentifier())) {
|
||||
|| shouldFilterApplicationLocked(ps, callingUid, user.getIdentifier())) {
|
||||
throw new PackageManagerException(MOVE_FAILED_DOESNT_EXIST, "Missing package");
|
||||
}
|
||||
if (pkg.applicationInfo.isSystemApp()) {
|
||||
@@ -22380,7 +22404,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
throw new IllegalArgumentException("Unknown package: " + packageName);
|
||||
}
|
||||
final PackageSetting ps = (PackageSetting) pkg.mExtras;
|
||||
if (filterAppAccessLPr(ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
|
||||
if (shouldFilterApplicationLocked(
|
||||
ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
|
||||
Slog.w(TAG, "KeySet requested for filtered package: " + packageName);
|
||||
throw new IllegalArgumentException("Unknown package: " + packageName);
|
||||
}
|
||||
@@ -22403,7 +22428,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
throw new IllegalArgumentException("Unknown package: " + packageName);
|
||||
}
|
||||
final PackageSetting ps = (PackageSetting) pkg.mExtras;
|
||||
if (filterAppAccessLPr(ps, callingUid, callingUserId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
|
||||
// filter and pretend the package doesn't exist
|
||||
Slog.w(TAG, "KeySet requested for filtered package: " + packageName
|
||||
+ ", uid:" + callingUid);
|
||||
@@ -22430,7 +22455,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
synchronized (mLock) {
|
||||
final PackageParser.Package pkg = mPackages.get(packageName);
|
||||
if (pkg == null
|
||||
|| filterAppAccessLPr((PackageSetting) pkg.mExtras, callingUid,
|
||||
|| shouldFilterApplicationLocked((PackageSetting) pkg.mExtras, callingUid,
|
||||
UserHandle.getUserId(callingUid))) {
|
||||
Slog.w(TAG, "KeySet requested for unknown package: " + packageName);
|
||||
throw new IllegalArgumentException("Unknown package: " + packageName);
|
||||
@@ -22456,7 +22481,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
synchronized (mLock) {
|
||||
final PackageParser.Package pkg = mPackages.get(packageName);
|
||||
if (pkg == null
|
||||
|| filterAppAccessLPr((PackageSetting) pkg.mExtras, callingUid,
|
||||
|| shouldFilterApplicationLocked((PackageSetting) pkg.mExtras, callingUid,
|
||||
UserHandle.getUserId(callingUid))) {
|
||||
Slog.w(TAG, "KeySet requested for unknown package: " + packageName);
|
||||
throw new IllegalArgumentException("Unknown package: " + packageName);
|
||||
@@ -22780,8 +22805,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
@Override
|
||||
public boolean filterAppAccess(PackageParser.Package pkg, int callingUid, int userId) {
|
||||
synchronized (mLock) {
|
||||
return PackageManagerService.this
|
||||
.filterAppAccessLPr((PackageSetting) pkg.mExtras, callingUid, userId);
|
||||
return PackageManagerService.this.shouldFilterApplicationLocked(
|
||||
(PackageSetting) pkg.mExtras, callingUid, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22793,7 +22818,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return false;
|
||||
}
|
||||
return PackageManagerService.this
|
||||
.filterAppAccessLPr((PackageSetting) pkg.mExtras, callingUid, userId);
|
||||
.shouldFilterApplicationLocked(
|
||||
(PackageSetting) pkg.mExtras, callingUid, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23276,7 +23302,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
public boolean canAccessComponent(int callingUid, ComponentName component, int userId) {
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
|
||||
return ps != null && !PackageManagerService.this.filterAppAccessLPr(
|
||||
return ps != null && !PackageManagerService.this.shouldFilterApplicationLocked(
|
||||
ps, callingUid, component, TYPE_UNKNOWN, userId);
|
||||
}
|
||||
}
|
||||
@@ -23711,7 +23737,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
"get install reason");
|
||||
synchronized (mLock) {
|
||||
final PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (filterAppAccessLPr(ps, callingUid, userId)) {
|
||||
if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
|
||||
return PackageManager.INSTALL_REASON_UNKNOWN;
|
||||
}
|
||||
if (ps != null) {
|
||||
|
||||
Reference in New Issue
Block a user