diff --git a/quickstep/res/layout/fallback_recents_activity.xml b/quickstep/res/layout/fallback_recents_activity.xml index 55400a7b24..a43296f602 100644 --- a/quickstep/res/layout/fallback_recents_activity.xml +++ b/quickstep/res/layout/fallback_recents_activity.xml @@ -33,6 +33,12 @@ android:layout_height="match_parent" android:clipChildren="false"> + + , mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed); if (swipeUpThresholdPassed) { - mActivity.getSystemUiController().updateUiState( - UI_STATE_OVERVIEW, mRecentsView.hasLightBackground()); + mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); } else { mActivity.getSystemUiController().updateUiState( - UI_STATE_OVERVIEW, centermostTaskFlags); + UI_STATE_FULLSCREEN_TASK, centermostTaskFlags); } } } diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 147297af23..7aa81d4819 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -15,10 +15,12 @@ */ package com.android.quickstep; +import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION; +import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.SysUINavigationMode.getMode; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; @@ -28,9 +30,11 @@ import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import android.animation.Animator; +import android.animation.ObjectAnimator; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; +import android.graphics.Color; import android.graphics.PointF; import android.graphics.Rect; import android.os.Build; @@ -51,6 +55,7 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.TaskbarController; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.WindowBounds; +import com.android.launcher3.views.ScrimView; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; @@ -344,14 +349,32 @@ public abstract class BaseActivityInterface { private Handler mUiHandler = new Handler(Looper.getMainLooper()); private RecentsDragLayer mDragLayer; + private ScrimView mScrimView; private FallbackRecentsView mFallbackRecentsView; private OverviewActionsView mActionsView; @@ -106,6 +109,7 @@ public final class RecentsActivity extends StatefulActivity { inflateRootView(R.layout.fallback_recents_activity); setContentView(getRootView()); mDragLayer = findViewById(R.id.drag_layer); + mScrimView = findViewById(R.id.scrim_view); mFallbackRecentsView = findViewById(R.id.overview_panel); mActionsView = findViewById(R.id.overview_actions_view); @@ -164,6 +168,10 @@ public final class RecentsActivity extends StatefulActivity { return mDragLayer; } + public ScrimView getScrimView() { + return mScrimView; + } + @Override public T getOverviewPanel() { return (T) mFallbackRecentsView; @@ -269,7 +277,7 @@ public final class RecentsActivity extends StatefulActivity { setupViews(); getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, - mFallbackRecentsView.hasLightBackground()); + Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText)); ACTIVITY_TRACKER.handleCreate(this); } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 8962ec93c8..7067dbcc0d 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -20,6 +20,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MO import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; @@ -95,5 +96,8 @@ public class FallbackRecentsStateController implements StateHandler { private static final int FLAG_FULL_SCREEN = BaseState.getFlag(2); private static final int FLAG_OVERVIEW_ACTIONS = BaseState.getFlag(3); private static final int FLAG_SHOW_AS_GRID = BaseState.getFlag(4); + private static final int FLAG_SCRIM = BaseState.getFlag(5); public static final RecentsState DEFAULT = new RecentsState(0, - FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID); + FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID | FLAG_SCRIM); public static final RecentsState MODAL_TASK = new ModalState(1, FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL - | FLAG_SHOW_AS_GRID); + | FLAG_SHOW_AS_GRID | FLAG_SCRIM); public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2, FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN); public static final RecentsState HOME = new RecentsState(3, 0); @@ -103,6 +107,14 @@ public class RecentsState implements BaseState { return hasFlag(FLAG_OVERVIEW_ACTIONS); } + /** + * For this state, what color scrim should be drawn behind overview. + */ + public int getScrimColor(RecentsActivity activity) { + return hasFlag(FLAG_SCRIM) ? Themes.getAttrColor(activity, R.attr.overviewScrimColor) + : Color.TRANSPARENT; + } + public float[] getOverviewScaleAndOffset(RecentsActivity activity) { return new float[] { NO_SCALE, NO_OFFSET }; } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 596f74688d..79dc6a9543 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -45,7 +45,7 @@ import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.launcher3.touch.PagedOrientationHandler.CANVAS_TRANSLATE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; -import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; +import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION; @@ -450,7 +450,6 @@ public abstract class RecentsView UPDATE_SYSUI_FLAGS_THRESHOLD) { mActivity.getSystemUiController().updateUiState( - UI_STATE_OVERVIEW, targetSysUiFlags); + UI_STATE_FULLSCREEN_TASK, targetSysUiFlags); } else { - mActivity.getSystemUiController().updateUiState( - UI_STATE_OVERVIEW, hasLightBackground()); + mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); } // Passing the threshold from taskview to fullscreen app will vibrate diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java index f77f7e8454..f64ce5c753 100644 --- a/src/com/android/launcher3/BaseActivity.java +++ b/src/com/android/launcher3/BaseActivity.java @@ -17,7 +17,7 @@ package com.android.launcher3; import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS; -import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; +import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -39,6 +39,7 @@ import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.util.SystemUiController; import com.android.launcher3.util.ViewCache; import com.android.launcher3.views.ActivityContext; +import com.android.launcher3.views.ScrimView; import java.io.PrintWriter; import java.lang.annotation.Retention; @@ -157,6 +158,10 @@ public abstract class BaseActivity extends Activity implements ActivityContext { return mSystemUiController; } + public ScrimView getScrimView() { + return null; + } + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); @@ -197,7 +202,7 @@ public abstract class BaseActivity extends Activity implements ActivityContext { // Reset the overridden sysui flags used for the task-swipe launch animation, this is a // catch all for if we do not get resumed (and therefore not paused below) - getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0); + getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); } @Override @@ -209,7 +214,7 @@ public abstract class BaseActivity extends Activity implements ActivityContext { // here instead of at the end of the animation because the start of the new activity does // not happen immediately, which would cause us to reset to launcher's sysui flags and then // back to the new app (causing a flash) - getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0); + getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); } @Override diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index a54c791aff..f640118552 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1426,6 +1426,7 @@ public class Launcher extends StatefulActivity implements Launche return mDropTargetBar; } + @Override public ScrimView getScrimView() { return mScrimView; } diff --git a/src/com/android/launcher3/util/SystemUiController.java b/src/com/android/launcher3/util/SystemUiController.java index 50166c3888..630df7e46b 100644 --- a/src/com/android/launcher3/util/SystemUiController.java +++ b/src/com/android/launcher3/util/SystemUiController.java @@ -30,7 +30,7 @@ public class SystemUiController { public static final int UI_STATE_BASE_WINDOW = 0; public static final int UI_STATE_SCRIM_VIEW = 1; public static final int UI_STATE_WIDGET_BOTTOM_SHEET = 2; - public static final int UI_STATE_OVERVIEW = 3; + public static final int UI_STATE_FULLSCREEN_TASK = 3; public static final int UI_STATE_ALLAPPS = 4; public static final int FLAG_LIGHT_NAV = 1 << 0; diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java index 722f57837a..5387a3ed17 100644 --- a/src/com/android/launcher3/views/ScrimView.java +++ b/src/com/android/launcher3/views/ScrimView.java @@ -25,8 +25,8 @@ import android.view.View; import androidx.core.graphics.ColorUtils; +import com.android.launcher3.BaseActivity; import com.android.launcher3.Insettable; -import com.android.launcher3.Launcher; import com.android.launcher3.util.SystemUiController; /** @@ -82,7 +82,7 @@ public class ScrimView extends View implements Insettable { private SystemUiController getSystemUiController() { if (mSystemUiController == null) { - mSystemUiController = Launcher.getLauncher(getContext()).getSystemUiController(); + mSystemUiController = BaseActivity.fromContext(getContext()).getSystemUiController(); } return mSystemUiController; }