use of android.telephony.ims.ImsMmTelManager in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method createForSubscriptionId_multipleValidSubscriptionIds_sharesInstances.
@Test
@SuppressLint("NewApi")
public void createForSubscriptionId_multipleValidSubscriptionIds_sharesInstances() {
ImsMmTelManager imsMmTelManager1 = ShadowImsMmTelManager.createForSubscriptionId(1);
ImsMmTelManager imsMmTelManager2 = ShadowImsMmTelManager.createForSubscriptionId(2);
assertThat(imsMmTelManager1).isNotEqualTo(imsMmTelManager2);
assertThat(imsMmTelManager1).isEqualTo(ShadowImsMmTelManager.createForSubscriptionId(1));
assertThat(imsMmTelManager2).isEqualTo(ShadowImsMmTelManager.createForSubscriptionId(2));
ShadowImsMmTelManager.clearExistingInstances();
assertThat(imsMmTelManager1).isNotEqualTo(ShadowImsMmTelManager.createForSubscriptionId(1));
assertThat(imsMmTelManager2).isNotEqualTo(ShadowImsMmTelManager.createForSubscriptionId(2));
}
use of android.telephony.ims.ImsMmTelManager in project android_packages_apps_Settings by omnirom.
the class ImsQueryController method isEnabledByPlatform.
@VisibleForTesting
boolean isEnabledByPlatform(int subId) throws InterruptedException, ImsException, IllegalArgumentException {
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
return false;
}
final ImsMmTelManager imsMmTelManager = ImsMmTelManager.createForSubscriptionId(subId);
// TODO: have a shared thread pool instead of create ExecutorService
// everytime to improve performance.
final ExecutorService executor = Executors.newSingleThreadExecutor();
final BooleanConsumer booleanResult = new BooleanConsumer();
imsMmTelManager.isSupported(mCapability, mTransportType, executor, booleanResult);
// or timeout after TIMEOUT_MILLIS milliseconds
return booleanResult.get(TIMEOUT_MILLIS);
}
use of android.telephony.ims.ImsMmTelManager in project robolectric by robolectric.
the class ShadowImsMmTelManager method createForSubscriptionId.
/**
* Returns only one instance per subscription id.
*/
@RequiresApi(api = VERSION_CODES.Q)
@Implementation
protected static ImsMmTelManager createForSubscriptionId(int subId) {
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
throw new IllegalArgumentException("Invalid subscription ID");
}
if (existingInstances.containsKey(subId)) {
return existingInstances.get(subId);
}
ImsMmTelManager imsMmTelManager = reflector(ImsMmTelManagerReflector.class).createForSubscriptionId(subId);
existingInstances.put(subId, imsMmTelManager);
return imsMmTelManager;
}
use of android.telephony.ims.ImsMmTelManager in project android_packages_apps_Settings by omnirom.
the class SimStatusDialogController method registerImsRegistrationCallback.
private void registerImsRegistrationCallback(int subId) {
if (!isImsRegistrationStateShowUp()) {
return;
}
try {
final ImsMmTelManager imsMmTelMgr = ImsMmTelManager.createForSubscriptionId(subId);
imsMmTelMgr.registerImsRegistrationCallback(mDialog.getContext().getMainExecutor(), mImsRegStateCallback);
} catch (ImsException exception) {
Log.w(TAG, "fail to register IMS status for subId=" + subId, exception);
}
}
use of android.telephony.ims.ImsMmTelManager in project android_packages_apps_Settings by omnirom.
the class SimStatusDialogController method unregisterImsRegistrationCallback.
private void unregisterImsRegistrationCallback(int subId) {
if (!isImsRegistrationStateShowUp()) {
return;
}
final ImsMmTelManager imsMmTelMgr = ImsMmTelManager.createForSubscriptionId(subId);
imsMmTelMgr.unregisterImsRegistrationCallback(mImsRegStateCallback);
}
Aggregations