Merge "Remove parameter from stopVpnRunnerAndNotifyAppLocked()"

This commit is contained in:
Lucas Lin 2022-09-13 00:30:10 +00:00 committed by Gerrit Code Review
commit c1165f0b82

View File

@ -1198,7 +1198,7 @@ public class Vpn {
mContext.unbindService(mConnection); mContext.unbindService(mConnection);
cleanupVpnStateLocked(); cleanupVpnStateLocked();
} else if (mVpnRunner != null) { } else if (mVpnRunner != null) {
stopVpnRunnerAndNotifyAppLocked(mPackage); stopVpnRunnerAndNotifyAppLocked();
} }
try { try {
@ -4061,7 +4061,7 @@ public class Vpn {
} }
@GuardedBy("this") @GuardedBy("this")
private void stopVpnRunnerAndNotifyAppLocked(@NonNull String packageName) { private void stopVpnRunnerAndNotifyAppLocked() {
// Build intent first because the sessionKey will be reset after performing // 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(). Also, cache mOwnerUID even if ownerUID will not be changed in
// VpnRunner.exit() to prevent design being changed in the future. // VpnRunner.exit() to prevent design being changed in the future.
@ -4069,17 +4069,17 @@ public class Vpn {
// ConnectivityServiceTest. // ConnectivityServiceTest.
final int ownerUid = mOwnerUID; final int ownerUid = mOwnerUID;
Intent intent = null; Intent intent = null;
if (SdkLevel.isAtLeastT() && isVpnApp(packageName)) { if (SdkLevel.isAtLeastT() && isVpnApp(mPackage)) {
intent = buildVpnManagerEventIntent( intent = buildVpnManagerEventIntent(
VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER, VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER,
-1 /* errorClass */, -1 /* errorCode*/, packageName, -1 /* errorClass */, -1 /* errorCode*/, mPackage,
getSessionKeyLocked(), makeVpnProfileStateLocked(), getSessionKeyLocked(), makeVpnProfileStateLocked(),
null /* underlyingNetwork */, null /* nc */, null /* lp */); null /* underlyingNetwork */, null /* nc */, null /* lp */);
} }
// cleanupVpnStateLocked() is called from mVpnRunner.exit() // cleanupVpnStateLocked() is called from mVpnRunner.exit()
mVpnRunner.exit(); mVpnRunner.exit();
if (intent != null && isVpnApp(packageName)) { if (intent != null && isVpnApp(mPackage)) {
notifyVpnManagerVpnStopped(packageName, ownerUid, intent); notifyVpnManagerVpnStopped(mPackage, ownerUid, intent);
} }
} }
@ -4099,7 +4099,7 @@ public class Vpn {
// To stop the VPN profile, the caller must be the current prepared package and must be // To stop the VPN profile, the caller must be the current prepared package and must be
// running an Ikev2VpnProfile. // running an Ikev2VpnProfile.
if (isCurrentIkev2VpnLocked(packageName)) { if (isCurrentIkev2VpnLocked(packageName)) {
stopVpnRunnerAndNotifyAppLocked(packageName); stopVpnRunnerAndNotifyAppLocked();
} }
} }