summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/icc_lock_tabs.xml60
-rw-r--r--res/values/cm_strings.xml5
-rw-r--r--res/xml/device_info_sim_status.xml12
-rw-r--r--src/com/android/settings/IccLockSettings.java74
-rw-r--r--src/com/android/settings/SecuritySettings.java98
-rw-r--r--src/com/android/settings/deviceinfo/ImeiInformation.java16
-rw-r--r--src/com/android/settings/deviceinfo/SimStatus.java92
-rw-r--r--src/com/android/settings/deviceinfo/Status.java50
8 files changed, 163 insertions, 244 deletions
diff --git a/res/layout/icc_lock_tabs.xml b/res/layout/icc_lock_tabs.xml
deleted file mode 100644
index d2a4acc..0000000
--- a/res/layout/icc_lock_tabs.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/tabhost"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:id="@+id/tabs_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none"
- android:fillViewport="true">
-
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- style="?android:attr/tabWidgetStyle" />
-
- </HorizontalScrollView>
-
- <!-- give an empty content area to make tabhost happy -->
- <FrameLayout
- android:id="@android:id/tabcontent"
- android:layout_width="0dip"
- android:layout_height="0dip" />
-
- <ListView
- android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:smoothScrollbar="false" />
-
- </LinearLayout>
-
-</TabHost>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 7741e2a..326d028 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -1044,6 +1044,11 @@
<string name="primary_sub_select_title">Default 3G/LTE subscription</string>
<string name="select_sim_card">Select SIM card</string>
+ <!-- MSIM SIM status -->
+ <string name="sim_card_status_title">SIM %d status</string>
+ <string name="sim_card_lock_settings_title">SIM %d lock settings</string>
+ <string name="sim_card_summary_empty">SIM not inserted</string>
+
<!-- Zen mode allowed event setting summary items -->
<!-- [CHAR LIMIT=50] Like zen_mode_reminders, but part of a list, so lower case if needed-->
<string name="zen_mode_summary_reminders">reminders</string>
diff --git a/res/xml/device_info_sim_status.xml b/res/xml/device_info_sim_status.xml
index 9e9444d..812b77a 100644
--- a/res/xml/device_info_sim_status.xml
+++ b/res/xml/device_info_sim_status.xml
@@ -65,16 +65,4 @@
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="imei"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_imei"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
-
- <Preference android:key="imei_sv"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_imei_sv"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
-
</PreferenceScreen>
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index 168d3c8..6f72b66 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -16,6 +16,7 @@
package com.android.settings;
+import android.app.ActionBar;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -35,11 +36,6 @@ import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
-import android.widget.TabHost;
-import android.widget.TabHost.OnTabChangeListener;
-import android.widget.TabHost.TabContentFactory;
-import android.widget.TabHost.TabSpec;
-import android.widget.TabWidget;
import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
@@ -71,6 +67,9 @@ public class IccLockSettings extends InstrumentedPreferenceActivity
// State when entering the new pin - second time
private static final int ICC_REENTER_MODE = 4;
+ static final String EXTRA_SUB_ID = "slot_id";
+ static final String EXTRA_SUB_DISPLAY_NAME = "sub_display_name";
+
// Keys in xml file
private static final String PIN_DIALOG = "sim_pin";
private static final String PIN_TOGGLE = "sim_toggle";
@@ -97,10 +96,6 @@ public class IccLockSettings extends InstrumentedPreferenceActivity
// Are we trying to enable or disable ICC lock?
private boolean mToState;
- private TabHost mTabHost;
- private TabWidget mTabWidget;
- private ListView mListView;
-
private Phone mPhone;
private EditPinPreference mPinDialog;
@@ -201,32 +196,16 @@ public class IccLockSettings extends InstrumentedPreferenceActivity
// Don't need any changes to be remembered
getPreferenceScreen().setPersistent(false);
- if (numSims > 1) {
- setContentView(R.layout.icc_lock_tabs);
-
- mTabHost = (TabHost) findViewById(android.R.id.tabhost);
- mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
- mListView = (ListView) findViewById(android.R.id.list);
-
- mTabHost.setup();
- mTabHost.setOnTabChangedListener(mTabListener);
- mTabHost.clearAllTabs();
-
- SubscriptionManager sm = SubscriptionManager.from(this);
- for (int i = 0; i < numSims; ++i) {
- final SubscriptionInfo subInfo = sm.getActiveSubscriptionInfoForSimSlotIndex(i);
- mTabHost.addTab(buildTabSpec(String.valueOf(i),
- String.valueOf(subInfo == null
- ? context.getString(R.string.sim_editor_title, i + 1)
- : subInfo.getDisplayName())));
- }
- final SubscriptionInfo sir = sm.getActiveSubscriptionInfoForSimSlotIndex(0);
-
- mPhone = (sir == null) ? null
- : PhoneFactory.getPhone(SubscriptionManager.getPhoneId(sir.getSubscriptionId()));
- } else {
- mPhone = PhoneFactory.getDefaultPhone();
+ Intent intent = getIntent();
+ ActionBar actionBar = getActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setSubtitle(intent.getStringExtra(EXTRA_SUB_DISPLAY_NAME));
}
+
+ int subId = intent.getIntExtra(EXTRA_SUB_ID, SubscriptionManager.getDefaultSubId());
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ mPhone = PhoneFactory.getPhone(phoneId);
mRes = getResources();
updatePreferences();
}
@@ -472,31 +451,4 @@ public class IccLockSettings extends InstrumentedPreferenceActivity
setDialogValues();
mDialogState = OFF_MODE;
}
-
- private OnTabChangeListener mTabListener = new OnTabChangeListener() {
- @Override
- public void onTabChanged(String tabId) {
- final int slotId = Integer.parseInt(tabId);
- final SubscriptionInfo sir = SubscriptionManager.from(getBaseContext())
- .getActiveSubscriptionInfoForSimSlotIndex(slotId);
-
- mPhone = (sir == null) ? null
- : PhoneFactory.getPhone(SubscriptionManager.getPhoneId(sir.getSubscriptionId()));
-
- // The User has changed tab; update the body.
- updatePreferences();
- }
- };
-
- private TabContentFactory mEmptyTabContent = new TabContentFactory() {
- @Override
- public View createTabContent(String tag) {
- return new View(mTabHost.getContext());
- }
- };
-
- private TabSpec buildTabSpec(String tag, String title) {
- return mTabHost.newTabSpec(tag).setIndicator(title).setContent(
- mEmptyTabContent);
- }
}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index bc0bcac..a500520 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -99,6 +99,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
// Misc Settings
private static final String KEY_SIM_LOCK = "sim_lock";
+ private static final String KEY_SIM_LOCK_SETTINGS = "sim_lock_settings";
private static final String KEY_SHOW_PASSWORD = "show_password";
private static final String KEY_CREDENTIAL_STORAGE_TYPE = "credential_storage_type";
private static final String KEY_RESET_CREDENTIALS = "credentials_reset";
@@ -295,17 +296,65 @@ public class SecuritySettings extends SettingsPreferenceFragment
addPreferencesFromResource(R.xml.security_settings_misc);
// Do not display SIM lock for devices without an Icc card
- TelephonyManager tm = TelephonyManager.getDefault();
CarrierConfigManager cfgMgr = (CarrierConfigManager)
getActivity().getSystemService(Context.CARRIER_CONFIG_SERVICE);
PersistableBundle b = cfgMgr.getConfig();
- if (!mIsPrimary || !isSimIccReady() ||
- b.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
- root.removePreference(root.findPreference(KEY_SIM_LOCK));
+ PreferenceGroup iccLockGroup = (PreferenceGroup) root.findPreference(KEY_SIM_LOCK);
+ Preference iccLock = root.findPreference(KEY_SIM_LOCK_SETTINGS);
+
+ if (!mIsPrimary
+ || b.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ root.removePreference(iccLockGroup);
} else {
- // Disable SIM lock if there is no ready SIM card.
- root.findPreference(KEY_SIM_LOCK).setEnabled(isSimReady());
+ SubscriptionManager subMgr = SubscriptionManager.from(getActivity());
+ TelephonyManager tm = TelephonyManager.getDefault();
+ int numPhones = tm.getPhoneCount();
+ boolean hasAnySim = false;
+
+ for (int i = 0; i < numPhones; i++) {
+ final Preference pref;
+
+ if (numPhones > 1) {
+ SubscriptionInfo sir = subMgr.getActiveSubscriptionInfoForSimSlotIndex(i);
+ if (sir == null) {
+ continue;
+ }
+
+ pref = new Preference(getActivity());
+ pref.setOrder(iccLock.getOrder());
+ pref.setTitle(getString(R.string.sim_card_lock_settings_title, i + 1));
+ pref.setSummary(sir.getDisplayName());
+
+ Intent intent = new Intent(getActivity(), IccLockSettings.class);
+ intent.putExtra(IccLockSettings.EXTRA_SUB_ID, sir.getSubscriptionId());
+ intent.putExtra(IccLockSettings.EXTRA_SUB_DISPLAY_NAME,
+ sir.getDisplayName());
+ pref.setIntent(intent);
+
+ iccLockGroup.addPreference(pref);
+ } else {
+ pref = iccLock;
+ }
+
+ // Do not display SIM lock for devices without an Icc card
+ hasAnySim |= tm.hasIccCard(i);
+
+ int simState = tm.getSimState(i);
+ boolean simPresent = simState != TelephonyManager.SIM_STATE_ABSENT
+ && simState != TelephonyManager.SIM_STATE_UNKNOWN
+ && simState != TelephonyManager.SIM_STATE_CARD_IO_ERROR;
+ if (!simPresent) {
+ pref.setEnabled(false);
+ }
+ }
+
+ if (!hasAnySim) {
+ root.removePreference(iccLockGroup);
+ } else if (numPhones > 1) {
+ iccLockGroup.removePreference(iccLock);
+ }
}
+
if (Settings.System.getInt(getContentResolver(),
Settings.System.LOCK_TO_APP_ENABLED, 0) != 0) {
root.findPreference(KEY_SCREEN_PINNING).setSummary(
@@ -440,43 +489,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
}
}
- /* Return true if a there is a Slot that has Icc.
- */
- private boolean isSimIccReady() {
- TelephonyManager tm = TelephonyManager.getDefault();
- final List<SubscriptionInfo> subInfoList =
- mSubscriptionManager.getActiveSubscriptionInfoList();
-
- if (subInfoList != null) {
- for (SubscriptionInfo subInfo : subInfoList) {
- if (tm.hasIccCard(subInfo.getSimSlotIndex())) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /* Return true if a SIM is ready for locking.
- * TODO: consider adding to TelephonyManager or SubscritpionManasger.
- */
- private boolean isSimReady() {
- int simState = TelephonyManager.SIM_STATE_UNKNOWN;
- final List<SubscriptionInfo> subInfoList =
- mSubscriptionManager.getActiveSubscriptionInfoList();
- if (subInfoList != null) {
- for (SubscriptionInfo subInfo : subInfoList) {
- simState = TelephonyManager.getDefault().getSimState(subInfo.getSimSlotIndex());
- if((simState != TelephonyManager.SIM_STATE_ABSENT) &&
- (simState != TelephonyManager.SIM_STATE_UNKNOWN)){
- return true;
- }
- }
- }
- return false;
- }
-
private static ArrayList<TrustAgentComponentInfo> getActiveTrustAgents(
PackageManager pm, LockPatternUtils utils, DevicePolicyManager dpm) {
ArrayList<TrustAgentComponentInfo> result = new ArrayList<TrustAgentComponentInfo>();
diff --git a/src/com/android/settings/deviceinfo/ImeiInformation.java b/src/com/android/settings/deviceinfo/ImeiInformation.java
index 707afea..e34a84f 100644
--- a/src/com/android/settings/deviceinfo/ImeiInformation.java
+++ b/src/com/android/settings/deviceinfo/ImeiInformation.java
@@ -21,6 +21,7 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
+import android.app.ActionBar;
import android.content.Context;
import android.os.Bundle;
import android.preference.Preference;
@@ -29,6 +30,7 @@ import android.preference.PreferenceScreen;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
+import android.view.MenuItem;
import com.android.settings.InstrumentedPreferenceActivity;
import com.android.settings.R;
@@ -52,6 +54,20 @@ public class ImeiInformation extends InstrumentedPreferenceActivity {
final TelephonyManager telephonyManager =
(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
initPreferenceScreen(telephonyManager.getSimCount());
+
+ ActionBar actionBar = getActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ }
+ return false;
}
// Since there are multiple phone for dsds, therefore need to show information for different
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index 8a249ee..036d00f 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -16,6 +16,7 @@
package com.android.settings.deviceinfo;
+import android.app.ActionBar;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -36,6 +37,9 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ListView;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.telephony.DefaultPhoneNotifier;
@@ -45,14 +49,6 @@ import com.android.settings.InstrumentedPreferenceActivity;
import com.android.settings.R;
import com.android.settings.Utils;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.TabHost;
-import android.widget.TabHost.OnTabChangeListener;
-import android.widget.TabHost.TabContentFactory;
-import android.widget.TabHost.TabSpec;
-import android.widget.TabWidget;
-
import java.util.ArrayList;
import java.util.List;
@@ -62,7 +58,6 @@ import java.util.List;
* # Phone Number
* # Network
* # Roaming
- * # Device Id (IMEI in GSM and MEID in CDMA)
* # Network type
* # Operator info (area info cell broadcast for Brazil)
* # Signal Strength
@@ -79,8 +74,6 @@ public class SimStatus extends InstrumentedPreferenceActivity {
private static final String KEY_LATEST_AREA_INFO = "latest_area_info";
private static final String KEY_PHONE_NUMBER = "number";
private static final String KEY_SIGNAL_STRENGTH = "signal_strength";
- private static final String KEY_IMEI = "imei";
- private static final String KEY_IMEI_SV = "imei_sv";
private static final String COUNTRY_ABBREVIATION_BRAZIL = "br";
static final String CB_AREA_INFO_RECEIVED_ACTION =
@@ -93,6 +86,7 @@ public class SimStatus extends InstrumentedPreferenceActivity {
static final String CB_AREA_INFO_SENDER_PERMISSION =
"android.permission.RECEIVE_EMERGENCY_BROADCAST";
+ static final String EXTRA_SLOT_ID = "slot_id";
private TelephonyManager mTelephonyManager;
private Phone mPhone = null;
@@ -104,11 +98,6 @@ public class SimStatus extends InstrumentedPreferenceActivity {
// Default summary for items
private String mDefaultText;
- private TabHost mTabHost;
- private TabWidget mTabWidget;
- private ListView mListView;
- private List<SubscriptionInfo> mSelectableSubInfos;
-
private PhoneStateListener mPhoneStateListener;
private BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
@Override
@@ -135,8 +124,6 @@ public class SimStatus extends InstrumentedPreferenceActivity {
super.onCreate(icicle);
mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
- mSelectableSubInfos = SubscriptionManager.from(this).getActiveSubscriptionInfoList();
-
addPreferencesFromResource(R.xml.device_info_sim_status);
mRes = getResources();
@@ -144,29 +131,20 @@ public class SimStatus extends InstrumentedPreferenceActivity {
// Note - missing in zaku build, be careful later...
mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
- if (mSelectableSubInfos == null) {
- mSir = null;
- } else {
- mSir = mSelectableSubInfos.size() > 0 ? mSelectableSubInfos.get(0) : null;
-
- if (mSelectableSubInfos.size() > 1) {
- setContentView(com.android.internal.R.layout.common_tab_settings);
+ SubscriptionManager subscriptionManager = SubscriptionManager.from(this);
+ int slotId = getIntent().getIntExtra(EXTRA_SLOT_ID, 0);
+ mSir = subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(slotId);
- mTabHost = (TabHost) findViewById(android.R.id.tabhost);
- mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
- mListView = (ListView) findViewById(android.R.id.list);
+ updatePhoneInfos();
- mTabHost.setup();
- mTabHost.setOnTabChangedListener(mTabListener);
- mTabHost.clearAllTabs();
+ if (getIntent().hasExtra(EXTRA_SLOT_ID)) {
+ setTitle(getString(R.string.sim_card_status_title, slotId + 1));
+ }
- for (int i = 0; i < mSelectableSubInfos.size(); i++) {
- mTabHost.addTab(buildTabSpec(String.valueOf(i),
- String.valueOf(mSelectableSubInfos.get(i).getDisplayName())));
- }
- }
+ ActionBar actionBar = getActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(true);
}
- updatePhoneInfos();
}
@Override
@@ -211,6 +189,15 @@ public class SimStatus extends InstrumentedPreferenceActivity {
}
}
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ }
+ return false;
+ }
+
/**
* Removes the specified preference, if it exists.
* @param key the key for the Preference item
@@ -368,8 +355,6 @@ public class SimStatus extends InstrumentedPreferenceActivity {
}
// If formattedNumber is null or empty, it'll display as "Unknown".
setSummaryText(KEY_PHONE_NUMBER, formattedNumber);
- setSummaryText(KEY_IMEI, mPhone.getImei());
- setSummaryText(KEY_IMEI_SV, mPhone.getDeviceSvn());
if (!mShowLatestAreaInfo) {
removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
@@ -408,33 +393,4 @@ public class SimStatus extends InstrumentedPreferenceActivity {
}
}
}
- private OnTabChangeListener mTabListener = new OnTabChangeListener() {
- @Override
- public void onTabChanged(String tabId) {
- final int slotId = Integer.parseInt(tabId);
- mSir = mSelectableSubInfos.get(slotId);
-
- // The User has changed tab; update the SIM information.
- updatePhoneInfos();
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
- | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
- | PhoneStateListener.LISTEN_SERVICE_STATE);
- updateDataState();
- updateNetworkType();
- updatePreference();
- }
- };
-
- private TabContentFactory mEmptyTabContent = new TabContentFactory() {
- @Override
- public View createTabContent(String tag) {
- return new View(mTabHost.getContext());
- }
- };
-
- private TabSpec buildTabSpec(String tag, String title) {
- return mTabHost.newTabSpec(tag).setIndicator(title).setContent(
- mEmptyTabContent);
- }
}
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index 079639b..4125d88 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -16,6 +16,7 @@
package com.android.settings.deviceinfo;
+import android.app.ActionBar;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.ClipboardManager;
@@ -35,7 +36,12 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
+import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
@@ -213,6 +219,36 @@ public class Status extends InstrumentedPreferenceActivity {
|| Utils.isWifiOnly(this)) {
removePreferenceFromScreen(KEY_SIM_STATUS);
removePreferenceFromScreen(KEY_IMEI_INFO);
+ } else {
+ int numPhones = TelephonyManager.getDefault().getPhoneCount();
+
+ if (numPhones > 1) {
+ PreferenceScreen prefSet = getPreferenceScreen();
+ Preference singleSimPref = prefSet.findPreference(KEY_SIM_STATUS);
+ SubscriptionManager subscriptionManager = SubscriptionManager.from(this);
+
+ for (int i = 0; i < numPhones; i++) {
+ SubscriptionInfo sir =
+ subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(i);
+ Preference pref = new Preference(this);
+
+ pref.setOrder(singleSimPref.getOrder());
+ pref.setTitle(getString(R.string.sim_card_status_title, i + 1));
+ if (sir != null) {
+ pref.setSummary(sir.getDisplayName());
+ } else {
+ pref.setSummary(R.string.sim_card_summary_empty);
+ }
+
+ Intent intent = new Intent(this, SimStatus.class);
+ intent.putExtra(SimStatus.EXTRA_SLOT_ID, i);
+ pref.setIntent(intent);
+
+ prefSet.addPreference(pref);
+ }
+
+ prefSet.removePreference(singleSimPref);
+ }
}
// Make every pref on this screen copy its data to the clipboard on longpress.
@@ -235,6 +271,20 @@ public class Status extends InstrumentedPreferenceActivity {
return true;
}
});
+
+ ActionBar actionBar = getActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ }
+ return false;
}
@Override