Merge "Use displayId to determine CHANGE_ACTIVE_SCREEN" into sc-v2-dev
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 3f621fd..4b75db4 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.taskbar;
+import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y_LONG_CLICK;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK;
@@ -194,6 +195,14 @@
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 ||
(flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0 ||
(flags & FLAG_KEYGUARD_OCCLUDED) != 0));
+ // Translate back button to be at end/start of other buttons for keyguard
+ int navButtonSize = mContext.getResources().getDimensionPixelSize(
+ R.dimen.taskbar_nav_buttons_size);
+ mPropertyHolders.add(new StatePropertyHolder(
+ mBackButton, flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
+ || (flags & FLAG_KEYGUARD_VISIBLE) != 0,
+ VIEW_TRANSLATE_X, navButtonSize * (isRtl ? -2 : 2), 0));
+
// home and recents buttons
View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer,
@@ -235,6 +244,7 @@
}
mSysuiStateFlags = systemUiStateFlags;
+ // TODO(b/202218289) we're getting IME as not visible on lockscreen from system
updateStateForFlag(FLAG_IME_VISIBLE, isImeVisible);
updateStateForFlag(FLAG_SWITCHER_SUPPORTED, isImeSwitcherShowing);
updateStateForFlag(FLAG_A11Y_VISIBLE, a11yVisible);
@@ -337,6 +347,10 @@
return buttonView;
}
+ public void onDestroy() {
+ mPropertyHolders.clear();
+ }
+
private class RotationButtonImpl implements RotationButton {
private final ImageView mButton;
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index 6144881..e49c6ae 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -89,6 +89,7 @@
* Cleans up all controllers.
*/
public void onDestroy() {
+ navbarButtonsViewController.onDestroy();
uiController.onDestroy();
rotationButtonController.onDestroy();
taskbarDragLayerController.onDestroy();
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index 2e9d8bc..9d88956 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -96,7 +96,10 @@
@Override
public void onConfigurationChanged(Configuration newConfig) {
- if ((mOldConfig.diff(newConfig) & ActivityInfo.CONFIG_ASSETS_PATHS) != 0) {
+ int configDiff = mOldConfig.diff(newConfig);
+ int configsRequiringRecreate = ActivityInfo.CONFIG_ASSETS_PATHS
+ | ActivityInfo.CONFIG_LAYOUT_DIRECTION;
+ if ((configDiff & configsRequiringRecreate) != 0) {
// Color has changed, recreate taskbar to reload background color & icons.
recreateTaskbar();
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index 37a1674..308bca6 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -179,7 +179,7 @@
mAllowGoingDown = i == mRecentsView.getCurrentPage()
&& SysUINavigationMode.getMode(mActivity).hasGestures
&& (!mRecentsView.showAsGrid() || mTaskBeingDragged.isFocusedTask())
- && mRecentsView.isTaskSnapped(i);
+ && mRecentsView.isTaskInExpectedScrollPosition(i);
directionsToDetectScroll = mAllowGoingDown ? DIRECTION_BOTH : upDirection;
break;
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index 9ac00e8..c45159e 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -111,19 +111,30 @@
}
+ /**
+ * Does NOT add split options in the following scenarios:
+ * * The taskView to add split options is already showing split screen tasks
+ * * There aren't at least 2 tasks in overview to show split options for
+ * * The taskView to show split options for is the focused task AND we haven't started
+ * scrolling in overview (if we haven't scrolled, there's a split overview action so
+ * we don't need this menu option)
+ */
private static void addSplitOptions(List<SystemShortcut> outShortcuts,
BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
+ RecentsView recentsView = taskView.getRecentsView();
+ PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
int[] taskViewTaskIds = taskView.getTaskIds();
boolean taskViewHasMultipleTasks = taskViewTaskIds[0] != -1 &&
taskViewTaskIds[1] != -1;
- boolean notEnoughTasksToSplit = taskView.getRecentsView().getTaskViewCount() < 2;
+ boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2;
+ boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask();
+ boolean isTaskInExpectedScrollPosition =
+ recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
if (taskViewHasMultipleTasks || notEnoughTasksToSplit ||
- (deviceProfile.overviewShowAsGrid && taskView.isFocusedTask())) {
+ (isFocusedTask && isTaskInExpectedScrollPosition)) {
return;
}
- PagedOrientationHandler orientationHandler =
- taskView.getRecentsView().getPagedOrientationHandler();
List<SplitPositionOption> positions =
orientationHandler.getSplitPositionOptions(deviceProfile);
for (SplitPositionOption option : positions) {
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 796caa0..023a926 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1056,11 +1056,11 @@
}
/**
- * Returns true if the task is snapped.
+ * Returns true if the task is in expected scroll position.
*
* @param taskIndex the index of the task
*/
- public boolean isTaskSnapped(int taskIndex) {
+ public boolean isTaskInExpectedScrollPosition(int taskIndex) {
return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
}
@@ -1727,8 +1727,7 @@
if (showAsGrid()) {
TaskView focusedTaskView = getFocusedTaskView();
hiddenFocusedScroll = focusedTaskView == null
- || getScrollForPage(indexOfChild(focusedTaskView))
- != mOrientationHandler.getPrimaryScroll(this);
+ || !isTaskInExpectedScrollPosition(indexOfChild(focusedTaskView));
} else {
hiddenFocusedScroll = false;
}
@@ -4359,12 +4358,14 @@
protected int computeMinScroll() {
if (getTaskViewCount() > 0) {
int minScroll;
+ boolean isLandscapeGridSplit = mActivity.getDeviceProfile().isLandscape
+ && showAsGrid() && isSplitSelectionActive();
if (mIsRtl) {
// If we aren't showing the clear all button, use the rightmost task as the min
// scroll.
minScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
- if (showAsGrid() && isSplitSelectionActive()
+ if (isLandscapeGridSplit
&& mSplitSelectStateController.getActiveSplitStagePosition()
== SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) {
minScroll -= mSplitPlaceholderSize;
@@ -4373,7 +4374,8 @@
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
minScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
: 0);
- // TODO(b/200537659): Adjust according to mSplitPlaceholderSize.
+ // TODO(b/200537659): Adjust according to mSplitPlaceholderSize when
+ // isLandscapeGridSplit is true.
}
return minScroll;
}
@@ -4384,11 +4386,13 @@
protected int computeMaxScroll() {
if (getTaskViewCount() > 0) {
int maxScroll;
+ boolean isLandscapeGridSplit = mActivity.getDeviceProfile().isLandscape
+ && showAsGrid() && isSplitSelectionActive();
if (mIsRtl) {
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
maxScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
: 0);
- if (showAsGrid() && isSplitSelectionActive()
+ if (isLandscapeGridSplit
&& mSplitSelectStateController.getActiveSplitStagePosition()
== SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
maxScroll += mSplitPlaceholderSize;
@@ -4398,7 +4402,8 @@
// scroll.
maxScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
- // TODO(b/200537659): Adjust according to mSplitPlaceholderSize.
+ // TODO(b/200537659): Adjust according to mSplitPlaceholderSize when
+ // isLandscapeGridSplit is true.
}
return maxScroll;
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 0acafc0..a8878df 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -176,10 +176,6 @@
"Replace Smartspace with the enhanced version. "
+ "Ignored if ENABLE_SMARTSPACE_UNIVERSAL is enabled.");
- public static final BooleanFlag ENABLE_SMARTSPACE_FEEDBACK = getDebugFlag(
- "ENABLE_SMARTSPACE_FEEDBACK", false,
- "Adds a menu option to send feedback for Enhanced Smartspace.");
-
public static final BooleanFlag ENABLE_SMARTSPACE_DISMISS = getDebugFlag(
"ENABLE_SMARTSPACE_DISMISS", true,
"Adds a menu option to dismiss the current Enhanced Smartspace card.");
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 65dd8ea..d6e927b 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -46,7 +46,6 @@
import com.android.launcher3.DropTarget;
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
@@ -64,7 +63,6 @@
import com.android.launcher3.popup.PopupDataProvider.PopupDataChangeListener;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
-import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.ShortcutUtil;
@@ -83,7 +81,7 @@
*
* @param <T> The activity on with the popup shows
*/
-public class PopupContainerWithArrow<T extends StatefulActivity<LauncherState>>
+public class PopupContainerWithArrow<T extends BaseDraggingActivity>
extends ArrowPopup<T> implements DragSource, DragController.DragListener {
private final List<DeepShortcutView> mShortcuts = new ArrayList<>();