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

Commit 016f07c4 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Add enforceNetworkStackOrProfileOrDeviceOwner()" am: 209025ca

Change-Id: I49f3f78dde8c0ab327709e484f05d7e2b53c0b43
parents f0bf41cb 209025ca
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ import static android.app.admin.DevicePolicyManager.WIPE_EXTERNAL_STORAGE;
import static android.app.admin.DevicePolicyManager.WIPE_RESET_PROTECTION_DATA;
import static android.app.admin.DevicePolicyManager.WIPE_SILENTLY;
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK;
import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
import static android.provider.Telephony.Carriers.DPC_URI;
@@ -5546,6 +5547,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
    }
    private void enforceNetworkStackOrProfileOrDeviceOwner(ComponentName who) {
        if (mContext.checkCallingPermission(PERMISSION_MAINLINE_NETWORK_STACK)
                == PackageManager.PERMISSION_GRANTED) {
            return;
        }
        enforceProfileOrDeviceOwner(who);
    }
    @Override
    public boolean approveCaCert(String alias, int userId, boolean approval) {
        enforceManageUsers();
@@ -6473,7 +6482,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    public boolean isAlwaysOnVpnLockdownEnabled(ComponentName admin) throws SecurityException {
        enforceProfileOrDeviceOwner(admin);
        enforceNetworkStackOrProfileOrDeviceOwner(admin);
        final int userId = mInjector.userHandleGetCallingUserId();
        final long token = mInjector.binderClearCallingIdentity();