Merge "Add sim color selection in settings" into lmp-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f0b3271..b4841dc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1178,6 +1178,18 @@
</intent-filter>
</activity>
+ <!-- Runs in the phone process since it needs access to the Phone object -->
+ <activity android:name=".deviceinfo.ImeiInformation"
+ android:label="@string/imei_information_title"
+ android:theme="@style/Theme.SubSettingsDialogWhenLarge"
+ android:process="com.android.phone">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE_LAUNCH" />
+ </intent-filter>
+ </activity>
+
<activity android:name="Settings$StorageSettingsActivity"
android:label="@string/storage_settings_title"
android:taskAffinity="com.android.settings"
diff --git a/res/layout/crypt_keeper_emergency_button.xml b/res/layout/crypt_keeper_emergency_button.xml
index d0004de..0b6f810 100644
--- a/res/layout/crypt_keeper_emergency_button.xml
+++ b/res/layout/crypt_keeper_emergency_button.xml
@@ -19,15 +19,21 @@
<!-- Emergency call button.
Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
-<Button
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/emergencyCallButton"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_gravity="center_horizontal"
- android:textSize="14sp"
- android:fontFamily="sans-serif"
- android:textColor="#FFFFFF"
android:layout_weight="1"
- android:gravity="bottom"
- style="?android:attr/borderlessButtonStyle" />
+ android:orientation="vertical"
+ android:gravity="bottom">
+ <Button
+ android:id="@+id/emergencyCallButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:textSize="14sp"
+ android:fontFamily="sans-serif"
+ android:textColor="#FFFFFF"
+ style="?android:attr/borderlessButtonStyle" />
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c0d190..f8721c3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5981,4 +5981,9 @@
<!-- Message for encryption dialog telling the user that Talkback and other accessibility services will be disabled. -->
<string name="encrypt_talkback_dialog_message_password">When you enter your password to start this device, accessibility services like <xliff:g id="service" example="TalkBack">%1$s</xliff:g> won\'t yet be available.</string>
+ <!-- Title and summary for SIM Status -->
+ <string name="imei_information_title">IMEI information</string>
+ <string name="imei_information_summary">IMEI relative information</string>
+ <string name="slot_number">(Slot<xliff:g id="slot_num">%1$d</xliff:g>)</string>
+
</resources>
diff --git a/res/xml/device_info_phone_status.xml b/res/xml/device_info_phone_status.xml
new file mode 100644
index 0000000..21c5af1
--- /dev/null
+++ b/res/xml/device_info_phone_status.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/imei_information_title">
+
+ <!-- This menu item is only for CDMA phone -->
+ <Preference android:key="min_number"
+ android:title="@string/status_min_number"
+ android:summary="@string/device_info_not_available" />
+
+ <!-- This menu item is only for CDMA phone -->
+ <Preference android:key="prl_version"
+ android:title="@string/status_prl_version"
+ android:summary="@string/device_info_not_available" />
+
+ <!-- This menu item is only for CDMA phone -->
+ <Preference android:key="meid_number"
+ android:title="@string/status_meid_number"
+ android:summary="@string/device_info_not_available" />
+
+ <Preference android:key="imei"
+ android:title="@string/status_imei"
+ android:summary="@string/device_info_not_available" />
+
+ <Preference android:key="imei_sv"
+ android:title="@string/status_imei_sv"
+ android:summary="@string/device_info_not_available" />
+
+ <Preference android:key="icc_id"
+ android:title="@string/status_icc_id"
+ android:summary="@string/device_info_not_available" />
+
+</PreferenceScreen>
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java
index 074176b..2d8b70e 100644
--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -99,8 +99,8 @@
}
@Override
- public void onStart() {
- super.onStart();
+ public void onResume() {
+ super.onResume();
mAuthenticatorHelper.listenToAccountUpdates();
updateAuthDescriptions();
showAccountsIfNeeded();
@@ -134,10 +134,15 @@
}
@Override
+ public void onPause() {
+ super.onPause();
+ mAuthenticatorHelper.stopListeningToAccountUpdates();
+ }
+
+ @Override
public void onStop() {
super.onStop();
final Activity activity = getActivity();
- mAuthenticatorHelper.stopListeningToAccountUpdates();
activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM);
activity.getActionBar().setCustomView(null);
}
@@ -231,7 +236,7 @@
private void showSyncState() {
// Catch any delayed delivery of update messages
- if (getActivity() == null) return;
+ if (getActivity() == null || getActivity().isFinishing()) return;
final int userId = mUserHandle.getIdentifier();
@@ -377,10 +382,8 @@
if (mAccountType != null && mFirstAccount != null) {
addAuthenticatorSettings();
} else {
- // There's no account, reset to top-level of settings
- Intent settingsTop = new Intent(android.provider.Settings.ACTION_SETTINGS);
- settingsTop.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- getActivity().startActivity(settingsTop);
+ // There's no account, close activity
+ finish();
}
}
diff --git a/src/com/android/settings/deviceinfo/ImeiInformation.java b/src/com/android/settings/deviceinfo/ImeiInformation.java
new file mode 100644
index 0000000..9ac2eac
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/ImeiInformation.java
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+package com.android.settings.deviceinfo;
+
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.PhoneFactory;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+import android.telephony.SubInfoRecord;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.settings.R;
+import java.util.List;
+
+public class ImeiInformation extends PreferenceActivity {
+
+ private static final String KEY_PRL_VERSION = "prl_version";
+ private static final String KEY_MIN_NUMBER = "min_number";
+ private static final String KEY_MEID_NUMBER = "meid_number";
+ private static final String KEY_ICC_ID = "icc_id";
+ private static final String KEY_IMEI = "imei";
+ private static final String KEY_IMEI_SV = "imei_sv";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final TelephonyManager telephonyManager =
+ (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
+ initPreferenceScreen(telephonyManager.getSimCount());
+ }
+
+ // Since there are multiple phone for dsds, therefore need to show information for different
+ // phones.
+ private void initPreferenceScreen(int slotCount) {
+ for (int slotId = 0; slotId < slotCount; slotId ++) {
+ addPreferencesFromResource(R.xml.device_info_phone_status);
+ setPreferenceValue(slotId);
+ setNewKey(slotId);
+ }
+ }
+
+ private void setPreferenceValue(int slotId) {
+ final Phone phone = getPhoneFromSlotId(slotId);
+
+ if (phone != null) {
+ if (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
+ setSummaryText(KEY_MEID_NUMBER, phone.getMeid());
+ setSummaryText(KEY_MIN_NUMBER, phone.getCdmaMin());
+
+ if (getResources().getBoolean(R.bool.config_msid_enable)) {
+ findPreference(KEY_MIN_NUMBER).setTitle(R.string.status_msid_number);
+ }
+
+ setSummaryText(KEY_PRL_VERSION, phone.getCdmaPrlVersion());
+ removePreferenceFromScreen(KEY_IMEI_SV);
+
+ if (phone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
+ // Show ICC ID and IMEI for LTE device
+ setSummaryText(KEY_ICC_ID, phone.getIccSerialNumber());
+ setSummaryText(KEY_IMEI, phone.getImei());
+ } else {
+ // device is not GSM/UMTS, do not display GSM/UMTS features
+ // check Null in case no specified preference in overlay xml
+ removePreferenceFromScreen(KEY_IMEI);
+ removePreferenceFromScreen(KEY_ICC_ID);
+ }
+ } else {
+ setSummaryText(KEY_IMEI, phone.getDeviceId());
+ setSummaryText(KEY_IMEI_SV,
+ ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
+ .getDeviceSoftwareVersion(/*slotId*/));
+ // device is not CDMA, do not display CDMA features
+ // check Null in case no specified preference in overlay xml
+ removePreferenceFromScreen(KEY_PRL_VERSION);
+ removePreferenceFromScreen(KEY_MEID_NUMBER);
+ removePreferenceFromScreen(KEY_MIN_NUMBER);
+ removePreferenceFromScreen(KEY_ICC_ID);
+ }
+ }
+ }
+
+ private Phone getPhoneFromSlotId(int slotId) {
+ final List<SubInfoRecord> subInfos = SubscriptionManager.getSubInfoUsingSlotId(slotId);
+
+ if (subInfos == null || subInfos.size() < 1) {
+ return null;
+ }
+
+ final Phone[] phones = PhoneFactory.getPhones();
+ for (int i = 0; i < phones.length; i++) {
+ // Currently we only operate with the first subscription of a SIM.
+ if (phones[i].getSubId() == subInfos.get(0).subId) {
+ return phones[i];
+ }
+ }
+
+ return null;
+ }
+
+ // Modify the preference key with prefix "_", so new added information preference can be set
+ // related phone information.
+ private void setNewKey(int slotId) {
+ final PreferenceScreen prefScreen = getPreferenceScreen();
+ final int count = prefScreen.getPreferenceCount();
+ for (int i = 0; i < count; i++) {
+ Preference pref = prefScreen.getPreference(i);
+ String key = pref.getKey();
+ if (!key.startsWith("_")){
+ key = "_" + key + String.valueOf(slotId);
+ pref.setKey(key);
+ updateTitle(pref, slotId);
+ }
+ }
+ }
+
+ private void updateTitle(Preference pref, int slotId) {
+ if (pref != null) {
+ String title = pref.getTitle().toString();
+ // Slot starts from 1, slotId starts from 0 so plus 1
+ title = title + getResources().getString(R.string.slot_number, slotId + 1);
+ pref.setTitle(title);
+ }
+ }
+
+ private void setSummaryText(String key, String text) {
+ final Preference preference = findPreference(key);
+
+ if (TextUtils.isEmpty(text)) {
+ text = getResources().getString(R.string.device_info_default);
+ }
+
+ if (preference != null) {
+ preference.setSummary(text);
+ }
+ }
+
+ /**
+ * Removes the specified preference, if it exists.
+ * @param key the key for the Preference item
+ */
+ private void removePreferenceFromScreen(String key) {
+ final Preference preference = findPreference(key);
+ if (preference != null) {
+ getPreferenceScreen().removePreference(preference);
+ }
+ }
+
+}
diff --git a/src/com/android/settings/notification/ZenModeConditionSelection.java b/src/com/android/settings/notification/ZenModeConditionSelection.java
index 856a7f6..2f86f63 100644
--- a/src/com/android/settings/notification/ZenModeConditionSelection.java
+++ b/src/com/android/settings/notification/ZenModeConditionSelection.java
@@ -26,6 +26,7 @@
import android.service.notification.Condition;
import android.service.notification.IConditionListener;
import android.service.notification.ZenModeConfig;
+import android.text.TextUtils;
import android.util.Log;
import android.widget.CompoundButton;
import android.widget.RadioButton;
@@ -59,7 +60,8 @@
b.setText(mContext.getString(com.android.internal.R.string.zen_mode_forever));
b.setChecked(true);
for (int i = ZenModeConfig.MINUTE_BUCKETS.length - 1; i >= 0; --i) {
- handleCondition(ZenModeConfig.toTimeCondition(ZenModeConfig.MINUTE_BUCKETS[i]));
+ handleCondition(ZenModeConfig.toTimeCondition(mContext,
+ ZenModeConfig.MINUTE_BUCKETS[i]));
}
}
@@ -114,7 +116,7 @@
}
}
if (v != null) {
- v.setText(c.summary);
+ v.setText(!TextUtils.isEmpty(c.line1) ? c.line1 : c.summary);
v.setEnabled(c.state == Condition.STATE_TRUE);
}
mConditions.add(c);
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 8e71819..9afab4b 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -444,8 +444,9 @@
if (bssid != null) {
visibility.append(" ").append(bssid);
}
- visibility.append(" score=").append(mInfo.score);
+ visibility.append(" rssi=").append(mInfo.getRssi());
visibility.append(" ");
+ visibility.append(" score=").append(mInfo.score);
visibility.append(String.format("tx=%.1f,", mInfo.txSuccessRate));
visibility.append(String.format("%.1f,", mInfo.txRetriesRate));
visibility.append(String.format("%.1f ", mInfo.txBadRate));
@@ -490,7 +491,7 @@
}
if (n5 < 4) {
if (scans5GHz == null) scans5GHz = new StringBuilder();
- scans5GHz.append(" {").append(result.BSSID);
+ scans5GHz.append(" \n{").append(result.BSSID);
if (bssid != null && result.BSSID.equals(bssid)) scans5GHz.append("*");
scans5GHz.append("=").append(result.frequency);
scans5GHz.append(",").append(result.level);
@@ -510,7 +511,7 @@
}
if (n24 < 4) {
if (scans24GHz == null) scans24GHz = new StringBuilder();
- scans24GHz.append(" {").append(result.BSSID);
+ scans24GHz.append(" \n{").append(result.BSSID);
if (bssid != null && result.BSSID.equals(bssid)) scans24GHz.append("*");
scans24GHz.append("=").append(result.frequency);
scans24GHz.append(",").append(result.level);
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 6c58bc1..1ef9cce 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -145,6 +145,9 @@
// this boolean extra specifies whether to disable the Next button when not connected. Used by
// account creation outside of setup wizard.
private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
+ // This string extra specifies a network to open the connect dialog on, so the user can enter
+ // network credentials. This is used by quick settings for secured networks.
+ private static final String EXTRA_START_CONNECT_SSID = "wifi_start_connect_ssid";
// should Next button only be enabled when we have a connection?
private boolean mEnableNextOnConnection;
@@ -326,6 +329,23 @@
mEmptyView = initEmptyView();
registerForContextMenu(getListView());
setHasOptionsMenu(true);
+
+ if (intent.hasExtra(EXTRA_START_CONNECT_SSID)) {
+ String ssid = intent.getStringExtra(EXTRA_START_CONNECT_SSID);
+ updateAccessPoints();
+ PreferenceScreen preferenceScreen = getPreferenceScreen();
+ for (int i = 0; i < preferenceScreen.getPreferenceCount(); i++) {
+ Preference preference = preferenceScreen.getPreference(i);
+ if (preference instanceof AccessPoint) {
+ AccessPoint accessPoint = (AccessPoint) preference;
+ if (ssid.equals(accessPoint.ssid) && accessPoint.networkId == -1
+ && accessPoint.security != AccessPoint.SECURITY_NONE) {
+ onPreferenceTreeClick(preferenceScreen, preference);
+ break;
+ }
+ }
+ }
+ }
}
@Override