use of android.telecom.TelecomManager in project android_packages_apps_Settings by LineageOS.
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);
}
use of android.telecom.TelecomManager in project android_packages_apps_Dialer by LineageOS.
the class VoicemailChannelUtils method getAllEligableAccounts.
private static List<PhoneAccountHandle> getAllEligableAccounts(@NonNull Context context) {
List<PhoneAccountHandle> handles = new ArrayList<>();
TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
for (PhoneAccountHandle handle : telecomManager.getCallCapablePhoneAccounts()) {
if (isChannelAllowedForAccount(context, handle)) {
handles.add(handle);
}
}
return handles;
}
use of android.telecom.TelecomManager in project android_packages_apps_Dialer by LineageOS.
the class VoicemailChannelUtils method createGlobalVoicemailChannel.
/**
* Creates a voicemail channel but doesn't associate it with a SIM. For devices with only one SIM
* slot this is ideal because there won't be duplication in the settings UI.
*/
private static void createGlobalVoicemailChannel(@NonNull Context context) {
NotificationChannel channel = newChannel(context, GLOBAL_VOICEMAIL_CHANNEL_ID, null);
TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
PhoneAccountHandle handle = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
if (handle == null) {
LogUtil.i("VoicemailChannelUtils.createGlobalVoicemailChannel", "phone account is null, not migrating sound settings");
} else if (!isChannelAllowedForAccount(context, handle)) {
LogUtil.i("VoicemailChannelUtils.createGlobalVoicemailChannel", "phone account is not eligable, not migrating sound settings");
} else {
migrateVoicemailSoundSettings(context, channel, handle);
}
context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
}
use of android.telecom.TelecomManager in project android_packages_apps_Dialer by LineageOS.
the class LegacyVoicemailNotifier method getNotificationText.
@NonNull
private static String getNotificationText(@NonNull Context context, PhoneAccountHandle handle, String voicemailNumber) {
if (PhoneAccountUtils.getSubscriptionPhoneAccounts(context).size() > 1) {
TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
PhoneAccount phoneAccount = telecomManager.getPhoneAccount(handle);
return phoneAccount.getShortDescription().toString();
} else {
return String.format(context.getString(R.string.notification_voicemail_text_format), PhoneNumberUtils.formatNumber(voicemailNumber));
}
}
use of android.telecom.TelecomManager in project android_packages_apps_Dialer by LineageOS.
the class PhoneAccountSelectionFragment method onResume.
@Override
public void onResume() {
super.onResume();
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
PreferenceScreen screen = getPreferenceScreen();
TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
List<PhoneAccountHandle> accountHandles = telecomManager.getCallCapablePhoneAccounts();
Context context = getActivity();
for (PhoneAccountHandle handle : accountHandles) {
PhoneAccount account = telecomManager.getPhoneAccount(handle);
if (account != null) {
final boolean isSimAccount = 0 != (account.getCapabilities() & PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION);
if (isSimAccount) {
screen.addPreference(new AccountPreference(context, handle, account));
}
}
}
}
Aggregations