summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml12
-rw-r--r--res/layout-xlarge/date_time_settings_setupwizard.xml4
-rw-r--r--res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml15
-rw-r--r--res/values-xlarge/bools.xml20
-rw-r--r--res/values-xlarge/colors.xml2
-rw-r--r--res/values/bools.xml2
-rw-r--r--res/values/strings.xml48
-rw-r--r--res/xml/security_settings_chooser.xml2
-rw-r--r--res/xml/security_settings_lockscreen.xml4
-rw-r--r--res/xml/security_settings_password.xml12
-rw-r--r--res/xml/security_settings_pattern.xml20
-rw-r--r--res/xml/security_settings_pin.xml12
-rw-r--r--src/com/android/settings/SecuritySettings.java23
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java3
-rw-r--r--src/com/android/settings/deviceinfo/Status.java104
15 files changed, 150 insertions, 133 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 964b4b7..17c2fcd 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -452,8 +452,8 @@
<activity android:name="Settings$DockSettingsActivity"
android:theme="@android:style/Theme.Holo"
android:label="@string/dock_settings_title"
- android:clearTaskOnLaunch="true"
- android:enabled="@bool/has_dock_settings">
+ android:enabled="@bool/has_dock_settings"
+ android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="com.android.settings.DOCK_SETTINGS" />
@@ -986,8 +986,7 @@
<activity android:name="AppWidgetPickActivity"
android:label="@string/widget_picker_title"
android:theme="@*android:style/Theme.Dialog.Alert"
- android:finishOnCloseSystemDialogs="true"
- android:enabled="@bool/has_powercontrol_widget">
+ android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_PICK" />
<category android:name="android.intent.category.DEFAULT" />
@@ -1064,8 +1063,9 @@
android:theme="@android:style/Theme.Holo.DialogWhenLarge"/>
<receiver android:name=".widget.SettingsAppWidgetProvider"
- android:label="@string/gadget_title" android:exported="false"
- android:enabled="@bool/has_powercontrol_widget">
+ android:label="@string/gadget_title"
+ android:exported="false"
+ android:enabled="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
diff --git a/res/layout-xlarge/date_time_settings_setupwizard.xml b/res/layout-xlarge/date_time_settings_setupwizard.xml
index 0b5d6bf..73aba01 100644
--- a/res/layout-xlarge/date_time_settings_setupwizard.xml
+++ b/res/layout-xlarge/date_time_settings_setupwizard.xml
@@ -18,7 +18,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingTop="96dip"
+ android:paddingTop="160dip"
android:paddingLeft="128dip"
android:paddingRight="128dip"
android:paddingBottom="96dip">
@@ -41,7 +41,7 @@
<View
android:id="@+id/top_divider"
android:layout_width="match_parent"
- android:layout_height="1px"
+ android:layout_height="3dip"
android:layout_below="@id/title"
android:background="@color/divider_color" />
diff --git a/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml b/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml
index 3e59faa..d3af1f8 100644
--- a/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml
+++ b/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml
@@ -20,8 +20,8 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="120dip"
- android:paddingLeft="96dip"
- android:paddingRight="96dip"
+ android:paddingLeft="128dip"
+ android:paddingRight="128dip"
android:paddingBottom="0dip" >
<RelativeLayout
@@ -64,13 +64,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal" />
-
- <View
- android:id="@+id/divider"
- android:layout_width="match_parent"
- android:layout_height="1px"
- android:layout_alignBottom="@id/scanning_progress_bar"
- android:background="@color/divider_color" />
</RelativeLayout>
<TextView
@@ -80,7 +73,7 @@
android:layout_below="@+id/top_divider"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dip"
- android:layout_marginTop="32dip"
+ android:layout_marginTop="16dip"
android:layout_marginBottom="0dip"
android:text="@string/wifi_setup_status_select_network"
android:textAppearance="?android:attr/textAppearanceMedium" />
@@ -112,7 +105,7 @@
android:id="@+id/wifi_config_ui"
android:layout_width="416dip"
android:layout_height="wrap_content"
- android:paddingTop="32dip"
+ android:paddingTop="16dip"
android:visibility="gone" />
</FrameLayout>
diff --git a/res/values-xlarge/bools.xml b/res/values-xlarge/bools.xml
deleted file mode 100644
index 55f496a..0000000
--- a/res/values-xlarge/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<resources>
- <!-- Whether or not the Power Control widget is enabled -->
- <bool name="has_powercontrol_widget">false</bool>
-</resources>
diff --git a/res/values-xlarge/colors.xml b/res/values-xlarge/colors.xml
index 414f7c2..4447333 100644
--- a/res/values-xlarge/colors.xml
+++ b/res/values-xlarge/colors.xml
@@ -18,5 +18,5 @@
-->
<resources>
- <color name="divider_color">#ff666666</color>
+ <color name="divider_color">#20ffffff</color>
</resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 235e2bb..61cc79e 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -20,6 +20,4 @@
<bool name="has_intrusive_led">false</bool>
<!-- Whether or not the dock settings are to be displayed for this device when docked -->
<bool name="has_dock_settings">false</bool>
- <!-- Whether or not the Power Control widget is enabled -->
- <bool name="has_powercontrol_widget">true</bool>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 64f8d9e..83dc8f5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -554,15 +554,15 @@
<!-- Security Settings --><skip />
<!-- Security settings screen, setting option name to change screen timeout -->
- <string name="lock_after_timeout">Lock device after timeout</string>
+ <string name="lock_after_timeout">Timeout</string>
<!-- Security settings screen, setting option summary to change screen timeout -->
- <string name="lock_after_timeout_summary">Adjust the delay before the device automatically locks</string>
+ <string name="lock_after_timeout_summary">Lock screen <xliff:g id="timeout_string">%1$s</xliff:g> after screen automatically turns off</string>
<!-- Text shown next to checkbox for showing owner info on LockScreen [CHAR LIMIT=50]-->
<string name="show_owner_info_on_lockscreen_label">Show owner info on lock screen</string>
<!-- Text shown for title of owner info setting [CHAR LIMIT=20]-->
<string name="owner_info_settings_title">Owner info</string>
<!-- Text shown for summary of owner info setting [CHAR LIMIT=40]-->
- <string name="owner_info_settings_summary">Set or disable showing owner info on lock screen</string>
+ <string name="owner_info_settings_summary"></string>
<!-- Hint text shown in owner info edit text [CHAR LIMIT=50] -->
<string name="owner_info_settings_edit_text_hint">Enter text to display on the lock screen</string>
<!-- Main Settings screen setting option title for the item to take you the security and location screen -->
@@ -584,10 +584,7 @@
<!-- Main Security lock settings --><skip />
<!-- Title for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=22] -->
- <string name="unlock_set_unlock_launch_picker_title">Set up screen lock</string>
-
- <!-- Summary for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=45] -->
- <string name="unlock_set_unlock_launch_picker_summary">Lock screen with a pattern, PIN, or password</string>
+ <string name="unlock_set_unlock_launch_picker_title">Configure lock screen</string>
<!-- Title for PreferenceScreen to change security method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_launch_picker_change_title">Change screen lock</string>
@@ -595,40 +592,47 @@
<!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_change_summary">Change or disable pattern, PIN, or password security</string>
- <!-- Title for PreferenceScreen to enable any lockscreen method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
- <string name="unlock_set_unlock_launch_picker_enable_title">Enable screen lock</string>
-
<!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_enable_summary">Choose a method to lock the screen</string>
<!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_off_title">Off</string>
<!-- Summary for preference that disables unlock security [CHAR LIMIT=45] -->
- <string name="unlock_set_unlock_off_summary">Don\u0027t show the lock screen</string>
+ <string name="unlock_set_unlock_off_summary">Never lock the screen</string>
<!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
- <string name="unlock_set_unlock_none_title">None</string>
+ <string name="unlock_set_unlock_none_title">Unsecure</string>
<!-- Summary for preference that disables unlock security [CHAR LIMIT=45]-->
- <string name="unlock_set_unlock_none_summary">Disable screen unlock security</string>
+ <string name="unlock_set_unlock_none_summary">Don\u0027t require a pattern, PIN, or password to unlock the screen</string>
<!-- Title for preference that guides the user through creating an unlock pattern [CHAR LIMIT=22]-->
<string name="unlock_set_unlock_pattern_title">Pattern</string>
<!-- Summary for preference that guides the user through creating an unlock pattern [CHAR LIMIT=45] -->
- <string name="unlock_set_unlock_pattern_summary">Draw pattern to unlock screen</string>
+ <string name="unlock_set_unlock_pattern_summary">Require a pattern to unlock the screen</string>
<!-- Title for preference that guides the user through creating an unlock PIN (Personal Identification Number) [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_pin_title">PIN</string>
<!-- Summary for preference that guides the user through creating an unlock PIN (Personal Identification Number) [CHAR LIMIT=45] -->
- <string name="unlock_set_unlock_pin_summary">Enter a numeric PIN to unlock screen</string>
+ <string name="unlock_set_unlock_pin_summary">Require a numeric PIN to unlock the screen</string>
<!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_password_title">Password</string>
<!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=45] -->
- <string name="unlock_set_unlock_password_summary">Enter a password to unlock screen</string>
+ <string name="unlock_set_unlock_password_summary">Require a password to unlock the screen</string>
<!-- Summary for preference that has been disabled by DevicePolicyAdmin [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_disabled_summary">Disabled by remote device administrator</string>
+ <!-- Summary for "Configure lockscreen" when lock screen is off [CHAR LIMIT=45] -->
+ <string name="unlock_set_unlock_mode_off">Off</string>
+ <!-- Summary for "Configure lockscreen" when security is disabled [CHAR LIMIT=45] -->
+ <string name="unlock_set_unlock_mode_none">Unsecure</string>
+ <!-- Summary for "Configure lockscreen" when security pattern is enabled [CHAR LIMIT=45] -->
+ <string name="unlock_set_unlock_mode_pattern">Secured with pattern</string>
+ <!-- Summary for "Configure lockscreen" when security PIN is enabled [CHAR LIMIT=45] -->
+ <string name="unlock_set_unlock_mode_pin">Secured with PIN</string>
+ <!-- Summary for "Configure lockscreen" when security password is enabled [CHAR LIMIT=45] -->
+ <string name="unlock_set_unlock_mode_password">Secured with password</string>
<!-- Title for option to turn of password/pin/pattern unlock. [CHAR LIMIT=22] -->
<string name="unlock_disable_lock_title">Turn off screen lock</string>
@@ -1378,7 +1382,9 @@
<!-- About phone screen, title of the item to go into the Phone status screen -->
<string name="device_status">Status</string>
<!-- About phone screen, summary of the item to go into the phone status screen -->
- <string name="device_status_summary">Phone number, signal, etc.</string>
+ <string name="device_status_summary" product="default">Phone number, signal, etc.</string>
+ <!-- About tablet screen, summary of the item that takes you to tablet status screen -->
+ <string name="device_status_summary" product="tablet">Status of the battery, network, and other information</string>
<!-- Main settings screen item's title to go into the storage settings screen [CHAR LIMIT=25] -->
<string name="storage_settings" >Storage</string>
<!-- Storage settings screen title -->
@@ -1745,11 +1751,11 @@
<!-- Security & location settings screen, setting summary when Assisted GPS check box is clear -->
<string name="assisted_gps_disabled">Use server to assist GPS (uncheck to improve GPS performance)</string>
<!-- [CHAR_LIMIT=100] Security & location settings screen, setting check box label if the user wants to use their location for Google Search & other Google services -->
- <string name="use_location_title">Use location for Google search</string>
+ <string name="use_location_title">Use location for Google Search</string>
<!-- [CHAR_LIMIT=100] Security & location settings screen, setting summary when Use My Location for Google services is clear -->
- <string name="use_location_summary_disabled">Use location for Google search and other Google services</string>
+ <string name="use_location_summary_disabled">Use location for Google Search and other Google services</string>
<!-- [CHAR_LIMIT=100] Security & location settings screen, setting summary when Use My Location for Google services is checked -->
- <string name="use_location_summary_enabled">Location used to improve Google search results and other Google services</string>
+ <string name="use_location_summary_enabled">Location used to improve Google Search results and other Google services</string>
<!-- About --> <skip />
<!-- Main settings screen, setting title for the user to go into the About phone screen -->
@@ -1823,7 +1829,7 @@
<!-- Lock Pattern settings -->
<!-- Security & location settings screen, header -->
- <string name="lock_settings_title">Screen unlock</string>
+ <string name="lock_settings_title">Lock screen</string>
<!-- Security & location settings screen, setting option name -->
<string name="lockpattern_change_lock_pattern_label">Change unlock pattern</string>
<!-- Security & location settings screen, change unlock pattern screen instruction when the user chooses "Change unlock pattern". We first ask the user toe nter the current pattern, and this is the message seen -->
diff --git a/res/xml/security_settings_chooser.xml b/res/xml/security_settings_chooser.xml
index 7b5d9c9..60d3a9f 100644
--- a/res/xml/security_settings_chooser.xml
+++ b/res/xml/security_settings_chooser.xml
@@ -23,7 +23,7 @@
<PreferenceScreen
android:key="unlock_set_or_change"
android:title="@string/unlock_set_unlock_launch_picker_title"
- android:summary="@string/unlock_set_unlock_launch_picker_summary"
+ android:summary="@string/unlock_set_unlock_mode_none"
android:persistent="false"/>
<PreferenceScreen
diff --git a/res/xml/security_settings_lockscreen.xml b/res/xml/security_settings_lockscreen.xml
index f66151d..fbdee60 100644
--- a/res/xml/security_settings_lockscreen.xml
+++ b/res/xml/security_settings_lockscreen.xml
@@ -22,8 +22,8 @@
<PreferenceScreen
android:key="unlock_set_or_change"
- android:title="@string/unlock_set_unlock_launch_picker_enable_title"
- android:summary="@string/unlock_set_unlock_launch_picker_enable_summary"
+ android:title="@string/unlock_set_unlock_launch_picker_title"
+ android:summary="@string/unlock_set_unlock_mode_off"
android:persistent="false"/>
</PreferenceCategory>
diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml
index 369f9ce..936f181 100644
--- a/res/xml/security_settings_password.xml
+++ b/res/xml/security_settings_password.xml
@@ -20,6 +20,12 @@
android:key="security_category"
android:title="@string/lock_settings_title">
+ <PreferenceScreen
+ android:key="unlock_set_or_change"
+ android:title="@string/unlock_set_unlock_launch_picker_title"
+ android:summary="@string/unlock_set_unlock_mode_password"
+ android:persistent="false"/>
+
<ListPreference
android:key="lock_after_timeout"
android:title="@string/lock_after_timeout"
@@ -28,12 +34,6 @@
android:entryValues="@array/lock_after_timeout_values"
android:persistent="false"/>
- <PreferenceScreen
- android:key="unlock_set_or_change"
- android:title="@string/unlock_set_unlock_launch_picker_change_title"
- android:summary="@string/unlock_set_unlock_launch_picker_change_summary"
- android:persistent="false"/>
-
<CheckBoxPreference
android:key="unlock_tactile_feedback"
android:title="@string/lockpattern_settings_enable_tactile_feedback_title"/>
diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml
index 4ff9214..4cfc360 100644
--- a/res/xml/security_settings_pattern.xml
+++ b/res/xml/security_settings_pattern.xml
@@ -20,24 +20,24 @@
android:key="security_category"
android:title="@string/lock_settings_title">
- <ListPreference
- android:key="lock_after_timeout"
- android:title="@string/lock_after_timeout"
- android:summary="@string/lock_after_timeout_summary"
- android:entries="@array/lock_after_timeout_entries"
- android:entryValues="@array/lock_after_timeout_values"
- android:persistent="false"/>
-
<PreferenceScreen
android:key="unlock_set_or_change"
- android:title="@string/unlock_set_unlock_launch_picker_change_title"
- android:summary="@string/unlock_set_unlock_launch_picker_change_summary"
+ android:title="@string/unlock_set_unlock_launch_picker_title"
+ android:summary="@string/unlock_set_unlock_mode_pattern"
android:persistent="false"/>
<CheckBoxPreference
android:key="visiblepattern"
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
+ <ListPreference
+ android:key="lock_after_timeout"
+ android:title="@string/lock_after_timeout"
+ android:summary="@string/lock_after_timeout_summary"
+ android:entries="@array/lock_after_timeout_entries"
+ android:entryValues="@array/lock_after_timeout_values"
+ android:persistent="false"/>
+
<CheckBoxPreference
android:key="unlock_tactile_feedback"
android:title="@string/lockpattern_settings_enable_tactile_feedback_title"/>
diff --git a/res/xml/security_settings_pin.xml b/res/xml/security_settings_pin.xml
index 369f9ce..0c8ff97 100644
--- a/res/xml/security_settings_pin.xml
+++ b/res/xml/security_settings_pin.xml
@@ -20,6 +20,12 @@
android:key="security_category"
android:title="@string/lock_settings_title">
+ <PreferenceScreen
+ android:key="unlock_set_or_change"
+ android:title="@string/unlock_set_unlock_launch_picker_title"
+ android:summary="@string/unlock_set_unlock_mode_pin"
+ android:persistent="false"/>
+
<ListPreference
android:key="lock_after_timeout"
android:title="@string/lock_after_timeout"
@@ -28,12 +34,6 @@
android:entryValues="@array/lock_after_timeout_values"
android:persistent="false"/>
- <PreferenceScreen
- android:key="unlock_set_or_change"
- android:title="@string/unlock_set_unlock_launch_picker_change_title"
- android:summary="@string/unlock_set_unlock_launch_picker_change_summary"
- android:persistent="false"/>
-
<CheckBoxPreference
android:key="unlock_tactile_feedback"
android:title="@string/lockpattern_settings_enable_tactile_feedback_title"/>
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index eea98b4..704eacd 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -212,6 +212,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
// lock after preference
mLockAfter = setupLockAfterPreference(pm);
+ updateLockAfterPreferenceSummary();
// visible pattern
mVisiblePattern = (CheckBoxPreference) pm.findPreference(KEY_VISIBLE_PATTERN);
@@ -303,6 +304,27 @@ public class SecuritySettings extends SettingsPreferenceFragment
return result;
}
+ private void updateLockAfterPreferenceSummary() {
+ // Not all security types have a "lock after" preference, so ignore those that don't.
+ if (mLockAfter == null) return;
+
+ // Update summary message with current value
+ long currentTimeout = Settings.Secure.getLong(getContentResolver(),
+ Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT, 0);
+ final CharSequence[] entries = mLockAfter.getEntries();
+ final CharSequence[] values = mLockAfter.getEntryValues();
+ int best = 0;
+ for (int i = 0; i < values.length; i++) {
+ long timeout = Long.valueOf(values[i].toString());
+ if (currentTimeout >= timeout) {
+ best = i;
+ }
+ }
+ String summary = mLockAfter.getContext()
+ .getString(R.string.lock_after_timeout_summary, entries[best]);
+ mLockAfter.setSummary(summary);
+ }
+
private static void disableUnusableTimeouts(ListPreference pref, long maxTimeout) {
final CharSequence[] entries = pref.getEntries();
final CharSequence[] values = pref.getEntryValues();
@@ -788,6 +810,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
} catch (NumberFormatException e) {
Log.e("SecuritySettings", "could not persist lockAfter timeout setting", e);
}
+ updateLockAfterPreferenceSummary();
} else if (preference == mUseLocation) {
boolean newValue = value == null ? false : (Boolean) value;
GoogleLocationSettingHelper.setUseLocationForServices(getActivity(), newValue);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index aa5decb..54f9fb1 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -286,7 +286,8 @@ public class BluetoothSettings extends SettingsPreferenceFragment
public void onDeviceAdded(CachedBluetoothDevice cachedDevice) {
if (mDevicePreferenceMap.get(cachedDevice) != null) {
- throw new IllegalStateException("Got onDeviceAdded, but cachedDevice already exists");
+ Log.e(TAG, "Got onDeviceAdded, but cachedDevice already exists");
+ return;
}
if (mScreenType != SCREEN_TYPE_SETTINGS
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index 99a8975..e443c1d 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -43,6 +43,7 @@ import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneStateIntentReceiver;
import com.android.internal.telephony.TelephonyProperties;
import com.android.settings.R;
+import com.android.settings.Utils;
import java.lang.ref.WeakReference;
@@ -62,8 +63,22 @@ import java.lang.ref.WeakReference;
*/
public class Status extends PreferenceActivity {
+ private static final String KEY_SERVICE_STATE = "service_state";
+ private static final String KEY_OPERATOR_NAME = "operator_name";
+ private static final String KEY_ROAMING_STATE = "roaming_state";
+ private static final String KEY_NETWORK_TYPE = "network_type";
+ private static final String KEY_PHONE_NUMBER = "number";
+ private static final String KEY_IMEI_SV = "imei_sv";
+ private static final String KEY_IMEI = "imei";
+ 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_SIGNAL_STRENGTH = "signal_strength";
+ private static final String KEY_BATTERY_STATUS = "battery_status";
+ private static final String KEY_BATTERY_LEVEL = "battery_level";
private static final String KEY_WIFI_MAC_ADDRESS = "wifi_mac_address";
private static final String KEY_BT_ADDRESS = "bt_address";
+
private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200;
private static final int EVENT_SERVICE_STATE_CHANGED = 300;
@@ -166,69 +181,59 @@ public class Status extends PreferenceActivity {
Preference removablePref;
mHandler = new MyHandler(this);
-
+
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
addPreferencesFromResource(R.xml.device_info_status);
- mBatteryLevel = findPreference("battery_level");
- mBatteryStatus = findPreference("battery_status");
-
+ mBatteryLevel = findPreference(KEY_BATTERY_LEVEL);
+ mBatteryStatus = findPreference(KEY_BATTERY_STATUS);
+
mRes = getResources();
if (sUnknown == null) {
sUnknown = mRes.getString(R.string.device_info_default);
}
-
+
mPhone = PhoneFactory.getDefaultPhone();
// Note - missing in zaku build, be careful later...
- mSignalStrength = findPreference("signal_strength");
+ mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
mUptime = findPreference("up_time");
-
+
//NOTE "imei" is the "Device ID" since it represents the IMEI in GSM and the MEID in CDMA
if (mPhone.getPhoneName().equals("CDMA")) {
- setSummaryText("meid_number", mPhone.getMeid());
- setSummaryText("min_number", mPhone.getCdmaMin());
- setSummaryText("prl_version", mPhone.getCdmaPrlVersion());
+ setSummaryText(KEY_MEID_NUMBER, mPhone.getMeid());
+ setSummaryText(KEY_MIN_NUMBER, mPhone.getCdmaMin());
+ setSummaryText(KEY_PRL_VERSION, mPhone.getCdmaPrlVersion());
// device is not GSM/UMTS, do not display GSM/UMTS features
// check Null in case no specified preference in overlay xml
- removablePref = findPreference("imei");
- if (removablePref != null) {
- getPreferenceScreen().removePreference(removablePref);
- }
- removablePref = findPreference("imei_sv");
- if (removablePref != null) {
- getPreferenceScreen().removePreference(removablePref);
- }
+ removePreferenceFromScreen(KEY_IMEI);
+ removePreferenceFromScreen(KEY_IMEI_SV);
} else {
- setSummaryText("imei", mPhone.getDeviceId());
+ setSummaryText(KEY_IMEI, mPhone.getDeviceId());
- setSummaryText("imei_sv",
+ setSummaryText(KEY_IMEI_SV,
((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
.getDeviceSoftwareVersion());
// device is not CDMA, do not display CDMA features
// check Null in case no specified preference in overlay xml
- removablePref = findPreference("prl_version");
- if (removablePref != null) {
- getPreferenceScreen().removePreference(removablePref);
- }
- removablePref = findPreference("meid_number");
- if (removablePref != null) {
- getPreferenceScreen().removePreference(removablePref);
- }
- removablePref = findPreference("min_number");
- if (removablePref != null) {
- getPreferenceScreen().removePreference(removablePref);
- }
+ removePreferenceFromScreen(KEY_PRL_VERSION);
+ removePreferenceFromScreen(KEY_MEID_NUMBER);
+ removePreferenceFromScreen(KEY_MIN_NUMBER);
}
- String rawNumber = mPhone.getLine1Number(); // may be null or empty
- String formattedNumber = null;
- if (!TextUtils.isEmpty(rawNumber)) {
- formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
+ // Remove the phone number preference if the device is not voice capable.
+ if (!Utils.isVoiceCapable(this)) {
+ removePreferenceFromScreen(KEY_PHONE_NUMBER);
+ } else {
+ String rawNumber = mPhone.getLine1Number(); // may be null or empty
+ String formattedNumber = null;
+ if (!TextUtils.isEmpty(rawNumber)) {
+ formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
+ }
+ // If formattedNumber is null or empty, it'll display as "Unknown".
+ setSummaryText(KEY_PHONE_NUMBER, formattedNumber);
}
- // If formattedNumber is null or empty, it'll display as "Unknown".
- setSummaryText("number", formattedNumber);
mPhoneStateReceiver = new PhoneStateIntentReceiver(this, mHandler);
mPhoneStateReceiver.notifySignalStrength(EVENT_SIGNAL_STRENGTH_CHANGED);
@@ -237,7 +242,7 @@ public class Status extends PreferenceActivity {
setWifiStatus();
setBtStatus();
}
-
+
@Override
protected void onResume() {
super.onResume();
@@ -266,6 +271,17 @@ public class Status extends PreferenceActivity {
}
/**
+ * Removes the specified preference, if it exists.
+ * @param key the key for the Preference item
+ */
+ private void removePreferenceFromScreen(String key) {
+ Preference pref = findPreference(key);
+ if (pref != null) {
+ getPreferenceScreen().removePreference(pref);
+ }
+ }
+
+ /**
* @param preference The key for the Preference item
* @param property The system property to fetch
* @param alt The default value, if the property doesn't exist
@@ -291,7 +307,7 @@ public class Status extends PreferenceActivity {
private void updateNetworkType() {
// Whether EDGE, UMTS, etc...
- setSummary("network_type", TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, sUnknown);
+ setSummary(KEY_NETWORK_TYPE, TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, sUnknown);
}
private void updateDataState() {
@@ -333,14 +349,14 @@ public class Status extends PreferenceActivity {
break;
}
- setSummaryText("service_state", display);
+ setSummaryText(KEY_SERVICE_STATE, display);
if (serviceState.getRoaming()) {
- setSummaryText("roaming_state", mRes.getString(R.string.radioInfo_roaming_in));
+ setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));
} else {
- setSummaryText("roaming_state", mRes.getString(R.string.radioInfo_roaming_not));
+ setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not));
}
- setSummaryText("operator_name", serviceState.getOperatorAlphaLong());
+ setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong());
}
void updateSignalStrength() {