Loading services/core/java/com/android/server/connectivity/Vpn.java +25 −31 Original line number Diff line number Diff line Loading @@ -1196,25 +1196,7 @@ public class Vpn { mContext.unbindService(mConnection); cleanupVpnStateLocked(); } else if (mVpnRunner != null) { // Build intent first because the sessionKey will be reset after performing // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in // VpnRunner.exit() to prevent design being changed in the future. // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from // ConnectivityServiceTest. final int ownerUid = mOwnerUID; Intent intent = null; if (SdkLevel.isAtLeastT() && isVpnApp(mPackage)) { intent = buildVpnManagerEventIntent( VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, -1 /* errorClass */, -1 /* errorCode*/, mPackage, getSessionKeyLocked(), makeVpnProfileStateLocked(), null /* underlyingNetwork */, null /* nc */, null /* lp */); } // cleanupVpnStateLocked() is called from mVpnRunner.exit() mVpnRunner.exit(); if (intent != null && isVpnApp(mPackage)) { notifyVpnManagerVpnStopped(mPackage, ownerUid, intent); } stopVpnRunnerAndNotifyAppLocked(mPackage); } try { Loading Loading @@ -4068,6 +4050,29 @@ public class Vpn { } } @GuardedBy("this") private void stopVpnRunnerAndNotifyAppLocked(@NonNull String packageName) { // Build intent first because the sessionKey will be reset after performing // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in // VpnRunner.exit() to prevent design being changed in the future. // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from // ConnectivityServiceTest. final int ownerUid = mOwnerUID; Intent intent = null; if (SdkLevel.isAtLeastT() && isVpnApp(packageName)) { intent = buildVpnManagerEventIntent( VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, -1 /* errorClass */, -1 /* errorCode*/, packageName, getSessionKeyLocked(), makeVpnProfileStateLocked(), null /* underlyingNetwork */, null /* nc */, null /* lp */); } // cleanupVpnStateLocked() is called from mVpnRunner.exit() mVpnRunner.exit(); if (intent != null && isVpnApp(packageName)) { notifyVpnManagerVpnStopped(packageName, ownerUid, intent); } } /** * Stops an already running VPN Profile for the given package. * Loading @@ -4084,18 +4089,7 @@ public class Vpn { // To stop the VPN profile, the caller must be the current prepared package and must be // running an Ikev2VpnProfile. if (isCurrentIkev2VpnLocked(packageName)) { // Build intent first because the sessionKey will be reset after performing // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in // VpnRunner.exit() to prevent design being changed in the future. final int ownerUid = mOwnerUID; final Intent intent = buildVpnManagerEventIntent( VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, -1 /* errorClass */, -1 /* errorCode*/, packageName, getSessionKeyLocked(), makeVpnProfileStateLocked(), null /* underlyingNetwork */, null /* nc */, null /* lp */); mVpnRunner.exit(); notifyVpnManagerVpnStopped(packageName, ownerUid, intent); stopVpnRunnerAndNotifyAppLocked(packageName); } } Loading Loading
services/core/java/com/android/server/connectivity/Vpn.java +25 −31 Original line number Diff line number Diff line Loading @@ -1196,25 +1196,7 @@ public class Vpn { mContext.unbindService(mConnection); cleanupVpnStateLocked(); } else if (mVpnRunner != null) { // Build intent first because the sessionKey will be reset after performing // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in // VpnRunner.exit() to prevent design being changed in the future. // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from // ConnectivityServiceTest. final int ownerUid = mOwnerUID; Intent intent = null; if (SdkLevel.isAtLeastT() && isVpnApp(mPackage)) { intent = buildVpnManagerEventIntent( VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, -1 /* errorClass */, -1 /* errorCode*/, mPackage, getSessionKeyLocked(), makeVpnProfileStateLocked(), null /* underlyingNetwork */, null /* nc */, null /* lp */); } // cleanupVpnStateLocked() is called from mVpnRunner.exit() mVpnRunner.exit(); if (intent != null && isVpnApp(mPackage)) { notifyVpnManagerVpnStopped(mPackage, ownerUid, intent); } stopVpnRunnerAndNotifyAppLocked(mPackage); } try { Loading Loading @@ -4068,6 +4050,29 @@ public class Vpn { } } @GuardedBy("this") private void stopVpnRunnerAndNotifyAppLocked(@NonNull String packageName) { // Build intent first because the sessionKey will be reset after performing // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in // VpnRunner.exit() to prevent design being changed in the future. // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from // ConnectivityServiceTest. final int ownerUid = mOwnerUID; Intent intent = null; if (SdkLevel.isAtLeastT() && isVpnApp(packageName)) { intent = buildVpnManagerEventIntent( VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, -1 /* errorClass */, -1 /* errorCode*/, packageName, getSessionKeyLocked(), makeVpnProfileStateLocked(), null /* underlyingNetwork */, null /* nc */, null /* lp */); } // cleanupVpnStateLocked() is called from mVpnRunner.exit() mVpnRunner.exit(); if (intent != null && isVpnApp(packageName)) { notifyVpnManagerVpnStopped(packageName, ownerUid, intent); } } /** * Stops an already running VPN Profile for the given package. * Loading @@ -4084,18 +4089,7 @@ public class Vpn { // To stop the VPN profile, the caller must be the current prepared package and must be // running an Ikev2VpnProfile. if (isCurrentIkev2VpnLocked(packageName)) { // Build intent first because the sessionKey will be reset after performing // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in // VpnRunner.exit() to prevent design being changed in the future. final int ownerUid = mOwnerUID; final Intent intent = buildVpnManagerEventIntent( VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, -1 /* errorClass */, -1 /* errorCode*/, packageName, getSessionKeyLocked(), makeVpnProfileStateLocked(), null /* underlyingNetwork */, null /* nc */, null /* lp */); mVpnRunner.exit(); notifyVpnManagerVpnStopped(packageName, ownerUid, intent); stopVpnRunnerAndNotifyAppLocked(packageName); } } Loading