Move RCS provisioning changed callback logic to RcsProvisioningMonitor
As there may be separated services to provide MMTEl and RCS features,
RCS provioning callback should not depend on MMTEL feature.
Bug: 177018241
Test: atest TeleServiceTests:com.android.phone.RcsProvisioningMonitorTest
Test: atest CtsTelephonyTestCases:android.telephony.ims.cts.ImsServiceTest
Merged-In: I532bbf851b2ac49fd59a22df0a7576239e30360f
Change-Id: I532bbf851b2ac49fd59a22df0a7576239e30360f
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index b8f87ea..f1ceca9 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -9571,10 +9571,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
- .addRcsProvisioningCallbackForSubscription(callback, subId);
- } catch (ImsException e) {
- throw new ServiceSpecificException(e.getCode());
+ if (!RcsProvisioningMonitor.getInstance()
+ .registerRcsProvisioningChangedCallback(subId, callback)) {
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION,
+ "Service not available for the subscription.");
+ }
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -9598,11 +9599,8 @@
final long identity = Binder.clearCallingIdentity();
try {
- ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
- .removeRcsProvisioningCallbackForSubscription(callback, subId);
- } catch (ImsException e) {
- Log.i(LOG_TAG, "unregisterRcsProvisioningChangedCallback: " + subId
- + "is inactive, ignoring unregister.");
+ RcsProvisioningMonitor.getInstance()
+ .unregisterRcsProvisioningChangedCallback(subId, callback);
} finally {
Binder.restoreCallingIdentity(identity);
}