Merge changes from topic "presubmit-am-66c2d088f05444b5984eb37e35ba24a0" into tm-mainline-prod
* changes:
[automerge] Implement splitting from Taskbar long-press 2p: abdf25d226
Implement splitting from Taskbar long-press
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 8e5839c..6b15807 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -58,6 +58,7 @@
HIDDEN_NON_ZERO_ROTATION,
HIDDEN_NO_TASKS,
HIDDEN_NO_RECENTS,
+ HIDDEN_FOCUSED_SCROLL,
HIDDEN_SPLIT_SCREEN})
@Retention(RetentionPolicy.SOURCE)
public @interface ActionsHiddenFlags { }
@@ -65,7 +66,8 @@
public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 0;
public static final int HIDDEN_NO_TASKS = 1 << 1;
public static final int HIDDEN_NO_RECENTS = 1 << 2;
- public static final int HIDDEN_SPLIT_SCREEN = 1 << 3;
+ public static final int HIDDEN_FOCUSED_SCROLL = 1 << 3;
+ public static final int HIDDEN_SPLIT_SCREEN = 1 << 4;
@IntDef(flag = true, value = {
DISABLED_SCROLLING,
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 52aad27..6859259 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -376,8 +376,6 @@
// OverScroll constants
private static final int OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION = 270;
- private static final int DEFAULT_ACTIONS_VIEW_ALPHA_ANIMATION_DURATION = 300;
-
private static final int DISMISS_TASK_DURATION = 300;
private static final int ADDITION_TASK_DURATION = 200;
private static final float INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET = 0.55f;
@@ -651,8 +649,6 @@
private TaskView mMovingTaskView;
private OverviewActionsView mActionsView;
- private ObjectAnimator mActionsViewAlphaAnimator;
- private float mActionsViewAlphaAnimatorFinalValue;
private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
new MultiWindowModeChangedListener() {
@@ -1138,11 +1134,6 @@
return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
}
- private boolean isFocusedTaskInExpectedScrollPosition() {
- TaskView focusedTask = getFocusedTaskView();
- return focusedTask != null && isTaskInExpectedScrollPosition(indexOfChild(focusedTask));
- }
-
/**
* Returns a {@link TaskView} that has taskId matching {@code taskId} or null if no match.
*/
@@ -1189,15 +1180,13 @@
@Override
protected void onPageBeginTransition() {
super.onPageBeginTransition();
- if (!mActivity.getDeviceProfile().isTablet) {
- mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, true);
- }
+ mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, true);
}
@Override
protected void onPageEndTransition() {
super.onPageEndTransition();
- if (isClearAllHidden() && !mActivity.getDeviceProfile().isTablet) {
+ if (isClearAllHidden()) {
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
}
if (getNextPage() > 0) {
@@ -1798,24 +1787,16 @@
}
private void updateActionsViewFocusedScroll() {
+ boolean hiddenFocusedScroll;
if (showAsGrid()) {
- float actionsViewAlphaValue = isFocusedTaskInExpectedScrollPosition() ? 1 : 0;
- // If animation is already in progress towards the same end value, do not restart.
- if (mActionsViewAlphaAnimator == null || !mActionsViewAlphaAnimator.isStarted()
- || (mActionsViewAlphaAnimator.isStarted()
- && mActionsViewAlphaAnimatorFinalValue != actionsViewAlphaValue)) {
- animateActionsViewAlpha(actionsViewAlphaValue,
- DEFAULT_ACTIONS_VIEW_ALPHA_ANIMATION_DURATION);
- }
+ TaskView focusedTaskView = getFocusedTaskView();
+ hiddenFocusedScroll = focusedTaskView == null
+ || !isTaskInExpectedScrollPosition(indexOfChild(focusedTaskView));
+ } else {
+ hiddenFocusedScroll = false;
}
- }
-
- private void animateActionsViewAlpha(float alphaValue, long duration) {
- mActionsViewAlphaAnimator = ObjectAnimator.ofFloat(
- mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, alphaValue);
- mActionsViewAlphaAnimatorFinalValue = alphaValue;
- mActionsViewAlphaAnimator.setDuration(duration);
- mActionsViewAlphaAnimator.start();
+ mActionsView.updateHiddenFlags(OverviewActionsView.HIDDEN_FOCUSED_SCROLL,
+ hiddenFocusedScroll);
}
/**
@@ -2346,9 +2327,10 @@
}
private void animateActionsViewIn() {
- if (!showAsGrid() || isFocusedTaskInExpectedScrollPosition()) {
- animateActionsViewAlpha(1, TaskView.SCALE_ICON_DURATION);
- }
+ ObjectAnimator anim = ObjectAnimator.ofFloat(
+ mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, 0, 1);
+ anim.setDuration(TaskView.SCALE_ICON_DURATION);
+ anim.start();
}
public void animateUpTaskIconScale() {
@@ -3284,7 +3266,7 @@
// Update various scroll-dependent UI.
dispatchScrollChanged();
updateActionsViewFocusedScroll();
- if (isClearAllHidden() && !mActivity.getDeviceProfile().isTablet) {
+ if (isClearAllHidden()) {
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING,
false);
}
diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml
index f1af348..dd201e5 100644
--- a/res/xml/device_profiles.xml
+++ b/res/xml/device_profiles.xml
@@ -145,39 +145,22 @@
launcher:numFolderColumns="3"
launcher:numHotseatIcons="6"
launcher:numAllAppsColumns="6"
- launcher:isScalable="true"
- launcher:devicePaddingId="@xml/paddings_6x5"
launcher:dbFile="launcher_6_by_5.db"
launcher:defaultLayoutId="@xml/default_workspace_6x5"
- launcher:deviceCategory="tablet">
+ launcher:deviceCategory="tablet" >
<display-option
launcher:name="Tablet"
launcher:minWidthDps="900"
launcher:minHeightDps="820"
- launcher:minCellHeight="120"
- launcher:minCellWidth="102"
- launcher:minCellHeightLandscape="104"
- launcher:minCellWidthLandscape="120"
+ launcher:minCellHeight="104"
+ launcher:minCellWidth="80"
launcher:iconImageSize="60"
launcher:iconTextSize="14"
- launcher:borderSpaceHorizontal="16"
- launcher:borderSpaceVertical="64"
- launcher:borderSpaceLandscapeHorizontal="64"
- launcher:borderSpaceLandscapeVertical="16"
- launcher:horizontalMargin="54"
- launcher:horizontalMarginLandscape="120"
- launcher:allAppsCellWidth="96"
- launcher:allAppsCellHeight="142"
- launcher:allAppsCellWidthLandscape="126"
- launcher:allAppsCellHeightLandscape="126"
+ launcher:borderSpace="16"
launcher:allAppsIconSize="60"
launcher:allAppsIconTextSize="14"
- launcher:allAppsBorderSpaceHorizontal="8"
- launcher:allAppsBorderSpaceVertical="16"
- launcher:allAppsBorderSpaceLandscape="16"
- launcher:hotseatBorderSpace="58"
- launcher:hotseatBorderSpaceLandscape="50.4"
+ launcher:allAppsBorderSpace="16"
launcher:canBeDefault="true" />
</grid-option>
diff --git a/res/xml/paddings_6x5.xml b/res/xml/paddings_6x5.xml
deleted file mode 100644
index a958ec7..0000000
--- a/res/xml/paddings_6x5.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2022 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<device-paddings xmlns:launcher="http://schemas.android.com/apk/res-auto" >
-
- <!-- Some non default screen sizes -->
- <device-padding
- launcher:maxEmptySpace="30dp">
- <workspaceTopPadding
- launcher:a="0.34"
- launcher:b="0"/>
- <workspaceBottomPadding
- launcher:a="0.26"
- launcher:b="0"/>
- <hotseatBottomPadding
- launcher:a="0.4"
- launcher:b="0"/>
- </device-padding>
-
- <device-padding
- launcher:maxEmptySpace="80dp">
- <workspaceTopPadding
- launcher:a="0"
- launcher:b="20dp"/>
- <workspaceBottomPadding
- launcher:a="0.4"
- launcher:b="0"
- launcher:c="20dp"/>
- <hotseatBottomPadding
- launcher:a="0.6"
- launcher:b="0"
- launcher:c="20dp"/>
- </device-padding>
-
- <device-padding
- launcher:maxEmptySpace="280dp">
- <workspaceTopPadding
- launcher:a="0"
- launcher:b="112dp"/>
- <workspaceBottomPadding
- launcher:a="0.4"
- launcher:b="0"
- launcher:c="112dp"/>
- <hotseatBottomPadding
- launcher:a="0.6"
- launcher:b="0"
- launcher:c="112dp"/>
- </device-padding>
-
- <device-padding
- launcher:maxEmptySpace="9999dp">
- <workspaceTopPadding
- launcher:a="0.40"
- launcher:c="36dp"/>
- <workspaceBottomPadding
- launcher:a="0.60"
- launcher:c="36dp"/>
- <hotseatBottomPadding
- launcher:a="0"
- launcher:b="36dp"/>
- </device-padding>
-</device-paddings>
\ No newline at end of file
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 847a9bf..3cc8a81 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -237,8 +237,8 @@
/**
* Default launcher application.
*/
-public class Launcher extends StatefulActivity<LauncherState> implements LauncherExterns,
- Callbacks, InvariantDeviceProfile.OnIDPChangeListener,
+public class Launcher extends StatefulActivity<LauncherState>
+ implements LauncherExterns, Callbacks, InvariantDeviceProfile.OnIDPChangeListener,
PluginListener<LauncherOverlayPlugin>, LauncherOverlayCallbacks {
public static final String TAG = "Launcher";
@@ -304,7 +304,7 @@
private Configuration mOldConfig;
@Thunk
- Workspace mWorkspace;
+ Workspace<?> mWorkspace;
@Thunk
DragLayer mDragLayer;
private DragController mDragController;
@@ -1527,7 +1527,7 @@
return mAppsView;
}
- public Workspace getWorkspace() {
+ public Workspace<?> getWorkspace() {
return mWorkspace;
}
@@ -3234,11 +3234,12 @@
/** Pauses view updates that should not be run during the app launch animation. */
public void pauseExpensiveViewUpdates() {
// Pause page indicator animations as they lead to layer trashing.
- getWorkspace().getPageIndicator().pauseAnimations();
+ mWorkspace.getPageIndicator().pauseAnimations();
}
/** Resumes view updates at the end of the app launch animation. */
public void resumeExpensiveViewUpdates() {
- getWorkspace().getPageIndicator().skipAnimationsToEnd();
+ mWorkspace.getPageIndicator().skipAnimationsToEnd();
}
+
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index ea9b69c..61090e7 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -92,7 +92,7 @@
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.SearchActionItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
-import com.android.launcher3.pageindicators.WorkspacePageIndicator;
+import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StateManager.StateHandler;
@@ -134,8 +134,9 @@
* The workspace is a wide area with a wallpaper and a finite number of pages.
* Each page contains a number of icons, folders or widgets the user can
* interact with. A workspace is meant to be used with a fixed width only.
+ * @param <T> Class that extends View and PageIndicator
*/
-public class Workspace extends PagedView<WorkspacePageIndicator>
+public class Workspace<T extends View & PageIndicator> extends PagedView<T>
implements DropTarget, DragSource, View.OnTouchListener,
DragController.DragListener, Insettable, StateHandler<LauncherState>,
WorkspaceLayoutManager, LauncherBindableItemsContainer {
diff --git a/src/com/android/launcher3/pageindicators/PageIndicator.java b/src/com/android/launcher3/pageindicators/PageIndicator.java
index 8fafb6f..5967be7 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicator.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicator.java
@@ -25,4 +25,24 @@
void setActiveMarker(int activePage);
void setMarkersCount(int numMarkers);
+
+ /**
+ * Sets the flag if the Page Indicator should autohide.
+ * @param shouldAutoHide
+ */
+ default void setShouldAutoHide(boolean shouldAutoHide) {
+ //No-op by default
+ }
+ /**
+ * Pauses all currently running animations.
+ */
+ default void pauseAnimations() {
+ //No-op by default
+ }
+ /**
+ * Force-ends all currently running or paused animations.
+ */
+ default void skipAnimationsToEnd() {
+ //No-op by default
+ }
}
diff --git a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
index c685891..1681ea5 100644
--- a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
+++ b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
@@ -187,6 +187,7 @@
}
}
+ @Override
public void setShouldAutoHide(boolean shouldAutoHide) {
mShouldAutoHide = shouldAutoHide;
if (shouldAutoHide && mLinePaint.getAlpha() > 0) {
@@ -236,6 +237,7 @@
/**
* Pauses all currently running animations.
*/
+ @Override
public void pauseAnimations() {
for (int i = 0; i < ANIMATOR_COUNT; i++) {
if (mAnimators[i] != null) {
@@ -247,6 +249,7 @@
/**
* Force-ends all currently running or paused animations.
*/
+ @Override
public void skipAnimationsToEnd() {
for (int i = 0; i < ANIMATOR_COUNT; i++) {
if (mAnimators[i] != null) {