Search in sources :

Example 1 with DialerCall

use of com.android.incallui.call.DialerCall 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 DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class VideoCallPresenter method onStateChange.

/**
 * Handles state changes (including incoming calls)
 *
 * @param newState The in call state.
 * @param callList The call list.
 */
@Override
public void onStateChange(InCallPresenter.InCallState oldState, InCallPresenter.InCallState newState, CallList callList) {
    LogUtil.v("VideoCallPresenter.onStateChange", "oldState: %s, newState: %s, isVideoMode: %b", oldState, newState, isVideoMode());
    if (newState == InCallPresenter.InCallState.NO_CALLS) {
        if (isVideoMode()) {
            exitVideoMode();
        }
        InCallPresenter.getInstance().cleanupSurfaces();
    }
    // Determine the primary active call).
    DialerCall primary = null;
    // Determine the call which is the focus of the user's attention.  In the case of an
    // incoming call waiting call, the primary call is still the active video call, however
    // the determination of whether we should be in fullscreen mode is based on the type of the
    // incoming call, not the active video call.
    DialerCall currentCall = null;
    if (newState == InCallPresenter.InCallState.INCOMING) {
        // We don't want to replace active video call (primary call)
        // with a waiting call, since user may choose to ignore/decline the waiting call and
        // this should have no impact on current active video call, that is, we should not
        // change the camera or UI unless the waiting VT call becomes active.
        primary = callList.getActiveCall();
        currentCall = callList.getIncomingCall();
        if (!isActiveVideoCall(primary)) {
            primary = callList.getIncomingCall();
        }
    } else if (newState == InCallPresenter.InCallState.OUTGOING) {
        currentCall = primary = callList.getOutgoingCall();
    } else if (newState == InCallPresenter.InCallState.PENDING_OUTGOING) {
        currentCall = primary = callList.getPendingOutgoingCall();
    } else if (newState == InCallPresenter.InCallState.INCALL) {
        currentCall = primary = callList.getActiveCall();
    }
    final boolean primaryChanged = !Objects.equals(mPrimaryCall, primary);
    LogUtil.i("VideoCallPresenter.onStateChange", "primaryChanged: %b, primary: %s, mPrimaryCall: %s", primaryChanged, primary, mPrimaryCall);
    if (primaryChanged) {
        onPrimaryCallChanged(primary);
    } else if (mPrimaryCall != null) {
        updateVideoCall(primary);
    }
    updateCallCache(primary);
    // If the call context changed, potentially exit fullscreen or schedule auto enter of
    // fullscreen mode.
    // If the current call context is no longer a video call, exit fullscreen mode.
    maybeExitFullscreen(currentCall);
    // Schedule auto-enter of fullscreen mode if the current call context is a video call
    maybeAutoEnterFullscreen(currentCall);
}
Also used : DialerCall(com.android.incallui.call.DialerCall)

Example 3 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class VideoCallPresenter method updateCameraSelection.

private static void updateCameraSelection(DialerCall call) {
    LogUtil.v("VideoCallPresenter.updateCameraSelection", "call=" + call);
    LogUtil.v("VideoCallPresenter.updateCameraSelection", "call=" + toSimpleString(call));
    final DialerCall activeCall = CallList.getInstance().getActiveCall();
    int cameraDir;
    // should handle it gracefully.
    if (call == null) {
        cameraDir = CameraDirection.CAMERA_DIRECTION_UNKNOWN;
        LogUtil.e("VideoCallPresenter.updateCameraSelection", "call is null. Setting camera direction to default value (CAMERA_DIRECTION_UNKNOWN)");
    } else // Clear camera direction if this is not a video call.
    if (isAudioCall(call) && !isVideoUpgrade(call)) {
        cameraDir = CameraDirection.CAMERA_DIRECTION_UNKNOWN;
        call.setCameraDir(cameraDir);
    } else // without user's permission.
    if (isVideoCall(activeCall) && isIncomingVideoCall(call)) {
        cameraDir = activeCall.getCameraDir();
    } else // if this is an outgoing video call.
    if (isOutgoingVideoCall(call) && !isCameraDirectionSet(call)) {
        cameraDir = toCameraDirection(call.getVideoState());
        call.setCameraDir(cameraDir);
    } else // is set.
    if (isOutgoingVideoCall(call)) {
        cameraDir = call.getCameraDir();
    } else // if this is an active video call and camera direction is not set.
    if (isActiveVideoCall(call) && !isCameraDirectionSet(call)) {
        cameraDir = toCameraDirection(call.getVideoState());
        call.setCameraDir(cameraDir);
    } else // is set.
    if (isActiveVideoCall(call)) {
        cameraDir = call.getCameraDir();
    } else // For all other cases infer the camera direction but don't store it in the call object.
    {
        cameraDir = toCameraDirection(call.getVideoState());
    }
    LogUtil.i("VideoCallPresenter.updateCameraSelection", "setting camera direction to %d, call: %s", cameraDir, call);
    final InCallCameraManager cameraManager = InCallPresenter.getInstance().getInCallCameraManager();
    cameraManager.setUseFrontFacingCamera(cameraDir == CameraDirection.CAMERA_DIRECTION_FRONT_FACING);
}
Also used : DialerCall(com.android.incallui.call.DialerCall) Point(android.graphics.Point)

Example 4 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class VideoPauseController method onStateChange.

/**
 * Handles changes in the {@link InCallState}. Triggers pause and resumption of video for the
 * current foreground call.
 *
 * @param oldState The previous {@link InCallState}.
 * @param newState The current {@link InCallState}.
 * @param callList List of current call.
 */
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
    DialerCall call;
    if (newState == InCallState.INCOMING) {
        call = callList.getIncomingCall();
    } else if (newState == InCallState.WAITING_FOR_ACCOUNT) {
        call = callList.getWaitingForAccountCall();
    } else if (newState == InCallState.PENDING_OUTGOING) {
        call = callList.getPendingOutgoingCall();
    } else if (newState == InCallState.OUTGOING) {
        call = callList.getOutgoingCall();
    } else {
        call = callList.getActiveCall();
    }
    boolean hasPrimaryCallChanged = !Objects.equals(call, mPrimaryCall);
    boolean canVideoPause = videoCanPause(call);
    LogUtil.i("VideoPauseController.onStateChange", "hasPrimaryCallChanged: %b, videoCanPause: %b, isInBackground: %b", hasPrimaryCallChanged, canVideoPause, mIsInBackground);
    if (hasPrimaryCallChanged) {
        onPrimaryCallChanged(call);
        return;
    }
    if (wasDialing() && canVideoPause && mIsInBackground) {
        // Bring UI to foreground if outgoing request becomes active while UI is in
        // background.
        bringToForeground();
    } else if (!mWasVideoCall && canVideoPause && mIsInBackground) {
        // Bring UI to foreground if VoLTE call becomes active while UI is in
        // background.
        bringToForeground();
    }
    updatePrimaryCallContext(call);
}
Also used : DialerCall(com.android.incallui.call.DialerCall)

Example 5 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class ReturnToCallActionReceiver method toggleSpeaker.

private void toggleSpeaker(Context context) {
    CallAudioState audioState = AudioModeProvider.getInstance().getAudioState();
    if ((audioState.getSupportedRouteMask() & CallAudioState.ROUTE_BLUETOOTH) == CallAudioState.ROUTE_BLUETOOTH) {
        LogUtil.w("ReturnToCallActionReceiver.toggleSpeaker", "toggleSpeaker() called when bluetooth available." + " Probably should have shown audio route selector");
    }
    DialerCall call = getCall();
    int newRoute;
    if (audioState.getRoute() == CallAudioState.ROUTE_SPEAKER) {
        newRoute = CallAudioState.ROUTE_WIRED_OR_EARPIECE;
        Logger.get(context).logCallImpression(DialerImpression.Type.BUBBLE_TURN_ON_WIRED_OR_EARPIECE, call != null ? call.getUniqueCallId() : "", call != null ? call.getTimeAddedMs() : 0);
    } else {
        newRoute = CallAudioState.ROUTE_SPEAKER;
        Logger.get(context).logCallImpression(DialerImpression.Type.BUBBLE_TURN_ON_SPEAKERPHONE, call != null ? call.getUniqueCallId() : "", call != null ? call.getTimeAddedMs() : 0);
    }
    TelecomAdapter.getInstance().setAudioRoute(newRoute);
}
Also used : CallAudioState(android.telecom.CallAudioState) DialerCall(com.android.incallui.call.DialerCall)

Aggregations

DialerCall (com.android.incallui.call.DialerCall)35 CallList (com.android.incallui.call.CallList)6 RequiresPermission (android.support.annotation.RequiresPermission)3 ContactCacheEntry (com.android.incallui.ContactInfoCache.ContactCacheEntry)3 PhoneAccountHandle (android.telecom.PhoneAccountHandle)2 SpannableString (android.text.SpannableString)2 ActivityManager (android.app.ActivityManager)1 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 Notification (android.app.Notification)1 Context (android.content.Context)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Point (android.graphics.Point)1 AudioAttributes (android.media.AudioAttributes)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 ArrayMap (android.support.v4.util.ArrayMap)1 CallAudioState (android.telecom.CallAudioState)1