Merge "Check 'number' against both empty and null string for handleCdmaCallWaiting" into oc-dr1-dev
diff --git a/res/layout/emergency_dialer.xml b/res/layout/emergency_dialer.xml
index 3b91b07..a18596f 100644
--- a/res/layout/emergency_dialer.xml
+++ b/res/layout/emergency_dialer.xml
@@ -19,8 +19,8 @@
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="50dp"
- android:paddingRight="50dp">
+ android:paddingLeft="36dp"
+ android:paddingRight="36dp">
<LinearLayout
android:layout_width="match_parent"
@@ -127,6 +127,7 @@
android:id="@+id/floating_action_button_container"
android:layout_width="@dimen/floating_action_button_width"
android:layout_height="@dimen/floating_action_button_height"
+ android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
android:layout_gravity="center_horizontal|bottom" >
<ImageButton
diff --git a/res/values-zh-rHK/strings.xml b/res/values-zh-rHK/strings.xml
index 10f8e23..a92dbdc 100644
--- a/res/values-zh-rHK/strings.xml
+++ b/res/values-zh-rHK/strings.xml
@@ -219,8 +219,8 @@
<string name="data_enable_summary" msgid="2382798156640007971">"允許使用數據"</string>
<string name="dialog_alert_title" msgid="6751344986194435476">"注意"</string>
<string name="roaming" msgid="7894878421600247140">"漫遊"</string>
- <string name="roaming_enable" msgid="7331106985174381987">"漫遊時連線到數據傳輸服務"</string>
- <string name="roaming_disable" msgid="1843417228755568110">"漫遊時連線到數據傳輸服務"</string>
+ <string name="roaming_enable" msgid="7331106985174381987">"漫遊時連線到數據服務"</string>
+ <string name="roaming_disable" msgid="1843417228755568110">"漫遊時連線到數據服務"</string>
<string name="roaming_reenable_message" msgid="8913735676127858115">"您已離開主網絡覆蓋範圍,且已關閉數據漫遊服務,因此數據連線已中斷。"</string>
<string name="roaming_warning" msgid="1603164667540144353">"您可能需要支付龐大的費用。"</string>
<string name="roaming_alert_title" msgid="3654815360303826008">"要允許數據漫遊服務嗎?"</string>
@@ -360,7 +360,7 @@
<item msgid="6043847456049107742">"1"</item>
</string-array>
<string name="cdma_activate_device" msgid="3793805892364814518">"啟動裝置"</string>
- <string name="cdma_lte_data_service" msgid="4255018217292548962">"設定數據傳輸服務"</string>
+ <string name="cdma_lte_data_service" msgid="4255018217292548962">"設定數據服務"</string>
<string name="carrier_settings_title" msgid="9028166176523012300">"流動網絡供應商設定"</string>
<string name="fdn" msgid="7878832555095183202">"固定撥號號碼"</string>
<string name="fdn_with_label" msgid="187084204115493366">"固定撥號 (<xliff:g id="SUBSCRIPTIONLABEL">%s</xliff:g>)"</string>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index a3c62a9..0a21d27 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -68,7 +68,7 @@
<!-- Dimensions for Emergency Dialer and dialpad inside the in-call screen -->
<dimen name="dialpad_horizontal_margin">4dp</dimen>
<dimen name="dialpad_vertical_margin">2dp</dimen>
- <dimen name="dialpad_digits_text_size">35sp</dimen>
+ <dimen name="dialpad_digits_text_size">40sp</dimen>
<dimen name="dialpad_space_above_keys">29dp</dimen>
<dimen name="dialpad_bottom_key_height">113dp</dimen>
@@ -106,5 +106,5 @@
inside the Emergency Dialer than the regular Dialer. -->
<dimen name="floating_action_button_width">67dp</dimen>
<dimen name="floating_action_button_height">67dp</dimen>
- <dimen name="floating_action_button_margin_bottom">26dp</dimen>
+ <dimen name="floating_action_button_margin_bottom">32dp</dimen>
</resources>
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 6e40e79..0f83332 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -152,6 +152,7 @@
"com.android.settings.Settings$WirelessSettingsActivity";
private SubscriptionManager mSubscriptionManager;
+ private TelephonyManager mTelephonyManager;
//UI objects
private ListPreference mButtonPreferredNetworkMode;
@@ -253,9 +254,7 @@
getActivity().getContentResolver(),
android.provider.Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
if (!TextUtils.isEmpty(tmpl)) {
- TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(
- Context.TELEPHONY_SERVICE);
- String imsi = tm.getSubscriberId();
+ String imsi = mTelephonyManager.getSubscriberId();
if (imsi == null) {
imsi = "";
}
@@ -302,7 +301,8 @@
};
private void initializeSubscriptions() {
- if (getActivity().isDestroyed()) {
+ final Activity activity = getActivity();
+ if (activity == null || activity.isDestroyed()) {
// Process preferences in activity only if its not destroyed
return;
}
@@ -458,13 +458,22 @@
public void onCreate(Bundle icicle) {
Log.i(LOG_TAG, "onCreate:+");
super.onCreate(icicle);
+
+ final Activity activity = getActivity();
+ if (activity == null || activity.isDestroyed()) {
+ Log.e(LOG_TAG, "onCreate:- with no valid activity.");
+ return;
+ }
+
mHandler = new MyHandler();
- mUm = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
- mSubscriptionManager = SubscriptionManager.from(getActivity());
+ mUm = (UserManager) activity.getSystemService(Context.USER_SERVICE);
+ mSubscriptionManager = SubscriptionManager.from(activity);
+ mTelephonyManager = (TelephonyManager) activity.getSystemService(
+ Context.TELEPHONY_SERVICE);
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
mUnavailable = true;
- getActivity().setContentView(R.layout.telephony_disallowed_preference_screen);
+ activity.setContentView(R.layout.telephony_disallowed_preference_screen);
return;
}
@@ -474,7 +483,7 @@
mButton4glte.setOnPreferenceChangeListener(this);
try {
- Context con = getActivity().createPackageContext("com.android.systemui", 0);
+ Context con = activity.createPackageContext("com.android.systemui", 0);
int id = con.getResources().getIdentifier("config_show4GForLTE",
"bool", "com.android.systemui");
mShow4GForLTE = con.getResources().getBoolean(id);
@@ -505,7 +514,7 @@
IntentFilter intentFilter = new IntentFilter(
TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
- getActivity().registerReceiver(mPhoneChangeReceiver, intentFilter);
+ activity.registerReceiver(mPhoneChangeReceiver, intentFilter);
initializeSubscriptions();
Log.i(LOG_TAG, "onCreate:-");
@@ -525,7 +534,9 @@
@Override
public void onDestroy() {
super.onDestroy();
- getActivity().unregisterReceiver(mPhoneChangeReceiver);
+ if (getActivity() != null && !getActivity().isDestroyed()) {
+ getActivity().unregisterReceiver(mPhoneChangeReceiver);
+ }
}
@Override
@@ -538,6 +549,11 @@
return;
}
+ final Activity activity = getActivity();
+ if (activity == null || activity.isDestroyed()) {
+ Log.e(LOG_TAG, "onResume:- with no valid activity.");
+ return;
+ }
// upon resumption from the sub-activity, make sure we re-enable the
// preferences.
getPreferenceScreen().setEnabled(true);
@@ -552,17 +568,14 @@
updatePreferredNetworkUIFromDb();
}
- if (ImsManager.isVolteEnabledByPlatform(getActivity())
- && ImsManager.isVolteProvisionedOnDevice(getActivity())) {
- TelephonyManager tm =
- (TelephonyManager) getActivity().getSystemService(
- Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
+ if (ImsManager.isVolteEnabledByPlatform(activity)
+ && ImsManager.isVolteProvisionedOnDevice(activity)) {
+ mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
// NOTE: Buttons will be enabled/disabled in mPhoneStateListener
- boolean enh4glteMode = ImsManager.isEnhanced4gLteModeSettingEnabledByUser(getActivity())
- && ImsManager.isNonTtyOrTtyOnVolteEnabled(getActivity());
+ boolean enh4glteMode = ImsManager.isEnhanced4gLteModeSettingEnabledByUser(activity)
+ && ImsManager.isNonTtyOrTtyOnVolteEnabled(activity);
mButton4glte.setChecked(enh4glteMode);
mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
@@ -595,7 +608,12 @@
}
private void updateBody() {
- Context context = getActivity().getApplicationContext();
+ final Activity activity = getActivity();
+ if (activity == null || activity.isDestroyed()) {
+ Log.e(LOG_TAG, "updateBody with no valid activity.");
+ return;
+ }
+ Context context = activity.getApplicationContext();
PreferenceScreen prefSet = getPreferenceScreen();
boolean isLteOnCdma = mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
final int phoneSubId = mPhone.getSubId();
@@ -612,16 +630,14 @@
prefSet.addPreference(mButton4glte);
if (showEuiccSettings()) {
prefSet.addPreference(mEuiccSettingsPref);
- TelephonyManager tm =
- (TelephonyManager) getActivity()
- .getSystemService(Context.TELEPHONY_SERVICE);
- if (TextUtils.isEmpty(tm.getLine1Number())) {
+ if (TextUtils.isEmpty(mTelephonyManager.getLine1Number())) {
mEuiccSettingsPref.setSummary(null);
} else {
mEuiccSettingsPref.setSummary(
getEuiccSettingsSummary(
- tm.getSimOperatorName(),
- PhoneNumberUtils.formatNumber(tm.getLine1Number())));
+ mTelephonyManager.getSimOperatorName(),
+ PhoneNumberUtils.formatNumber(
+ mTelephonyManager.getLine1Number())));
}
}
}
@@ -771,7 +787,7 @@
}
final boolean missingDataServiceUrl = TextUtils.isEmpty(
- android.provider.Settings.Global.getString(getActivity().getContentResolver(),
+ android.provider.Settings.Global.getString(activity.getContentResolver(),
android.provider.Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL));
if (!isLteOnCdma || missingDataServiceUrl) {
prefSet.removePreference(mLteDataServicePref);
@@ -779,8 +795,8 @@
android.util.Log.d(LOG_TAG, "keep ltePref");
}
- if (!(ImsManager.isVolteEnabledByPlatform(getActivity())
- && ImsManager.isVolteProvisionedOnDevice(getActivity()))
+ if (!(ImsManager.isVolteEnabledByPlatform(activity)
+ && ImsManager.isVolteProvisionedOnDevice(activity))
|| carrierConfig.getBoolean(
CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL)) {
Preference pref = prefSet.findPreference(BUTTON_4G_LTE_KEY);
@@ -789,14 +805,14 @@
}
}
- ActionBar actionBar = getActivity().getActionBar();
+ ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
// android.R.id.home will be triggered in onOptionsItemSelected()
actionBar.setDisplayHomeAsUpEnabled(true);
}
// Enable link to CMAS app settings depending on the value in config.xml.
- final boolean isCellBroadcastAppLinkEnabled = getActivity().getResources().getBoolean(
+ final boolean isCellBroadcastAppLinkEnabled = activity.getResources().getBoolean(
com.android.internal.R.bool.config_cellBroadcastAppLinks);
if (!mUm.isAdminUser() || !isCellBroadcastAppLinkEnabled
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) {
@@ -827,11 +843,11 @@
* change dynamically such as when hot swapping sims.
*/
boolean hasActiveSubscriptions = hasActiveSubscriptions();
- TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(
- Context.TELEPHONY_SERVICE);
- boolean canChange4glte = (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) &&
- ImsManager.isNonTtyOrTtyOnVolteEnabled(getActivity().getApplicationContext()) &&
- carrierConfig.getBoolean(
+ boolean canChange4glte =
+ (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)
+ && ImsManager.isNonTtyOrTtyOnVolteEnabled(
+ activity.getApplicationContext())
+ && carrierConfig.getBoolean(
CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL);
boolean useVariant4glteTitle = carrierConfig.getBoolean(
CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_BOOL);
@@ -883,13 +899,7 @@
super.onPause();
if (DBG) log("onPause:+");
- if (ImsManager.isVolteEnabledByPlatform(getActivity())
- && ImsManager.isVolteProvisionedOnDevice(getActivity())) {
- TelephonyManager tm =
- (TelephonyManager) getActivity().getSystemService(
- Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
- }
+ mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
mSubscriptionManager
.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
@@ -1391,8 +1401,6 @@
private boolean isWorldMode() {
boolean worldModeOn = false;
- final TelephonyManager tm =
- (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
final String configString = getResources().getString(R.string.config_world_mode);
if (!TextUtils.isEmpty(configString)) {
@@ -1402,8 +1410,9 @@
if (configArray != null &&
((configArray.length == 1 && configArray[0].equalsIgnoreCase("true"))
|| (configArray.length == 2 && !TextUtils.isEmpty(configArray[1])
- && tm != null
- && configArray[1].equalsIgnoreCase(tm.getGroupIdLevel1())))) {
+ && mTelephonyManager != null
+ && configArray[1].equalsIgnoreCase(
+ mTelephonyManager.getGroupIdLevel1())))) {
worldModeOn = true;
}
}