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
This commit is contained in:
Chalard Jean
2023-03-30 17:20:42 +09:00
parent aac5467d8a
commit e8117f6720

View File

@@ -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);
}
}