Search in sources :

Example 41 with TelecomManager

use of android.telecom.TelecomManager in project platform_packages_apps_Settings by BlissRoms.

the class SimDialogActivity method setUserSelectedOutgoingPhoneAccount.

private void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle phoneAccount) {
    final TelecomManager telecomManager = TelecomManager.from(this);
    telecomManager.setUserSelectedOutgoingPhoneAccount(phoneAccount);
}
Also used : TelecomManager(android.telecom.TelecomManager)

Example 42 with TelecomManager

use of android.telecom.TelecomManager in project platform_packages_apps_Settings by BlissRoms.

the class SimDialogActivity method subscriptionIdToPhoneAccountHandle.

private PhoneAccountHandle subscriptionIdToPhoneAccountHandle(final int subId) {
    final TelecomManager telecomManager = TelecomManager.from(this);
    final TelephonyManager telephonyManager = TelephonyManager.from(this);
    final Iterator<PhoneAccountHandle> phoneAccounts = telecomManager.getCallCapablePhoneAccounts().listIterator();
    while (phoneAccounts.hasNext()) {
        final PhoneAccountHandle phoneAccountHandle = phoneAccounts.next();
        final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
        if (subId == telephonyManager.getSubIdForPhoneAccount(phoneAccount)) {
            return phoneAccountHandle;
        }
    }
    return null;
}
Also used : PhoneAccount(android.telecom.PhoneAccount) PhoneAccountHandle(android.telecom.PhoneAccountHandle) TelephonyManager(android.telephony.TelephonyManager) TelecomManager(android.telecom.TelecomManager)

Example 43 with TelecomManager

use of android.telecom.TelecomManager in project packages_apps_Contacts by AOKP.

the class DelCallLogAdapter method getAccountIcon.

private Drawable getAccountIcon(Context context, PhoneAccountHandle accountHandle) {
    TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
    final PhoneAccount account;
    if (telecomManager.getCallCapablePhoneAccounts().size() <= 1) {
        account = null;
    } else {
        account = telecomManager.getPhoneAccount(accountHandle);
    }
    if (account == null) {
        return null;
    } else {
        return account.getIcon().loadDrawable(context);
    }
}
Also used : PhoneAccount(android.telecom.PhoneAccount) TelecomManager(android.telecom.TelecomManager)

Example 44 with TelecomManager

use of android.telecom.TelecomManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SimSettings method updateCallValues.

private void updateCallValues() {
    final Preference simPref = findPreference(KEY_CALLS);
    final TelecomManager telecomManager = TelecomManager.from(mContext);
    final PhoneAccountHandle phoneAccount = telecomManager.getUserSelectedOutgoingPhoneAccount();
    final List<PhoneAccountHandle> allPhoneAccounts = telecomManager.getCallCapablePhoneAccounts();
    simPref.setTitle(R.string.calls_title);
    simPref.setSummary(phoneAccount == null ? mContext.getResources().getString(R.string.sim_calls_ask_first_prefs_title) : (String) telecomManager.getPhoneAccount(phoneAccount).getLabel());
    simPref.setEnabled(allPhoneAccounts.size() > 1);
}
Also used : PhoneAccountHandle(android.telecom.PhoneAccountHandle) Preference(androidx.preference.Preference) TelecomManager(android.telecom.TelecomManager)

Example 45 with TelecomManager

use of android.telecom.TelecomManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SimDialogActivity method subscriptionIdToPhoneAccountHandle.

private PhoneAccountHandle subscriptionIdToPhoneAccountHandle(final int subId) {
    final TelecomManager telecomManager = getSystemService(TelecomManager.class);
    final TelephonyManager telephonyManager = getSystemService(TelephonyManager.class);
    for (PhoneAccountHandle handle : telecomManager.getCallCapablePhoneAccounts()) {
        final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(handle);
        if (subId == telephonyManager.getSubIdForPhoneAccount(phoneAccount)) {
            return handle;
        }
    }
    return null;
}
Also used : PhoneAccount(android.telecom.PhoneAccount) PhoneAccountHandle(android.telecom.PhoneAccountHandle) TelephonyManager(android.telephony.TelephonyManager) TelecomManager(android.telecom.TelecomManager)

Aggregations

TelecomManager (android.telecom.TelecomManager)86 PhoneAccountHandle (android.telecom.PhoneAccountHandle)45 PhoneAccount (android.telecom.PhoneAccount)30 TelephonyManager (android.telephony.TelephonyManager)17 SubscriptionInfo (android.telephony.SubscriptionInfo)11 KeyEvent (android.view.KeyEvent)9 ArrayList (java.util.ArrayList)9 AlertDialog (android.app.AlertDialog)8 ActivityNotFoundException (android.content.ActivityNotFoundException)8 DialogInterface (android.content.DialogInterface)8 Message (android.os.Message)8 SubscriptionManager (android.telephony.SubscriptionManager)8 Dialog (android.app.Dialog)7 ListAdapter (android.widget.ListAdapter)7 Intent (android.content.Intent)6 Preference (android.support.v7.preference.Preference)6 ComponentName (android.content.ComponentName)4 PackageManagerInternal (android.content.pm.PackageManagerInternal)4 RemoteException (android.os.RemoteException)4 IntArray (android.util.IntArray)4