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

Commit c53bd971 authored by Robin Lee's avatar Robin Lee Committed by Android (Google) Code Review
Browse files

Merge "Check DeviceOwner exists before using packageName"

parents ae39c628 08fc72d0
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1315,9 +1315,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            }
            if (admin.getUid() != Binder.getCallingUid()) {
                // If trying to remove device owner, refuse when the caller is not the owner.
                if (mDeviceOwner != null
                        && adminReceiver.getPackageName().equals(
                        mDeviceOwner.getDeviceOwnerPackageName())) {
                if (isDeviceOwner(adminReceiver.getPackageName())) {
                    return;
                }
                mContext.enforceCallingOrSelfPermission(
@@ -2793,6 +2791,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        synchronized (this) {
            return mDeviceOwner != null
                    && mDeviceOwner.hasDeviceOwner()
                    && mDeviceOwner.getDeviceOwnerPackageName().equals(packageName);
        }
    }