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

Commit 43ff2895 authored by Sarah Chin's avatar Sarah Chin
Browse files

Update override network type after service state changes

Previously, if the data rat was the same after a service state change,
we would not do anything since the state is the same.
However, the override network type could be different.
Make sure to update the override network type (either directly or
through a transition) whenever the service state changes.

Test: atest NetworkTypeControllerTest
Bug: 263678417
Change-Id: I74fb8f483a2dec281d16f86bf0f16e19acae9221
parent 2c95c1a8
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -743,7 +743,8 @@ public class NetworkTypeController extends StateMachine {
                    // fallthrough
                case EVENT_UPDATE:
                    int rat = getDataNetworkType();
                    if (rat == TelephonyManager.NETWORK_TYPE_NR || isLte(rat) && isNrConnected()) {
                    if (rat == TelephonyManager.NETWORK_TYPE_NR
                            || (isLte(rat) && isNrConnected())) {
                        if (isNrAdvanced()) {
                            transitionTo(mNrConnectedAdvancedState);
                        } else {
@@ -755,7 +756,7 @@ public class NetworkTypeController extends StateMachine {
                        if (isPhysicalLinkActive()) {
                            transitionWithTimerTo(mLteConnectedState);
                        } else {
                            // Update in case of LTE/LTE+ switch
                            // Update in case the override network type changed
                            updateOverrideNetworkType();
                        }
                    }
@@ -839,7 +840,7 @@ public class NetworkTypeController extends StateMachine {
                        if (!isPhysicalLinkActive()) {
                            transitionWithTimerTo(mIdleState);
                        } else {
                            // Update in case of LTE/LTE+ switch
                            // Update in case the override network type changed
                            updateOverrideNetworkType();
                        }
                    }
@@ -910,11 +911,13 @@ public class NetworkTypeController extends StateMachine {
                    // fallthrough
                case EVENT_UPDATE:
                    int rat = getDataNetworkType();
                    if (rat == TelephonyManager.NETWORK_TYPE_NR || isLte(rat) && isNrConnected()) {
                    if (rat == TelephonyManager.NETWORK_TYPE_NR
                            || (isLte(rat) && isNrConnected())) {
                        if (isNrAdvanced()) {
                            transitionTo(mNrConnectedAdvancedState);
                        } else {
                            // Same NR connected state
                            // Update in case the override network type changed
                            updateOverrideNetworkType();
                        }
                    } else if (isLte(rat) && isNrNotRestricted()) {
                        transitionWithTimerTo(isPhysicalLinkActive()
@@ -985,7 +988,8 @@ public class NetworkTypeController extends StateMachine {
                    if (rat == TelephonyManager.NETWORK_TYPE_NR
                            || (isLte(rat) && isNrConnected())) {
                        if (isNrAdvanced()) {
                            // Same NR advanced state
                            // Update in case the override network type changed
                            updateOverrideNetworkType();
                        } else {
                            transitionWithTimerTo(mNrConnectedState);
                        }