Merge changes from topic "presubmit-am-57a4c6718ca64e5aa29f52e2a381bac4"
* changes: [automerge] [Security] Verify the permission first before querying installed apps 2p:42d5979f69
2p:cc44f71530
[automerge] [Security] Verify the permission first before querying installed apps 2p:42d5979f69
[Security] Verify the permission first before querying installed apps
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