From 19f71afa7fe559658c8a2757f382451f033d11db Mon Sep 17 00:00:00 2001 From: lucaslin Date: Fri, 22 Apr 2022 03:28:58 +0800 Subject: [PATCH 1/5] Send VPN manager event when there is an IkeProtocolException Bug: 191413541 Test: atest FrameworksNetTests:VpnTest Change-Id: Iff00d1f2728d36b23d58bda122f02d7676f49323 (cherry picked from commit 4e1f12986abbc1467bf337935650f70afbd569d2) Merged-In: Iff00d1f2728d36b23d58bda122f02d7676f49323 --- .../com/android/server/connectivity/Vpn.java | 99 +++++++++++++++---- .../server/connectivity/VpnIkev2Utils.java | 18 ++++ 2 files changed, 100 insertions(+), 17 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index 254a3226e6deb..f055691fe269c 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -2530,6 +2530,21 @@ public class Vpn { } } + @Nullable + protected synchronized NetworkCapabilities getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + NetworkCapabilities nc) { + if (nc == null) return null; + return mConnectivityManager.getRedactedNetworkCapabilitiesForPackage( + nc, mOwnerUID, mPackage); + } + + @Nullable + protected synchronized LinkProperties getRedactedLinkPropertiesOfUnderlyingNetwork( + LinkProperties lp) { + if (lp == null) return null; + return mConnectivityManager.getRedactedLinkPropertiesForPackage(lp, mOwnerUID, mPackage); + } + /** This class represents the common interface for all VPN runners. */ @VisibleForTesting abstract class VpnRunner extends Thread { @@ -2564,6 +2579,10 @@ public class Vpn { interface IkeV2VpnRunnerCallback { void onDefaultNetworkChanged(@NonNull Network network); + void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc); + + void onDefaultNetworkLinkPropertiesChanged(@NonNull LinkProperties lp); + void onChildOpened( @NonNull Network network, @NonNull ChildSessionConfiguration childConfig); @@ -2620,6 +2639,8 @@ public class Vpn { @Nullable private IpSecTunnelInterface mTunnelIface; @Nullable private IkeSession mSession; @Nullable private Network mActiveNetwork; + @Nullable private NetworkCapabilities mNetworkCapabilities; + @Nullable private LinkProperties mLinkProperties; private final String mSessionKey; IkeV2VpnRunner(@NonNull Ikev2VpnProfile profile) { @@ -2849,6 +2870,16 @@ public class Vpn { } } + /** Called when the NetworkCapabilities of underlying network is changed */ + public void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc) { + mNetworkCapabilities = nc; + } + + /** Called when the LinkProperties of underlying network is changed */ + public void onDefaultNetworkLinkPropertiesChanged(@NonNull LinkProperties lp) { + mLinkProperties = lp; + } + /** Marks the state as FAILED, and disconnects. */ private void markFailedAndDisconnect(Exception exception) { synchronized (Vpn.this) { @@ -2879,28 +2910,60 @@ public class Vpn { return; } - if (exception instanceof IkeProtocolException) { - final IkeProtocolException ikeException = (IkeProtocolException) exception; + synchronized (Vpn.this) { + if (exception instanceof IkeProtocolException) { + final IkeProtocolException ikeException = (IkeProtocolException) exception; - switch (ikeException.getErrorType()) { - case IkeProtocolException.ERROR_TYPE_NO_PROPOSAL_CHOSEN: // Fallthrough - case IkeProtocolException.ERROR_TYPE_INVALID_KE_PAYLOAD: // Fallthrough - case IkeProtocolException.ERROR_TYPE_AUTHENTICATION_FAILED: // Fallthrough - case IkeProtocolException.ERROR_TYPE_SINGLE_PAIR_REQUIRED: // Fallthrough - case IkeProtocolException.ERROR_TYPE_FAILED_CP_REQUIRED: // Fallthrough - case IkeProtocolException.ERROR_TYPE_TS_UNACCEPTABLE: - // All the above failures are configuration errors, and are terminal - markFailedAndDisconnect(exception); - return; - // All other cases possibly recoverable. + switch (ikeException.getErrorType()) { + case IkeProtocolException.ERROR_TYPE_NO_PROPOSAL_CHOSEN: // Fallthrough + case IkeProtocolException.ERROR_TYPE_INVALID_KE_PAYLOAD: // Fallthrough + case IkeProtocolException.ERROR_TYPE_AUTHENTICATION_FAILED: // Fallthrough + case IkeProtocolException.ERROR_TYPE_SINGLE_PAIR_REQUIRED: // Fallthrough + case IkeProtocolException.ERROR_TYPE_FAILED_CP_REQUIRED: // Fallthrough + case IkeProtocolException.ERROR_TYPE_TS_UNACCEPTABLE: + // All the above failures are configuration errors, and are terminal + // TODO(b/230548427): Remove SDK check once VPN related stuff are + // decoupled from ConnectivityServiceTest. + if (SdkLevel.isAtLeastT()) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_IKE_ERROR, + VpnManager.ERROR_CLASS_NOT_RECOVERABLE, + ikeException.getErrorType(), + getPackage(), mSessionKey, makeVpnProfileStateLocked(), + mActiveNetwork, + getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + this.mNetworkCapabilities), + getRedactedLinkPropertiesOfUnderlyingNetwork( + this.mLinkProperties)); + } + markFailedAndDisconnect(exception); + return; + // All other cases possibly recoverable. + default: + // All the above failures are configuration errors, and are terminal + // TODO(b/230548427): Remove SDK check once VPN related stuff are + // decoupled from ConnectivityServiceTest. + if (SdkLevel.isAtLeastT()) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_IKE_ERROR, + VpnManager.ERROR_CLASS_RECOVERABLE, + ikeException.getErrorType(), + getPackage(), mSessionKey, makeVpnProfileStateLocked(), + mActiveNetwork, + getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + this.mNetworkCapabilities), + getRedactedLinkPropertiesOfUnderlyingNetwork( + this.mLinkProperties)); + } + } + } else if (exception instanceof IllegalArgumentException) { + // Failed to build IKE/ChildSessionParams; fatal profile configuration error + markFailedAndDisconnect(exception); + return; } - } else if (exception instanceof IllegalArgumentException) { - // Failed to build IKE/ChildSessionParams; fatal profile configuration error - markFailedAndDisconnect(exception); - return; } mActiveNetwork = null; + mNetworkCapabilities = null; + mLinkProperties = null; // Close all obsolete state, but keep VPN alive incase a usable network comes up. // (Mirrors VpnService behavior) @@ -2965,6 +3028,8 @@ public class Vpn { */ private void disconnectVpnRunner() { mActiveNetwork = null; + mNetworkCapabilities = null; + mLinkProperties = null; mIsRunning = false; resetIkeState(); diff --git a/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java b/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java index 6982d60956897..e1e488db679f7 100644 --- a/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java +++ b/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java @@ -50,7 +50,9 @@ import android.net.InetAddresses; import android.net.IpPrefix; import android.net.IpSecAlgorithm; import android.net.IpSecTransform; +import android.net.LinkProperties; import android.net.Network; +import android.net.NetworkCapabilities; import android.net.RouteInfo; import android.net.eap.EapSessionConfig; import android.net.ipsec.ike.ChildSaProposal; @@ -392,6 +394,22 @@ public class VpnIkev2Utils { mExecutor.execute(() -> mCallback.onDefaultNetworkChanged(network)); } + @Override + public void onCapabilitiesChanged(@NonNull Network network, + @NonNull NetworkCapabilities networkCapabilities) { + Log.d(mTag, "NC changed for net " + network + " : " + networkCapabilities); + mExecutor.execute( + () -> mCallback.onDefaultNetworkCapabilitiesChanged(networkCapabilities)); + } + + @Override + public void onLinkPropertiesChanged(@NonNull Network network, + @NonNull LinkProperties linkProperties) { + Log.d(mTag, "LP changed for net " + network + " : " + linkProperties); + mExecutor.execute( + () -> mCallback.onDefaultNetworkLinkPropertiesChanged(linkProperties)); + } + @Override public void onLost(@NonNull Network network) { Log.d(mTag, "Tearing down; lost network: " + network); From 41eb56744d510c2ab52f6e045df62670bfde6de8 Mon Sep 17 00:00:00 2001 From: lucaslin Date: Fri, 22 Apr 2022 03:26:37 +0800 Subject: [PATCH 2/5] Send VPN manager event when there is a network error Bug: 191413541 Test: atest FrameworksNetTests:VpnTest Change-Id: I767e23750ccf12c0c787a3ec23d4a520dc5bb570 (cherry picked from commit 64eaff5dba207a05ff9b1f9826de98ee05533b30) Merged-In: I767e23750ccf12c0c787a3ec23d4a520dc5bb570 --- .../com/android/server/connectivity/Vpn.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index f055691fe269c..5e26009c24690 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -88,7 +88,10 @@ import android.net.ipsec.ike.IkeSession; import android.net.ipsec.ike.IkeSessionCallback; import android.net.ipsec.ike.IkeSessionParams; import android.net.ipsec.ike.IkeTunnelConnectionParams; +import android.net.ipsec.ike.exceptions.IkeNetworkLostException; +import android.net.ipsec.ike.exceptions.IkeNonProtocolException; import android.net.ipsec.ike.exceptions.IkeProtocolException; +import android.net.ipsec.ike.exceptions.IkeTimeoutException; import android.os.Binder; import android.os.Build.VERSION_CODES; import android.os.Bundle; @@ -2958,6 +2961,66 @@ public class Vpn { // Failed to build IKE/ChildSessionParams; fatal profile configuration error markFailedAndDisconnect(exception); return; + } else if (exception instanceof IkeNetworkLostException) { + // TODO(b/230548427): Remove SDK check once VPN related stuff are + // decoupled from ConnectivityServiceTest. + if (SdkLevel.isAtLeastT()) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_NETWORK_ERROR, + VpnManager.ERROR_CLASS_RECOVERABLE, + VpnManager.ERROR_CODE_NETWORK_LOST, + getPackage(), mSessionKey, makeVpnProfileStateLocked(), + mActiveNetwork, + getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + this.mNetworkCapabilities), + getRedactedLinkPropertiesOfUnderlyingNetwork( + this.mLinkProperties)); + } + } else if (exception instanceof IkeNonProtocolException) { + if (exception.getCause() instanceof UnknownHostException) { + // TODO(b/230548427): Remove SDK check once VPN related stuff are + // decoupled from ConnectivityServiceTest. + if (SdkLevel.isAtLeastT()) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_NETWORK_ERROR, + VpnManager.ERROR_CLASS_RECOVERABLE, + VpnManager.ERROR_CODE_NETWORK_UNKNOWN_HOST, + getPackage(), mSessionKey, makeVpnProfileStateLocked(), + mActiveNetwork, + getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + this.mNetworkCapabilities), + getRedactedLinkPropertiesOfUnderlyingNetwork( + this.mLinkProperties)); + } + } else if (exception.getCause() instanceof IkeTimeoutException) { + // TODO(b/230548427): Remove SDK check once VPN related stuff are + // decoupled from ConnectivityServiceTest. + if (SdkLevel.isAtLeastT()) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_NETWORK_ERROR, + VpnManager.ERROR_CLASS_RECOVERABLE, + VpnManager.ERROR_CODE_NETWORK_PROTOCOL_TIMEOUT, + getPackage(), mSessionKey, makeVpnProfileStateLocked(), + mActiveNetwork, + getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + this.mNetworkCapabilities), + getRedactedLinkPropertiesOfUnderlyingNetwork( + this.mLinkProperties)); + } + } else if (exception.getCause() instanceof IOException) { + // TODO(b/230548427): Remove SDK check once VPN related stuff are + // decoupled from ConnectivityServiceTest. + if (SdkLevel.isAtLeastT()) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_NETWORK_ERROR, + VpnManager.ERROR_CLASS_RECOVERABLE, + VpnManager.ERROR_CODE_NETWORK_IO, + getPackage(), mSessionKey, makeVpnProfileStateLocked(), + mActiveNetwork, + getRedactedNetworkCapabilitiesOfUnderlyingNetwork( + this.mNetworkCapabilities), + getRedactedLinkPropertiesOfUnderlyingNetwork( + this.mLinkProperties)); + } + } + } else if (exception != null) { + Log.wtf(TAG, "onSessionLost: exception = " + exception); } } From 09eab9ca4367a8e9342588cc40f4b5cb507e5a6f Mon Sep 17 00:00:00 2001 From: lucaslin Date: Fri, 13 May 2022 04:24:11 +0800 Subject: [PATCH 3/5] Rename vars of Ikev2VpnRunner There is already a var which is named mNetworkCapabilities in Vpn class. In order to simply distinguish Vpn#mNetworkCapabilities and Ikev2VpnRunner#mNetworkCapabilities, rename the one in Ikev2VpnRunner to mUnderlyingNetworkCapabilities, also change Ikev2VpnRunner#mLinkProperties to mUnderlyingLinkProperties. Bug: 191413541 Test: atest FrameworksNetTest#VpnTest Change-Id: I49a5aee159baa1d1583abb94d73da9fbc03ffe07 (cherry picked from commit c9bd64daf348a224fa75c0538d792721a74291b7) Merged-In: I49a5aee159baa1d1583abb94d73da9fbc03ffe07 --- .../com/android/server/connectivity/Vpn.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index 5e26009c24690..a8cc2c218a7a1 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -2642,8 +2642,8 @@ public class Vpn { @Nullable private IpSecTunnelInterface mTunnelIface; @Nullable private IkeSession mSession; @Nullable private Network mActiveNetwork; - @Nullable private NetworkCapabilities mNetworkCapabilities; - @Nullable private LinkProperties mLinkProperties; + @Nullable private NetworkCapabilities mUnderlyingNetworkCapabilities; + @Nullable private LinkProperties mUnderlyingLinkProperties; private final String mSessionKey; IkeV2VpnRunner(@NonNull Ikev2VpnProfile profile) { @@ -2875,12 +2875,12 @@ public class Vpn { /** Called when the NetworkCapabilities of underlying network is changed */ public void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc) { - mNetworkCapabilities = nc; + mUnderlyingNetworkCapabilities = nc; } /** Called when the LinkProperties of underlying network is changed */ public void onDefaultNetworkLinkPropertiesChanged(@NonNull LinkProperties lp) { - mLinkProperties = lp; + mUnderlyingLinkProperties = lp; } /** Marks the state as FAILED, and disconnects. */ @@ -2934,9 +2934,9 @@ public class Vpn { getPackage(), mSessionKey, makeVpnProfileStateLocked(), mActiveNetwork, getRedactedNetworkCapabilitiesOfUnderlyingNetwork( - this.mNetworkCapabilities), + mUnderlyingNetworkCapabilities), getRedactedLinkPropertiesOfUnderlyingNetwork( - this.mLinkProperties)); + mUnderlyingLinkProperties)); } markFailedAndDisconnect(exception); return; @@ -2952,9 +2952,9 @@ public class Vpn { getPackage(), mSessionKey, makeVpnProfileStateLocked(), mActiveNetwork, getRedactedNetworkCapabilitiesOfUnderlyingNetwork( - this.mNetworkCapabilities), + mUnderlyingNetworkCapabilities), getRedactedLinkPropertiesOfUnderlyingNetwork( - this.mLinkProperties)); + mUnderlyingLinkProperties)); } } } else if (exception instanceof IllegalArgumentException) { @@ -2971,9 +2971,9 @@ public class Vpn { getPackage(), mSessionKey, makeVpnProfileStateLocked(), mActiveNetwork, getRedactedNetworkCapabilitiesOfUnderlyingNetwork( - this.mNetworkCapabilities), + mUnderlyingNetworkCapabilities), getRedactedLinkPropertiesOfUnderlyingNetwork( - this.mLinkProperties)); + mUnderlyingLinkProperties)); } } else if (exception instanceof IkeNonProtocolException) { if (exception.getCause() instanceof UnknownHostException) { @@ -2986,9 +2986,9 @@ public class Vpn { getPackage(), mSessionKey, makeVpnProfileStateLocked(), mActiveNetwork, getRedactedNetworkCapabilitiesOfUnderlyingNetwork( - this.mNetworkCapabilities), + mUnderlyingNetworkCapabilities), getRedactedLinkPropertiesOfUnderlyingNetwork( - this.mLinkProperties)); + mUnderlyingLinkProperties)); } } else if (exception.getCause() instanceof IkeTimeoutException) { // TODO(b/230548427): Remove SDK check once VPN related stuff are @@ -3000,9 +3000,9 @@ public class Vpn { getPackage(), mSessionKey, makeVpnProfileStateLocked(), mActiveNetwork, getRedactedNetworkCapabilitiesOfUnderlyingNetwork( - this.mNetworkCapabilities), + mUnderlyingNetworkCapabilities), getRedactedLinkPropertiesOfUnderlyingNetwork( - this.mLinkProperties)); + mUnderlyingLinkProperties)); } } else if (exception.getCause() instanceof IOException) { // TODO(b/230548427): Remove SDK check once VPN related stuff are @@ -3014,9 +3014,9 @@ public class Vpn { getPackage(), mSessionKey, makeVpnProfileStateLocked(), mActiveNetwork, getRedactedNetworkCapabilitiesOfUnderlyingNetwork( - this.mNetworkCapabilities), + mUnderlyingNetworkCapabilities), getRedactedLinkPropertiesOfUnderlyingNetwork( - this.mLinkProperties)); + mUnderlyingLinkProperties)); } } } else if (exception != null) { @@ -3025,8 +3025,8 @@ public class Vpn { } mActiveNetwork = null; - mNetworkCapabilities = null; - mLinkProperties = null; + mUnderlyingNetworkCapabilities = null; + mUnderlyingLinkProperties = null; // Close all obsolete state, but keep VPN alive incase a usable network comes up. // (Mirrors VpnService behavior) @@ -3091,8 +3091,8 @@ public class Vpn { */ private void disconnectVpnRunner() { mActiveNetwork = null; - mNetworkCapabilities = null; - mLinkProperties = null; + mUnderlyingNetworkCapabilities = null; + mUnderlyingLinkProperties = null; mIsRunning = false; resetIkeState(); From 29b1b5beacdfa5412562e112c638f3ddf46753ea Mon Sep 17 00:00:00 2001 From: lucaslin Date: Fri, 13 May 2022 08:06:20 +0800 Subject: [PATCH 4/5] Address leftover comments of ag/18112116 Bug: 225010642 Test: atest FrameworksNetTests:VpnTest Change-Id: I0b129ec322159f608c447f608a4e11bed1971b55 (cherry picked from commit 5226b1f41610fff0fef27e7a0ed4b41e697f3b47) Merged-In: I0b129ec322159f608c447f608a4e11bed1971b55 --- .../com/android/server/connectivity/Vpn.java | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index a8cc2c218a7a1..81a4a7cad90e3 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -763,31 +763,36 @@ public class Vpn { // Also notify the new package if there was a provider change. final boolean shouldNotifyNewPkg = isVpnApp(packageName) && isPackageChanged; - if (setAlwaysOnPackageInternal(packageName, lockdown, lockdownAllowlist)) { - saveAlwaysOnPackage(); - // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from - // ConnectivityServiceTest. - if (shouldNotifyOldPkg && SdkLevel.isAtLeastT()) { - // If both of shouldNotifyOldPkg & isPackageChanged are true, which means the - // always-on of old package is disabled or the old package is replaced with the new - // package. In this case, VpnProfileState should be disconnected. - sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED, - -1 /* errorClass */, -1 /* errorCode*/, oldPackage, - null /* sessionKey */, isPackageChanged ? makeDisconnectedVpnProfileState() - : makeVpnProfileStateLocked(), - null /* underlyingNetwork */, null /* nc */, null /* lp */); - } - // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from - // ConnectivityServiceTest. - if (shouldNotifyNewPkg && SdkLevel.isAtLeastT()) { - sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED, - -1 /* errorClass */, -1 /* errorCode*/, packageName, - getSessionKeyLocked(), makeVpnProfileStateLocked(), - null /* underlyingNetwork */, null /* nc */, null /* lp */); - } + if (!setAlwaysOnPackageInternal(packageName, lockdown, lockdownAllowlist)) { + return false; + } + + saveAlwaysOnPackage(); + + // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from + // ConnectivityServiceTest. + if (!SdkLevel.isAtLeastT()) { return true; } - return false; + + if (shouldNotifyOldPkg) { + // If both of shouldNotifyOldPkg & isPackageChanged are true, that means the + // always-on of old package is disabled or the old package is replaced with the new + // package. In this case, VpnProfileState should be disconnected. + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED, + -1 /* errorClass */, -1 /* errorCode*/, oldPackage, + null /* sessionKey */, isPackageChanged ? makeDisconnectedVpnProfileState() + : makeVpnProfileStateLocked(), + null /* underlyingNetwork */, null /* nc */, null /* lp */); + } + + if (shouldNotifyNewPkg) { + sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED, + -1 /* errorClass */, -1 /* errorCode*/, packageName, + getSessionKeyLocked(), makeVpnProfileStateLocked(), + null /* underlyingNetwork */, null /* nc */, null /* lp */); + } + return true; } /** From 63b2a309ec234e6cc59dc2c03b0d31870ef2cb1e Mon Sep 17 00:00:00 2001 From: lucaslin Date: Tue, 17 May 2022 00:45:57 +0800 Subject: [PATCH 5/5] Address leftover comments of ag/18108411 Bug: 229799060 Test: atest FrameworksNetTests:VpnTest Change-Id: Iade04ede17b9371e530556acb2bd84c4b57c1581 (cherry picked from commit a0cb82f78bcef7e9a19cbcc17bde8b01c503bdf8) Merged-In: Iade04ede17b9371e530556acb2bd84c4b57c1581 --- services/core/java/com/android/server/connectivity/Vpn.java | 2 -- .../java/com/android/server/connectivity/VpnIkev2Utils.java | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index 81a4a7cad90e3..2ab68409a80f4 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -2655,8 +2655,6 @@ public class Vpn { super(TAG); mProfile = profile; mIpSecManager = (IpSecManager) mContext.getSystemService(Context.IPSEC_SERVICE); - // Pass mExecutor into Ikev2VpnNetworkCallback and make sure that IkeV2VpnRunnerCallback - // will be called by the mExecutor thread. mNetworkCallback = new VpnIkev2Utils.Ikev2VpnNetworkCallback(TAG, this, mExecutor); mSessionKey = UUID.randomUUID().toString(); } diff --git a/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java b/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java index e1e488db679f7..17058282d9474 100644 --- a/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java +++ b/services/core/java/com/android/server/connectivity/VpnIkev2Utils.java @@ -88,7 +88,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; -import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executor; /** * Utility class to build and convert IKEv2/IPsec parameters. @@ -379,10 +379,10 @@ public class VpnIkev2Utils { static class Ikev2VpnNetworkCallback extends NetworkCallback { private final String mTag; private final Vpn.IkeV2VpnRunnerCallback mCallback; - private final ExecutorService mExecutor; + private final Executor mExecutor; Ikev2VpnNetworkCallback(String tag, Vpn.IkeV2VpnRunnerCallback callback, - ExecutorService executor) { + Executor executor) { mTag = tag; mCallback = callback; mExecutor = executor;