packages/apps/Settings
Revisão | d7b2dccbe60a02965186d28f0b671ef1c419a2a8 (tree) |
---|---|
Hora | 2011-07-14 02:25:29 |
Autor | John Wang <johnwang@goog...> |
Commiter | John Wang |
Display IMEI and ICCID for LTE device.
Display IMEI nad ICCID in About tablet / Status for LTE devices.
bug:4983512
bug:5001888
Change-Id: I4c418b159b49bef96acd5ef300c9b71379821d1b
@@ -1550,8 +1550,10 @@ | ||
1550 | 1550 | <string name="status_min_number">MIN</string> |
1551 | 1551 | <!-- About phone, status item title. The phone PRL Version of the current device.--> |
1552 | 1552 | <string name="status_prl_version">PRL Version</string> |
1553 | - <!-- About phone, status item title. The phone IMEI/MEID number of the current LTE/CDMA device.--> | |
1554 | - <string name="status_meid_number">IMEI / MEID</string> | |
1553 | + <!-- About phone, status item title. The phone MEID number of the current LTE/CDMA device. [CHAR LIMIT=30] --> | |
1554 | + <string name="status_meid_number">MEID</string> | |
1555 | + <!-- About phone, status item title. The ICCID of the current LTE device. [CHAR LIMIT=30] --> | |
1556 | + <string name="status_icc_id">ICCID</string> | |
1555 | 1557 | <!-- About phone, status item title for the type of data phone network we're connected to, for example 3G or Edge or GPRS --> |
1556 | 1558 | <string name="status_network_type">Mobile network type</string> |
1557 | 1559 | <!-- About phone, status item title. The status of data access. For example, the value may be "Connected" --> |
@@ -4,9 +4,9 @@ | ||
4 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | you may not use this file except in compliance with the License. |
6 | 6 | You may obtain a copy of the License at |
7 | - | |
7 | + | |
8 | 8 | http://www.apache.org/licenses/LICENSE-2.0 |
9 | - | |
9 | + | |
10 | 10 | Unless required by applicable law or agreed to in writing, software |
11 | 11 | distributed under the License is distributed on an "AS IS" BASIS, |
12 | 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
@@ -17,91 +17,96 @@ | ||
17 | 17 | <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" |
18 | 18 | android:title="@string/device_status_activity_title"> |
19 | 19 | |
20 | - <Preference android:key="battery_status" | |
21 | - style="?android:attr/preferenceInformationStyle" | |
20 | + <Preference android:key="battery_status" | |
21 | + style="?android:attr/preferenceInformationStyle" | |
22 | 22 | android:title="@string/battery_status_title" |
23 | 23 | android:summary="@string/device_info_not_available" |
24 | 24 | android:persistent="false" /> |
25 | - <Preference android:key="battery_level" | |
26 | - style="?android:attr/preferenceInformationStyle" | |
25 | + <Preference android:key="battery_level" | |
26 | + style="?android:attr/preferenceInformationStyle" | |
27 | 27 | android:title="@string/battery_level_title" |
28 | 28 | android:summary="@string/device_info_not_available" |
29 | 29 | android:persistent="false" /> |
30 | - <Preference android:key="number" | |
31 | - style="?android:attr/preferenceInformationStyle" | |
32 | - android:title="@string/status_number" | |
30 | + <Preference android:key="operator_name" | |
31 | + style="?android:attr/preferenceInformationStyle" | |
32 | + android:title="@string/status_operator" | |
33 | 33 | android:summary="@string/device_info_not_available" |
34 | 34 | android:persistent="false" /> |
35 | - <!-- This menu item is only for CDMA phone --> | |
36 | - <Preference android:key="min_number" | |
35 | + <Preference android:key="signal_strength" | |
37 | 36 | style="?android:attr/preferenceInformationStyle" |
38 | - android:title="@string/status_min_number" | |
37 | + android:title="@string/status_signal_strength" | |
39 | 38 | android:summary="@string/device_info_not_available" |
40 | 39 | android:persistent="false" /> |
41 | - <!-- This menu item is only for CDMA phone --> | |
42 | - <Preference android:key="prl_version" | |
40 | + <Preference android:key="network_type" | |
43 | 41 | style="?android:attr/preferenceInformationStyle" |
44 | - android:title="@string/status_prl_version" | |
42 | + android:title="@string/status_network_type" | |
45 | 43 | android:summary="@string/device_info_not_available" |
46 | 44 | android:persistent="false" /> |
47 | - <!-- This menu item is only for CDMA phone --> | |
48 | - <Preference android:key="meid_number" | |
45 | + <Preference android:key="service_state" | |
49 | 46 | style="?android:attr/preferenceInformationStyle" |
50 | - android:title="@string/status_meid_number" | |
47 | + android:title="@string/status_service_state" | |
51 | 48 | android:summary="@string/device_info_not_available" |
52 | 49 | android:persistent="false" /> |
53 | - <Preference android:key="operator_name" | |
54 | - style="?android:attr/preferenceInformationStyle" | |
55 | - android:title="@string/status_operator" | |
50 | + <Preference android:key="roaming_state" | |
51 | + style="?android:attr/preferenceInformationStyle" | |
52 | + android:title="@string/status_roaming" | |
56 | 53 | android:summary="@string/device_info_not_available" |
57 | 54 | android:persistent="false" /> |
58 | - <Preference android:key="signal_strength" | |
59 | - style="?android:attr/preferenceInformationStyle" | |
60 | - android:title="@string/status_signal_strength" | |
55 | + <Preference android:key="data_state" | |
56 | + style="?android:attr/preferenceInformationStyle" | |
57 | + android:title="@string/status_data_state" | |
61 | 58 | android:summary="@string/device_info_not_available" |
62 | 59 | android:persistent="false" /> |
63 | - <Preference android:key="network_type" | |
64 | - style="?android:attr/preferenceInformationStyle" | |
65 | - android:title="@string/status_network_type" | |
60 | + <Preference android:key="number" | |
61 | + style="?android:attr/preferenceInformationStyle" | |
62 | + android:title="@string/status_number" | |
66 | 63 | android:summary="@string/device_info_not_available" |
67 | 64 | android:persistent="false" /> |
68 | - <Preference android:key="service_state" | |
69 | - style="?android:attr/preferenceInformationStyle" | |
70 | - android:title="@string/status_service_state" | |
65 | + <!-- This menu item is only for CDMA phone --> | |
66 | + <Preference android:key="min_number" | |
67 | + style="?android:attr/preferenceInformationStyle" | |
68 | + android:title="@string/status_min_number" | |
71 | 69 | android:summary="@string/device_info_not_available" |
72 | 70 | android:persistent="false" /> |
73 | - <Preference android:key="roaming_state" | |
74 | - style="?android:attr/preferenceInformationStyle" | |
75 | - android:title="@string/status_roaming" | |
71 | + <!-- This menu item is only for CDMA phone --> | |
72 | + <Preference android:key="prl_version" | |
73 | + style="?android:attr/preferenceInformationStyle" | |
74 | + android:title="@string/status_prl_version" | |
76 | 75 | android:summary="@string/device_info_not_available" |
77 | 76 | android:persistent="false" /> |
78 | - <Preference android:key="data_state" | |
79 | - style="?android:attr/preferenceInformationStyle" | |
80 | - android:title="@string/status_data_state" | |
77 | + <!-- This menu item is only for CDMA phone --> | |
78 | + <Preference android:key="meid_number" | |
79 | + style="?android:attr/preferenceInformationStyle" | |
80 | + android:title="@string/status_meid_number" | |
81 | 81 | android:summary="@string/device_info_not_available" |
82 | 82 | android:persistent="false" /> |
83 | - <Preference android:key="imei" | |
84 | - style="?android:attr/preferenceInformationStyle" | |
83 | + <Preference android:key="imei" | |
84 | + style="?android:attr/preferenceInformationStyle" | |
85 | 85 | android:title="@string/status_imei" |
86 | 86 | android:summary="@string/device_info_not_available" |
87 | 87 | android:persistent="false" /> |
88 | - <Preference android:key="imei_sv" | |
89 | - style="?android:attr/preferenceInformationStyle" | |
88 | + <Preference android:key="imei_sv" | |
89 | + style="?android:attr/preferenceInformationStyle" | |
90 | 90 | android:title="@string/status_imei_sv" |
91 | 91 | android:summary="@string/device_info_not_available" |
92 | 92 | android:persistent="false" /> |
93 | + <Preference android:key="icc_id" | |
94 | + style="?android:attr/preferenceInformationStyle" | |
95 | + android:title="@string/status_icc_id" | |
96 | + android:summary="@string/device_info_not_available" | |
97 | + android:persistent="false" /> | |
93 | 98 | <Preference android:key="wifi_ip_address" |
94 | 99 | style="?android:attr/preferenceInformationStyle" |
95 | 100 | android:title="@string/wifi_advanced_ip_address_title" |
96 | 101 | android:summary="@string/device_info_not_available" |
97 | 102 | android:persistent="false" /> |
98 | 103 | <Preference android:key="wifi_mac_address" |
99 | - style="?android:attr/preferenceInformationStyle" | |
104 | + style="?android:attr/preferenceInformationStyle" | |
100 | 105 | android:title="@string/status_wifi_mac_address" |
101 | 106 | android:summary="@string/device_info_not_available" |
102 | 107 | android:persistent="false" /> |
103 | 108 | <Preference android:key="bt_address" |
104 | - style="?android:attr/preferenceInformationStyle" | |
109 | + style="?android:attr/preferenceInformationStyle" | |
105 | 110 | android:title="@string/status_bt_address" |
106 | 111 | android:summary="@string/device_info_not_available" |
107 | 112 | android:persistent="false" /> |
@@ -111,7 +116,7 @@ | ||
111 | 116 | android:summary="@string/device_info_not_available" |
112 | 117 | android:persistent="false" /> |
113 | 118 | <Preference android:key="up_time" |
114 | - style="?android:attr/preferenceInformationStyle" | |
119 | + style="?android:attr/preferenceInformationStyle" | |
115 | 120 | android:title="@string/status_up_time" |
116 | 121 | android:summary="@string/device_info_not_available" |
117 | 122 | android:persistent="false" /> |
@@ -82,6 +82,7 @@ public class Status extends PreferenceActivity { | ||
82 | 82 | private static final String KEY_WIFI_MAC_ADDRESS = "wifi_mac_address"; |
83 | 83 | private static final String KEY_BT_ADDRESS = "bt_address"; |
84 | 84 | private static final String KEY_SERIAL_NUMBER = "serial_number"; |
85 | + private static final String KEY_ICC_ID = "icc_id"; | |
85 | 86 | |
86 | 87 | private static final String[] PHONE_RELATED_ENTRIES = { |
87 | 88 | KEY_DATA_STATE, |
@@ -95,7 +96,8 @@ public class Status extends PreferenceActivity { | ||
95 | 96 | KEY_PRL_VERSION, |
96 | 97 | KEY_MIN_NUMBER, |
97 | 98 | KEY_MEID_NUMBER, |
98 | - KEY_SIGNAL_STRENGTH | |
99 | + KEY_SIGNAL_STRENGTH, | |
100 | + KEY_ICC_ID | |
99 | 101 | }; |
100 | 102 | |
101 | 103 | private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200; |
@@ -111,7 +113,7 @@ public class Status extends PreferenceActivity { | ||
111 | 113 | private Preference mUptime; |
112 | 114 | |
113 | 115 | private static String sUnknown; |
114 | - | |
116 | + | |
115 | 117 | private Preference mBatteryStatus; |
116 | 118 | private Preference mBatteryLevel; |
117 | 119 |
@@ -150,7 +152,7 @@ public class Status extends PreferenceActivity { | ||
150 | 152 | } |
151 | 153 | |
152 | 154 | private BroadcastReceiver mBatteryInfoReceiver = new BroadcastReceiver() { |
153 | - | |
155 | + | |
154 | 156 | @Override |
155 | 157 | public void onReceive(Context context, Intent intent) { |
156 | 158 | String action = intent.getAction(); |
@@ -158,9 +160,9 @@ public class Status extends PreferenceActivity { | ||
158 | 160 | |
159 | 161 | int level = intent.getIntExtra("level", 0); |
160 | 162 | int scale = intent.getIntExtra("scale", 100); |
161 | - | |
163 | + | |
162 | 164 | mBatteryLevel.setSummary(String.valueOf(level * 100 / scale) + "%"); |
163 | - | |
165 | + | |
164 | 166 | int plugType = intent.getIntExtra("plugged", 0); |
165 | 167 | int status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN); |
166 | 168 | String statusString; |
@@ -193,7 +195,7 @@ public class Status extends PreferenceActivity { | ||
193 | 195 | updateNetworkType(); |
194 | 196 | } |
195 | 197 | }; |
196 | - | |
198 | + | |
197 | 199 | @Override |
198 | 200 | protected void onCreate(Bundle icicle) { |
199 | 201 | super.onCreate(icicle); |
@@ -228,11 +230,18 @@ public class Status extends PreferenceActivity { | ||
228 | 230 | setSummaryText(KEY_MEID_NUMBER, mPhone.getMeid()); |
229 | 231 | setSummaryText(KEY_MIN_NUMBER, mPhone.getCdmaMin()); |
230 | 232 | setSummaryText(KEY_PRL_VERSION, mPhone.getCdmaPrlVersion()); |
231 | - | |
232 | - // device is not GSM/UMTS, do not display GSM/UMTS features | |
233 | - // check Null in case no specified preference in overlay xml | |
234 | - removePreferenceFromScreen(KEY_IMEI); | |
235 | 233 | removePreferenceFromScreen(KEY_IMEI_SV); |
234 | + | |
235 | + if (mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) { | |
236 | + // Show ICC ID and IMEI for LTE device | |
237 | + setSummaryText(KEY_ICC_ID, mPhone.getIccSerialNumber()); | |
238 | + setSummaryText(KEY_IMEI, mPhone.getImei()); | |
239 | + } else { | |
240 | + // device is not GSM/UMTS, do not display GSM/UMTS features | |
241 | + // check Null in case no specified preference in overlay xml | |
242 | + removePreferenceFromScreen(KEY_IMEI); | |
243 | + removePreferenceFromScreen(KEY_ICC_ID); | |
244 | + } | |
236 | 245 | } else { |
237 | 246 | setSummaryText(KEY_IMEI, mPhone.getDeviceId()); |
238 | 247 |
@@ -245,6 +254,7 @@ public class Status extends PreferenceActivity { | ||
245 | 254 | removePreferenceFromScreen(KEY_PRL_VERSION); |
246 | 255 | removePreferenceFromScreen(KEY_MEID_NUMBER); |
247 | 256 | removePreferenceFromScreen(KEY_MIN_NUMBER); |
257 | + removePreferenceFromScreen(KEY_ICC_ID); | |
248 | 258 | } |
249 | 259 | |
250 | 260 | String rawNumber = mPhone.getLine1Number(); // may be null or empty |
@@ -288,7 +298,7 @@ public class Status extends PreferenceActivity { | ||
288 | 298 | registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); |
289 | 299 | mHandler.sendEmptyMessage(EVENT_UPDATE_STATS); |
290 | 300 | } |
291 | - | |
301 | + | |
292 | 302 | @Override |
293 | 303 | public void onPause() { |
294 | 304 | super.onPause(); |
@@ -322,7 +332,7 @@ public class Status extends PreferenceActivity { | ||
322 | 332 | findPreference(preference).setSummary( |
323 | 333 | SystemProperties.get(property, alt)); |
324 | 334 | } catch (RuntimeException e) { |
325 | - | |
335 | + | |
326 | 336 | } |
327 | 337 | } |
328 | 338 |
@@ -335,12 +345,12 @@ public class Status extends PreferenceActivity { | ||
335 | 345 | findPreference(preference).setSummary(text); |
336 | 346 | } |
337 | 347 | } |
338 | - | |
348 | + | |
339 | 349 | private void updateNetworkType() { |
340 | 350 | // Whether EDGE, UMTS, etc... |
341 | 351 | setSummary(KEY_NETWORK_TYPE, TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, sUnknown); |
342 | 352 | } |
343 | - | |
353 | + | |
344 | 354 | private void updateDataState() { |
345 | 355 | int state = mTelephonyManager.getDataState(); |
346 | 356 | String display = mRes.getString(R.string.radioInfo_unknown); |
@@ -359,14 +369,14 @@ public class Status extends PreferenceActivity { | ||
359 | 369 | display = mRes.getString(R.string.radioInfo_data_disconnected); |
360 | 370 | break; |
361 | 371 | } |
362 | - | |
372 | + | |
363 | 373 | setSummaryText(KEY_DATA_STATE, display); |
364 | 374 | } |
365 | 375 | |
366 | 376 | private void updateServiceState(ServiceState serviceState) { |
367 | 377 | int state = serviceState.getState(); |
368 | 378 | String display = mRes.getString(R.string.radioInfo_unknown); |
369 | - | |
379 | + | |
370 | 380 | switch (state) { |
371 | 381 | case ServiceState.STATE_IN_SERVICE: |
372 | 382 | display = mRes.getString(R.string.radioInfo_service_in); |
@@ -379,9 +389,9 @@ public class Status extends PreferenceActivity { | ||
379 | 389 | display = mRes.getString(R.string.radioInfo_service_off); |
380 | 390 | break; |
381 | 391 | } |
382 | - | |
392 | + | |
383 | 393 | setSummaryText(KEY_SERVICE_STATE, display); |
384 | - | |
394 | + | |
385 | 395 | if (serviceState.getRoaming()) { |
386 | 396 | setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in)); |
387 | 397 | } else { |
@@ -389,7 +399,7 @@ public class Status extends PreferenceActivity { | ||
389 | 399 | } |
390 | 400 | setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong()); |
391 | 401 | } |
392 | - | |
402 | + | |
393 | 403 | void updateSignalStrength() { |
394 | 404 | // TODO PhoneStateIntentReceiver is deprecated and PhoneStateListener |
395 | 405 | // should probably used instead. |
@@ -426,7 +436,7 @@ public class Status extends PreferenceActivity { | ||
426 | 436 | |
427 | 437 | Preference wifiMacAddressPref = findPreference(KEY_WIFI_MAC_ADDRESS); |
428 | 438 | String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress(); |
429 | - wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress | |
439 | + wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress | |
430 | 440 | : getString(R.string.status_unavailable)); |
431 | 441 | |
432 | 442 | Preference wifiIpAddressPref = findPreference(KEY_WIFI_IP_ADDRESS); |
@@ -462,7 +472,7 @@ public class Status extends PreferenceActivity { | ||
462 | 472 | |
463 | 473 | mUptime.setSummary(convert(ut)); |
464 | 474 | } |
465 | - | |
475 | + | |
466 | 476 | private String pad(int n) { |
467 | 477 | if (n >= 10) { |
468 | 478 | return String.valueOf(n); |