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

Commit 4ca4bd31 authored by Qi Ding's avatar Qi Ding Committed by Yoshinori Hirano
Browse files

Fix current tab is changed when rotating device

Even if SIM slot 2 is selected in SIM card lock settings,
the current tab is changed to SIM slot 1 when rotating the device.
To fix this issue, the current tab should be restored
after rotating the device.

Fixes: 63690125
Test: manual - go to Settings > Security > SIM card lock
               and rotate device

Change-Id: I874d4d06019e21dd7b65951a3aefb75ff5ea298b
parent aa8a972e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class IccLockSettings extends SettingsPreferenceFragment
    private static final String DIALOG_PIN = "dialogPin";
    private static final String DIALOG_ERROR = "dialogError";
    private static final String ENABLE_TO_STATE = "enableState";
    private static final String CURRENT_TAB = "currentTab";

    // Save and restore inputted PIN code when configuration changed
    // (ex. portrait<-->landscape) during change PIN code
@@ -235,6 +236,10 @@ public class IccLockSettings extends SettingsPreferenceFragment

            mPhone = (sir == null) ? null
                : PhoneFactory.getPhone(SubscriptionManager.getPhoneId(sir.getSubscriptionId()));

            if (savedInstanceState != null && savedInstanceState.containsKey(CURRENT_TAB)) {
                mTabHost.setCurrentTabByTag(savedInstanceState.getString(CURRENT_TAB));
            }
            return view;
        } else {
            mPhone = PhoneFactory.getDefaultPhone();
@@ -326,6 +331,10 @@ public class IccLockSettings extends SettingsPreferenceFragment
        } else {
            super.onSaveInstanceState(out);
        }

        if (mTabHost != null) {
            out.putString(CURRENT_TAB, mTabHost.getCurrentTabTag());
        }
    }

    private void showPinDialog() {