Search in sources :

Example 1 with DisconnectCause

use of android.telecom.DisconnectCause in project android_packages_apps_Dialer by LineageOS.

the class EnableWifiCallingPrompt method createDialog.

@Override
public Pair<Dialog, CharSequence> createDialog(@NonNull final Context context, DialerCall call) {
    Assert.isNotNull(context);
    DisconnectCause cause = call.getDisconnectCause();
    CharSequence message = cause.getDescription();
    Dialog dialog = new AlertDialog.Builder(context).setMessage(message).setPositiveButton(R.string.incall_enable_wifi_calling_button, (OnClickListener) (dialog1, which) -> openWifiCallingSettings(context)).setNegativeButton(android.R.string.cancel, null).create();
    return new Pair<>(dialog, message);
}
Also used : AlertDialog(android.app.AlertDialog) Assert(com.android.dialer.common.Assert) Context(android.content.Context) LogUtil(com.android.dialer.common.LogUtil) DialerCall(com.android.incallui.call.DialerCall) OnClickListener(android.content.DialogInterface.OnClickListener) Pair(android.util.Pair) Dialog(android.app.Dialog) Intent(android.content.Intent) NonNull(android.support.annotation.NonNull) DisconnectCause(android.telecom.DisconnectCause) DisconnectCause(android.telecom.DisconnectCause) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) Pair(android.util.Pair)

Example 2 with DisconnectCause

use of android.telecom.DisconnectCause in project android_packages_apps_Dialer by LineageOS.

the class SimulatorConnection method onReject.

@Override
public void onReject() {
    LogUtil.enterBlock("SimulatorConnection.onReject");
    setDisconnected(new DisconnectCause(DisconnectCause.REJECTED));
}
Also used : DisconnectCause(android.telecom.DisconnectCause)

Example 3 with DisconnectCause

use of android.telecom.DisconnectCause in project android_packages_apps_Dialer by LineageOS.

the class SimulatorConnection method onDisconnect.

@Override
public void onDisconnect() {
    LogUtil.enterBlock("SimulatorConnection.onDisconnect");
    setDisconnected(new DisconnectCause(DisconnectCause.LOCAL));
    destroy();
}
Also used : DisconnectCause(android.telecom.DisconnectCause)

Example 4 with DisconnectCause

use of android.telecom.DisconnectCause in project android_packages_apps_Dialer by MoKee.

the class CallList method clearOnDisconnect.

/**
 * This is called when the service disconnects, either expectedly or unexpectedly.
 * For the expected case, it's because we have no calls left.  For the unexpected case,
 * it is likely a crash of phone and we need to clean up our calls manually.  Without phone,
 * there can be no active calls, so this is relatively safe thing to do.
 */
public void clearOnDisconnect() {
    for (Call call : mCallById.values()) {
        final int state = call.getState();
        if (state != Call.State.IDLE && state != Call.State.INVALID && state != Call.State.DISCONNECTED) {
            call.setState(Call.State.DISCONNECTED);
            call.setDisconnectCause(new DisconnectCause(DisconnectCause.UNKNOWN));
            updateCallInMap(call);
        }
    }
    notifyGenericListeners();
}
Also used : DisconnectCause(android.telecom.DisconnectCause)

Example 5 with DisconnectCause

use of android.telecom.DisconnectCause in project android_packages_apps_Dialer by MoKee.

the class InCallPresenter method setDisconnectCauseForMissingAccounts.

/**
 * Sets the DisconnectCause for a call that was disconnected because it was missing a
 * PhoneAccount or PhoneAccounts to select from.
 * @param call
 */
private void setDisconnectCauseForMissingAccounts(Call call) {
    android.telecom.Call telecomCall = call.getTelecomCall();
    Bundle extras = telecomCall.getDetails().getIntentExtras();
    // Initialize the extras bundle to avoid NPE
    if (extras == null) {
        extras = new Bundle();
    }
    final List<PhoneAccountHandle> phoneAccountHandles = extras.getParcelableArrayList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS);
    if (phoneAccountHandles == null || phoneAccountHandles.isEmpty()) {
        String scheme = telecomCall.getDetails().getHandle().getScheme();
        final String errorMsg = PhoneAccount.SCHEME_TEL.equals(scheme) ? mContext.getString(R.string.callFailed_simError) : mContext.getString(R.string.incall_error_supp_service_unknown);
        DisconnectCause disconnectCause = new DisconnectCause(DisconnectCause.ERROR, null, errorMsg, errorMsg);
        call.setDisconnectCause(disconnectCause);
    }
}
Also used : DisconnectCause(android.telecom.DisconnectCause) PhoneAccountHandle(android.telecom.PhoneAccountHandle) Bundle(android.os.Bundle)

Aggregations

DisconnectCause (android.telecom.DisconnectCause)12 AlertDialog (android.app.AlertDialog)2 Dialog (android.app.Dialog)2 Bundle (android.os.Bundle)2 PhoneAccountHandle (android.telecom.PhoneAccountHandle)2 Pair (android.util.Pair)2 Context (android.content.Context)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 Intent (android.content.Intent)1 Point (android.graphics.Point)1 Handler (android.os.Handler)1 NonNull (android.support.annotation.NonNull)1 Assert (com.android.dialer.common.Assert)1 LogUtil (com.android.dialer.common.LogUtil)1 DialerCall (com.android.incallui.call.DialerCall)1