use of android.telecom.TelecomManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CallsSimListDialogFragment method getCurrentSubscriptions.
@Override
protected List<SubscriptionInfo> getCurrentSubscriptions() {
final Context context = getContext();
final SubscriptionManager subscriptionManager = context.getSystemService(SubscriptionManager.class);
final TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class);
final List<PhoneAccountHandle> phoneAccounts = telecomManager.getCallCapablePhoneAccounts();
final List<SubscriptionInfo> result = new ArrayList<>();
if (phoneAccounts == null) {
return result;
}
for (PhoneAccountHandle handle : phoneAccounts) {
final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(handle);
final int subId = telephonyManager.getSubIdForPhoneAccount(phoneAccount);
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
continue;
}
result.add(subscriptionManager.getActiveSubscriptionInfo(subId));
}
return result;
}
Aggregations