use of android.telecom.PhoneAccount in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SoundSettingsTest method getPhoneAccountHandles.
private List<PhoneAccountHandle> getPhoneAccountHandles() {
List<PhoneAccountHandle> subscriptionAccountHandles = new ArrayList<>();
List<PhoneAccountHandle> accountHandles = mTelecomManager.getCallCapablePhoneAccounts(true);
for (PhoneAccountHandle accountHandle : accountHandles) {
PhoneAccount phoneAccount = mTelecomManager.getPhoneAccount(accountHandle);
// Emergency phone account also has CAPABILITY_SIM_SUBSCRIPTION, so should exclude it.
if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION) && !"E".equals(accountHandle.getId())) {
subscriptionAccountHandles.add(accountHandle);
}
}
return subscriptionAccountHandles;
}
use of android.telecom.PhoneAccount in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SoundSettingsTest method getDisplayNameForRingtonePreference.
private CharSequence getDisplayNameForRingtonePreference(PhoneAccountHandle phoneAccountHandle) {
SubscriptionManager subscriptionManager = (SubscriptionManager) getInstrumentation().getContext().getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
TelephonyManager telephonyManager = (TelephonyManager) getInstrumentation().getContext().getSystemService(Context.TELEPHONY_SERVICE);
PhoneAccount phoneAccount = mTelecomManager.getPhoneAccount(phoneAccountHandle);
int subId = telephonyManager.getSubIdForPhoneAccount(phoneAccount);
SubscriptionInfo subInfo = subscriptionManager.getActiveSubscriptionInfo(subId);
if (subInfo != null) {
return subInfo.getDisplayName();
}
return null;
}
use of android.telecom.PhoneAccount in project android_packages_apps_Settings by omnirom.
the class DefaultSubscriptionController method getLabelFromCallingAccount.
/**
* Get label from calling account
*
* @param handle to get label from {@link PhoneAccountHandle}
* @return label of calling account
*/
public CharSequence getLabelFromCallingAccount(PhoneAccountHandle handle) {
CharSequence label = null;
final PhoneAccount account = getPhoneAccount(handle);
if (account != null) {
label = account.getLabel();
}
if (label != null) {
label = mContext.getPackageManager().getUserBadgedLabel(label, handle.getUserHandle());
}
return (label != null) ? label : "";
}
Aggregations