Merge "Generalize canPackageQuery error message" into tm-dev
This commit is contained in:
@@ -5443,22 +5443,18 @@ public class ComputerEngine implements Computer {
|
|||||||
false /*checkShell*/, "may package query");
|
false /*checkShell*/, "may package query");
|
||||||
final PackageStateInternal sourceSetting = getPackageStateInternal(sourcePackageName);
|
final PackageStateInternal sourceSetting = getPackageStateInternal(sourcePackageName);
|
||||||
final PackageStateInternal targetSetting = getPackageStateInternal(targetPackageName);
|
final PackageStateInternal targetSetting = getPackageStateInternal(targetPackageName);
|
||||||
if (sourceSetting == null || targetSetting == null) {
|
boolean throwException = sourceSetting == null || targetSetting == null;
|
||||||
throw new ParcelableException(new PackageManager.NameNotFoundException("Package(s) "
|
if (!throwException) {
|
||||||
+ (sourceSetting == null ? sourcePackageName + " " : "")
|
final boolean filterSource =
|
||||||
+ (targetSetting == null ? targetPackageName + " " : "")
|
shouldFilterApplication(sourceSetting, callingUid, userId);
|
||||||
+ "not found."));
|
final boolean filterTarget =
|
||||||
|
shouldFilterApplication(targetSetting, callingUid, userId);
|
||||||
|
// The caller must have visibility of the both packages
|
||||||
|
throwException = filterSource || filterTarget;
|
||||||
}
|
}
|
||||||
final boolean filterSource =
|
if (throwException) {
|
||||||
shouldFilterApplication(sourceSetting, callingUid, userId);
|
|
||||||
final boolean filterTarget =
|
|
||||||
shouldFilterApplication(targetSetting, callingUid, userId);
|
|
||||||
// The caller must have visibility of the both packages
|
|
||||||
if (filterSource || filterTarget) {
|
|
||||||
throw new ParcelableException(new PackageManager.NameNotFoundException("Package(s) "
|
throw new ParcelableException(new PackageManager.NameNotFoundException("Package(s) "
|
||||||
+ (filterSource ? sourcePackageName + " " : "")
|
+ sourcePackageName + " and/or " + targetPackageName + " not found."));
|
||||||
+ (filterTarget ? targetPackageName + " " : "")
|
|
||||||
+ "not found."));
|
|
||||||
}
|
}
|
||||||
final int sourcePackageUid = UserHandle.getUid(userId, sourceSetting.getAppId());
|
final int sourcePackageUid = UserHandle.getUid(userId, sourceSetting.getAppId());
|
||||||
return !shouldFilterApplication(targetSetting, sourcePackageUid, userId);
|
return !shouldFilterApplication(targetSetting, sourcePackageUid, userId);
|
||||||
|
|||||||
Reference in New Issue
Block a user