use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by MoKee.
the class PhoneAccountUtils method getSubscriptionPhoneAccounts.
/**
* Return a list of phone accounts that are subscription/SIM accounts.
*/
public static List<PhoneAccountHandle> getSubscriptionPhoneAccounts(Context context) {
List<PhoneAccountHandle> subscriptionAccountHandles = new ArrayList<PhoneAccountHandle>();
final List<PhoneAccountHandle> accountHandles = TelecomUtil.getCallCapablePhoneAccounts(context);
for (PhoneAccountHandle accountHandle : accountHandles) {
PhoneAccount account = TelecomUtil.getPhoneAccount(context, accountHandle);
if (account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
subscriptionAccountHandles.add(accountHandle);
}
}
return subscriptionAccountHandles;
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by MoKee.
the class CallCardPresenter method getCallProviderIcon.
/**
* Return the icon to represent the call provider
*/
private Drawable getCallProviderIcon(Call call) {
PhoneAccount account = getAccountForCall(call);
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
if (account != null && account.getIcon() != null && mgr.getCallCapablePhoneAccounts().size() > 1 && SubscriptionManager.from(mContext).getActiveSubscriptionInfoCount() > 1) {
return account.getIcon().loadDrawable(mContext);
}
return null;
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by MoKee.
the class CallCardPresenter method getSubscriptionNumber.
private String getSubscriptionNumber() {
// If it's an emergency call, and they're not populating the callback number,
// then try to fall back to the phone sub info (to hopefully get the SIM's
// number directly from the telephony layer).
PhoneAccountHandle accountHandle = mPrimary.getAccountHandle();
if (accountHandle != null) {
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
PhoneAccount account = TelecomManagerCompat.getPhoneAccount(mgr, accountHandle);
if (account != null) {
return getNumberFromHandle(account.getSubscriptionAddress());
}
}
return null;
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by MoKee.
the class CallCardPresenter method getCallProviderLabel.
/**
* Return the string label to represent the call provider
*/
private String getCallProviderLabel(Call call) {
PhoneAccount account = getAccountForCall(call);
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
if (account != null && !TextUtils.isEmpty(account.getLabel()) && TelecomManagerCompat.getCallCapablePhoneAccounts(mgr).size() >= 1) {
return account.getLabel().toString();
}
return null;
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by MoKee.
the class Call method updateFromTelecomCall.
private void updateFromTelecomCall(boolean registerCallback) {
Log.d(this, "updateFromTelecomCall: " + mTelecomCall.toString());
final int translatedState = translateState(mTelecomCall.getState());
if (mState != State.BLOCKED) {
setState(translatedState);
setDisconnectCause(mTelecomCall.getDetails().getDisconnectCause());
maybeCancelVideoUpgrade(mTelecomCall.getDetails().getVideoState());
}
if (registerCallback && mTelecomCall.getVideoCall() != null) {
if (mVideoCallCallback == null) {
mVideoCallCallback = new InCallVideoCallCallback(this);
}
mTelecomCall.getVideoCall().registerCallback(mVideoCallCallback);
mIsVideoCallCallbackRegistered = true;
}
mChildCallIds.clear();
final int numChildCalls = mTelecomCall.getChildren().size();
for (int i = 0; i < numChildCalls; i++) {
mChildCallIds.add(CallList.getInstance().getCallByTelecomCall(mTelecomCall.getChildren().get(i)).getId());
}
// The number of conferenced calls can change over the course of the call, so use the
// maximum number of conferenced child calls as the metric for conference call usage.
mLogState.conferencedCalls = Math.max(numChildCalls, mLogState.conferencedCalls);
updateFromCallExtras(mTelecomCall.getDetails().getExtras());
// If the handle of the call has changed, update state for the call determining if it is an
// emergency call.
Uri newHandle = mTelecomCall.getDetails().getHandle();
if (!Objects.equals(mHandle, newHandle)) {
mHandle = newHandle;
updateEmergencyCallState();
}
// If the phone account handle of the call is set, cache capability bit indicating whether
// the phone account supports call subjects.
PhoneAccountHandle newPhoneAccountHandle = mTelecomCall.getDetails().getAccountHandle();
if (!Objects.equals(mPhoneAccountHandle, newPhoneAccountHandle)) {
mPhoneAccountHandle = newPhoneAccountHandle;
if (mPhoneAccountHandle != null) {
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
PhoneAccount phoneAccount = TelecomManagerCompat.getPhoneAccount(mgr, mPhoneAccountHandle);
if (phoneAccount != null) {
mIsCallSubjectSupported = phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT);
}
}
}
}
Aggregations