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

Commit 13b95a88 authored by naman14's avatar naman14 Committed by Roman Birg
Browse files

Fix fatal crash in Settings(Phone Status) for secondary user

Switch to secondary user-> About Phone->Status. Settings crashes

SubscriptionController.getInstance will be null for secondary user
as Phone information is not provided for secondary user. Further
both SIM status and IMEI should also be removed from Status screen
as they will again throw IllegalStateException as no Default Phone
is available for secondary user.
A simple fix is to check for current user before calling
SubscriptionController and removing SIM status and IMEI from
preferences for the secondary user.

Change-Id: I5a9607e83673afa8c7de0ed6ca6767ebf79e9cb8
(cherry picked from commit 688cb9a9)
parent b5dfb1c6
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -102,6 +102,8 @@ public class Status extends PreferenceActivity {
    private static final String KEY_SERIAL_NUMBER = "serial_number";
    private static final String KEY_ICC_ID = "icc_id";
    private static final String KEY_WIMAX_MAC_ADDRESS = "wimax_mac_address";
    private static final String KEY_SIM_STATUS = "sim_status";
    private static final String KEY_IMEI_INFO = "imei_info";

    private static final String[] PHONE_RELATED_ENTRIES = {
        KEY_DATA_STATE,
@@ -278,7 +280,7 @@ public class Status extends PreferenceActivity {
        mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
        mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);

        if (isMultiSimEnabled()) {
        if (UserHandle.myUserId() == UserHandle.USER_OWNER && isMultiSimEnabled()) {
            addPreferencesFromResource(R.xml.device_info_msim_status);
        } else {
            addPreferencesFromResource(R.xml.device_info_status);
@@ -395,6 +397,12 @@ public class Status extends PreferenceActivity {
            removePreferenceFromScreen(KEY_SERIAL_NUMBER);
        }

        //Remove SimStatus and Imei for Secondary user
        if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
            removePreferenceFromScreen(KEY_SIM_STATUS);
            removePreferenceFromScreen(KEY_IMEI_INFO);
        }

        // Make every pref on this screen copy its data to the clipboard on longpress.
        // Super convenient for capturing the IMEI, MAC addr, serial, etc.
        getListView().setOnItemLongClickListener(