Merge "Revert "Grant the ACTIVATE_PLATFORM_VPN appop if VPN app has CON..."" am: 3ea732de43 am: b5fb9726b7 am: c9531fa6c6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2188655 Change-Id: Ida9620aff1971a613cd291b75a8d4bc2b403a2db Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1110,7 +1110,7 @@ public class Vpn {
|
|||||||
// Except for Settings and VpnDialogs, the caller should be matched one of oldPackage or
|
// 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.
|
// newPackage. Otherwise, non VPN owner might get the VPN always-on status of the VPN owner.
|
||||||
// See b/191382886.
|
// See b/191382886.
|
||||||
if (!hasControlVpnPermission()) {
|
if (mContext.checkCallingOrSelfPermission(CONTROL_VPN) != PERMISSION_GRANTED) {
|
||||||
if (oldPackage != null) {
|
if (oldPackage != null) {
|
||||||
verifyCallingUidAndPackage(oldPackage);
|
verifyCallingUidAndPackage(oldPackage);
|
||||||
}
|
}
|
||||||
@@ -2073,10 +2073,6 @@ public class Vpn {
|
|||||||
"Unauthorized Caller");
|
"Unauthorized Caller");
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasControlVpnPermission() {
|
|
||||||
return mContext.checkCallingOrSelfPermission(CONTROL_VPN) == PERMISSION_GRANTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Connection implements ServiceConnection {
|
private class Connection implements ServiceConnection {
|
||||||
private IBinder mService;
|
private IBinder mService;
|
||||||
|
|
||||||
@@ -3901,10 +3897,8 @@ public class Vpn {
|
|||||||
Binder.restoreCallingIdentity(token);
|
Binder.restoreCallingIdentity(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If package has CONTROL_VPN, grant the ACTIVATE_PLATFORM_VPN appop.
|
// TODO: if package has CONTROL_VPN, grant the ACTIVATE_PLATFORM_VPN appop.
|
||||||
if (hasControlVpnPermission()) {
|
// This mirrors the prepareAndAuthorize that is used by VpnService.
|
||||||
setPackageAuthorization(packageName, VpnManager.TYPE_VPN_PLATFORM);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return whether the app is already pre-consented
|
// Return whether the app is already pre-consented
|
||||||
return isVpnProfilePreConsented(mContext, packageName);
|
return isVpnProfilePreConsented(mContext, packageName);
|
||||||
|
|||||||
Reference in New Issue
Block a user