use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by MoKee.
the class Call method getSubId.
public int getSubId(PhoneAccountHandle ph) {
if (ph == null) {
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
PhoneAccount account = mgr.getPhoneAccount(ph);
if (account != null) {
return TelephonyManager.getDefault().getSubIdForPhoneAccount(account);
} else {
return SubscriptionManager.getDefaultVoiceSubscriptionId();
}
}
use of android.telecom.PhoneAccount 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;
}
use of android.telecom.PhoneAccount 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);
}
}
use of android.telecom.PhoneAccount in project robolectric by robolectric.
the class ShadowTelecomManagerTest method registerAndUnRegister.
@Test
public void registerAndUnRegister() {
assertThat(shadowOf(telecomService).getAllPhoneAccountsCount()).isEqualTo(0);
assertThat(shadowOf(telecomService).getAllPhoneAccounts()).hasSize(0);
PhoneAccountHandle handler = createHandle("id");
PhoneAccount phoneAccount = PhoneAccount.builder(handler, "main_account").build();
telecomService.registerPhoneAccount(phoneAccount);
assertThat(shadowOf(telecomService).getAllPhoneAccountsCount()).isEqualTo(1);
assertThat(shadowOf(telecomService).getAllPhoneAccounts()).hasSize(1);
assertThat(telecomService.getAllPhoneAccountHandles()).hasSize(1);
assertThat(telecomService.getAllPhoneAccountHandles()).contains(handler);
assertThat(telecomService.getPhoneAccount(handler).getLabel().toString()).isEqualTo(phoneAccount.getLabel().toString());
telecomService.unregisterPhoneAccount(handler);
assertThat(shadowOf(telecomService).getAllPhoneAccountsCount()).isEqualTo(0);
assertThat(shadowOf(telecomService).getAllPhoneAccounts()).hasSize(0);
assertThat(telecomService.getAllPhoneAccountHandles()).hasSize(0);
}
use of android.telecom.PhoneAccount 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;
}
Aggregations