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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations