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

Commit 9b5795a5 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Hide shelf in 2-Button Landscape

Disable overview rotation in 2-Button
until we can figure out the correct
transition/animation.
TODO: b/154665738

Fixes: 154181816
Test: Tested no button and 2 button,
overview actions worked as before.

Change-Id: Ib67906b11e24def870a39f57b5156e29db258fd7
parent a29a6994
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.quickstep.views;

import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import static com.android.quickstep.SysUINavigationMode.getMode;

import android.content.Context;
import android.util.AttributeSet;
@@ -31,6 +31,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.R;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks;

import java.lang.annotation.Retention;
@@ -118,7 +119,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        updateHiddenFlags(HIDDEN_DISABLED_FEATURE, !ENABLE_OVERVIEW_ACTIONS.get());
        updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, !removeShelfFromOverview(getContext()));
        updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION,
                getMode(getContext()) == SysUINavigationMode.Mode.TWO_BUTTONS);
    }

    public void updateHiddenFlags(@ActionsHiddenFlags int visibilityFlags, boolean enable) {
+6 −1
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ import com.android.quickstep.RecentsAnimationController;
import com.android.quickstep.RecentsAnimationTargets;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RecentsModel.TaskVisualsChangeListener;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskUtils;
@@ -800,11 +801,14 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
    @Override
    public void setInsets(Rect insets) {
        mInsets.set(insets);
        resetPaddingFromTaskSize();
    }

    private void resetPaddingFromTaskSize() {
        DeviceProfile dp = mActivity.getDeviceProfile();
        getTaskSize(dp, mTempRect);
        mTaskWidth = mTempRect.width();
        mTaskHeight = mTempRect.height();

        mTempRect.top -= mTaskTopMargin;
        setPadding(mTempRect.left - mInsets.left, mTempRect.top - mInsets.top,
                dp.widthPx - mInsets.right - mTempRect.right,
@@ -1569,6 +1573,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
            mActivity.getDragLayer().recreateControllers();
            mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
                    touchRotation != 0 || launcherRotation != 0);
            resetPaddingFromTaskSize();
            requestLayout();
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.launcher3.util.Themes;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.systemui.plugins.OverviewScreenshotActions;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.shared.recents.model.Task;
+10 −4
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ import android.content.Intent;
import android.content.res.Resources;
import android.util.Log;

import com.android.launcher3.Launcher;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.quickstep.views.RecentsView;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -128,10 +130,14 @@ public class SysUINavigationMode {
        }
    }

    /** @return Whether we can remove the shelf from overview. */
    public static boolean removeShelfFromOverview(Context context) {
        // The shelf is core to the two-button mode model, so we need to continue supporting it.
        return getMode(context) != Mode.TWO_BUTTONS;
    public static boolean removeShelfFromOverview(Launcher launcher) {
        // The shelf is core to the two-button mode model, so we need to continue supporting it
        // when in portrait.
        if (getMode(launcher) != Mode.TWO_BUTTONS) {
            return true;
        }
        RecentsView recentsView = launcher.getOverviewPanel();
        return !recentsView.getPagedOrientationHandler().isLayoutNaturalToLauncher();
    }

    public void dump(PrintWriter pw) {
+12 −7
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@
package com.android.quickstep.util;

import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
import static com.android.quickstep.SysUINavigationMode.getMode;

import static java.lang.annotation.RetentionPolicy.SOURCE;

@@ -60,7 +61,7 @@ public class LayoutUtils {
        } else {
            Resources res = context.getResources();

            if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
            if (showOverviewActions(context)) {
                //TODO: this needs to account for the swipe gesture height and accessibility
                // UI when shown.
                extraSpace = res.getDimensionPixelSize(R.dimen.overview_actions_height);
@@ -76,7 +77,7 @@ public class LayoutUtils {

    public static void calculateFallbackTaskSize(Context context, DeviceProfile dp, Rect outRect) {
        float extraSpace;
        if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
        if (showOverviewActions(context)) {
            extraSpace = context.getResources()
                    .getDimensionPixelSize(R.dimen.overview_actions_height);
        } else {
@@ -91,7 +92,7 @@ public class LayoutUtils {
        float taskWidth, taskHeight, paddingHorz;
        Resources res = context.getResources();
        Rect insets = dp.getInsets();
        final boolean overviewActionsEnabled = ENABLE_OVERVIEW_ACTIONS.get();
        final boolean showLargeTaskSize = showOverviewActions(context);

        if (dp.isMultiWindowMode) {
            if (multiWindowStrategy == MULTI_WINDOW_STRATEGY_HALF_SCREEN) {
@@ -121,7 +122,7 @@ public class LayoutUtils {
            final int paddingResId;
            if (dp.isVerticalBarLayout()) {
                paddingResId = R.dimen.landscape_task_card_horz_space;
            } else if (overviewActionsEnabled && removeShelfFromOverview(context)) {
            } else if (showLargeTaskSize) {
                paddingResId = R.dimen.portrait_task_card_horz_space_big_overview;
            } else {
                paddingResId = R.dimen.portrait_task_card_horz_space;
@@ -130,7 +131,7 @@ public class LayoutUtils {
        }

        float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
        float paddingVert = overviewActionsEnabled && removeShelfFromOverview(context)
        float paddingVert = showLargeTaskSize
                ? 0 : res.getDimension(R.dimen.task_card_vert_space);

        // Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless
@@ -156,7 +157,7 @@ public class LayoutUtils {

    public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
        // Track the bottom of the window.
        if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
        if (showOverviewActions(context)) {
            Rect taskSize = new Rect();
            calculateLauncherTaskSize(context, dp, taskSize);
            return (dp.heightPx - taskSize.height()) / 2;
@@ -180,4 +181,8 @@ public class LayoutUtils {
            return srcHeight / targetHeight;
        }
    }

    private static boolean showOverviewActions(Context context) {
        return ENABLE_OVERVIEW_ACTIONS.get() && getMode(context) != TWO_BUTTONS;
    }
}
Loading