From e8117f67204cc3774e6e8702a10cc028323e1e73 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Thu, 30 Mar 2023 17:20:42 +0900 Subject: Always startOrMigrate connection when caps change This is a simplification whose main point is to make regular the recovery mechanisms. When a new NC is found, there is now a central function that can always be called no matter the state, which is valuable because it can be copied in other cases where a change is necessary. The prime example of this will be changes of LP. Bug: 269715746 Test: VpnTest Change-Id: I7981668ea091db5103b749eb80502e9ba348d4f3 --- services/core/java/com/android/server/connectivity/Vpn.java | 8 +++----- 1 file 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 7e48f68dcefc..928dcb389153 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -3738,12 +3738,10 @@ public class Vpn { + mUnderlyingNetworkCapabilities + " to " + nc); final NetworkCapabilities oldNc = mUnderlyingNetworkCapabilities; mUnderlyingNetworkCapabilities = nc; - if (oldNc == null) { - // A new default network is available. + if (oldNc == null || !nc.getSubscriptionIds().equals(oldNc.getSubscriptionIds())) { + // A new default network is available, or the subscription has changed. + // Try to migrate the session, or failing that, start a new one. startOrMigrateIkeSession(mActiveNetwork); - } else if (!nc.getSubscriptionIds().equals(oldNc.getSubscriptionIds())) { - // Renew carrierConfig values. - maybeMigrateIkeSessionAndUpdateVpnTransportInfo(mActiveNetwork); } } -- cgit v1.2.3-59-g8ed1b