Merge "Add permission check for getDefaultCarrierServicePackageName"
diff --git a/Android.bp b/Android.bp
index a9e4cd2..76e910f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -24,6 +24,7 @@
"ims-common",
"org.apache.http.legacy",
"libprotobuf-java-lite",
+ "unsupportedappusage",
],
static_libs: [
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 035e7b6..6d11cf6 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -35,7 +35,7 @@
<protected-broadcast android:name="android.intent.action.DATA_CONNECTION_FAILED" />
<protected-broadcast android:name="android.intent.action.DATA_STALL_DETECTED" />
<protected-broadcast android:name="android.intent.action.SIM_STATE_CHANGED" />
- <protected-broadcast android:name="android.intent.action.NETWORK_SET_TIME" />
+ <protected-broadcast android:name="android.telephony.action.NETWORK_SET_TIME" />
<protected-broadcast android:name="com.android.internal.intent.action.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS" />
<protected-broadcast android:name="android.intent.action.ACTION_MDN_STATE_CHANGED" />
<protected-broadcast android:name="android.provider.Telephony.SPN_STRINGS_UPDATED" />
@@ -161,6 +161,7 @@
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />
<uses-permission android:name="android.permission.MANAGE_APP_OPS_MODES" />
+ <uses-permission android:name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS" />
<uses-permission android:name="android.permission.NETWORK_FACTORY" />
<uses-permission android:name="android.permission.OBSERVE_NETWORK_POLICY" />
<uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS" />
@@ -173,7 +174,7 @@
<!-- BIND_CARRIER_MESSAGING_SERVICE has been deprecated in favor of BIND_CARRIER_SERVICES. -->
<uses-permission android:name="android.permission.BIND_CARRIER_MESSAGING_SERVICE" />
<uses-permission android:name="android.permission.BIND_EUICC_SERVICE" />
- <uses-permission android:name="com.android.permission.BIND_TELEPHONY_NETWORK_SERVICE" />
+ <uses-permission android:name="android.permission.BIND_TELEPHONY_NETWORK_SERVICE" />
<uses-permission android:name="android.permission.BIND_CELL_BROADCAST_SERVICE" />
<uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
@@ -242,6 +243,15 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL_EMERGENCY" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL_EMERGENCY" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="tel" />
+ </intent-filter>
</activity>
<activity android:name="ADNList" />
diff --git a/apex/Android.bp b/apex/Android.bp
index 86ebe3a..f9e4b67 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -1,19 +1,24 @@
-apex {
- name: "com.android.telephony",
-
- manifest: "apex_manifest.json",
+apex_defaults {
+ name: "com.android.telephony-defaults",
// optional. if unspecified, a default one is auto-generated
androidManifest: "AndroidManifest.xml",
java_libs: ["telephony-common", "ims-common"],
//apps: ["TeleService", "StkLib", "ONSLib"],
- apps: ["StkLib"],
key: "com.android.telephony.key",
certificate: ":com.android.telephony.certificate",
}
+apex {
+ name: "com.android.telephony",
+ manifest: "apex_manifest.json",
+ apps: ["StkLib"],
+
+ defaults:["com.android.telephony-defaults"],
+}
+
apex_key {
name: "com.android.telephony.key",
public_key: "com.android.telephony.avbpubkey",
diff --git a/apex/testing/Android.bp b/apex/testing/Android.bp
new file mode 100644
index 0000000..10455a4
--- /dev/null
+++ b/apex/testing/Android.bp
@@ -0,0 +1,25 @@
+// Copyright (C) 2019 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.
+
+apex {
+ name: "test_com.android.telephony",
+ visibility: [
+ "//system/apex/tests",
+ ],
+ defaults: ["com.android.telephony-defaults"],
+ manifest: "test_manifest.json",
+ file_contexts: ":com.android.telephony-file_contexts",
+ // Test APEX, should never be installed
+ installable: false,
+}
\ No newline at end of file
diff --git a/apex/testing/AndroidManifest.xml b/apex/testing/AndroidManifest.xml
new file mode 100644
index 0000000..e2af9f5
--- /dev/null
+++ b/apex/testing/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2019 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.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.telephony">
+ <!-- APEX does not have classes.dex -->
+ <application android:hasCode="false" />
+ <uses-sdk
+ android:targetSdkVersion="30"
+ />
+</manifest>
\ No newline at end of file
diff --git a/apex/testing/test_manifest.json b/apex/testing/test_manifest.json
new file mode 100644
index 0000000..30bfda2
--- /dev/null
+++ b/apex/testing/test_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.telephony",
+ "version": 2147483647
+}
\ No newline at end of file
diff --git a/res/values/config.xml b/res/values/config.xml
index 8bc1919..8c36b1a 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -235,6 +235,12 @@
<!-- Flag indicating whether the device supports RTT (real-time text) -->
<bool name="config_support_rtt">false</bool>
+ <!-- String indicating the package name of the device ImsService implementation for MMTEL. -->
+ <string name="config_ims_mmtel_package"></string>
+
+ <!-- String indicating the package name of the device ImsService implementation for RCS. -->
+ <string name="config_ims_rcs_package"></string>
+
<!-- The package name for the platform number verification supplier app. -->
<string name="platform_number_verification_package" translatable="false"></string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b97ef10..6ac95c3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -438,6 +438,17 @@
<item>LTE/TDSCDMA/GSM/WCDMA</item>
<item>TDSCDMA/CDMA/EVDO/GSM/WCDMA </item>
<item>LTE/TDSCDMA/CDMA/EVDO/GSM/WCDMA</item>
+ <item>NR only</item>
+ <item>NR/LTE</item>
+ <item>NR/LTE/CDMA/EvDo</item>
+ <item>NR/LTE/GSM/WCDMA</item>
+ <item>NR/LTE/CDMA/EvDo/GSM/WCDMA</item>
+ <item>NR/LTE/WCDMA</item>
+ <item>NR/LTE/TDSCDMA</item>
+ <item>NR/LTE/TDSCDMA/GSM</item>
+ <item>NR/LTE/TDSCDMA/WCDMA</item>
+ <item>NR/LTE/TDSCDMA/GSM/WCDMA</item>
+ <item>NR/LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA</item>
</string-array>
<!-- The preferred network modes RIL constants, in order of the modes above,
e.g. the choice "GSM/WCDMA preferred" has the corresponding value "0" -->
@@ -465,6 +476,17 @@
<item>"20"</item>
<item>"21"</item>
<item>"22"</item>
+ <item>"23"</item>
+ <item>"24"</item>
+ <item>"25"</item>
+ <item>"26"</item>
+ <item>"27"</item>
+ <item>"28"</item>
+ <item>"29"</item>
+ <item>"30"</item>
+ <item>"31"</item>
+ <item>"32"</item>
+ <item>"33"</item>
</string-array>
<!-- The following strings are summaries for preferred network modes in Mobile network settings,
@@ -493,6 +515,8 @@
<string name="preferred_network_mode_lte_gsm_wcdma_summary">Preferred network mode: GSM/WCDMA/LTE</string>
<!-- CDMA+LTE/EVDO -->
<string name="preferred_network_mode_lte_cdma_evdo_summary">Preferred network mode: CDMA+LTE/EVDO</string>
+ <!-- LTE/CDMA/EvDo/GSM/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_lte_cdma_evdo_gsm_wcdma_summary">Preferred network mode: LTE/CDMA/EvDo/GSM/WCDMA</string>
<!-- Global -->
<string name="preferred_network_mode_global_summary">Preferred network mode: Global</string>
<!-- LTE / WCDMA -->
@@ -521,6 +545,28 @@
<string name="preferred_network_mode_tdscdma_cdma_evdo_gsm_wcdma_summary">Preferred network mode: TDSCDMA/CDMA/EvDo/GSM/WCDMA</string>
<!-- LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA -->
<string name="preferred_network_mode_lte_tdscdma_cdma_evdo_gsm_wcdma_summary">Preferred network mode: LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA</string>
+ <!-- NR only [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_only_summary">Preferred network mode: NR only</string>
+ <!-- NR / LTE [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_summary">Preferred network mode: NR / LTE</string>
+ <!-- NR/LTE/CDMA/EvDo [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_cdma_evdo_summary">Preferred network mode: NR/LTE/CDMA/EvDo</string>
+ <!-- NR/LTE/GSM/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_gsm_wcdma_summary">Preferred network mode: NR/LTE/GSM/WCDMA</string>
+ <!-- NR/LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_cdma_evdo_gsm_wcdma_summary">Preferred network mode: NR/LTE/CDMA/EvDo/GSM/WCDMA</string>
+ <!-- NR/LTE/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_wcdma_summary">Preferred network mode: NR/LTE/WCDMA</string>
+ <!-- NR/LTE/TDSCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_tdscdma_summary">Preferred network mode: NR/LTE/TDSCDMA</string>
+ <!-- NR/LTE/TDSCDMA/GSM [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_tdscdma_gsm_summary">Preferred network mode: NR/LTE/TDSCDMA/GSM</string>
+ <!-- NR/LTE/TDSCDMA/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_tdscdma_wcdma_summary">Preferred network mode: NR/LTE/TDSCDMA/WCDMA</string>
+ <!-- NR/LTE/TDSCDMA/GSM/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_tdscdma_gsm_wcdma_summary">Preferred network mode: NR/LTE/TDSCDMA/GSM/WCDMA</string>
+ <!-- NR/LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA [CHAR LIMIT=NONE] -->
+ <string name="preferred_network_mode_nr_lte_tdscdma_cdma_evdo_gsm_wcdma_summary">Preferred network mode: NR/LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA</string>
<!-- Mobile network settings screen, name for call settings category -->
<string name="call_category">Calling</string>
@@ -757,6 +803,10 @@
<string name="multi_category_enable">Multi-category enabled</string>
<string name="multi_category_disable">Multi-category disabled</string>
+ <string name="network_recommended">\u0020(recommended)</string>
+ <string name="network_5G" translatable="false">5G</string>
+ <string name="network_lte_pure" translatable="false">LTE</string>
+ <string name="network_4G_pure" translatable="false">4G</string>
<string name="network_lte">LTE (recommended)</string>
<string name="network_4G">4G (recommended)</string>
<string name="network_3G" translatable="false">3G</string>
diff --git a/src/com/android/phone/CLIRListPreference.java b/src/com/android/phone/CLIRListPreference.java
index 5c6132b..d8a9041 100755
--- a/src/com/android/phone/CLIRListPreference.java
+++ b/src/com/android/phone/CLIRListPreference.java
@@ -47,10 +47,15 @@
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
- mPhone.setOutgoingCallerIdDisplay(convertValueToCLIRMode(getValue()),
- mHandler.obtainMessage(MyHandler.MESSAGE_SET_CLIR));
- if (mTcpListener != null) {
- mTcpListener.onStarted(this, false);
+ if (positiveResult && (getValue() != null)) {
+ mPhone.setOutgoingCallerIdDisplay(convertValueToCLIRMode(getValue()),
+ mHandler.obtainMessage(MyHandler.MESSAGE_SET_CLIR));
+ if (mTcpListener != null) {
+ mTcpListener.onStarted(this, false);
+ }
+ } else {
+ Log.d(LOG_TAG, String.format("onDialogClosed: positiveResult=%b value=%s -- do nothing",
+ positiveResult, getValue()));
}
}
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index a07f7aa..41d83c4 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -30,13 +30,12 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
-import android.os.SystemProperties;
+import android.sysprop.TelephonyProperties;
import android.util.Log;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.util.NotificationChannelController;
import java.text.SimpleDateFormat;
@@ -50,7 +49,7 @@
public class EmergencyCallbackModeService extends Service {
// Default Emergency Callback Mode timeout value
- private static final int DEFAULT_ECM_EXIT_TIMER_VALUE = 300000;
+ private static final long DEFAULT_ECM_EXIT_TIMER_VALUE = 300000L;
private static final String LOG_TAG = "EmergencyCallbackModeService";
private NotificationManager mNotificationManager = null;
@@ -139,8 +138,7 @@
*/
private void startTimerNotification() {
// Get Emergency Callback Mode timeout value
- long ecmTimeout = SystemProperties.getLong(
- TelephonyProperties.PROPERTY_ECM_EXIT_TIMER, DEFAULT_ECM_EXIT_TIMER_VALUE);
+ long ecmTimeout = TelephonyProperties.ecm_exit_timer().orElse(DEFAULT_ECM_EXIT_TIMER_VALUE);
// Show the notification
showNotification(ecmTimeout);
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 5d4d9b3..1371674 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -26,6 +26,7 @@
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.PackageManager;
import android.content.res.XmlResourceParser;
import android.media.AudioManager;
import android.net.ConnectivityManager;
@@ -66,6 +67,7 @@
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.dataconnection.DataConnectionReasons;
import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataDisallowedReasonType;
+import com.android.internal.telephony.ims.ImsResolver;
import com.android.internal.util.IndentingPrintWriter;
import com.android.phone.settings.SettingsConstants;
import com.android.phone.vvm.CarrierVvmPackageInstalledReceiver;
@@ -146,6 +148,7 @@
CallNotifier notifier;
CallerInfoCache callerInfoCache;
NotificationMgr notificationMgr;
+ ImsResolver mImsResolver;
public PhoneInterfaceManager phoneMgr;
public ImsRcsController imsRcsController;
CarrierConfigLoader configLoader;
@@ -317,6 +320,19 @@
// Initialize the telephony framework
PhoneFactory.makeDefaultPhones(this);
+ // Only bring up ImsResolver if the device supports having an IMS stack.
+ if (getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_TELEPHONY_IMS)) {
+ // Get the package name of the default IMS implementation.
+ String defaultImsMmtelPackage = getResources().getString(
+ R.string.config_ims_mmtel_package);
+ String defaultImsRcsPackage = getResources().getString(
+ R.string.config_ims_rcs_package);
+ mImsResolver = new ImsResolver(this, defaultImsMmtelPackage,
+ defaultImsRcsPackage, PhoneFactory.getPhones().length);
+ mImsResolver.initialize();
+ }
+
// Start TelephonyDebugService After the default phone is created.
Intent intent = new Intent(this, TelephonyDebugService.class);
startService(intent);
@@ -438,6 +454,10 @@
return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
}
+ public ImsResolver getImsResolver() {
+ return mImsResolver;
+ }
+
/* package */ CallManager getCallManager() {
return mCM;
}
@@ -877,6 +897,14 @@
pw.increaseIndent();
mDataRoamingNotifLog.dump(fd, pw, args);
pw.decreaseIndent();
+ pw.println("ImsResolver:");
+ pw.increaseIndent();
+ try {
+ if (mImsResolver != null) mImsResolver.dump(fd, pw, args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ pw.decreaseIndent();
pw.decreaseIndent();
pw.println("------- End PhoneGlobals -------");
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7fe72ae..42894fd 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -52,7 +52,6 @@
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.os.ShellCallback;
-import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.WorkSource;
@@ -60,6 +59,7 @@
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Telephony;
+import android.sysprop.TelephonyProperties;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -272,15 +272,12 @@
private static final int SELECT_P2 = 0;
private static final int SELECT_P3 = 0x10;
- private static final String DEFAULT_NETWORK_MODE_PROPERTY_NAME = "ro.telephony.default_network";
- private static final String DEFAULT_DATA_ROAMING_PROPERTY_NAME = "ro.com.android.dataroaming";
- private static final String DEFAULT_MOBILE_DATA_PROPERTY_NAME = "ro.com.android.mobiledata";
-
/** The singleton instance. */
private static PhoneInterfaceManager sInstance;
private PhoneGlobals mApp;
private CallManager mCM;
+ private ImsResolver mImsResolver;
private UserManager mUserManager;
private AppOpsManager mAppOps;
private MainThreadHandler mMainThreadHandler;
@@ -881,7 +878,7 @@
}
// Result cannot be null. Return ModemActivityInfo with all fields set to 0.
if (request.result == null) {
- request.result = new ModemActivityInfo(0, 0, 0, null, 0, 0);
+ request.result = new ModemActivityInfo(0, 0, 0, null, 0);
}
notifyRequester(request);
break;
@@ -1393,6 +1390,7 @@
private PhoneInterfaceManager(PhoneGlobals app) {
mApp = app;
mCM = PhoneGlobals.getInstance().mCM;
+ mImsResolver = PhoneGlobals.getInstance().getImsResolver();
mUserManager = (UserManager) app.getSystemService(Context.USER_SERVICE);
mAppOps = (AppOpsManager)app.getSystemService(Context.APP_OPS_SERVICE);
mMainThreadHandler = new MainThreadHandler();
@@ -1778,6 +1776,7 @@
}
public boolean needMobileRadioShutdown() {
+ enforceReadPrivilegedPermission("needMobileRadioShutdown");
/*
* If any of the Radios are available, it will need to be
* shutdown. So return true if any Radio is available.
@@ -4461,12 +4460,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return;
}
- resolver.enableIms(slotId);
+ mImsResolver.enableIms(slotId);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -4481,12 +4479,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return;
}
- resolver.disableIms(slotId);
+ mImsResolver.disableIms(slotId);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -4503,12 +4500,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return null;
}
- return resolver.getMmTelFeatureAndListen(slotId, callback);
+ return mImsResolver.getMmTelFeatureAndListen(slotId, callback);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -4525,12 +4521,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return null;
}
- return resolver.getRcsFeatureAndListen(slotId, callback);
+ return mImsResolver.getRcsFeatureAndListen(slotId, callback);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -4545,12 +4540,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return null;
}
- return resolver.getImsRegistration(slotId, feature);
+ return mImsResolver.getImsRegistration(slotId, feature);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -4565,12 +4559,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return null;
}
- return resolver.getImsConfig(slotId, feature);
+ return mImsResolver.getImsConfig(slotId, feature);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -4579,58 +4572,65 @@
/**
* Sets the ImsService Package Name that Telephony will bind to.
*
- * @param slotId the slot ID that the ImsService should bind for.
- * @param isCarrierImsService true if the ImsService is the carrier override, false if the
+ * @param slotIndex the slot ID that the ImsService should bind for.
+ * @param isCarrierService true if the ImsService is the carrier override, false if the
* ImsService is the device default ImsService.
- * @param packageName The package name of the application that contains the ImsService to bind
- * to.
+ * @param featureTypes An integer array of feature types associated with a packageName.
+ * @param packageName The name of the package that the current configuration will be replaced
+ * with.
* @return true if setting the ImsService to bind to succeeded, false if it did not.
- * @hide
*/
- public boolean setImsService(int slotId, boolean isCarrierImsService, String packageName) {
- int[] subIds = SubscriptionManager.getSubId(slotId);
+ public boolean setBoundImsServiceOverride(int slotIndex, boolean isCarrierService,
+ int[] featureTypes, String packageName) {
+ int[] subIds = SubscriptionManager.getSubId(slotIndex);
+ TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(), "setBoundImsServiceOverride");
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
(subIds != null ? subIds[0] : SubscriptionManager.INVALID_SUBSCRIPTION_ID),
- "setImsService");
+ "setBoundImsServiceOverride");
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return false;
}
- return resolver.overrideImsServiceConfiguration(slotId, isCarrierImsService,
- packageName);
+ Map<Integer, String> featureConfig = new HashMap<>();
+ for (int featureType : featureTypes) {
+ featureConfig.put(featureType, packageName);
+ }
+ return mImsResolver.overrideImsServiceConfiguration(slotIndex, isCarrierService,
+ featureConfig);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
/**
- * Return the ImsService configuration.
+ * Return the package name of the currently bound ImsService.
*
* @param slotId The slot that the ImsService is associated with.
* @param isCarrierImsService true, if the ImsService is a carrier override, false if it is
* the device default.
+ * @param featureType The feature associated with the queried configuration.
* @return the package name of the ImsService configuration.
*/
- public String getImsService(int slotId, boolean isCarrierImsService) {
+ public String getBoundImsServicePackage(int slotId, boolean isCarrierImsService,
+ @ImsFeature.FeatureType int featureType) {
int[] subIds = SubscriptionManager.getSubId(slotId);
- TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
- (subIds != null ? subIds[0] : SubscriptionManager.INVALID_SUBSCRIPTION_ID),
- "getImsService");
+ TelephonyPermissions
+ .enforeceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
+ mApp, (subIds != null ? subIds[0] : SubscriptionManager.INVALID_SUBSCRIPTION_ID),
+ "getBoundImsServicePackage");
final long identity = Binder.clearCallingIdentity();
try {
- ImsResolver resolver = PhoneFactory.getImsResolver();
- if (resolver == null) {
+ if (mImsResolver == null) {
// may happen if the device does not support IMS.
return "";
}
// TODO: change API to query RCS separately.
- return resolver.getImsServiceConfiguration(slotId, isCarrierImsService,
- ImsFeature.FEATURE_MMTEL);
+ return mImsResolver.getImsServiceConfiguration(slotId, isCarrierImsService,
+ featureType);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -5963,7 +5963,7 @@
}
private final ModemActivityInfo mLastModemActivityInfo =
- new ModemActivityInfo(0, 0, 0, new int[0], 0, 0);
+ new ModemActivityInfo(0, 0, 0, new int[0], 0);
/**
* Responds to the ResultReceiver with the {@link android.telephony.ModemActivityInfo} object
@@ -5987,27 +5987,27 @@
null, workSource);
if (isModemActivityInfoValid(info)) {
int[] mergedTxTimeMs = new int[ModemActivityInfo.TX_POWER_LEVELS];
+ int[] txTimeMs = info.getTransmitTimeMillis();
+ int[] lastModemTxTimeMs = mLastModemActivityInfo.getTransmitTimeMillis();
for (int i = 0; i < mergedTxTimeMs.length; i++) {
- mergedTxTimeMs[i] = info.getTxTimeMillis()[i]
- + mLastModemActivityInfo.getTxTimeMillis()[i];
+ mergedTxTimeMs[i] = txTimeMs[i] + lastModemTxTimeMs[i];
}
mLastModemActivityInfo.setTimestamp(info.getTimestamp());
mLastModemActivityInfo.setSleepTimeMillis(info.getSleepTimeMillis()
+ mLastModemActivityInfo.getSleepTimeMillis());
mLastModemActivityInfo.setIdleTimeMillis(
info.getIdleTimeMillis() + mLastModemActivityInfo.getIdleTimeMillis());
- mLastModemActivityInfo.setTxTimeMillis(mergedTxTimeMs);
- mLastModemActivityInfo.setRxTimeMillis(
- info.getRxTimeMillis() + mLastModemActivityInfo.getRxTimeMillis());
- mLastModemActivityInfo.setEnergyUsed(
- info.getEnergyUsed() + mLastModemActivityInfo.getEnergyUsed());
+ mLastModemActivityInfo.setTransmitTimeMillis(mergedTxTimeMs);
+ mLastModemActivityInfo.setReceiveTimeMillis(
+ info.getReceiveTimeMillis() + mLastModemActivityInfo
+ .getReceiveTimeMillis());
}
+
ret = new ModemActivityInfo(mLastModemActivityInfo.getTimestamp(),
mLastModemActivityInfo.getSleepTimeMillis(),
mLastModemActivityInfo.getIdleTimeMillis(),
- mLastModemActivityInfo.getTxTimeMillis(),
- mLastModemActivityInfo.getRxTimeMillis(),
- mLastModemActivityInfo.getEnergyUsed());
+ mLastModemActivityInfo.getTransmitTimeMillis(),
+ mLastModemActivityInfo.getReceiveTimeMillis());
}
Bundle bundle = new Bundle();
bundle.putParcelable(TelephonyManager.MODEM_ACTIVITY_RESULT_KEY, ret);
@@ -6026,13 +6026,14 @@
int activityDurationMs =
(int) (info.getTimestamp() - mLastModemActivityInfo.getTimestamp());
int totalTxTimeMs = 0;
- for (int i = 0; i < info.getTxTimeMillis().length; i++) {
- totalTxTimeMs += info.getTxTimeMillis()[i];
+ int[] txTimeMs = info.getTransmitTimeMillis();
+ for (int i = 0; i < info.getTransmitPowerInfo().size(); i++) {
+ totalTxTimeMs += txTimeMs[i];
}
return (info.isValid()
&& (info.getSleepTimeMillis() <= activityDurationMs)
&& (info.getIdleTimeMillis() <= activityDurationMs)
- && (info.getRxTimeMillis() <= activityDurationMs)
+ && (info.getReceiveTimeMillis() <= activityDurationMs)
&& (totalTxTimeMs <= activityDurationMs));
}
@@ -6993,8 +6994,7 @@
* Returns false if the mobile data is disabled by default, otherwise return true.
*/
private boolean getDefaultDataEnabled() {
- return "true".equalsIgnoreCase(
- SystemProperties.get(DEFAULT_MOBILE_DATA_PROPERTY_NAME, "true"));
+ return TelephonyProperties.mobile_data().orElse(true);
}
/**
@@ -7005,8 +7005,7 @@
private boolean getDefaultDataRoamingEnabled(int subId) {
final CarrierConfigManager configMgr = (CarrierConfigManager)
mApp.getSystemService(Context.CARRIER_CONFIG_SERVICE);
- boolean isDataRoamingEnabled = "true".equalsIgnoreCase(
- SystemProperties.get(DEFAULT_DATA_ROAMING_PROPERTY_NAME, "false"));
+ boolean isDataRoamingEnabled = TelephonyProperties.data_roaming().orElse(true);
isDataRoamingEnabled |= configMgr.getConfigForSubId(subId).getBoolean(
CarrierConfigManager.KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL);
return isDataRoamingEnabled;
@@ -7017,11 +7016,12 @@
* not set, return {@link Phone#PREFERRED_NT_MODE}.
*/
private int getDefaultNetworkType(int subId) {
- return Integer.parseInt(
- TelephonyManager.getTelephonyProperty(
- mSubscriptionController.getPhoneId(subId),
- DEFAULT_NETWORK_MODE_PROPERTY_NAME,
- String.valueOf(Phone.PREFERRED_NT_MODE)));
+ List<Integer> list = TelephonyProperties.default_network();
+ int phoneId = mSubscriptionController.getPhoneId(subId);
+ if (phoneId >= 0 && phoneId < list.size() && list.get(phoneId) != null) {
+ return list.get(phoneId);
+ }
+ return Phone.PREFERRED_NT_MODE;
}
@Override
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 672a27f..db2f429 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -26,6 +26,7 @@
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.emergency.EmergencyNumber;
+import android.telephony.ims.feature.ImsFeature;
import android.util.Log;
import com.android.internal.telephony.ITelephony;
@@ -35,6 +36,7 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.TreeSet;
@@ -172,13 +174,15 @@
private void onHelpIms() {
PrintWriter pw = getOutPrintWriter();
pw.println("IMS Commands:");
- pw.println(" ims set-ims-service [-s SLOT_ID] (-c | -d) PACKAGE_NAME");
+ pw.println(" ims set-ims-service [-s SLOT_ID] (-c | -d | -f) PACKAGE_NAME");
pw.println(" Sets the ImsService defined in PACKAGE_NAME to to be the bound");
pw.println(" ImsService. Options are:");
pw.println(" -s: the slot ID that the ImsService should be bound for. If no option");
pw.println(" is specified, it will choose the default voice SIM slot.");
pw.println(" -c: Override the ImsService defined in the carrier configuration.");
pw.println(" -d: Override the ImsService defined in the device overlay.");
+ pw.println(" -f: Set the feature that this override if for, if no option is");
+ pw.println(" specified, the new package name will be used for all features.");
pw.println(" ims get-ims-service [-s SLOT_ID] [-c | -d]");
pw.println(" Gets the package name of the currently defined ImsService.");
pw.println(" Options are:");
@@ -186,6 +190,8 @@
pw.println(" is specified, it will choose the default voice SIM slot.");
pw.println(" -c: The ImsService defined as the carrier configured ImsService.");
pw.println(" -c: The ImsService defined as the device default ImsService.");
+ pw.println(" -f: The feature type that the query will be requested for. If none is");
+ pw.println(" specified, the returned package name will correspond to MMTEL.");
pw.println(" ims enable [-s SLOT_ID]");
pw.println(" enables IMS for the SIM slot specified, or for the default voice SIM slot");
pw.println(" if none is specified.");
@@ -394,6 +400,7 @@
PrintWriter errPw = getErrPrintWriter();
int slotId = getDefaultSlot();
Boolean isCarrierService = null;
+ List<Integer> featuresList = new ArrayList<>();
String opt;
while ((opt = getNextOption()) != null) {
@@ -415,6 +422,26 @@
isCarrierService = false;
break;
}
+ case "-f": {
+ String featureString = getNextArgRequired();
+ String[] features = featureString.split(",");
+ for (int i = 0; i < features.length; i++) {
+ try {
+ Integer result = Integer.parseInt(features[i]);
+ if (result < ImsFeature.FEATURE_EMERGENCY_MMTEL
+ || result >= ImsFeature.FEATURE_MAX) {
+ errPw.println("ims set-ims-service -f " + result
+ + " is an invalid feature.");
+ return -1;
+ }
+ featuresList.add(result);
+ } catch (NumberFormatException e) {
+ errPw.println("ims set-ims-service -f tried to parse " + features[i]
+ + " as an integer.");
+ return -1;
+ }
+ }
+ }
}
}
// Mandatory param, either -c or -d
@@ -429,16 +456,24 @@
if (packageName == null) {
packageName = "";
}
- boolean result = mInterface.setImsService(slotId, isCarrierService, packageName);
+ int[] featureArray = new int[featuresList.size()];
+ for (int i = 0; i < featuresList.size(); i++) {
+ featureArray[i] = featuresList.get(i);
+ }
+ boolean result = mInterface.setBoundImsServiceOverride(slotId, isCarrierService,
+ featureArray, packageName);
if (VDBG) {
Log.v(LOG_TAG, "ims set-ims-service -s " + slotId + " "
- + (isCarrierService ? "-c " : "-d ") + packageName + ", result=" + result);
+ + (isCarrierService ? "-c " : "-d ")
+ + "-f " + featuresList + " "
+ + packageName + ", result=" + result);
}
getOutPrintWriter().println(result);
} catch (RemoteException e) {
Log.w(LOG_TAG, "ims set-ims-service -s " + slotId + " "
- + (isCarrierService ? "-c " : "-d ") + packageName + ", error"
- + e.getMessage());
+ + (isCarrierService ? "-c " : "-d ")
+ + "-f " + featuresList + " "
+ + packageName + ", error" + e.getMessage());
errPw.println("Exception: " + e.getMessage());
return -1;
}
@@ -450,6 +485,7 @@
PrintWriter errPw = getErrPrintWriter();
int slotId = getDefaultSlot();
Boolean isCarrierService = null;
+ Integer featureType = ImsFeature.FEATURE_MMTEL;
String opt;
while ((opt = getNextOption()) != null) {
@@ -471,23 +507,38 @@
isCarrierService = false;
break;
}
+ case "-f": {
+ try {
+ featureType = Integer.parseInt(getNextArg());
+ } catch (NumberFormatException e) {
+ errPw.println("ims get-ims-service -f requires valid integer as feature.");
+ return -1;
+ }
+ if (featureType < ImsFeature.FEATURE_EMERGENCY_MMTEL
+ || featureType >= ImsFeature.FEATURE_MAX) {
+ errPw.println("ims get-ims-service -f invalid feature.");
+ return -1;
+ }
+ }
}
}
// Mandatory param, either -c or -d
if (isCarrierService == null) {
- errPw.println("ims set-ims-service requires either \"-c\" or \"-d\" to be set.");
+ errPw.println("ims get-ims-service requires either \"-c\" or \"-d\" to be set.");
return -1;
}
String result;
try {
- result = mInterface.getImsService(slotId, isCarrierService);
+ result = mInterface.getBoundImsServicePackage(slotId, isCarrierService, featureType);
} catch (RemoteException e) {
return -1;
}
if (VDBG) {
Log.v(LOG_TAG, "ims get-ims-service -s " + slotId + " "
- + (isCarrierService ? "-c " : "-d ") + ", returned: " + result);
+ + (isCarrierService ? "-c " : "-d ")
+ + (featureType != null ? ("-f " + featureType) : "") + " , returned: "
+ + result);
}
getOutPrintWriter().println(result);
return 0;
diff --git a/src/com/android/phone/otasp/OtaspSimStateReceiver.java b/src/com/android/phone/otasp/OtaspSimStateReceiver.java
index 78f7baf..bb4022a 100644
--- a/src/com/android/phone/otasp/OtaspSimStateReceiver.java
+++ b/src/com/android/phone/otasp/OtaspSimStateReceiver.java
@@ -18,9 +18,11 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.os.AsyncResult;
+import android.os.Handler;
+import android.os.Message;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
-import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -32,15 +34,32 @@
private static final boolean DBG = true;
private Context mContext;
- private PhoneStateListener mPhoneStateListener = new PhoneStateListener(){
+ private static final int EVENT_OTASP_CHANGED = 1;
+
+ private Handler mOtaspHandler = new Handler() {
@Override
- public void onOtaspChanged(int otaspMode) {
- logd("onOtaspChanged: otaspMode=" + otaspMode);
- if (otaspMode == TelephonyManager.OTASP_NEEDED) {
- logd("otasp activation required, start otaspActivationService");
- mContext.startService(new Intent(mContext, OtaspActivationService.class));
- } else if (otaspMode == TelephonyManager.OTASP_NOT_NEEDED) {
- OtaspActivationService.updateActivationState(mContext, true);
+ public void handleMessage(Message msg) {
+ AsyncResult ar;
+ switch (msg.what) {
+ case EVENT_OTASP_CHANGED:
+ ar = (AsyncResult) msg.obj;
+ if (ar.exception == null && ar.result != null) {
+ int otaspMode = (Integer) ar.result;
+ logd("EVENT_OTASP_CHANGED: otaspMode=" + otaspMode);
+ if (otaspMode == TelephonyManager.OTASP_NEEDED) {
+ logd("otasp activation required, start otaspActivationService");
+ mContext.startService(
+ new Intent(mContext, OtaspActivationService.class));
+ } else if (otaspMode == TelephonyManager.OTASP_NOT_NEEDED) {
+ OtaspActivationService.updateActivationState(mContext, true);
+ }
+ } else {
+ logd("EVENT_OTASP_CHANGED: exception=" + ar.exception);
+ }
+ break;
+ default:
+ super.handleMessage(msg);
+ break;
}
}
};
@@ -74,13 +93,17 @@
if(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED.equals(intent.getAction())) {
if (DBG) logd("Received intent: " + intent.getAction());
if (PhoneGlobals.getPhone().getIccRecordsLoaded() && isCarrierSupported()) {
- final TelephonyManager telephonyManager = TelephonyManager.from(context);
- telephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_OTASP_CHANGED);
+ registerOtaspChangedHandler();
}
}
}
+ // It's fine to call mutiple times, as the registrants are de-duped by Handler object.
+ private void registerOtaspChangedHandler() {
+ final Phone phone = PhoneGlobals.getPhone();
+ phone.registerForOtaspChange(mOtaspHandler, EVENT_OTASP_CHANGED, null);
+ }
+
private static void logd(String s) {
Log.d(TAG, s);
}
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index ce5b839..77f1135 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -111,28 +111,40 @@
private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
private static final String[] PREFERRED_NETWORK_LABELS = {
- "WCDMA preferred",
+ "GSM/WCDMA preferred",
"GSM only",
"WCDMA only",
- "GSM auto (PRL)",
- "CDMA auto (PRL)",
+ "GSM/WCDMA auto (PRL)",
+ "CDMA/EvDo auto (PRL)",
"CDMA only",
"EvDo only",
- "Global auto (PRL)",
- "LTE/CDMA auto (PRL)",
- "LTE/UMTS auto (PRL)",
- "LTE/CDMA/UMTS auto (PRL)",
+ "CDMA/EvDo/GSM/WCDMA (PRL)",
+ "CDMA + LTE/EvDo (PRL)",
+ "GSM/WCDMA/LTE (PRL)",
+ "LTE/CDMA/EvDo/GSM/WCDMA (PRL)",
"LTE only",
"LTE/WCDMA",
- "TD-SCDMA only",
- "TD-SCDMA/WCDMA",
- "LTE/TD-SCDMA",
- "TD-SCDMA/GSM",
- "TD-SCDMA/UMTS",
- "LTE/TD-SCDMA/WCDMA",
- "LTE/TD-SCDMA/UMTS",
- "TD-SCDMA/CDMA/UMTS",
- "Global/TD-SCDMA",
+ "TDSCDMA only",
+ "TDSCDMA/WCDMA",
+ "LTE/TDSCDMA",
+ "TDSCDMA/GSM",
+ "LTE/TDSCDMA/GSM",
+ "TDSCDMA/GSM/WCDMA",
+ "LTE/TDSCDMA/WCDMA",
+ "LTE/TDSCDMA/GSM/WCDMA",
+ "TDSCDMA/CDMA/EvDo/GSM/WCDMA ",
+ "LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA",
+ "NR only",
+ "NR/LTE",
+ "NR/LTE/CDMA/EvDo",
+ "NR/LTE/GSM/WCDMA",
+ "NR/LTE/CDMA/EvDo/GSM/WCDMA",
+ "NR/LTE/WCDMA",
+ "NR/LTE/TDSCDMA",
+ "NR/LTE/TDSCDMA/GSM",
+ "NR/LTE/TDSCDMA/WCDMA",
+ "NR/LTE/TDSCDMA/GSM/WCDMA",
+ "NR/LTE/TDSCDMA/CDMA/EvDo/GSM/WCDMA",
"Unknown"
};
diff --git a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
index 0eda140..140cc74 100644
--- a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
@@ -443,7 +443,7 @@
}
if (v == mNameField) {
- mNumberField.requestFocus();
+ mButton.requestFocus();
} else if (v == mNumberField) {
mButton.requestFocus();
} else if (v == mButton) {
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 5a9fbcf..fb865b4 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -203,6 +203,7 @@
// whether the call should have the HD audio property set.
refreshConferenceSupported();
refreshDisableAddCall();
+ refreshHoldSupported();
updateConnectionProperties();
break;
@@ -1345,6 +1346,18 @@
}
}
+ private void refreshHoldSupported() {
+ if (mOriginalConnection == null) {
+ Log.w(this, "refreshHoldSupported org conn is null");
+ return;
+ }
+
+ if (!mOriginalConnection.shouldAllowHoldingVideoCall() && canHoldImsCalls() !=
+ ((getConnectionCapabilities() & (CAPABILITY_HOLD | CAPABILITY_SUPPORT_HOLD)) != 0)) {
+ updateConnectionCapabilities();
+ }
+ }
+
private void refreshDisableAddCall() {
if (shouldSetDisableAddCallExtra()) {
Bundle newExtras = getExtras();
@@ -1501,8 +1514,10 @@
private boolean canHoldImsCalls() {
PersistableBundle b = getCarrierConfig();
// Return true if the CarrierConfig is unavailable
- return !doesDeviceRespectHoldCarrierConfig() || b == null ||
- b.getBoolean(CarrierConfigManager.KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL);
+ return (!doesDeviceRespectHoldCarrierConfig() || b == null ||
+ b.getBoolean(CarrierConfigManager.KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL)) &&
+ ((mOriginalConnection != null && mOriginalConnection.shouldAllowHoldingVideoCall())
+ || !VideoProfile.isVideo(getVideoState()));
}
@VisibleForTesting
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 10d2c2f..40b941e 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -1457,16 +1457,32 @@
phone.getEmergencyNumberTracker().getEmergencyNumber(number);
if (emergencyNumber != null) {
phone.notifyOutgoingEmergencyCall(emergencyNumber);
- // If we do not support holding ongoing calls for an outgoing emergency call,
- // disconnect the ongoing calls.
- if (!shouldHoldForEmergencyCall(phone) && !getAllConnections().isEmpty()) {
- for (Connection c : getAllConnections()) {
- if (!c.equals(connection)
- && c.getState() != Connection.STATE_DISCONNECTED
- && c instanceof TelephonyConnection) {
- ((TelephonyConnection) c).hangup(
- android.telephony.DisconnectCause
- .OUTGOING_EMERGENCY_CALL_PLACED);
+ if (!getAllConnections().isEmpty()) {
+ if (!shouldHoldForEmergencyCall(phone)) {
+ // If we do not support holding ongoing calls for an outgoing
+ // emergency call, disconnect the ongoing calls.
+ for (Connection c : getAllConnections()) {
+ if (!c.equals(connection)
+ && c.getState() != Connection.STATE_DISCONNECTED
+ && c instanceof TelephonyConnection) {
+ ((TelephonyConnection) c).hangup(
+ android.telephony.DisconnectCause
+ .OUTGOING_EMERGENCY_CALL_PLACED);
+ }
+ }
+ } else if (!isVideoCallHoldAllowed(phone)) {
+ // If we do not support holding ongoing video call for an outgoing
+ // emergency call, disconnect the ongoing video call.
+ for (Connection c : getAllConnections()) {
+ if (!c.equals(connection)
+ && c.getState() == Connection.STATE_ACTIVE
+ && VideoProfile.isVideo(c.getVideoState())
+ && c instanceof TelephonyConnection) {
+ ((TelephonyConnection) c).hangup(
+ android.telephony.DisconnectCause
+ .OUTGOING_EMERGENCY_CALL_PLACED);
+ break;
+ }
}
}
}
@@ -1536,6 +1552,18 @@
}
}
+ private boolean isVideoCallHoldAllowed(Phone phone) {
+ CarrierConfigManager cfgManager = (CarrierConfigManager)
+ phone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ if (cfgManager == null) {
+ // For some reason CarrierConfigManager is unavailable, return default
+ Log.w(this, "isVideoCallHoldAllowed: couldn't get CarrierConfigManager");
+ return true;
+ }
+ return cfgManager.getConfigForSubId(phone.getSubId()).getBoolean(
+ CarrierConfigManager.KEY_ALLOW_HOLDING_VIDEO_CALL_BOOL, true);
+ }
+
private boolean shouldHoldForEmergencyCall(Phone phone) {
CarrierConfigManager cfgManager = (CarrierConfigManager)
phone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
diff --git a/testapps/TelephonyRegistryTestApp/src/com/android/phone/testapps/telephonyregistry/TelephonyRegistryTestApp.java b/testapps/TelephonyRegistryTestApp/src/com/android/phone/testapps/telephonyregistry/TelephonyRegistryTestApp.java
index 96f8bf7..f8d4487 100644
--- a/testapps/TelephonyRegistryTestApp/src/com/android/phone/testapps/telephonyregistry/TelephonyRegistryTestApp.java
+++ b/testapps/TelephonyRegistryTestApp/src/com/android/phone/testapps/telephonyregistry/TelephonyRegistryTestApp.java
@@ -50,7 +50,6 @@
put(PhoneStateListener.LISTEN_DATA_CONNECTION_STATE, "DATA_CONNECTION_STATE");
put(PhoneStateListener.LISTEN_DATA_ACTIVITY, "DATA_ACTIVITY");
put(PhoneStateListener.LISTEN_SIGNAL_STRENGTHS, "SIGNAL_STRENGTHS");
- put(PhoneStateListener.LISTEN_OTASP_CHANGED, "OTASP_CHANGED");
put(PhoneStateListener.LISTEN_CELL_INFO, "CELL_INFO");
put(PhoneStateListener.LISTEN_PRECISE_CALL_STATE, "PRECISE_CALL_STATE");
put(PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE,