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

Commit 209025ca authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add enforceNetworkStackOrProfileOrDeviceOwner()"

parents 24b58ed9 597644f0
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();