From 6bde5e6f7a9c3db1ef1020e6221557577b692746 Mon Sep 17 00:00:00 2001 From: Grace Jia Date: Thu, 9 Jan 2020 16:30:14 -0800 Subject: Support API to toggle IMS on and off. Bug: 141929672 Test: atest CtsTelephonyTestCases:TelephonyManagerTest Change-Id: Icac337d99b578d2667657c07ab5bd13fd3e17590 --- api/system-current.txt | 1 + .../java/android/telephony/TelephonyManager.java | 24 ++++++++++++++++++++++ .../com/android/internal/telephony/ITelephony.aidl | 5 +++++ 3 files changed, 30 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index 6f20cd1cfafc..ff661b710787 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -9364,6 +9364,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetAllCarrierActions(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetCarrierKeysForImsiEncryption(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void resetIms(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean resetRadioConfig(); method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings(); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 839889f91c4a..638c78b381e5 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -6878,6 +6878,30 @@ public class TelephonyManager { } } + + /** + * Resets the {@link android.telephony.ims.ImsService} associated with the specified sim slot. + * Used by diagnostic apps to force the IMS stack to be disabled and re-enabled in an effort to + * recover from scenarios where the {@link android.telephony.ims.ImsService} gets in to a bad + * state. + * + * @param slotIndex the sim slot to reset the IMS stack on. + * @hide */ + @SystemApi + @WorkerThread + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void resetIms(int slotIndex) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.resetIms(slotIndex); + } + } catch (RemoteException e) { + Rlog.e(TAG, "toggleImsOnOff, RemoteException: " + + e.getMessage()); + } + } + /** * Enables IMS for the framework. This will trigger IMS registration and ImsFeature capability * status updates, if not already enabled. diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 1f84451a35e4..625f5252026c 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -827,6 +827,11 @@ interface ITelephony { */ void disableIms(int slotId); + /** + * Toggle framework IMS disables and enables. + */ + void resetIms(int slotIndex); + /** * Get IImsMmTelFeature binder from ImsResolver that corresponds to the subId and MMTel feature * as well as registering the MmTelFeature for callbacks using the IImsServiceFeatureCallback -- cgit v1.2.3-59-g8ed1b