Merge "Import translations. DO NOT MERGE" into oc-dev
diff --git a/src/com/android/phone/NetworkSetting.java b/src/com/android/phone/NetworkSetting.java
index 29608da..72ad513 100644
--- a/src/com/android/phone/NetworkSetting.java
+++ b/src/com/android/phone/NetworkSetting.java
@@ -394,7 +394,7 @@
if (phone != null) {
ServiceState ss = tm.getServiceStateForSubscriber(phone.getSubId());
if (ss != null) {
- app.notificationMgr.updateNetworkSelection(ss.getState());
+ app.notificationMgr.updateNetworkSelection(ss.getState(), phone.getSubId());
}
}
}
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 69c0871..bc67fd5 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -53,6 +53,7 @@
import android.widget.Toast;
import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.TelephonyCapabilities;
import com.android.internal.telephony.util.NotificationChannelController;
import com.android.phone.settings.VoicemailSettingsActivity;
@@ -92,7 +93,6 @@
private static NotificationMgr sInstance;
private PhoneGlobals mApp;
- private Phone mPhone;
private Context mContext;
private NotificationManager mNotificationManager;
@@ -121,7 +121,6 @@
mStatusBarManager =
(StatusBarManager) app.getSystemService(Context.STATUS_BAR_SERVICE);
mUserManager = (UserManager) app.getSystemService(Context.USER_SERVICE);
- mPhone = app.mCM.getDefaultPhone();
mSubscriptionManager = SubscriptionManager.from(mContext);
mTelecomManager = TelecomManager.from(mContext);
mTelephonyManager = (TelephonyManager) app.getSystemService(Context.TELEPHONY_SERVICE);
@@ -574,8 +573,9 @@
/**
* Display the network selection "no service" notification
* @param operator is the numeric operator number
+ * @param subId is the subscription ID
*/
- private void showNetworkSelection(String operator) {
+ private void showNetworkSelection(String operator, int subId) {
if (DBG) log("showNetworkSelection(" + operator + ")...");
Notification.Builder builder = new Notification.Builder(mContext)
@@ -595,7 +595,7 @@
intent.setComponent(new ComponentName(
mContext.getString(R.string.network_operator_settings_package),
mContext.getString(R.string.network_operator_settings_class)));
- intent.putExtra(GsmUmtsOptions.EXTRA_SUB_ID, mPhone.getSubId());
+ intent.putExtra(GsmUmtsOptions.EXTRA_SUB_ID, subId);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
List<UserInfo> users = mUserManager.getUsers(true);
@@ -627,10 +627,13 @@
* Update notification about no service of user selected operator
*
* @param serviceState Phone service state
+ * @param subId The subscription ID
*/
- void updateNetworkSelection(int serviceState) {
- if (TelephonyCapabilities.supportsNetworkSelection(mPhone)) {
- int subId = mPhone.getSubId();
+ void updateNetworkSelection(int serviceState, int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ Phone phone = SubscriptionManager.isValidPhoneId(phoneId) ?
+ PhoneFactory.getPhone(phoneId) : PhoneFactory.getDefaultPhone();
+ if (TelephonyCapabilities.supportsNetworkSelection(phone)) {
if (SubscriptionManager.isValidSubscriptionId(subId)) {
// get the shared preference of network_selection.
// empty is auto mode, otherwise it is the operator alpha name
@@ -649,7 +652,7 @@
if (serviceState == ServiceState.STATE_OUT_OF_SERVICE
&& !TextUtils.isEmpty(networkSelection)) {
- showNetworkSelection(networkSelection);
+ showNetworkSelection(networkSelection, subId);
mSelectedUnavailableNotify = true;
} else {
if (mSelectedUnavailableNotify) {
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 0bb271e..39937eb 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -738,7 +738,9 @@
ServiceState ss = ServiceState.newFromBundle(extras);
if (ss != null) {
int state = ss.getState();
- notificationMgr.updateNetworkSelection(state);
+ int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+ notificationMgr.updateNetworkSelection(state, subId);
}
}
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 9d1e283..8afe14f 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1495,6 +1495,7 @@
}
public boolean setRadioPower(boolean turnOn) {
+ enforceModifyPermission();
final Phone defaultPhone = PhoneFactory.getDefaultPhone();
if (defaultPhone != null) {
defaultPhone.setRadioPower(turnOn);
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 311c026..b9be502 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -22,6 +22,7 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import android.provider.Settings;
import android.telecom.Conference;
import android.telecom.Connection;
import android.telecom.ConnectionRequest;
@@ -349,7 +350,10 @@
final boolean isEmergencyNumber =
PhoneNumberUtils.isLocalEmergencyNumber(this, numberToDial);
- if (isEmergencyNumber && !isRadioOn()) {
+ final boolean isAirplaneModeOn = Settings.Global.getInt(getContentResolver(),
+ Settings.Global.AIRPLANE_MODE_ON, 0) > 0;
+
+ if (isEmergencyNumber && (!isRadioOn() || isAirplaneModeOn)) {
final Uri emergencyHandle = handle;
// By default, Connection based on the default Phone, since we need to return to Telecom
// now.