Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e112d23 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Fix shared transitions in screenshot shelf UI" into 24D1-dev am:...

Merge "Merge "Fix shared transitions in screenshot shelf UI" into 24D1-dev am: 256196a1" into main
parents 4ca88ff6 7783873b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -135,11 +135,12 @@
            android:id="@+id/screenshot_scrollable_preview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clipToOutline="true"
            android:scaleType="matrix"
            android:visibility="gone"
            app:layout_constraintStart_toStartOf="@id/screenshot_preview"
            app:layout_constraintTop_toTopOf="@id/screenshot_preview"
            android:elevation="7dp"/>
            android:elevation="3dp"/>

        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline"
@@ -169,6 +170,13 @@
            <include layout="@layout/screenshot_detection_notice" />
        </FrameLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
    <ImageView
        android:id="@+id/screenshot_scrolling_scrim"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        android:clickable="true"
        android:importantForAccessibility="no"/>
    <ImageView
        android:id="@+id/screenshot_flash"
        android:layout_width="match_parent"
+14 −7
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.content.Intent
import android.os.UserHandle
import android.util.Log
import android.util.Pair
import android.view.View
import android.view.Window
import com.android.app.tracing.coroutines.launch
import com.android.internal.app.ChooserActivity
@@ -41,8 +40,8 @@ constructor(
    private val intentExecutor: ActionIntentExecutor,
    @Application private val applicationScope: CoroutineScope,
    @Assisted val window: Window,
    @Assisted val transitionView: View,
    @Assisted val onDismiss: (() -> Unit)
    @Assisted val viewProxy: ScreenshotViewProxy,
    @Assisted val finishDismiss: () -> Unit,
) {

    var isPendingSharedTransition = false
@@ -50,6 +49,7 @@ constructor(

    fun startSharedTransition(intent: Intent, user: UserHandle, overrideTransition: Boolean) {
        isPendingSharedTransition = true
        viewProxy.fadeForSharedTransition()
        val windowTransition = createWindowTransition()
        applicationScope.launch("$TAG#launchIntentAsync") {
            intentExecutor.launchIntent(
@@ -70,7 +70,7 @@ constructor(
                ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
            )
            pendingIntent.send(options.toBundle())
            onDismiss.invoke()
            viewProxy.requestDismissal(null)
        } catch (e: PendingIntent.CanceledException) {
            Log.e(TAG, "Intent cancelled", e)
        }
@@ -89,7 +89,7 @@ constructor(

                override fun hideSharedElements() {
                    isPendingSharedTransition = false
                    onDismiss.invoke()
                    finishDismiss.invoke()
                }

                override fun onFinish() {}
@@ -98,13 +98,20 @@ constructor(
            window,
            callbacks,
            null,
            Pair.create(transitionView, ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME)
            Pair.create(
                viewProxy.screenshotPreview,
                ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME
            )
        )
    }

    @AssistedFactory
    interface Factory {
        fun create(window: Window, transitionView: View, onDismiss: (() -> Unit)): ActionExecutor
        fun create(
            window: Window,
            viewProxy: ScreenshotViewProxy,
            finishDismiss: (() -> Unit)
        ): ActionExecutor
    }

    companion object {
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ object ActionIntentCreator {
            .putExtra(LongScreenshotActivity.EXTRA_SCREENSHOT_USER_HANDLE, owner)
            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
            .addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
    }

    private const val EXTRA_EDIT_SOURCE = "edit_source"
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ constructor(

    override fun restoreNonScrollingUi() = view.restoreNonScrollingUi()

    override fun fadeForSharedTransition() {} // unused

    override fun stopInputListening() = view.stopInputListening()

    override fun requestFocus() {
+8 −8
Original line number Diff line number Diff line
@@ -317,9 +317,9 @@ public class ScreenshotController {
        mConfigChanges.applyNewConfig(context.getResources());
        reloadAssets();

        mActionExecutor = actionExecutorFactory.create(mWindow, mViewProxy.getScreenshotPreview(),
        mActionExecutor = actionExecutorFactory.create(mWindow, mViewProxy,
                () -> {
                    requestDismissal(null);
                    finishDismiss();
                    return Unit.INSTANCE;
                });

@@ -623,9 +623,11 @@ public class ScreenshotController {
                (response) -> {
                    mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_LONG_SCREENSHOT_IMPRESSION,
                            0, response.getPackageName());
                    if (screenshotShelfUi2() && mActionsProvider != null) {
                    if (screenshotShelfUi2()) {
                        if (mActionsProvider != null) {
                            mActionsProvider.onScrollChipReady(
                                    () -> onScrollButtonClicked(owner, response));
                        }
                    } else {
                        mViewProxy.showScrollChip(response.getPackageName(),
                                () -> onScrollButtonClicked(owner, response));
@@ -657,9 +659,7 @@ public class ScreenshotController {
                () -> {
                    final Intent intent = ActionIntentCreator.INSTANCE.createLongScreenshotIntent(
                            owner, mContext);
                    mActionIntentExecutor.launchIntentAsync(intent, owner, true,
                            ActivityOptions.makeCustomAnimation(mContext, 0, 0), null);

                    mActionIntentExecutor.launchIntentAsync(intent, owner, true, null, null);
                },
                mViewProxy::restoreNonScrollingUi,
                mViewProxy::startLongScreenshotTransition);
Loading