Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf5670aa authored by Rubin Xu's avatar Rubin Xu Committed by Android (Google) Code Review
Browse files

Merge "Fix DPMS.findAdmin() after app enumeration restrictions" into rvc-dev

parents 931e7099 b460022e
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -3297,22 +3297,24 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    public DeviceAdminInfo findAdmin(ComponentName adminName, int userHandle,
    public DeviceAdminInfo findAdmin(final ComponentName adminName, final int userHandle,
            boolean throwForMissingPermission) {
        if (!mHasFeature) {
            return null;
        }
        enforceFullCrossUsersPermission(userHandle);
        ActivityInfo ai = null;
        final ActivityInfo ai = mInjector.binderWithCleanCallingIdentity(() -> {
            try {
            ai = mIPackageManager.getReceiverInfo(adminName,
                    PackageManager.GET_META_DATA |
                    PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS |
                    PackageManager.MATCH_DIRECT_BOOT_AWARE |
                    PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userHandle);
                return mIPackageManager.getReceiverInfo(adminName,
                        PackageManager.GET_META_DATA
                        | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS
                        | PackageManager.MATCH_DIRECT_BOOT_AWARE
                        | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userHandle);
            } catch (RemoteException e) {
                // shouldn't happen.
                return null;
            }
        });
        if (ai == null) {
            throw new IllegalArgumentException("Unknown admin: " + adminName);
        }