diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java index 0101ac75d9..ed07062235 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java @@ -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_ROTATED; import android.annotation.SuppressLint; import android.content.Context; @@ -143,8 +144,12 @@ public class TaskOverlayFactory implements ResourceBasedOverride { /** * Called when the current task is interactive for the user */ - public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix) { + public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix, + boolean rotated) { final boolean isAllowedByPolicy = thumbnail.isRealSnapshot; + + mActionsView.updateDisabledFlags(DISABLED_ROTATED, rotated); + getActionsView().setCallbacks(new OverlayUICallbacks() { @Override public void onShare() { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java index 0c21c5de42..a2da39855c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java @@ -38,6 +38,7 @@ import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks; +import com.android.quickstep.util.LayoutUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -67,6 +68,15 @@ public class OverviewActionsView extends FrameLayo public static final int HIDDEN_GESTURE_RUNNING = 1 << 4; public static final int HIDDEN_NO_RECENTS = 1 << 5; + @IntDef(flag = true, value = { + DISABLED_SCROLLING, + DISABLED_ROTATED}) + @Retention(RetentionPolicy.SOURCE) + public @interface ActionsDisabledFlags { } + + public static final int DISABLED_SCROLLING = 1 << 0; + public static final int DISABLED_ROTATED = 1 << 1; + private static final int INDEX_CONTENT_ALPHA = 0; private static final int INDEX_VISIBILITY_ALPHA = 1; private static final int INDEX_FULLSCREEN_ALPHA = 2; @@ -77,6 +87,9 @@ public class OverviewActionsView extends FrameLayo @ActionsHiddenFlags private int mHiddenFlags; + @ActionsDisabledFlags + protected int mDisabledFlags; + protected T mCallbacks; public OverviewActionsView(Context context) { @@ -156,6 +169,25 @@ public class OverviewActionsView extends FrameLayo setVisibility(isHidden ? INVISIBLE : VISIBLE); } + /** + * Updates the proper disabled flag to indicate whether OverviewActionsView should be enabled. + * Ignores DISABLED_ROTATED flag for determining enabled. Flag is used to enable/disable + * buttons individually, currently done for select button in subclass. + * + * @param disabledFlags The flag to update. + * @param enable Whether to enable the disable flag: True will cause view to be disabled. + */ + public void updateDisabledFlags(@ActionsDisabledFlags int disabledFlags, boolean enable) { + if (enable) { + mDisabledFlags |= disabledFlags; + } else { + mDisabledFlags &= ~disabledFlags; + } + // + boolean isEnabled = (mDisabledFlags & ~DISABLED_ROTATED) == 0; + LayoutUtils.setViewEnabled(this, isEnabled); + } + public AlphaProperty getContentAlpha() { return mMultiValueAlpha.getProperty(INDEX_CONTENT_ALPHA); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 7d2544753c..885ea5a620 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -623,14 +623,14 @@ public abstract class RecentsView extends PagedView impl @Override protected void onPageBeginTransition() { super.onPageBeginTransition(); - LayoutUtils.setViewEnabled(mActionsView, false); + mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, true); } @Override protected void onPageEndTransition() { super.onPageEndTransition(); if (isClearAllHidden()) { - LayoutUtils.setViewEnabled(mActionsView, true); + mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false); } if (getNextPage() > 0) { setSwipeDownShouldLaunchApp(true); @@ -2217,7 +2217,6 @@ public abstract class RecentsView extends PagedView impl boolean inPlaceLandscape = !mOrientationState.canLauncherRotate() && mOrientationState.getTouchRotation() != ROTATION_0; mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, modalness < 1 && inPlaceLandscape); - LayoutUtils.setViewEnabled(mActionsView, true); } @Nullable diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java index 26fb563b82..b2f937f8c2 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java @@ -357,10 +357,9 @@ public class TaskThumbnailView extends View implements PluginListener