use of com.android.dialer.enrichedcall.Session in project android_packages_apps_Dialer by LineageOS.
the class CallComposerActivity method refreshUiForCallComposerState.
private void refreshUiForCallComposerState() {
Session session = getEnrichedCallManager().getSession(sessionId);
if (session == null) {
return;
}
@State int state = session.getState();
LogUtil.i("CallComposerActivity.refreshUiForCallComposerState", "state: %s", StateExtension.toString(state));
switch(state) {
case Session.STATE_STARTING:
timeoutHandler.postDelayed(sessionStartedTimedOut, getSessionStartedTimeoutMillis());
if (sendAndCallReady) {
showLoadingUi();
}
break;
case Session.STATE_STARTED:
timeoutHandler.removeCallbacks(sessionStartedTimedOut);
if (sendAndCallReady) {
sendAndCall();
}
break;
case Session.STATE_START_FAILED:
case Session.STATE_CLOSED:
setFailedResultAndFinish();
break;
case Session.STATE_MESSAGE_FAILED:
case Session.STATE_MESSAGE_SENT:
case Session.STATE_NONE:
default:
break;
}
}
use of com.android.dialer.enrichedcall.Session in project android_packages_apps_Dialer by LineageOS.
the class CallComposerActivity method sendAndCall.
@Override
public void sendAndCall() {
if (!sessionReady()) {
sendAndCallReady = true;
showLoadingUi();
LogUtil.i("CallComposerActivity.onClick", "sendAndCall pressed, but the session isn't ready");
Logger.get(this).logImpression(DialerImpression.Type.CALL_COMPOSER_ACTIVITY_SEND_AND_CALL_PRESSED_WHEN_SESSION_NOT_READY);
return;
}
sendAndCall.setEnabled(false);
CallComposerFragment fragment = (CallComposerFragment) adapter.instantiateItem(pager, currentIndex);
MultimediaData.Builder builder = MultimediaData.builder();
if (fragment instanceof MessageComposerFragment) {
MessageComposerFragment messageComposerFragment = (MessageComposerFragment) fragment;
builder.setText(messageComposerFragment.getMessage());
placeRCSCall(builder);
}
if (fragment instanceof GalleryComposerFragment) {
GalleryComposerFragment galleryComposerFragment = (GalleryComposerFragment) fragment;
// If the current data is not a copy, make one.
if (!galleryComposerFragment.selectedDataIsCopy()) {
DialerExecutors.createUiTaskBuilder(getFragmentManager(), "copyAndResizeImageToSend", new CopyAndResizeImageWorker(this.getApplicationContext())).onSuccess(output -> {
Uri shareableUri = FileProvider.getUriForFile(CallComposerActivity.this, Constants.get().getFileProviderAuthority(), output.first);
builder.setImage(grantUriPermission(shareableUri), output.second);
placeRCSCall(builder);
}).onFailure(throwable -> {
// TODO(b/34279096) - gracefully handle message failure
LogUtil.e("CallComposerActivity.onCopyFailed", "copy Failed", throwable);
}).build().executeParallel(galleryComposerFragment.getGalleryData().getFileUri());
} else {
Uri shareableUri = FileProvider.getUriForFile(this, Constants.get().getFileProviderAuthority(), new File(galleryComposerFragment.getGalleryData().getFilePath()));
builder.setImage(grantUriPermission(shareableUri), galleryComposerFragment.getGalleryData().getMimeType());
placeRCSCall(builder);
}
}
if (fragment instanceof CameraComposerFragment) {
CameraComposerFragment cameraComposerFragment = (CameraComposerFragment) fragment;
cameraComposerFragment.getCameraUriWhenReady(uri -> {
builder.setImage(grantUriPermission(uri), cameraComposerFragment.getMimeType());
placeRCSCall(builder);
});
}
}
use of com.android.dialer.enrichedcall.Session in project android_packages_apps_Dialer by LineageOS.
the class DialerCall method updateEnrichedCallSession.
private void updateEnrichedCallSession() {
if (getNumber() == null) {
return;
}
if (getEnrichedCallSession() != null) {
// State changes to existing sessions are currently handled by the UI components (which have
// their own listeners). Someday instead we could remove those and just call update() here and
// have the usual onDialerCallUpdate update the UI.
dispatchOnEnrichedCallSessionUpdate();
return;
}
EnrichedCallManager manager = EnrichedCallComponent.get(mContext).getEnrichedCallManager();
Filter filter = isIncoming() ? manager.createIncomingCallComposerFilter() : manager.createOutgoingCallComposerFilter();
Session session = manager.getSession(getUniqueCallId(), getNumber(), filter);
if (session == null) {
return;
}
session.setUniqueDialerCallId(getUniqueCallId());
setEnrichedCallSession(session);
LogUtil.i("DialerCall.updateEnrichedCallSession", "setting session %d's dialer id to %s", session.getSessionId(), getUniqueCallId());
dispatchOnEnrichedCallSessionUpdate();
}
Aggregations