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

Commit 68330a93 authored by Sreyas's avatar Sreyas Committed by Sreyas Rangaraju
Browse files

Disabling overview actions when thumbnail is not loaded.

Bug: 160331177
Change-Id: I05eaec7d6f2e3f2ba71d8148a4e97dcf5a1522c6
parent 4c7ced91
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.quickstep;
import static android.view.Surface.ROTATION_0;

import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBNAIL;
import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED;

import android.annotation.SuppressLint;
@@ -146,9 +147,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
         */
        public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix,
                boolean rotated) {
            final boolean isAllowedByPolicy = thumbnail.isRealSnapshot;
            getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null);

            if (thumbnail != null) {
                getActionsView().updateDisabledFlags(DISABLED_ROTATED, rotated);
                final boolean isAllowedByPolicy = thumbnail.isRealSnapshot;

                getActionsView().setCallbacks(new OverlayUICallbacks() {
                    @Override
@@ -167,6 +170,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
                    }
                });
            }
        }

        /**
         * Called to save screenshot of the task thumbnail.
+3 −1
Original line number Diff line number Diff line
@@ -70,12 +70,14 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo

    @IntDef(flag = true, value = {
            DISABLED_SCROLLING,
            DISABLED_ROTATED})
            DISABLED_ROTATED,
            DISABLED_NO_THUMBNAIL})
    @Retention(RetentionPolicy.SOURCE)
    public @interface ActionsDisabledFlags { }

    public static final int DISABLED_SCROLLING = 1 << 0;
    public static final int DISABLED_ROTATED = 1 << 1;
    public static final int DISABLED_NO_THUMBNAIL = 1 << 2;

    private static final int INDEX_CONTENT_ALPHA = 0;
    private static final int INDEX_VISIBILITY_ALPHA = 1;
+1 −1
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
    }

    private void updateOverlay() {
        if (mOverlayEnabled && mBitmapShader != null && mThumbnailData != null) {
        if (mOverlayEnabled) {
            mOverlay.initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
                    mPreviewPositionHelper.mIsOrientationChanged);
        } else {