Merge "Modify Settings to use new SIM call manager API"
diff --git a/res/layout/emergency_information.xml b/res/layout/emergency_information.xml
index e925479..524387f 100644
--- a/res/layout/emergency_information.xml
+++ b/res/layout/emergency_information.xml
@@ -53,7 +53,7 @@
android:maxLines="1"
android:ellipsize="end"
android:lineHeight="@dimen/emergency_info_name_line_height"
- android:fontFamily="google-sans"
+ android:fontFamily="@*android:string/config_headlineFontFamily"
android:textAppearance="@style/HeadlineTextAppearance"/>
<TextView
android:id="@+id/emergency_info_hint"
@@ -99,7 +99,7 @@
android:maxLines="2"
android:ellipsize="end"
android:lineHeight="@dimen/confirmed_emergency_info_line_height"
- android:fontFamily="google-sans"
+ android:fontFamily="@*android:string/config_headlineFontFamily"
android:textAppearance="@style/PhoneCallHintTextAppearance"
android:text="@string/emergency_information_confirm_hint"/>
</LinearLayout>
diff --git a/res/layout/emergency_shortcut_button.xml b/res/layout/emergency_shortcut_button.xml
index 136db0c..239371a 100644
--- a/res/layout/emergency_shortcut_button.xml
+++ b/res/layout/emergency_shortcut_button.xml
@@ -57,7 +57,7 @@
android:maxLines="1"
android:ellipsize="end"
android:lineHeight="@dimen/phone_number_line_height"
- android:fontFamily="google-sans"
+ android:fontFamily="@*android:string/config_headlineFontFamily"
android:textAppearance="@style/PhoneNumberTextAppearance"/>
<TextView
android:id="@+id/phone_number_description"
@@ -124,7 +124,7 @@
android:maxLines="2"
android:ellipsize="end"
android:lineHeight="@dimen/phone_call_hint_line_height"
- android:fontFamily="google-sans"
+ android:fontFamily="@*android:string/config_headlineFontFamily"
android:textAppearance="@style/PhoneCallHintTextAppearance"/>
</FrameLayout>
</LinearLayout>
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 8299d86..da478fa 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -935,10 +935,7 @@
if (overrides == null) {
mOverrideConfigs[phoneId] = new PersistableBundle();
- return;
- }
-
- if (mOverrideConfigs[phoneId] == null) {
+ } else if (mOverrideConfigs[phoneId] == null) {
mOverrideConfigs[phoneId] = overrides;
} else {
mOverrideConfigs[phoneId].putAll(overrides);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f32bf02..6c3ec89 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2802,27 +2802,6 @@
}
}
- /**
- * Returns the data network type.
- * Legacy call, permission-free.
- *
- * @Deprecated to be removed Q3 2013 use {@link #getDataNetworkType}.
- */
- @Override
- public int getNetworkType() {
- final long identity = Binder.clearCallingIdentity();
- try {
- final Phone phone = getPhone(getDefaultSubscription());
- if (phone != null) {
- return phone.getServiceState().getDataNetworkType();
- } else {
- return TelephonyManager.NETWORK_TYPE_UNKNOWN;
- }
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
- }
-
@Override
public int getNetworkSelectionMode(int subId) {
if (!isActiveSubscription(subId)) {
@@ -3524,12 +3503,16 @@
}
/**
- * Returns the network type for a subId
+ * Returns the data network type for a subId; does not throw SecurityException.
*/
@Override
public int getNetworkTypeForSubscriber(int subId, String callingPackage) {
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getNetworkTypeForSubscriber")) {
+ final int targetSdk = getTargetSdk(callingPackage);
+ if (targetSdk > android.os.Build.VERSION_CODES.Q) {
+ return getDataNetworkTypeForSubscriber(subId, callingPackage);
+ } else if (targetSdk == android.os.Build.VERSION_CODES.Q
+ && !TelephonyPermissions.checkCallingOrSelfReadPhoneStateNoThrow(
+ mApp, subId, callingPackage, "getNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -3838,7 +3821,7 @@
int command, int p1, int p2, int p3, String data) {
final long identity = Binder.clearCallingIdentity();
try {
- if (channel < 0) {
+ if (channel <= 0) {
return "";
}
@@ -7052,4 +7035,28 @@
Binder.restoreCallingIdentity(identity);
}
}
+
+ @Override
+ public String getMmsUAProfUrl(int subId) {
+ //TODO investigate if this API should require proper permission check in R b/133791609
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return SubscriptionManager.getResourcesForSubId(getDefaultPhone().getContext(), subId)
+ .getString(com.android.internal.R.string.config_mms_user_agent_profile_url);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ @Override
+ public String getMmsUserAgent(int subId) {
+ //TODO investigate if this API should require proper permission check in R b/133791609
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return SubscriptionManager.getResourcesForSubId(getDefaultPhone().getContext(), subId)
+ .getString(com.android.internal.R.string.config_mms_user_agent);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 498625d..4b29f4a 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -54,6 +54,7 @@
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RIL;
+import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneConnection;
@@ -481,7 +482,10 @@
// it is a test emergency number and we have to wait for the device to move
// IN_SERVICE before the call can take place over normal routing.
return (phone.getState() == PhoneConstants.State.OFFHOOK)
- || serviceState == ServiceState.STATE_IN_SERVICE;
+ // Do not wait for voice in service on opportunistic SIMs.
+ || SubscriptionController.getInstance().isOpportunistic(
+ phone.getSubId())
+ || serviceState == ServiceState.STATE_IN_SERVICE;
}
}
});
@@ -582,8 +586,11 @@
// Notify Telecom of the new Connection type.
// TODO: Switch out the underlying connection instead of creating a new
// one and causing UI Jank.
+ boolean noActiveSimCard = SubscriptionController.getInstance()
+ .getActiveSubInfoCount(phone.getContext().getOpPackageName()) == 0;
+ // If there's no active sim card and the device is in emergency mode, use E account.
addExistingConnection(PhoneUtils.makePstnPhoneAccountHandleWithPrefix(
- phone, "", isEmergencyNumber), repConnection);
+ phone, "", isEmergencyNumber && noActiveSimCard), repConnection);
// Remove the old connection from Telecom after.
originalConnection.setDisconnected(
DisconnectCauseUtil.toTelecomDisconnectCause(