Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84dd61d2 authored by chiachangwang's avatar chiachangwang
Browse files

Prevent migrating the session from using the wrong value

Migrating the IKE session requires reading the subId information
from network capabilities. A new default network change will
start with an onAailable callback and start the migration. But
Vpn does not yet get the new network capabilities. The migration
should not be processed until receiving network capabilities
change.

Bug: 269714970
Test: atest FrameworksNetTests
Change-Id: I1d2eb9647cd3a0434ba656671926eb504abbf150
parent f0eb7b81
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -3302,8 +3302,6 @@ public class Vpn {
            mUnderlyingLinkProperties = null;
            mUnderlyingNetworkCapabilities = null;
            mRetryCount = 0;

            startOrMigrateIkeSession(network);
        }

        @NonNull
@@ -3530,11 +3528,11 @@ public class Vpn {
        public void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc) {
            final NetworkCapabilities oldNc = mUnderlyingNetworkCapabilities;
            mUnderlyingNetworkCapabilities = nc;
            // The oldNc may be null when it's not assigned yet.
            final boolean subIdChanged =
                    (oldNc == null) || !nc.getSubscriptionIds().equals(oldNc.getSubscriptionIds());
            // Update carrierConfig.
            if (subIdChanged) {
            if (oldNc == null) {
                // A new default network is available.
                startOrMigrateIkeSession(mActiveNetwork);
            } else if (!nc.getSubscriptionIds().equals(oldNc.getSubscriptionIds())) {
                // Renew carrierConfig values.
                maybeMigrateIkeSession(mActiveNetwork);
            }
        }