From 20f7fd985a75c48817ba53fb647fb43f1c7937c4 Mon Sep 17 00:00:00 2001 From: joonhunshin Date: Wed, 15 Feb 2023 05:51:57 +0000 Subject: [PATCH] Add the resetIms interface between framework and ImsService. Add the resetIms interface between framework and ImsService. Bug: b/268251541 Test: atest ImsEnablementTrackerTest Test: 1. AT&T activated, Fi deactivated 2. AT&T activated, Fi activated 3. AT&T deactivated, Fi activated 4. AT&T activated, Fi activated 5. repeat from step 1 Merged-In: I0574091723aab1f6ab7406ae851cd44c11616f3e Change-Id: I0574091723aab1f6ab7406ae851cd44c11616f3e (cherry picked from commit 58f76c37a6ff87d4ded55a5e3879f8bf5db5628e) --- .../android/telephony/ims/ImsService.java | 27 ++++++++++++++++++- .../ims/aidl/IImsServiceController.aidl | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/telephony/java/android/telephony/ims/ImsService.java b/telephony/java/android/telephony/ims/ImsService.java index 33c86d8299a08..4c37f7d3184c5 100644 --- a/telephony/java/android/telephony/ims/ImsService.java +++ b/telephony/java/android/telephony/ims/ImsService.java @@ -398,7 +398,11 @@ public class ImsService extends Service { ImsService.this.disableImsForSubscription(slotId, subId), "disableIms"); } - + @Override + public void resetIms(int slotId, int subId) { + executeMethodAsync(() -> + ImsService.this.resetImsInternal(slotId, subId), "resetIms"); + } }; private final IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { @@ -634,6 +638,14 @@ public class ImsService extends Service { } } + private void resetImsInternal(int slotId, int subId) { + try { + resetIms(slotId); + } catch (UnsupportedOperationException e) { + disableImsForSubscription(slotId, subId); + } + } + /** * When called, provide the {@link ImsFeatureConfiguration} that this {@link ImsService} * currently supports. This will trigger the framework to set up the {@link ImsFeature}s that @@ -750,6 +762,19 @@ public class ImsService extends Service { public void disableIms(int slotId) { } + /** + * The framework has reset IMS for the slot specified. The ImsService must deregister + * and release all resources for IMS. After resetIms is called, either + * {@link #enableImsForSubscription(int, int)} or {@link #disableImsForSubscription(int, int)} + * will be called for the same slotId. + * + * @param slotId The slot ID that IMS will be reset for. + * @hide + */ + public void resetIms(int slotId) { + throw new UnsupportedOperationException(); + } + /** * When called, the framework is requesting that a new {@link MmTelFeature} is created for the * specified subscription. diff --git a/telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl b/telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl index ae6166fea02a8..fdf43a52685a8 100644 --- a/telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl +++ b/telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl @@ -47,4 +47,5 @@ interface IImsServiceController { ISipTransport getSipTransport(int slotId); oneway void enableIms(int slotId, int subId); oneway void disableIms(int slotId, int subId); + oneway void resetIms(int slotId, int subId); }