Search in sources :

Example 11 with DisconnectCause

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

the class InCallActivity method maybeShowErrorDialogOnDisconnect.

public void maybeShowErrorDialogOnDisconnect(Call call) {
    Log.d(this, "maybeShowErrorDialogOnDisconnect");
    if (isFinishing()) {
        return;
    }
    DisconnectCause disconnectCause = call.getDisconnectCause();
    int code = disconnectCause.getCode();
    if (call.wasUnansweredForwarded()) {
        showErrorDialog(getString(R.string.callUnanswered_forwarded));
    } else if (call.missedBecauseIncomingCallsBarredRemotely()) {
        showErrorDialog(getString(R.string.callFailed_incoming_cb_enabled));
    } else if (!TextUtils.isEmpty(disconnectCause.getDescription()) && (code == DisconnectCause.ERROR || code == DisconnectCause.RESTRICTED)) {
        showErrorDialog(disconnectCause.getDescription());
    }
}
Also used : DisconnectCause(android.telecom.DisconnectCause) Point(android.graphics.Point)

Example 12 with DisconnectCause

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

the class InCallVibrationHandler method handleCallEnd.

private void handleCallEnd(Call call) {
    long durationMillis = System.currentTimeMillis() - call.getConnectTimeMillis();
    DisconnectCause cause = call.getDisconnectCause();
    boolean localDisconnect = // Disconnection not yet processed
    call.getState() == Call.State.DISCONNECTING || // Disconnection already processed
    (cause != null && cause.getCode() == DisconnectCause.LOCAL);
    Log.d(this, "Ending active call: duration = " + durationMillis + ", locally disconnected = " + localDisconnect);
    if (mPrefs.getBoolean(KEY_VIBRATE_HANGUP, true) && !localDisconnect && durationMillis > 500) {
        vibrate(50, 100, 50);
    }
    // Stop 45-second vibration
    removeMessages(MSG_VIBRATE_45_SEC);
}
Also used : DisconnectCause(android.telecom.DisconnectCause)

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