From 48b28027c069dfb1e14022515a876c9e04ac3340 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 27 Apr 2020 20:48:49 +0000 Subject: [PATCH] Revert "Hide shelf in 2-Button Landscape" This reverts commit 9b5795a57969e9dd5d108fcaf7890f9cb7fdb7e2. Reason for revert: b/155090034 Change-Id: If7decd54965a680d50e4474fb279ebe0002441bb --- .../quickstep/views/OverviewActionsView.java | 6 ++---- .../android/quickstep/views/RecentsView.java | 7 +------ .../quickstep/views/TaskThumbnailView.java | 1 - .../quickstep/SysUINavigationMode.java | 14 ++++---------- .../android/quickstep/util/LayoutUtils.java | 19 +++++++------------ .../quickstep/util/RecentsOrientedState.java | 6 +----- .../quickstep/views/ShelfScrimView.java | 2 +- .../launcher3/InsettableFrameLayout.java | 3 --- src/com/android/launcher3/Launcher.java | 1 + 9 files changed, 17 insertions(+), 42 deletions(-) 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 6e9ca23919..d160686f73 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 @@ -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.getMode; +import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; import android.util.AttributeSet; @@ -31,7 +31,6 @@ 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; @@ -119,8 +118,7 @@ public class OverviewActionsView extends FrameLayo protected void onAttachedToWindow() { super.onAttachedToWindow(); updateHiddenFlags(HIDDEN_DISABLED_FEATURE, !ENABLE_OVERVIEW_ACTIONS.get()); - updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, - getMode(getContext()) == SysUINavigationMode.Mode.TWO_BUTTONS); + updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, !removeShelfFromOverview(getContext())); } public void updateHiddenFlags(@ActionsHiddenFlags int visibilityFlags, boolean enable) { 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 7c257058d7..3b6fd13804 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 @@ -116,7 +116,6 @@ 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; @@ -801,14 +800,11 @@ public abstract class RecentsView 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, @@ -1573,7 +1569,6 @@ public abstract class RecentsView extends PagedView impl mActivity.getDragLayer().recreateControllers(); mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, touchRotation != 0 || launcherRotation != 0); - resetPaddingFromTaskSize(); requestLayout(); } } 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 b3d7f360e1..a05e0fa4fc 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 @@ -49,7 +49,6 @@ 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; diff --git a/quickstep/src/com/android/quickstep/SysUINavigationMode.java b/quickstep/src/com/android/quickstep/SysUINavigationMode.java index 0569828b89..c715c934dd 100644 --- a/quickstep/src/com/android/quickstep/SysUINavigationMode.java +++ b/quickstep/src/com/android/quickstep/SysUINavigationMode.java @@ -24,9 +24,7 @@ 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; @@ -130,14 +128,10 @@ public class SysUINavigationMode { } } - 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(); + /** @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 void dump(PrintWriter pw) { diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java index a2471d8241..4edf2fbab0 100644 --- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java +++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java @@ -16,8 +16,7 @@ package com.android.quickstep.util; import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; -import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; -import static com.android.quickstep.SysUINavigationMode.getMode; +import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -61,7 +60,7 @@ public class LayoutUtils { } else { Resources res = context.getResources(); - if (showOverviewActions(context)) { + if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) { //TODO: this needs to account for the swipe gesture height and accessibility // UI when shown. extraSpace = res.getDimensionPixelSize(R.dimen.overview_actions_height); @@ -77,7 +76,7 @@ public class LayoutUtils { public static void calculateFallbackTaskSize(Context context, DeviceProfile dp, Rect outRect) { float extraSpace; - if (showOverviewActions(context)) { + if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) { extraSpace = context.getResources() .getDimensionPixelSize(R.dimen.overview_actions_height); } else { @@ -92,7 +91,7 @@ public class LayoutUtils { float taskWidth, taskHeight, paddingHorz; Resources res = context.getResources(); Rect insets = dp.getInsets(); - final boolean showLargeTaskSize = showOverviewActions(context); + final boolean overviewActionsEnabled = ENABLE_OVERVIEW_ACTIONS.get(); if (dp.isMultiWindowMode) { if (multiWindowStrategy == MULTI_WINDOW_STRATEGY_HALF_SCREEN) { @@ -122,7 +121,7 @@ public class LayoutUtils { final int paddingResId; if (dp.isVerticalBarLayout()) { paddingResId = R.dimen.landscape_task_card_horz_space; - } else if (showLargeTaskSize) { + } else if (overviewActionsEnabled && removeShelfFromOverview(context)) { paddingResId = R.dimen.portrait_task_card_horz_space_big_overview; } else { paddingResId = R.dimen.portrait_task_card_horz_space; @@ -131,7 +130,7 @@ public class LayoutUtils { } float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin); - float paddingVert = showLargeTaskSize + float paddingVert = overviewActionsEnabled && removeShelfFromOverview(context) ? 0 : res.getDimension(R.dimen.task_card_vert_space); // Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless @@ -157,7 +156,7 @@ public class LayoutUtils { public static int getShelfTrackingDistance(Context context, DeviceProfile dp) { // Track the bottom of the window. - if (showOverviewActions(context)) { + if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) { Rect taskSize = new Rect(); calculateLauncherTaskSize(context, dp, taskSize); return (dp.heightPx - taskSize.height()) / 2; @@ -181,8 +180,4 @@ public class LayoutUtils { return srcHeight / targetHeight; } } - - private static boolean showOverviewActions(Context context) { - return ENABLE_OVERVIEW_ACTIONS.get() && getMode(context) != TWO_BUTTONS; - } } diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java index c6384d322b..74daeca33f 100644 --- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java +++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java @@ -25,7 +25,6 @@ import static android.view.Surface.ROTATION_90; import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; -import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.content.ContentResolver; @@ -50,7 +49,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Utilities; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.quickstep.SysUINavigationMode; import java.lang.annotation.Retention; import java.util.function.IntConsumer; @@ -156,9 +154,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre if (isFixedRotationTransformEnabled(context)) { mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_FLAG; } - // TODO(b/154665738): Determine if we need animation for 2 button mode or not - if (mOrientationListener.canDetectOrientation() - && SysUINavigationMode.getMode(context) != TWO_BUTTONS) { + if (mOrientationListener.canDetectOrientation()) { mFlags |= FLAG_ROTATION_WATCHER_SUPPORTED; } } diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index af77c62eff..f5498c9961 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -165,7 +165,7 @@ public class ShelfScrimView extends ScrimView if ((OVERVIEW.getVisibleElements(mLauncher) & ALL_APPS_HEADER_EXTRA) == 0) { mDragHandleProgress = 1; if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() - && SysUINavigationMode.removeShelfFromOverview(mLauncher)) { + && SysUINavigationMode.removeShelfFromOverview(context)) { // Fade in all apps background quickly to distinguish from swiping from nav bar. mMidAlpha = Themes.getAttrInteger(context, R.attr.allAppsInterimScrimAlpha); mMidProgress = OverviewState.getDefaultVerticalProgress(mLauncher); diff --git a/src/com/android/launcher3/InsettableFrameLayout.java b/src/com/android/launcher3/InsettableFrameLayout.java index 9a66d32524..faa18b8050 100644 --- a/src/com/android/launcher3/InsettableFrameLayout.java +++ b/src/com/android/launcher3/InsettableFrameLayout.java @@ -91,9 +91,6 @@ public class InsettableFrameLayout extends FrameLayout implements Insettable { @Override public void onViewAdded(View child) { super.onViewAdded(child); - if (!isAttachedToWindow()) { - return; - } setFrameLayoutChildInsets(child, mInsets, new Rect()); } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index b6e301863e..c4eab8fb49 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -18,6 +18,7 @@ package com.android.launcher3; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; + import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR;