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

Commit 99637baa authored by Taesu Lee's avatar Taesu Lee
Browse files

Avoid unexpected state changes for enhanced preferences



Assigning current call state to mCallState right before registering
PhoneStateListener so that the preferences have correct state before
first onCallStateChanged() by initial registration even.

Bug: 166307650
Test: Check the preferences state when onStop() -> onStart()

Change-Id: I861a687497ba4da7a845540fd92ae2b865392d60
Signed-off-by: default avatarTaesu Lee <taesu82.lee@samsung.com>
parent 36cfa7db
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -225,6 +225,9 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
            if (SubscriptionManager.isValidSubscriptionId(subId)) {
                mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
            }
            // assign current call state so that it helps to show correct preference state even
            // before first onCallStateChanged() by initial registration.
            mCallState = mTelephonyManager.getCallState(subId);
            mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);

            final long supportedRadioBitmask = mTelephonyManager.getSupportedRadioAccessFamily();
+3 −0
Original line number Diff line number Diff line
@@ -182,6 +182,9 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
            if (SubscriptionManager.isValidSubscriptionId(subId)) {
                mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
            }
            // assign current call state so that it helps to show correct preference state even
            // before first onCallStateChanged() by initial registration.
            mCallState = mTelephonyManager.getCallState(subId);
            mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);
        }

+3 −0
Original line number Diff line number Diff line
@@ -210,6 +210,9 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont

        public void register(Context context, int subId) {
            mTelephonyManager = getTelephonyManager(context, subId);
            // assign current call state so that it helps to show correct preference state even
            // before first onCallStateChanged() by initial registration.
            mCallState = mTelephonyManager.getCallState(subId);
            mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);
        }