[automerge] [Security] Verify the permission first before querying installed apps 2p: 42d5979f69
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17730673 Bug: 227753723 Change-Id: I6d6e57e086a694b992d847eca7f91617be3ef4d0
This commit is contained in:
@@ -69,15 +69,6 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationInfo ai;
|
||||
try {
|
||||
ai = getPackageManager().getApplicationInfo(mPackageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
debugLog("Requested package doesn't exist: " + mPackageName);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (getPackageManager().checkPermission(
|
||||
Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, mPackageName)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
@@ -87,6 +78,15 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationInfo ai;
|
||||
try {
|
||||
ai = getPackageManager().getApplicationInfo(mPackageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
debugLog("Requested package doesn't exist: " + mPackageName);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
final AlertController.AlertParams p = mAlertParams;
|
||||
final CharSequence appLabel = ai.loadSafeLabel(getPackageManager(),
|
||||
PackageItemInfo.DEFAULT_MAX_LABEL_SIZE_PX, PackageItemInfo.SAFE_LABEL_FLAG_TRIM
|
||||
|
Reference in New Issue
Block a user