Commit a08b5b61 authored by Varun Shah's avatar Varun Shah Committed by syphyr

Added missing permission check to isPackageDeviceAdminOnAnyUser.

Added a check for the MANAGE_USERS permission to

To test that the method is still usable:
1) Enable virtual storage via: adb shell sm set-virtual-disk true
2) Follow instructions by clicking on notification to set up virtual storage
3) Go to Settings -> Apps & notifications -> See all X apps
4) Click on any non-system app (example Instagram)
5) Tap Storage and you should see a "Change" button (if not, choose another app)
6) Tap Change and you should see Internal and Virtual storage options listed
7) The above step confirms the method is still usable by Settings

Bug: 128599183
Test: SafetyNet logging (steps listed above)
Change-Id: I989f1daf52a71f6c778ebd81baa6f1bf83e9a718
Merged-In: I36521fa43daab399e08869647326a7ac32d1e512
(cherry picked from commit 18e7dedf)
parent 8c6c7a97
......@@ -15871,6 +15871,13 @@ public class PackageManagerService extends IPackageManager.Stub {
public boolean isPackageDeviceAdminOnAnyUser(String packageName) {
final int callingUid = Binder.getCallingUid();
if (checkUidPermission(android.Manifest.permission.MANAGE_USERS, callingUid)
EventLog.writeEvent(0x534e4554, "128599183", -1, "");
throw new SecurityException(android.Manifest.permission.MANAGE_USERS
+ " permission is required to call this API");
return isPackageDeviceAdmin(packageName, UserHandle.USER_ALL);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment