use of android.telecom.TelecomManager in project android_packages_apps_Dialer by MoKee.
the class SpeedDialListActivity method showSelectAccountDialog.
private void showSelectAccountDialog(Context context) {
TelecomManager telecomManager = getTelecomManager(context);
List<PhoneAccountHandle> accountsList = telecomManager.getCallCapablePhoneAccounts();
final PhoneAccountHandle[] accounts = accountsList.toArray(new PhoneAccountHandle[accountsList.size()]);
CharSequence[] accountEntries = new CharSequence[accounts.length];
for (int i = 0; i < accounts.length; i++) {
CharSequence label = telecomManager.getPhoneAccount(accounts[i]).getLabel();
accountEntries[i] = (label == null) ? null : label.toString();
}
AlertDialog dialog = new AlertDialog.Builder(context).setTitle(R.string.select_account_dialog_title).setItems(accountEntries, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(ACTION_ADD_VOICEMAIL);
int sub = Integer.parseInt(accounts[which].getId());
intent.setClassName("com.android.phone", "com.android.phone.MSimCallFeaturesSubSetting");
intent.putExtra(SUBSCRIPTION_KEY, sub);
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "can not find activity deal with voice mail");
}
}
}).create();
dialog.show();
}
use of android.telecom.TelecomManager 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.TelecomManager 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.TelecomManager 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.TelecomManager 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