From a547b781ee5a72fcfb8c672df342a86cf54cf800 Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Mon, 29 Mar 2021 16:52:26 -0700 Subject: [PATCH] Overview - update UI to use solid color scrim. Also required updates to colors and status bar icons to match with new color. Bug: 179922117 Test: local build and flash on two devices Change-Id: Ibec54107f52c01f125e6d100abe32434f2067b71 --- quickstep/res/values/styles.xml | 2 +- .../uioverrides/states/OverviewState.java | 2 +- .../QuickSwitchTouchController.java | 7 +++-- .../android/quickstep/AbsSwipeUpHandler.java | 10 +++++-- .../android/quickstep/RecentsActivity.java | 3 +- .../quickstep/SwipeUpAnimationLogic.java | 13 ++------- .../quickstep/util/TaskViewSimulator.java | 3 +- .../quickstep/util/TransformParams.java | 14 --------- .../android/quickstep/views/RecentsView.java | 29 ++++++++++++++++--- res/color/overview_button.xml | 4 +-- .../launcher3/graphics/OverviewScrim.java | 11 ++++++- 11 files changed, 55 insertions(+), 43 deletions(-) diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml index df089f6738..e56397aa94 100644 --- a/quickstep/res/values/styles.xml +++ b/quickstep/res/values/styles.xml @@ -81,7 +81,7 @@ parent="@android:style/Widget.DeviceDefault.Button.Borderless"> @color/overview_button @color/overview_button - ?attr/workspaceTextColor + ?android:attr/textColorPrimary 8dp false diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 43e70a3923..b269901a0b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -105,7 +105,7 @@ public class OverviewState extends LauncherState { @Override public float getOverviewScrimAlpha(Launcher launcher) { - return 0.5f; + return 1f; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index fc9e1bbfe5..a4518bda85 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -137,14 +137,17 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll private void updateFullscreenProgress(float progress) { mOverviewPanel.setFullscreenProgress(progress); - int sysuiFlags = 0; if (progress > UPDATE_SYSUI_FLAGS_THRESHOLD) { + int sysuiFlags = 0; TaskView tv = mOverviewPanel.getTaskViewAt(0); if (tv != null) { sysuiFlags = tv.getThumbnail().getSysUiStatusNavFlags(); } + mLauncher.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags); + } else { + mLauncher.getSystemUiController().updateUiState( + UI_STATE_OVERVIEW, mOverviewPanel.hasLightBackground()); } - mLauncher.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags); } @Override diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 1a5f9c221e..6394131091 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -91,7 +91,6 @@ import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; -import com.android.quickstep.inputconsumers.OverviewInputConsumer; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; @@ -654,8 +653,13 @@ public abstract class AbsSwipeUpHandler, || (quickswitchThresholdPassed && centermostTaskFlags != 0)); mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed); - int sysuiFlags = swipeUpThresholdPassed ? 0 : centermostTaskFlags; - mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags); + if (swipeUpThresholdPassed) { + mActivity.getSystemUiController().updateUiState( + UI_STATE_OVERVIEW, mRecentsView.hasLightBackground()); + } else { + mActivity.getSystemUiController().updateUiState( + UI_STATE_OVERVIEW, centermostTaskFlags); + } } } diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index d3ed791b40..1340abb6ab 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -56,7 +56,6 @@ import com.android.launcher3.util.ActivityOptionsWrapper; import com.android.launcher3.util.ActivityTracker; import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.SystemUiController; -import com.android.launcher3.util.Themes; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.fallback.FallbackRecentsStateController; import com.android.quickstep.fallback.FallbackRecentsView; @@ -267,7 +266,7 @@ public final class RecentsActivity extends StatefulActivity { setupViews(); getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, - Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText)); + mFallbackRecentsView.hasLightBackground()); ACTIVITY_TRACKER.handleCreate(this); } diff --git a/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java index f4b8b62c6d..a8c09dc8fa 100644 --- a/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java +++ b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java @@ -29,7 +29,6 @@ import androidx.annotation.NonNull; import androidx.annotation.UiThread; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; @@ -67,8 +66,6 @@ public abstract class SwipeUpAnimationLogic { // How much further we can drag past recents, as a factor of mTransitionDragLength. protected float mDragLengthFactor = 1; - protected final float mMaxShadowRadius; - protected AnimatorControllerWithResistance mWindowTransitionController; public SwipeUpAnimationLogic(Context context, RecentsAnimationDeviceState deviceState, @@ -82,9 +79,6 @@ public abstract class SwipeUpAnimationLogic { mTaskViewSimulator.getOrientationState().update( mDeviceState.getRotationTouchHelper().getCurrentActiveRotation(), mDeviceState.getRotationTouchHelper().getDisplayRotation()); - - mMaxShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.max_shadow_radius); - mTransformParams.setShadowRadius(mMaxShadowRadius); } protected void initTransitionEndpoints(DeviceProfile dp) { @@ -271,11 +265,9 @@ public abstract class SwipeUpAnimationLogic { mMatrix.setRectToRect(mCropRectF, mWindowCurrentRect, ScaleToFit.FILL); float cornerRadius = Utilities.mapRange(progress, mStartRadius, mEndRadius); - float shadowRadius = Utilities.mapRange(progress, mMaxShadowRadius, 0); mTransformParams .setTargetAlpha(getWindowAlpha(progress)) - .setCornerRadius(cornerRadius) - .setShadowRadius(shadowRadius); + .setCornerRadius(cornerRadius); mTransformParams.applySurfaceParams(mTransformParams.createSurfaceParams(this)); mAnimationFactory.update(currentRect, progress, mMatrix.mapRadius(cornerRadius)); @@ -286,8 +278,7 @@ public abstract class SwipeUpAnimationLogic { Builder builder, RemoteAnimationTargetCompat app, TransformParams params) { builder.withMatrix(mMatrix) .withWindowCrop(mCropRect) - .withCornerRadius(params.getCornerRadius()) - .withShadowRadius(app.isTranslucent ? 0 : params.getShadowRadius()); + .withCornerRadius(params.getCornerRadius()); } @Override diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 6cfe3029d8..3c8a12c876 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -330,8 +330,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { Builder builder, RemoteAnimationTargetCompat app, TransformParams params) { builder.withMatrix(mMatrix) .withWindowCrop(mTmpCropRect) - .withCornerRadius(getCurrentCornerRadius()) - .withShadowRadius(app.isTranslucent ? 0 : params.getShadowRadius()); + .withCornerRadius(getCurrentCornerRadius()); if (LIVE_TILE.get() && params.getRecentsSurface() != null) { // When relativeLayer = 0, it reverts the surfaces back to the original order. diff --git a/quickstep/src/com/android/quickstep/util/TransformParams.java b/quickstep/src/com/android/quickstep/util/TransformParams.java index cdf5163f59..756331dcdf 100644 --- a/quickstep/src/com/android/quickstep/util/TransformParams.java +++ b/quickstep/src/com/android/quickstep/util/TransformParams.java @@ -57,7 +57,6 @@ public class TransformParams { private float mProgress; private float mTargetAlpha; private float mCornerRadius; - private float mShadowRadius; private RemoteAnimationTargets mTargetSet; private SurfaceTransactionApplier mSyncTransactionApplier; private SurfaceControl mRecentsSurface; @@ -69,7 +68,6 @@ public class TransformParams { mProgress = 0; mTargetAlpha = 1; mCornerRadius = -1; - mShadowRadius = 0; } /** @@ -92,14 +90,6 @@ public class TransformParams { return this; } - /** - * Sets the shadow radius of the transformed window, in pixels. - */ - public TransformParams setShadowRadius(float shadowRadius) { - mShadowRadius = shadowRadius; - return this; - } - /** * Specifies the alpha of the transformed window. Default is 1. */ @@ -207,10 +197,6 @@ public class TransformParams { return mCornerRadius; } - public float getShadowRadius() { - return mShadowRadius; - } - public SurfaceControl getRecentsSurface() { return mRecentsSurface; } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index a35580f2bb..7a1076c620 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -439,6 +439,7 @@ public abstract class RecentsView extends PagedView private boolean mRunningTaskIconScaledDown = false; + private final boolean mHasLightBackground; private boolean mOverviewStateEnabled; private boolean mHandleTaskStackChanges; private boolean mSwipeDownShouldLaunchApp; @@ -570,6 +571,8 @@ public abstract class RecentsView extends PagedView mLiveTileTaskViewSimulator.recentsViewScale.value = 1; mLiveTileTaskViewSimulator.setOrientationState(mOrientationState); mLiveTileTaskViewSimulator.setDrawsBelowRecents(true); + + mHasLightBackground = Themes.getAttrBoolean(mActivity, android.R.attr.isLightTheme); } public OverScroller getScroller() { @@ -847,6 +850,13 @@ public abstract class RecentsView extends PagedView cancelSplitSelect(false); } } + + if (enabled) { + mActivity.getSystemUiController().updateUiState( + UI_STATE_OVERVIEW, hasLightBackground()); + } else { + mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0); + } } public void onDigitalWellbeingToastShown() { @@ -2515,6 +2525,14 @@ public abstract class RecentsView extends PagedView } } + /** + * True if the background scrim of the recents view is light colored and the foreground elements + * should use dark colors. + */ + public boolean hasLightBackground() { + return mHasLightBackground; + } + public void initiateSplitSelect(TaskView taskView, SplitPositionOption splitPositionOption) { mSplitHiddenTaskView = taskView; mSplitPlaceholderView.getSplitController().setInitialTaskSelect(taskView, @@ -2759,10 +2777,13 @@ public abstract class RecentsView extends PagedView progressAnim.addUpdateListener(animator -> { // Once we pass a certain threshold, update the sysui flags to match the target // tasks' flags - mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, - animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD - ? targetSysUiFlags - : 0); + if (animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD) { + mActivity.getSystemUiController().updateUiState( + UI_STATE_OVERVIEW, targetSysUiFlags); + } else { + mActivity.getSystemUiController().updateUiState( + UI_STATE_OVERVIEW, hasLightBackground()); + } // Passing the threshold from taskview to fullscreen app will vibrate final boolean passed = animator.getAnimatedFraction() >= diff --git a/res/color/overview_button.xml b/res/color/overview_button.xml index 6ac36bf5df..aa48b78604 100644 --- a/res/color/overview_button.xml +++ b/res/color/overview_button.xml @@ -2,10 +2,10 @@ \ No newline at end of file diff --git a/src/com/android/launcher3/graphics/OverviewScrim.java b/src/com/android/launcher3/graphics/OverviewScrim.java index 53303dbbe5..7d52744b44 100644 --- a/src/com/android/launcher3/graphics/OverviewScrim.java +++ b/src/com/android/launcher3/graphics/OverviewScrim.java @@ -25,6 +25,10 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.android.launcher3.R; +import com.android.launcher3.uioverrides.WallpaperColorInfo; +import com.android.launcher3.util.Themes; + /** * View scrim which draws behind overview (recent apps). */ @@ -52,7 +56,7 @@ public class OverviewScrim extends Scrim { public OverviewScrim(View view) { super(view); - onExtractedColorsChanged(mWallpaperColorInfo); + mScrimColor = Themes.getAttrColor(view.getContext(), R.attr.allAppsScrimColor); } /** @@ -74,6 +78,11 @@ public class OverviewScrim extends Scrim { } } + @Override + public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) { + // No super, don't respond to wallpaper colors, follow device ones instead + } + /** * @return The view to draw the scrim behind, or null if all visible views should be scrimmed. */