Search in sources :

Example 1 with Session

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;
    }
}
Also used : State(com.android.dialer.enrichedcall.Session.State) Session(com.android.dialer.enrichedcall.Session)

Example 2 with Session

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);
        });
    }
}
Also used : LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) CallIntentBuilder(com.android.dialer.callintent.CallIntentBuilder) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) Animator(android.animation.Animator) CallInitiationType(com.android.dialer.callintent.CallInitiationType) EnrichedCallComponent(com.android.dialer.enrichedcall.EnrichedCallComponent) FileProvider(android.support.v4.content.FileProvider) VisibleForTesting(android.support.annotation.VisibleForTesting) Constants(com.android.dialer.constants.Constants) DialerToolbar(com.android.dialer.widget.DialerToolbar) OnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener) Handler(android.os.Handler) View(android.view.View) ArgbEvaluator(android.animation.ArgbEvaluator) Session(com.android.dialer.enrichedcall.Session) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) LockableViewPager(com.android.dialer.widget.LockableViewPager) ContactPhotoManager(com.android.contacts.common.ContactPhotoManager) DialerImpression(com.android.dialer.logging.DialerImpression) ContextCompat(android.support.v4.content.ContextCompat) ViewAnimationUtils(android.view.ViewAnimationUtils) CallComposerListener(com.android.dialer.callcomposer.CallComposerFragment.CallComposerListener) AppCompatActivity(android.support.v7.app.AppCompatActivity) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) RelativeLayout(android.widget.RelativeLayout) TelecomUtil(com.android.dialer.telecom.TelecomUtil) AnimatorListener(android.animation.Animator.AnimatorListener) Assert(com.android.dialer.common.Assert) Context(android.content.Context) LogUtil(com.android.dialer.common.LogUtil) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) DialerExecutors(com.android.dialer.common.concurrent.DialerExecutors) Intent(android.content.Intent) MultimediaData(com.android.dialer.multimedia.MultimediaData) NonNull(android.support.annotation.NonNull) ViewUtil(com.android.dialer.util.ViewUtil) StateExtension(com.android.dialer.enrichedcall.extensions.StateExtension) ProtoParsers(com.android.dialer.protos.ProtoParsers) Toast(android.widget.Toast) State(com.android.dialer.enrichedcall.Session.State) DialerContact(com.android.dialer.dialercontact.DialerContact) AnimatorSet(android.animation.AnimatorSet) ConfigProviderBindings(com.android.dialer.configprovider.ConfigProviderBindings) Logger(com.android.dialer.logging.Logger) ThreadUtil(com.android.dialer.common.concurrent.ThreadUtil) QuickContactBadge(android.widget.QuickContactBadge) EnrichedCallManager(com.android.dialer.enrichedcall.EnrichedCallManager) TextUtils(android.text.TextUtils) File(java.io.File) Gravity(android.view.Gravity) SharedPreferences(android.content.SharedPreferences) Configuration(android.content.res.Configuration) Base64(android.util.Base64) DialerUtils(com.android.dialer.util.DialerUtils) UiUtil(com.android.dialer.common.UiUtil) ValueAnimator(android.animation.ValueAnimator) OnClickListener(android.view.View.OnClickListener) MultimediaData(com.android.dialer.multimedia.MultimediaData) Uri(android.net.Uri) File(java.io.File)

Example 3 with Session

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();
}
Also used : Filter(com.android.dialer.enrichedcall.EnrichedCallManager.Filter) EnrichedCallManager(com.android.dialer.enrichedcall.EnrichedCallManager) Session(com.android.dialer.enrichedcall.Session)

Aggregations

Session (com.android.dialer.enrichedcall.Session)3 State (com.android.dialer.enrichedcall.Session.State)2 Animator (android.animation.Animator)1 AnimatorListener (android.animation.Animator.AnimatorListener)1 AnimatorSet (android.animation.AnimatorSet)1 ArgbEvaluator (android.animation.ArgbEvaluator)1 ValueAnimator (android.animation.ValueAnimator)1 Context (android.content.Context)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Configuration (android.content.res.Configuration)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 NonNull (android.support.annotation.NonNull)1 VisibleForTesting (android.support.annotation.VisibleForTesting)1 ContextCompat (android.support.v4.content.ContextCompat)1 FileProvider (android.support.v4.content.FileProvider)1 OnPageChangeListener (android.support.v4.view.ViewPager.OnPageChangeListener)1 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)1