Enhance IMS related shell commands to also specify an optional User
When running IMS related CTS tests, we override the IMS package.
To support HSUM devices, ensure that the user is also specified in
the override.
Flag: com.android.internal.telephony.flags.ims_resolver_user_aware
Bug: 371272669
Test: atest CtsTelephonyTestCases
Change-Id: Ifacc64406a406c792f3bb20bccc58e88b5fdd23b
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index d7f7939..a8ec8a7 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6640,6 +6640,8 @@
* Sets the ImsService Package Name that Telephony will bind to.
*
* @param slotIndex the slot ID that the ImsService should bind for.
+ * @param userId the user ID that the ImsService should bind for or {@link UserHandle#USER_NULL}
+ * if there is no preference.
* @param isCarrierService true if the ImsService is the carrier override, false if the
* ImsService is the device default ImsService.
* @param featureTypes An integer array of feature types associated with a packageName.
@@ -6647,7 +6649,7 @@
* with.
* @return true if setting the ImsService to bind to succeeded, false if it did not.
*/
- public boolean setBoundImsServiceOverride(int slotIndex, boolean isCarrierService,
+ public boolean setBoundImsServiceOverride(int slotIndex, int userId, boolean isCarrierService,
int[] featureTypes, String packageName) {
TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(), "setBoundImsServiceOverride");
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
@@ -6659,12 +6661,8 @@
// may happen if the device does not support IMS.
return false;
}
- Map<Integer, String> featureConfig = new HashMap<>();
- for (int featureType : featureTypes) {
- featureConfig.put(featureType, packageName);
- }
- return mImsResolver.overrideImsServiceConfiguration(slotIndex, isCarrierService,
- featureConfig);
+ return mImsResolver.overrideImsServiceConfiguration(packageName, slotIndex, userId,
+ isCarrierService, featureTypes);
} finally {
Binder.restoreCallingIdentity(identity);
}