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

Commit 7219ea65 authored by Lucas Lin's avatar Lucas Lin Committed by Automerger Merge Worker
Browse files

Merge "Revert "Grant the ACTIVATE_PLATFORM_VPN appop if VPN app has CON...""...

Merge "Revert "Grant the ACTIVATE_PLATFORM_VPN appop if VPN app has CON..."" am: 3ea732de am: b5fb9726 am: c9531fa6 am: 658d3b01 am: a6130995

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2188655



Change-Id: I4d7f3be8178a3111f43cf013ac5064c1931dd204
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f019512b a6130995
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -1110,7 +1110,7 @@ public class Vpn {
        // Except for Settings and VpnDialogs, the caller should be matched one of oldPackage or
        // newPackage. Otherwise, non VPN owner might get the VPN always-on status of the VPN owner.
        // See b/191382886.
        if (!hasControlVpnPermission()) {
        if (mContext.checkCallingOrSelfPermission(CONTROL_VPN) != PERMISSION_GRANTED) {
            if (oldPackage != null) {
                verifyCallingUidAndPackage(oldPackage);
            }
@@ -2073,10 +2073,6 @@ public class Vpn {
                "Unauthorized Caller");
    }

    private boolean hasControlVpnPermission() {
        return mContext.checkCallingOrSelfPermission(CONTROL_VPN) == PERMISSION_GRANTED;
    }

    private class Connection implements ServiceConnection {
        private IBinder mService;

@@ -3901,10 +3897,8 @@ public class Vpn {
            Binder.restoreCallingIdentity(token);
        }

        // If package has CONTROL_VPN, grant the ACTIVATE_PLATFORM_VPN appop.
        if (hasControlVpnPermission()) {
            setPackageAuthorization(packageName, VpnManager.TYPE_VPN_PLATFORM);
        }
        // TODO: if package has CONTROL_VPN, grant the ACTIVATE_PLATFORM_VPN appop.
        // This mirrors the prepareAndAuthorize that is used by VpnService.

        // Return whether the app is already pre-consented
        return isVpnProfilePreConsented(mContext, packageName);