Search in sources :

Example 51 with PhoneAccount

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;
}
Also used : PhoneAccount(android.telecom.PhoneAccount) PhoneAccountHandle(android.telecom.PhoneAccountHandle) ArrayList(java.util.ArrayList)

Example 52 with PhoneAccount

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;
}
Also used : PhoneAccount(android.telecom.PhoneAccount) TelephonyManager(android.telephony.TelephonyManager) SubscriptionInfo(android.telephony.SubscriptionInfo) SubscriptionManager(android.telephony.SubscriptionManager)

Example 53 with PhoneAccount

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 : "";
}
Also used : PhoneAccount(android.telecom.PhoneAccount)

Aggregations

PhoneAccount (android.telecom.PhoneAccount)53 PhoneAccountHandle (android.telecom.PhoneAccountHandle)40 TelecomManager (android.telecom.TelecomManager)31 TelephonyManager (android.telephony.TelephonyManager)18 ArrayList (java.util.ArrayList)13 SubscriptionInfo (android.telephony.SubscriptionInfo)11 SubscriptionManager (android.telephony.SubscriptionManager)10 AlertDialog (android.app.AlertDialog)7 Dialog (android.app.Dialog)7 DialogInterface (android.content.DialogInterface)7 KeyEvent (android.view.KeyEvent)7 ListAdapter (android.widget.ListAdapter)7 Uri (android.net.Uri)3 Context (android.content.Context)2 NotificationChannel (android.app.NotificationChannel)1 NotificationManager (android.app.NotificationManager)1 ContentResolver (android.content.ContentResolver)1 ContentValues (android.content.ContentValues)1 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1