Merge "launcher: create paddings for foldables" into sc-v2-dev
diff --git a/go/quickstep/res/layout/overview_actions_container.xml b/go/quickstep/res/layout/overview_actions_container.xml
index 710e2e0..196541f 100644
--- a/go/quickstep/res/layout/overview_actions_container.xml
+++ b/go/quickstep/res/layout/overview_actions_container.xml
@@ -120,16 +120,6 @@
android:layout_height="1dp"
android:layout_weight="1"
android:visibility="gone" />
-
- <Button
- android:id="@+id/action_share"
- style="@style/GoOverviewActionButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:drawableStart="@drawable/ic_share"
- android:text="@string/action_share"
- android:theme="@style/ThemeControlHighlightWorkspaceColor"
- android:visibility="gone" />
</LinearLayout>
</com.android.quickstep.views.GoOverviewActionsView>
\ No newline at end of file
diff --git a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
index 97ba590..492611f 100644
--- a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
@@ -117,7 +117,7 @@
*/
public void updateOrientationState(RecentsOrientedState orientedState) {
// dismiss tooltip
- boolean canLauncherRotate = orientedState.canRecentsActivityRotate();
+ boolean canLauncherRotate = orientedState.isRecentsActivityRotationAllowed();
if (mArrowTipView != null && !canLauncherRotate) {
mArrowTipView.close(/* animate= */ false);
}
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index bc8bd3a..124cd57 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -100,7 +100,6 @@
<activity android:name="com.android.quickstep.interaction.GestureSandboxActivity"
android:autoRemoveFromRecents="true"
android:excludeFromRecents="true"
- android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="com.android.quickstep.action.GESTURE_SANDBOX"/>
diff --git a/quickstep/res/drawable/default_sandbox_app_previous_task_thumbnail.xml b/quickstep/res/drawable/default_sandbox_app_previous_task_thumbnail.xml
deleted file mode 100644
index 9c95497..0000000
--- a/quickstep/res/drawable/default_sandbox_app_previous_task_thumbnail.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2020 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.
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <solid android:color="@color/gesture_tutorial_fake_previous_task_view_color" />
-</shape>
diff --git a/quickstep/res/layout/gesture_tutorial_fragment.xml b/quickstep/res/layout/gesture_tutorial_fragment.xml
index cfb3eb0..0f01190 100644
--- a/quickstep/res/layout/gesture_tutorial_fragment.xml
+++ b/quickstep/res/layout/gesture_tutorial_fragment.xml
@@ -41,13 +41,54 @@
android:layout_height="20dp"
android:visibility="invisible" />
- <View
+ <com.android.quickstep.interaction.AnimatedTaskView
android:id="@+id/gesture_tutorial_fake_previous_task_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleX="0.98"
android:scaleY="0.98"
- android:visibility="invisible" />
+ android:visibility="invisible">
+
+ <View
+ android:id="@+id/full_task_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="invisible"
+
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/top_task_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:visibility="invisible"
+ android:layout_marginBottom="@dimen/gesture_tutorial_multi_row_task_view_spacing"
+
+ app:cardElevation="0dp"
+ app:cardCornerRadius="@dimen/gesture_tutorial_small_task_view_corner_radius"
+ app:layout_constraintVertical_chainStyle="spread"
+ app:layout_constraintTop_toTopOf="@id/full_task_view"
+ app:layout_constraintBottom_toTopOf="@id/bottom_task_view"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/bottom_task_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:visibility="invisible"
+
+ app:cardElevation="0dp"
+ app:cardCornerRadius="@dimen/gesture_tutorial_small_task_view_corner_radius"
+ app:layout_constraintTop_toBottomOf="@id/top_task_view"
+ app:layout_constraintBottom_toBottomOf="@id/full_task_view"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ </com.android.quickstep.interaction.AnimatedTaskView>
<FrameLayout
android:id="@+id/gesture_tutorial_fake_task_view"
diff --git a/quickstep/res/layout/gesture_tutorial_mock_conversation.xml b/quickstep/res/layout/gesture_tutorial_mock_conversation.xml
index 89973d3..9951663 100644
--- a/quickstep/res/layout/gesture_tutorial_mock_conversation.xml
+++ b/quickstep/res/layout/gesture_tutorial_mock_conversation.xml
@@ -118,19 +118,17 @@
<androidx.cardview.widget.CardView
android:id="@+id/reply_icon_1"
- android:layout_width="0dp"
- android:layout_height="0dp"
+ android:layout_width="44dp"
+ android:layout_height="44dp"
android:layout_marginBottom="32dp"
android:layout_marginStart="26dp"
- android:layout_marginEnd="342dp"
app:cardElevation="0dp"
app:cardCornerRadius="100dp"
app:cardBackgroundColor="@color/mock_conversation_profile_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toTopOf="@id/message_2"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent"/>
+ app:layout_constraintStart_toStartOf="parent"/>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
@@ -178,19 +176,17 @@
<androidx.cardview.widget.CardView
android:id="@+id/reply_icon_2"
- android:layout_width="0dp"
- android:layout_height="0dp"
+ android:layout_width="44dp"
+ android:layout_height="44dp"
android:layout_marginBottom="32dp"
android:layout_marginStart="26dp"
- android:layout_marginEnd="342dp"
app:cardElevation="0dp"
app:cardCornerRadius="100dp"
app:cardBackgroundColor="@color/mock_conversation_profile_icon"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toTopOf="@id/message_4"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent"/>
+ app:layout_constraintStart_toStartOf="parent"/>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml
index acbb5b9..dd8afc2 100644
--- a/quickstep/res/layout/overview_actions_container.xml
+++ b/quickstep/res/layout/overview_actions_container.xml
@@ -63,16 +63,6 @@
android:layout_weight="1"
android:visibility="gone" />
- <Button
- android:id="@+id/action_share"
- style="@style/OverviewActionButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:drawableStart="@drawable/ic_share"
- android:text="@string/action_share"
- android:theme="@style/ThemeControlHighlightWorkspaceColor"
- android:visibility="gone" />
-
<Space
android:id="@+id/oav_three_button_space"
android:layout_width="0dp"
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 38c202b..e903377 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -121,6 +121,8 @@
<dimen name="gesture_tutorial_subtitle_margin_start_end">16dp</dimen>
<dimen name="gesture_tutorial_feedback_margin_start_end">24dp</dimen>
<dimen name="gesture_tutorial_button_margin_start_end">18dp</dimen>
+ <dimen name="gesture_tutorial_multi_row_task_view_spacing">72dp</dimen>
+ <dimen name="gesture_tutorial_small_task_view_corner_radius">18dp</dimen>
<!-- All Set page -->
<dimen name="allset_page_margin_horizontal">40dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
index 63a569a..1b0f967 100644
--- a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
@@ -282,8 +282,7 @@
@Override
public void setInsets(Rect insets, DeviceProfile grid) {
- int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
- + grid.cellLayoutPaddingLeftRightPx;
+ int leftRightPadding = grid.allAppsLeftRightPadding;
setPadding(leftRightPadding, getPaddingTop(), leftRightPadding, getPaddingBottom());
}
diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index 5242b3c..9ad8bb2 100644
--- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -249,8 +249,7 @@
@Override
public void setInsets(Rect insets, DeviceProfile grid) {
- int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
- + grid.cellLayoutPaddingLeftRightPx;
+ int leftRightPadding = grid.allAppsLeftRightPadding;
setPadding(leftRightPadding, getPaddingTop(), leftRightPadding, getPaddingBottom());
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java
index 0224bc4..6db5839 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java
@@ -15,6 +15,10 @@
*/
package com.android.launcher3.taskbar;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -23,15 +27,20 @@
import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat;
+import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
public class StashedHandleView extends View {
+ private static final long COLOR_CHANGE_DURATION = 120;
+
private final @ColorInt int mStashedHandleLightColor;
private final @ColorInt int mStashedHandleDarkColor;
private final Rect mSampledRegion = new Rect();
private final int[] mTmpArr = new int[2];
+ private @Nullable ObjectAnimator mColorChangeAnim;
+
public StashedHandleView(Context context) {
this(context, null);
}
@@ -54,17 +63,44 @@
R.color.taskbar_stashed_handle_dark_color);
}
- public void updateSampledRegion() {
+ /**
+ * Updates mSampledRegion to be the location of the stashedHandleBounds relative to the screen.
+ * @see #getSampledRegion()
+ */
+ public void updateSampledRegion(Rect stashedHandleBounds) {
getLocationOnScreen(mTmpArr);
- mSampledRegion.set(mTmpArr[0], mTmpArr[1], mTmpArr[0] + getWidth(),
- mTmpArr[1] + getHeight());
+ mSampledRegion.set(stashedHandleBounds);
+ mSampledRegion.offset(mTmpArr[0], mTmpArr[1]);
}
public Rect getSampledRegion() {
return mSampledRegion;
}
- public void updateHandleColor(boolean isRegionDark) {
- setBackgroundColor(isRegionDark ? mStashedHandleLightColor : mStashedHandleDarkColor);
+ /**
+ * Updates the handle color.
+ * @param isRegionDark Whether the background behind the handle is dark, and thus the handle
+ * should be light (and vice versa).
+ * @param animate Whether to animate the change, or apply it immediately.
+ */
+ public void updateHandleColor(boolean isRegionDark, boolean animate) {
+ int newColor = isRegionDark ? mStashedHandleLightColor : mStashedHandleDarkColor;
+ if (mColorChangeAnim != null) {
+ mColorChangeAnim.cancel();
+ }
+ if (animate) {
+ mColorChangeAnim = ObjectAnimator.ofArgb(this,
+ LauncherAnimUtils.VIEW_BACKGROUND_COLOR, newColor);
+ mColorChangeAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mColorChangeAnim = null;
+ }
+ });
+ mColorChangeAnim.setDuration(COLOR_CHANGE_DURATION);
+ mColorChangeAnim.start();
+ } else {
+ setBackgroundColor(newColor);
+ }
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
index 2858d7c..10da826 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
@@ -70,7 +70,8 @@
mPrefs = Utilities.getPrefs(mActivity);
mStashedHandleView = stashedHandleView;
mStashedHandleView.updateHandleColor(
- mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false));
+ mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false),
+ false /* animate */);
final Resources resources = mActivity.getResources();
mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width);
mStashedHandleHeight = resources.getDimensionPixelSize(
@@ -79,7 +80,7 @@
new RegionSamplingHelper.SamplingCallback() {
@Override
public void onRegionDarknessChanged(boolean isRegionDark) {
- mStashedHandleView.updateHandleColor(isRegionDark);
+ mStashedHandleView.updateHandleColor(isRegionDark, true /* animate */);
mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY,
isRegionDark).apply();
}
@@ -109,6 +110,7 @@
stashedCenterY - mStashedHandleHeight / 2,
stashedCenterX + mStashedHandleWidth / 2,
stashedCenterY + mStashedHandleHeight / 2);
+ mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mStashedHandleRadius = view.getHeight() / 2f;
outline.setRoundRect(mStashedHandleBounds, mStashedHandleRadius);
}
@@ -154,7 +156,7 @@
public void onIsStashed(boolean isStashed) {
mRegionSamplingHelper.setWindowVisible(isStashed);
if (isStashed) {
- mStashedHandleView.updateSampledRegion();
+ mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion());
} else {
mRegionSamplingHelper.stop();
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index 010f463..37a1674 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -84,6 +84,8 @@
private TaskView mTaskBeingDragged;
+ private boolean mIsDismissHapticRunning = false;
+
public TaskViewTouchController(T activity) {
mActivity = activity;
mRecentsView = activity.getOverviewPanel();
@@ -365,9 +367,10 @@
mCurrentAnimation.startWithVelocity(mActivity, goingToEnd,
velocity * orientationHandler.getSecondaryTranslationDirectionFactor(),
mEndDisplacement, animationDuration);
- if (goingUp && goingToEnd) {
+ if (goingUp && goingToEnd && !mIsDismissHapticRunning) {
VibratorWrapper.INSTANCE.get(mActivity).vibrate(TASK_DISMISS_VIBRATION_PRIMITIVE,
TASK_DISMISS_VIBRATION_PRIMITIVE_SCALE, TASK_DISMISS_VIBRATION_FALLBACK);
+ mIsDismissHapticRunning = true;
}
}
@@ -376,5 +379,6 @@
mDetector.setDetectableScrollConditions(0, false);
mTaskBeingDragged = null;
mCurrentAnimation = null;
+ mIsDismissHapticRunning = false;
}
}
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index f752822..12fba0d 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -2,10 +2,10 @@
import android.app.Activity;
import android.content.Context;
+import android.graphics.Rect;
import android.os.Bundle;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.testing.TestInformationHandler;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
@@ -53,9 +53,14 @@
Bundle::putInt, PortraitStatesTouchController::getHotseatTop);
}
- case TestProtocol.REQUEST_OVERVIEW_SHARE_ENABLED: {
- response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- FeatureFlags.ENABLE_OVERVIEW_SHARE.get());
+ case TestProtocol.REQUEST_GET_FOCUSED_TASK_WIDTH_FOR_TABLET: {
+ if (!mDeviceProfile.isTablet) {
+ return null;
+ }
+ Rect focusedTaskRect = new Rect();
+ LauncherActivityInterface.INSTANCE.calculateTaskSize(mContext, mDeviceProfile,
+ focusedTaskRect);
+ response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, focusedTaskRect.width());
return response;
}
}
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index 085bfbb..9ac00e8 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -86,7 +86,7 @@
}
}
RecentsOrientedState orientedState = taskView.getRecentsView().getPagedViewOrientedState();
- boolean canLauncherRotate = orientedState.canRecentsActivityRotate();
+ boolean canLauncherRotate = orientedState.isRecentsActivityRotationAllowed();
boolean isInLandscape = orientedState.getTouchRotation() != ROTATION_0;
// Add overview actions to the menu when in in-place rotate landscape mode.
@@ -331,14 +331,6 @@
mTask = task;
}
- public void onShare() {
- if (mIsAllowedByPolicy) {
- endLiveTileMode(() -> mImageApi.startShareActivity(null));
- } else {
- showBlockedByPolicyMessage();
- }
- }
-
@SuppressLint("NewApi")
public void onScreenshot() {
endLiveTileMode(() -> saveScreenshot(mTask));
@@ -355,9 +347,6 @@
* controller.
*/
public interface OverlayUICallbacks {
- /** User has indicated they want to share the current task. */
- void onShare();
-
/** User has indicated they want to screenshot the current task. */
void onScreenshot();
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java
index fb420a2..e984b4f 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/OverscrollInputConsumer.java
@@ -230,9 +230,6 @@
// Make sure there isn't an app to quick switch to on our right
int maxIndex = 0;
- if (mRecentsView != null && mRecentsView.hasRecentsExtraCard()) {
- maxIndex = 1;
- }
boolean atRightMostApp = mRecentsView == null
|| (mRecentsView.getRunningTaskIndex() <= maxIndex);
diff --git a/quickstep/src/com/android/quickstep/interaction/AnimatedTaskView.java b/quickstep/src/com/android/quickstep/interaction/AnimatedTaskView.java
new file mode 100644
index 0000000..53ad138
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/interaction/AnimatedTaskView.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+package com.android.quickstep.interaction;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
+import android.annotation.ColorInt;
+import android.content.Context;
+import android.graphics.Outline;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewOutlineProvider;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.cardview.widget.CardView;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+import com.android.launcher3.R;
+
+import java.util.ArrayList;
+
+/**
+ * Helper View for the gesture tutorial mock previous app task view.
+ *
+ * This helper class allows animating from a single-row layout to a two-row layout as seen in
+ * large screen devices.
+ */
+public class AnimatedTaskView extends ConstraintLayout {
+
+ private View mFullTaskView;
+ private CardView mTopTaskView;
+ private CardView mBottomTaskView;
+
+ private ViewOutlineProvider mTaskViewOutlineProvider = null;
+ private final Rect mTaskViewAnimatedRect = new Rect();
+ private float mTaskViewAnimatedRadius;
+
+ public AnimatedTaskView(@NonNull Context context) {
+ super(context);
+ }
+
+ public AnimatedTaskView(@NonNull Context context,
+ @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public AnimatedTaskView(
+ @NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public AnimatedTaskView(
+ @NonNull Context context,
+ @Nullable AttributeSet attrs,
+ int defStyleAttr,
+ int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+
+ mFullTaskView = findViewById(R.id.full_task_view);
+ mTopTaskView = findViewById(R.id.top_task_view);
+ mBottomTaskView = findViewById(R.id.bottom_task_view);
+
+ setToSingleRowLayout(false);
+ }
+
+ AnimatorSet createAnimationToMultiRowLayout() {
+ if (mTaskViewOutlineProvider == null) {
+ // This is an illegal state.
+ return null;
+ }
+ Outline startOutline = new Outline();
+ mTaskViewOutlineProvider.getOutline(this, startOutline);
+ Rect outlineStartRect = new Rect();
+ startOutline.getRect(outlineStartRect);
+ int endRectBottom = mTopTaskView.getHeight();
+ float outlineStartRadius = startOutline.getRadius();
+ float outlineEndRadius = getContext().getResources().getDimensionPixelSize(
+ R.dimen.gesture_tutorial_small_task_view_corner_radius);
+
+ ValueAnimator outlineAnimator = ValueAnimator.ofFloat(0f, 1f);
+ outlineAnimator.addUpdateListener(valueAnimator -> {
+ float progress = (float) valueAnimator.getAnimatedValue();
+ mTaskViewAnimatedRect.bottom = (int) (outlineStartRect.bottom
+ + progress * (endRectBottom - outlineStartRect.bottom));
+ mTaskViewAnimatedRadius = outlineStartRadius
+ + progress * (outlineEndRadius - outlineStartRadius);
+ mFullTaskView.invalidateOutline();
+ });
+ outlineAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ super.onAnimationStart(animation);
+
+ mTaskViewAnimatedRect.set(outlineStartRect);
+ mTaskViewAnimatedRadius = outlineStartRadius;
+
+ mFullTaskView.setClipToOutline(true);
+ mFullTaskView.setOutlineProvider(new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ outline.setRoundRect(mTaskViewAnimatedRect, mTaskViewAnimatedRadius);
+ }
+ });
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ mFullTaskView.setOutlineProvider(mTaskViewOutlineProvider);
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ super.onAnimationCancel(animation);
+ mFullTaskView.setOutlineProvider(mTaskViewOutlineProvider);
+ }
+ });
+
+ ArrayList<Animator> animations = new ArrayList<>();
+ animations.add(ObjectAnimator.ofFloat(
+ mBottomTaskView, View.TRANSLATION_X, -mBottomTaskView.getWidth(), 0));
+ animations.add(outlineAnimator);
+
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(animations);
+ animatorSet.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ super.onAnimationStart(animation);
+ setToSingleRowLayout(true);
+
+ setPadding(0, outlineStartRect.top, 0, getHeight() - outlineStartRect.bottom);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ setToMultiRowLayout();
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ super.onAnimationCancel(animation);
+ setToMultiRowLayout();
+ }
+ });
+
+ return animatorSet;
+ }
+
+ void setToSingleRowLayout(boolean forAnimation) {
+ mFullTaskView.setVisibility(VISIBLE);
+ mTopTaskView.setVisibility(INVISIBLE);
+ mBottomTaskView.setVisibility(forAnimation ? VISIBLE : INVISIBLE);
+ }
+
+ void setToMultiRowLayout() {
+ mFullTaskView.setVisibility(INVISIBLE);
+ mTopTaskView.setVisibility(VISIBLE);
+ mBottomTaskView.setVisibility(VISIBLE);
+ }
+
+ void setFakeTaskViewFillColor(@ColorInt int colorResId) {
+ mFullTaskView.setBackgroundColor(colorResId);
+ mTopTaskView.setCardBackgroundColor(colorResId);
+ mBottomTaskView.setCardBackgroundColor(colorResId);
+ }
+
+ @Override
+ public void setClipToOutline(boolean clipToOutline) {
+ mFullTaskView.setClipToOutline(clipToOutline);
+ }
+
+ @Override
+ public void setOutlineProvider(ViewOutlineProvider provider) {
+ mTaskViewOutlineProvider = provider;
+ mFullTaskView.setOutlineProvider(mTaskViewOutlineProvider);
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
index ff1743f..9d60e1b 100644
--- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.anim.Interpolators.ACCEL;
+import android.animation.Animator;
import android.animation.AnimatorSet;
import android.annotation.TargetApi;
import android.graphics.PointF;
@@ -29,6 +30,8 @@
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
import com.android.quickstep.interaction.NavBarGestureHandler.NavBarGestureResult;
+import java.util.ArrayList;
+
/** A {@link TutorialController} for the Overview tutorial. */
@TargetApi(Build.VERSION_CODES.R)
final class OverviewGestureTutorialController extends SwipeUpGestureTutorialController {
@@ -123,10 +126,24 @@
}
public void animateTaskViewToOverview() {
- PendingAnimation anim = new PendingAnimation(300);
+ PendingAnimation anim = new PendingAnimation(TASK_VIEW_END_ANIMATION_DURATION_MILLIS);
anim.setFloat(mTaskViewSwipeUpAnimation
.getCurrentShift(), AnimatedFloat.VALUE, 1, ACCEL);
- AnimatorSet animset = anim.buildAnim();
+
+ ArrayList<Animator> animators = new ArrayList<>();
+
+ if (mTutorialFragment.isLargeScreen()) {
+ Animator multiRowAnimation = mFakePreviousTaskView.createAnimationToMultiRowLayout();
+
+ if (multiRowAnimation != null) {
+ multiRowAnimation.setDuration(TASK_VIEW_END_ANIMATION_DURATION_MILLIS);
+ animators.add(multiRowAnimation);
+ }
+ }
+ animators.add(anim.buildAnim());
+
+ AnimatorSet animset = new AnimatorSet();
+ animset.playTogether(animators);
animset.start();
mRunningWindowAnim = SwipeUpAnimationLogic.RunningWindowAnim.wrap(animset);
}
diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
index 30430ff..0c7b35b 100644
--- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
@@ -63,6 +63,7 @@
private static final int FAKE_PREVIOUS_TASK_MARGIN = Utilities.dpToPx(12);
+ protected static final long TASK_VIEW_END_ANIMATION_DURATION_MILLIS = 300;
private static final long HOME_SWIPE_ANIMATION_DURATION_MILLIS = 625;
private static final long OVERVIEW_SWIPE_ANIMATION_DURATION_MILLIS = 1000;
@@ -89,6 +90,7 @@
mFakeTaskView.setAlpha(1);
mFakePreviousTaskView.setVisibility(View.INVISIBLE);
mFakePreviousTaskView.setAlpha(1);
+ mFakePreviousTaskView.setToSingleRowLayout(false);
mShowTasks = false;
mShowPreviousTasks = false;
mRunningWindowAnim = null;
@@ -146,7 +148,8 @@
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation, boolean isReverse) {
- PendingAnimation fadeAnim = new PendingAnimation(300);
+ PendingAnimation fadeAnim =
+ new PendingAnimation(TASK_VIEW_END_ANIMATION_DURATION_MILLIS);
if (reset) {
fadeAnim.setFloat(mTaskViewSwipeUpAnimation
.getCurrentShift(), AnimatedFloat.VALUE, 0, ACCEL);
@@ -159,6 +162,23 @@
fadeAnim.addListener(AnimatorListeners.forSuccessCallback(onEndRunnable));
}
AnimatorSet animset = fadeAnim.buildAnim();
+
+ if (reset && mTutorialFragment.isLargeScreen()) {
+ animset.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ super.onAnimationStart(animation);
+ Animator multiRowAnimation =
+ mFakePreviousTaskView.createAnimationToMultiRowLayout();
+
+ if (multiRowAnimation != null) {
+ multiRowAnimation.setDuration(
+ TASK_VIEW_END_ANIMATION_DURATION_MILLIS).start();
+ }
+ }
+ });
+ }
+
animset.setStartDelay(100);
animset.start();
mRunningWindowAnim = RunningWindowAnim.wrap(animset);
@@ -301,7 +321,7 @@
public RectF getWindowTargetRect() {
int fakeHomeIconSizePx = Utilities.dpToPx(60);
int fakeHomeIconLeft = mFakeHotseatView.getLeft();
- int fakeHomeIconTop = mDp.heightPx - Utilities.dpToPx(216);
+ int fakeHomeIconTop = mFakeHotseatView.getTop();
return new RectF(fakeHomeIconLeft, fakeHomeIconTop,
fakeHomeIconLeft + fakeHomeIconSizePx,
fakeHomeIconTop + fakeHomeIconSizePx);
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
index ef62fd6..94fb556 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
@@ -24,6 +24,7 @@
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
+import android.annotation.ColorRes;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.AnimatedVectorDrawable;
@@ -87,7 +88,7 @@
final ImageView mFakeHotseatView;
final ClipIconView mFakeIconView;
final FrameLayout mFakeTaskView;
- final View mFakePreviousTaskView;
+ final AnimatedTaskView mFakePreviousTaskView;
final View mRippleView;
final RippleDrawable mRippleDrawable;
final Button mActionButton;
@@ -177,9 +178,9 @@
return View.NO_ID;
}
- @DrawableRes
- protected int getMockPreviousAppTaskThumbnailResId() {
- return R.drawable.default_sandbox_app_previous_task_thumbnail;
+ @ColorRes
+ protected int getMockPreviousAppTaskThumbnailColorResId() {
+ return R.color.gesture_tutorial_fake_previous_task_view_color;
}
@DrawableRes
@@ -442,8 +443,8 @@
updateFakeAppTaskViewLayout(getMockAppTaskLayoutResId());
mFakeTaskView.animate().alpha(1).setListener(
AnimatorListeners.forSuccessCallback(() -> mFakeTaskView.animate().cancel()));
- mFakePreviousTaskView.setBackground(AppCompatResources.getDrawable(
- mContext, getMockPreviousAppTaskThumbnailResId()));
+ mFakePreviousTaskView.setFakeTaskViewFillColor(mContext.getResources().getColor(
+ getMockPreviousAppTaskThumbnailColorResId()));
mFakeIconView.setBackground(AppCompatResources.getDrawable(
mContext, getMockAppIconResId()));
}
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
index 1d78c6b..89be1a6 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
@@ -20,6 +20,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ActivityInfo;
import android.graphics.Insets;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
@@ -40,6 +41,7 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
+import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.R;
import com.android.quickstep.interaction.TutorialController.TutorialType;
@@ -63,6 +65,8 @@
private boolean mFragmentStopped = false;
+ private boolean mIsLargeScreen;
+
public static TutorialFragment newInstance(TutorialType tutorialType) {
TutorialFragment fragment = getFragmentForTutorialType(tutorialType);
if (fragment == null) {
@@ -130,6 +134,21 @@
mTutorialType = (TutorialType) args.getSerializable(KEY_TUTORIAL_TYPE);
mEdgeBackGestureHandler = new EdgeBackGestureHandler(getContext());
mNavBarGestureHandler = new NavBarGestureHandler(getContext());
+
+ mIsLargeScreen = InvariantDeviceProfile.INSTANCE.get(getContext())
+ .getDeviceProfile(getContext()).isTablet;
+
+ if (mIsLargeScreen) {
+ ((Activity) getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
+ } else {
+ // Temporary until UI mocks for landscape mode for phones are created.
+ ((Activity) getContext()).setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ }
+ }
+
+ public boolean isLargeScreen() {
+ return mIsLargeScreen;
}
@Override
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index a4db596..9c6fd3d 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -218,8 +218,8 @@
private boolean updateHandler() {
mRecentsActivityRotation = inferRecentsActivityRotation(mDisplayRotation);
- if (mRecentsActivityRotation == mTouchRotation
- || (canRecentsActivityRotate() && (mFlags & FLAG_SWIPE_UP_NOT_RUNNING) != 0)) {
+ if (mRecentsActivityRotation == mTouchRotation || (isRecentsActivityRotationAllowed()
+ && (mFlags & FLAG_SWIPE_UP_NOT_RUNNING) != 0)) {
mOrientationHandler = PagedOrientationHandler.PORTRAIT;
} else if (mTouchRotation == ROTATION_90) {
mOrientationHandler = PagedOrientationHandler.LANDSCAPE;
@@ -253,7 +253,7 @@
private boolean setFlag(int mask, boolean enabled) {
boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
&& (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED
- && !canRecentsActivityRotate();
+ && !isRecentsActivityRotationAllowed();
if (enabled) {
mFlags |= mask;
} else {
@@ -262,7 +262,7 @@
boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
&& (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED
- && !canRecentsActivityRotate();
+ && !isRecentsActivityRotationAllowed();
if (wasRotationEnabled != isRotationEnabled) {
UI_HELPER_EXECUTOR.execute(() -> {
if (isRotationEnabled) {
@@ -376,13 +376,6 @@
}
/**
- * Returns true if the activity can rotate, if allowed by system rotation settings
- */
- public boolean canRecentsActivityRotate() {
- return (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0 && isRecentsActivityRotationAllowed();
- }
-
- /**
* Enables or disables the rotation watcher for listening to rotation callbacks
*/
public void setRotationWatcherEnabled(boolean isEnabled) {
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index ddb1fca..5ca5c94 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -29,18 +29,14 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.Surface;
-import android.widget.FrameLayout;
import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager.StateListener;
-import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.util.SplitSelectStateController;
-import com.android.systemui.plugins.PluginListener;
-import com.android.systemui.plugins.RecentsExtraCard;
/**
* {@link RecentsView} used in Launcher activity
@@ -49,25 +45,6 @@
public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, LauncherState>
implements StateListener<LauncherState> {
- private RecentsExtraCard mRecentsExtraCardPlugin;
- private RecentsExtraViewContainer mRecentsExtraViewContainer;
- private PluginListener<RecentsExtraCard> mRecentsExtraCardPluginListener =
- new PluginListener<RecentsExtraCard>() {
- @Override
- public void onPluginConnected(RecentsExtraCard recentsExtraCard, Context context) {
- createRecentsExtraCard();
- mRecentsExtraCardPlugin = recentsExtraCard;
- mRecentsExtraCardPlugin.setupView(context, mRecentsExtraViewContainer, mActivity);
- }
-
- @Override
- public void onPluginDisconnected(RecentsExtraCard plugin) {
- removeView(mRecentsExtraViewContainer);
- mRecentsExtraCardPlugin = null;
- mRecentsExtraViewContainer = null;
- }
- };
-
public LauncherRecentsView(Context context) {
this(context, null);
}
@@ -148,73 +125,6 @@
}
@Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- PluginManagerWrapper.INSTANCE.get(getContext()).addPluginListener(
- mRecentsExtraCardPluginListener, RecentsExtraCard.class);
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(
- mRecentsExtraCardPluginListener);
- }
-
- @Override
- protected int computeMinScroll() {
- if (canComputeScrollX() && !mIsRtl) {
- return computeScrollX();
- }
- return super.computeMinScroll();
- }
-
- @Override
- protected int computeMaxScroll() {
- if (canComputeScrollX() && mIsRtl) {
- return computeScrollX();
- }
- return super.computeMaxScroll();
- }
-
- private boolean canComputeScrollX() {
- return mRecentsExtraCardPlugin != null && getTaskViewCount() > 0
- && !mDisallowScrollToClearAll;
- }
-
- private int computeScrollX() {
- int scrollIndex = getTaskViewStartIndex() - 1;
- while (scrollIndex >= 0 && getChildAt(scrollIndex) instanceof RecentsExtraViewContainer
- && ((RecentsExtraViewContainer) getChildAt(scrollIndex)).isScrollable()) {
- scrollIndex--;
- }
- return getScrollForPage(scrollIndex + 1);
- }
-
- private void createRecentsExtraCard() {
- mRecentsExtraViewContainer = new RecentsExtraViewContainer(getContext());
- FrameLayout.LayoutParams helpCardParams =
- new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
- FrameLayout.LayoutParams.MATCH_PARENT);
- mRecentsExtraViewContainer.setLayoutParams(helpCardParams);
- mRecentsExtraViewContainer.setScrollable(true);
- addView(mRecentsExtraViewContainer, 0);
- }
-
- @Override
- public boolean hasRecentsExtraCard() {
- return mRecentsExtraViewContainer != null;
- }
-
- @Override
- public void setContentAlpha(float alpha) {
- super.setContentAlpha(alpha);
- if (mRecentsExtraViewContainer != null) {
- mRecentsExtraViewContainer.setAlpha(alpha);
- }
- }
-
- @Override
protected DepthController getDepthController() {
return mActivity.getDepthController();
}
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index da3fa2a..76d3591 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -16,8 +16,6 @@
package com.android.quickstep.views;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SHARE;
-
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -111,15 +109,9 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- View share = findViewById(R.id.action_share);
- share.setOnClickListener(this);
findViewById(R.id.action_screenshot).setOnClickListener(this);
mSplitButton = findViewById(R.id.action_split);
mSplitButton.setOnClickListener(this);
- if (ENABLE_OVERVIEW_SHARE.get()) {
- share.setVisibility(VISIBLE);
- findViewById(R.id.oav_three_button_space).setVisibility(VISIBLE);
- }
}
/**
@@ -137,9 +129,7 @@
return;
}
int id = view.getId();
- if (id == R.id.action_share) {
- mCallbacks.onShare();
- } else if (id == R.id.action_screenshot) {
+ if (id == R.id.action_screenshot) {
mCallbacks.onScreenshot();
} else if (id == R.id.action_split) {
mCallbacks.onSplit();
diff --git a/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java b/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
deleted file mode 100644
index 16bc3bc..0000000
--- a/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.quickstep.views;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.FrameLayout;
-
-/**
- * Empty view to house recents overview extra card
- */
-public class RecentsExtraViewContainer extends FrameLayout {
-
- private boolean mScrollable = false;
-
- public RecentsExtraViewContainer(Context context) {
- super(context);
- }
-
- public RecentsExtraViewContainer(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public RecentsExtraViewContainer(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- /**
- * Determine whether the view should be scrolled to in the recents overview, similar to the
- * taskviews.
- * @return true if viewed should be scrolled to, false if not
- */
- public boolean isScrollable() {
- return mScrollable;
- }
-
- public void setScrollable(boolean scrollable) {
- this.mScrollable = scrollable;
- }
-}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 98f8b72..e1a3895 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -117,7 +117,6 @@
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
@@ -612,8 +611,6 @@
*/
private TaskView mMovingTaskView;
- // Keeps track of the index where the first TaskView should be
- private int mTaskViewStartIndex = 0;
private OverviewActionsView mActionsView;
private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
@@ -898,7 +895,6 @@
taskView.setTaskViewId(-1);
mActionsView.updateHiddenFlags(HIDDEN_NO_TASKS, getTaskViewCount() == 0);
}
- updateTaskStartIndex(child);
}
@Override
@@ -908,7 +904,6 @@
// RecentsView is set to RTL in the constructor when system is using LTR. Here we set the
// child direction back to match system settings.
child.setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_LTR : View.LAYOUT_DIRECTION_RTL);
- updateTaskStartIndex(child);
mActionsView.updateHiddenFlags(HIDDEN_NO_TASKS, false);
updateEmptyMessage();
}
@@ -1001,18 +996,6 @@
anim.start();
}
- private void updateTaskStartIndex(View affectingView) {
- if (!(affectingView instanceof TaskView) && !(affectingView instanceof ClearAllButton)) {
- int childCount = getChildCount();
-
- mTaskViewStartIndex = 0;
- while (mTaskViewStartIndex < childCount
- && !(getChildAt(mTaskViewStartIndex) instanceof TaskView)) {
- mTaskViewStartIndex++;
- }
- }
- }
-
public boolean isTaskViewVisible(TaskView tv) {
if (showAsGrid()) {
int screenStart = mOrientationHandler.getPrimaryScroll(this);
@@ -1077,8 +1060,7 @@
* @param taskIndex the index of the task
*/
public boolean isTaskSnapped(int taskIndex) {
- return getScrollForPage(taskIndex + mTaskViewStartIndex)
- == getPagedOrientationHandler().getPrimaryScroll(this);
+ return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
}
public TaskView getTaskViewByTaskId(int taskId) {
@@ -1292,7 +1274,7 @@
return;
}
- if (mCurrentPage == mTaskViewStartIndex) {
+ if (mCurrentPage == 0) {
return;
}
@@ -1304,8 +1286,8 @@
removeView(focusedTaskView);
mMovingTaskView = null;
focusedTaskView.resetPersistentViewTransforms();
- addView(focusedTaskView, mTaskViewStartIndex);
- setCurrentPage(mTaskViewStartIndex);
+ addView(focusedTaskView, 0);
+ setCurrentPage(0);
updateGridProperties();
}
@@ -1323,7 +1305,7 @@
}
int currentTaskId = -1;
- TaskView currentTaskView = getTaskViewAtByAbsoluteIndex(mCurrentPage);
+ TaskView currentTaskView = getTaskViewAt(mCurrentPage);
if (currentTaskView != null) {
currentTaskId = currentTaskView.getTask().key.id;
}
@@ -1377,7 +1359,7 @@
for (int taskViewIndex = requiredTaskViewCount - 1, taskDataIndex = tasks.size() - 1;
taskViewIndex >= 0;
taskViewIndex--, taskDataIndex--) {
- final int pageIndex = requiredTaskViewCount - taskViewIndex - 1 + mTaskViewStartIndex;
+ final int pageIndex = requiredTaskViewCount - taskViewIndex - 1;
final Task task = tasks.get(taskDataIndex);
final TaskView taskView = (TaskView) getChildAt(pageIndex);
if (taskView instanceof GroupedTaskView) {
@@ -1418,7 +1400,7 @@
if (newRunningTaskView == null) {
StringBuilder sb = new StringBuilder();
for (int i = requiredTaskViewCount - 1; i >= 0; i--) {
- final int pageIndex = requiredTaskViewCount - i - 1 + mTaskViewStartIndex;
+ final int pageIndex = requiredTaskViewCount - i - 1;
final TaskView taskView = (TaskView) getChildAt(pageIndex);
int taskViewId = taskView.getTaskViewId();
sb.append(" taskViewId: " + taskViewId
@@ -1481,7 +1463,7 @@
}
public int getTaskViewCount() {
- int taskViewCount = getChildCount() - mTaskViewStartIndex;
+ int taskViewCount = getChildCount();
if (indexOfChild(mClearAllButton) != -1) {
taskViewCount--;
}
@@ -1615,7 +1597,7 @@
boolean isInLandscape = mOrientationState.getTouchRotation() != ROTATION_0
|| mOrientationState.getRecentsActivityRotation() != ROTATION_0;
mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
- !mOrientationState.canRecentsActivityRotate() && isInLandscape);
+ !mOrientationState.isRecentsActivityRotationAllowed() && isInLandscape);
// Update TaskView's DeviceProfile dependent layout.
updateChildTaskOrientations();
@@ -1896,11 +1878,6 @@
public abstract void startHome();
- /** `true` if there is a +1 space available in overview. */
- public boolean hasRecentsExtraCard() {
- return false;
- }
-
public void reset() {
setCurrentTask(-1);
mIgnoreResetTaskId = -1;
@@ -2007,10 +1984,6 @@
return tv == null ? -1 : indexOfChild(tv);
}
- public int getTaskViewStartIndex() {
- return mTaskViewStartIndex;
- }
-
/**
* Reloads the view if anything in recents changed.
*/
@@ -2047,7 +2020,7 @@
}
private void animateRecentsRotationInPlace(int newRotation) {
- if (mOrientationState.canRecentsActivityRotate()) {
+ if (mOrientationState.isRecentsActivityRotationAllowed()) {
// Let system take care of the rotation
return;
}
@@ -2185,7 +2158,7 @@
Task.from(new TaskKey(taskInfo), taskInfo, false),
Task.from(new TaskKey(secondaryTaskInfo), secondaryTaskInfo, false)
};
- addView(taskView, mTaskViewStartIndex);
+ addView(taskView, 0);
// When we create a placeholder task view mSplitBoundsConfig will be null, but with
// the actual app running we won't need to show the thumbnail until all the tasks
// load later anyways
@@ -2193,7 +2166,7 @@
mOrientationState, mSplitBoundsConfig);
} else {
taskView = getTaskViewFromPool(false);
- addView(taskView, mTaskViewStartIndex);
+ addView(taskView, 0);
// The temporary running task is only used for the duration between the start of the
// gesture and the task list is loaded and applied
mTmpRunningTasks = new Task[]{Task.from(new TaskKey(taskInfo), taskInfo, false)};
@@ -2361,7 +2334,7 @@
int focusedTaskWidthAndSpacing = 0;
int snappedTaskRowWidth = 0;
int snappedPage = getNextPage();
- TaskView snappedTaskView = getTaskViewAtByAbsoluteIndex(snappedPage);
+ TaskView snappedTaskView = getTaskViewAt(snappedPage);
TaskView homeTaskView = getHomeTaskView();
TaskView nextFocusedTaskView = null;
@@ -2474,7 +2447,7 @@
if (snappedTaskView != null) {
snappedTaskNonGridScrollAdjustment = snappedTaskView.getScrollAdjustment(
/*fullscreenEnabled=*/true, /*gridEnabled=*/false);
- snappedTaskGridTranslationX = gridTranslations[snappedPage - mTaskViewStartIndex];
+ snappedTaskGridTranslationX = gridTranslations[snappedPage];
}
// Use the accumulated translation of the row containing the last task.
@@ -3030,7 +3003,7 @@
// Get the id of the task view we will snap to based on the current
// page's relative position as the order of indices change over time due
// to dismissals.
- TaskView snappedTaskView = getTaskViewAtByAbsoluteIndex(mCurrentPage);
+ TaskView snappedTaskView = getTaskViewAt(mCurrentPage);
if (snappedTaskView != null) {
if (snappedTaskView.getTaskViewId() == mFocusedTaskViewId) {
if (finalNextFocusedTaskView != null) {
@@ -3229,10 +3202,7 @@
if (isTaskViewVisible(topTask)) {
TaskView bottomTask = getTaskViewFromTaskViewId(bottomRowIdArray.get(i));
- lastVisibleIndex = Math.max(
- indexOfChild(topTask) - mTaskViewStartIndex,
- indexOfChild(bottomTask) - mTaskViewStartIndex
- );
+ lastVisibleIndex = Math.max(indexOfChild(topTask), indexOfChild(bottomTask));
} else if (lastVisibleIndex < Integer.MAX_VALUE) {
break;
}
@@ -3505,22 +3475,22 @@
@Nullable
public TaskView getNextTaskView() {
- return getTaskViewAtByAbsoluteIndex(getRunningTaskIndex() + 1);
+ return getTaskViewAt(getRunningTaskIndex() + 1);
}
@Nullable
public TaskView getCurrentPageTaskView() {
- return getTaskViewAtByAbsoluteIndex(getCurrentPage());
+ return getTaskViewAt(getCurrentPage());
}
@Nullable
public TaskView getNextPageTaskView() {
- return getTaskViewAtByAbsoluteIndex(getNextPage());
+ return getTaskViewAt(getNextPage());
}
@Nullable
public TaskView getTaskViewNearestToCenterOfScreen() {
- return getTaskViewAtByAbsoluteIndex(getPageNearestToCenterOfScreen());
+ return getTaskViewAt(getPageNearestToCenterOfScreen());
}
/**
@@ -3528,16 +3498,8 @@
*/
@Nullable
public TaskView getTaskViewAt(int index) {
- return getTaskViewAtByAbsoluteIndex(index + mTaskViewStartIndex);
- }
-
- @Nullable
- private TaskView getTaskViewAtByAbsoluteIndex(int index) {
- if (index < getChildCount() && index >= 0) {
- View child = getChildAt(index);
- return child instanceof TaskView ? (TaskView) child : null;
- }
- return null;
+ View child = getChildAt(index);
+ return child instanceof TaskView ? (TaskView) child : null;
}
public void setOnEmptyMessageUpdatedListener(OnEmptyMessageUpdatedListener listener) {
@@ -4395,7 +4357,7 @@
} else {
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
- : mTaskViewStartIndex);
+ : 0);
}
}
return super.computeMinScroll();
@@ -4407,7 +4369,7 @@
if (mIsRtl) {
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
- : mTaskViewStartIndex);
+ : 0);
} else {
// If we aren't showing the clear all button, use the leftmost task as the min
// scroll.
@@ -4459,7 +4421,7 @@
for (int i = 0; i < taskCount; i++) {
TaskView taskView = getTaskViewAt(i);
float scrollDiff = taskView.getScrollAdjustment(showAsFullscreen, showAsGrid);
- int pageScroll = newPageScrolls[i + mTaskViewStartIndex] + (int) scrollDiff;
+ int pageScroll = newPageScrolls[i] + (int) scrollDiff;
if ((mIsRtl && pageScroll < clearAllScroll + clearAllWidth)
|| (!mIsRtl && pageScroll > clearAllScroll - clearAllWidth)) {
pageScroll = clearAllScroll + (mIsRtl ? clearAllWidth : -clearAllWidth);
@@ -4488,7 +4450,7 @@
@Override
protected int getChildVisibleSize(int index) {
- final TaskView taskView = getTaskViewAtByAbsoluteIndex(index);
+ final TaskView taskView = getTaskViewAt(index);
if (taskView == null) {
return super.getChildVisibleSize(index);
}
@@ -4531,7 +4493,7 @@
* according to {@link #mGridProgress}.
*/
public float getGridTranslationSecondary(int pageIndex) {
- TaskView taskView = getTaskViewAtByAbsoluteIndex(pageIndex);
+ TaskView taskView = getTaskViewAt(pageIndex);
if (taskView == null) {
return 0;
}
@@ -4572,8 +4534,8 @@
private void updateEnabledOverlays() {
int overlayEnabledPage = mOverlayEnabled ? getNextPage() : -1;
int taskCount = getTaskViewCount();
- for (int i = mTaskViewStartIndex; i < mTaskViewStartIndex + taskCount; i++) {
- getTaskViewAtByAbsoluteIndex(i).setOverlayEnabled(i == overlayEnabledPage);
+ for (int i = 0; i < taskCount; i++) {
+ getTaskViewAt(i).setOverlayEnabled(i == overlayEnabledPage);
}
}
@@ -4676,7 +4638,7 @@
getCurrentPageTaskView().setModalness(modalness);
}
// Only show actions view when it's modal for in-place landscape mode.
- boolean inPlaceLandscape = !mOrientationState.canRecentsActivityRotate()
+ boolean inPlaceLandscape = !mOrientationState.isRecentsActivityRotationAllowed()
&& mOrientationState.getTouchRotation() != ROTATION_0;
mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, modalness < 1 && inPlaceLandscape);
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 17a88e5..3b7370f 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -170,7 +170,6 @@
OverviewActions actionsView =
mLauncher.pressHome().switchToOverview().getOverviewActions();
actionsView.clickAndDismissScreenshot();
- actionsView.clickAndDismissShare();
}
private int getCurrentOverviewPage(Launcher launcher) {
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 720d736..9c20e1f 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -193,6 +193,8 @@
<attr name="borderSpacingDps" format="float" />
+ <attr name="allAppsCellSpacingDps" format="float" />
+
<attr name="iconImageSize" format="float" />
<!-- landscapeIconSize defaults to iconImageSize, if not specified -->
<attr name="landscapeIconSize" format="float" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 323c5ca..f315725 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -198,8 +198,11 @@
<!-- Error text that lets a user know that the widget can't load. -->
<string name="gadget_error_text">Can\'t load widget</string>
+ <!-- Button text. This button lets a user change a widget's settings. -->
+ <string name="gadget_setup_text">Widget settings</string>
+
<!-- Instructional text to encourage a user to finish setting up the widget. -->
- <string name="gadget_setup_text">Tap to finish setup</string>
+ <string name="gadget_complete_setup_text">Tap to finish setup</string>
<!-- Text to inform the user that they can't uninstall a system application -->
<string name="uninstall_system_app_text">This is a system app and can\'t be uninstalled.</string>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index e739c37..192fe30 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -168,11 +168,13 @@
public int qsbBottomMarginPx;
// All apps
+ public int allAppsCellSpacingPx;
public int allAppsOpenVerticalTranslate;
public int allAppsCellHeightPx;
public int allAppsCellWidthPx;
public int allAppsIconSizePx;
public int allAppsIconDrawablePaddingPx;
+ public int allAppsLeftRightPadding;
public final int numShownAllAppsColumns;
public float allAppsIconTextSizePx;
@@ -283,6 +285,7 @@
folderContentPaddingTop = res.getDimensionPixelSize(R.dimen.folder_content_padding_top);
setCellLayoutBorderSpacing(pxFromDp(inv.borderSpacing, mMetrics, 1f));
+ allAppsCellSpacingPx = pxFromDp(inv.allAppsCellSpacing, mMetrics, 1f);
cellLayoutBorderSpacingOriginalPx = cellLayoutBorderSpacingPx;
folderCellLayoutBorderSpacingPx = cellLayoutBorderSpacingPx;
@@ -544,6 +547,17 @@
+ textHeight + (topBottomPadding * 2);
}
+ private void updateAllAppsWidth() {
+ if (isTwoPanels) {
+ int usedWidth = (allAppsCellWidthPx * numShownAllAppsColumns)
+ + (allAppsCellSpacingPx * (numShownAllAppsColumns + 1));
+ allAppsLeftRightPadding = Math.max(1, (availableWidthPx - usedWidth) / 2);
+ } else {
+ allAppsLeftRightPadding =
+ desiredWorkspaceLeftRightMarginPx + cellLayoutPaddingLeftRightPx;
+ }
+ }
+
/**
* Returns the amount of extra (or unused) vertical space.
*/
@@ -663,6 +677,7 @@
allAppsCellHeightPx = getCellSize().y;
}
allAppsCellWidthPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx;
+ updateAllAppsWidth();
if (isVerticalLayout) {
hideWorkspaceLabelsIfNotEnoughSpace();
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 5f441d1..8631040 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -108,6 +108,7 @@
public float iconTextSize;
public float allAppsIconSize;
public float allAppsIconTextSize;
+ public float allAppsCellSpacing;
public boolean isSplitDisplay;
public float minCellHeight;
@@ -153,7 +154,8 @@
*/
public List<DeviceProfile> supportedProfiles = Collections.EMPTY_LIST;
- @Nullable public DevicePaddings devicePaddings;
+ @Nullable
+ public DevicePaddings devicePaddings;
public Point defaultWallpaperSize;
public Rect defaultWidgetPadding;
@@ -161,7 +163,8 @@
private final ArrayList<OnIDPChangeListener> mChangeListeners = new ArrayList<>();
@VisibleForTesting
- public InvariantDeviceProfile() {}
+ public InvariantDeviceProfile() {
+ }
@TargetApi(23)
private InvariantDeviceProfile(Context context) {
@@ -219,6 +222,7 @@
result.minCellHeight = defaultDisplayOption.minCellHeight;
result.minCellWidth = defaultDisplayOption.minCellWidth;
result.borderSpacing = defaultDisplayOption.borderSpacing;
+ result.allAppsCellSpacing = defaultDisplayOption.allAppsCellSpacing;
initGrid(context, myInfo, result, false);
}
@@ -283,6 +287,7 @@
twoPanelLandscapeMinCellHeightDps = displayOption.twoPanelLandscapeMinCellHeightDps;
twoPanelLandscapeMinCellWidthDps = displayOption.twoPanelLandscapeMinCellWidthDps;
borderSpacing = displayOption.borderSpacing;
+ allAppsCellSpacing = displayOption.allAppsCellSpacing;
numShownHotseatIcons = closestProfile.numHotseatIcons;
numDatabaseHotseatIcons = isSplitDisplay
@@ -356,7 +361,7 @@
}
private Object[] toModelState() {
- return new Object[] {
+ return new Object[]{
numColumns, numRows, numDatabaseHotseatIcons, iconBitmapSize, fillResIconDpi,
numDatabaseAllAppsColumns, dbFile};
}
@@ -402,7 +407,7 @@
}
}
}
- } catch (IOException|XmlPullParserException e) {
+ } catch (IOException | XmlPullParserException e) {
throw new RuntimeException(e);
}
@@ -456,7 +461,7 @@
private int getLauncherIconDensity(int requiredSize) {
// Densities typically defined by an app.
- int[] densityBuckets = new int[] {
+ int[] densityBuckets = new int[]{
DisplayMetrics.DENSITY_LOW,
DisplayMetrics.DENSITY_MEDIUM,
DisplayMetrics.DENSITY_TV,
@@ -596,8 +601,8 @@
// We will use these two data points to extrapolate how much the wallpaper parallax effect
// to span (ie travel) at any aspect ratio:
- final float ASPECT_RATIO_LANDSCAPE = 16/10f;
- final float ASPECT_RATIO_PORTRAIT = 10/16f;
+ final float ASPECT_RATIO_LANDSCAPE = 16 / 10f;
+ final float ASPECT_RATIO_PORTRAIT = 10 / 16f;
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f;
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f;
@@ -607,7 +612,8 @@
// (10/16)x + y = 1.2
// We solve for x and y and end up with a final formula:
final float x =
- (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) /
+ (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE
+ - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) /
(ASPECT_RATIO_LANDSCAPE - ASPECT_RATIO_PORTRAIT);
final float y = WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT - x * ASPECT_RATIO_PORTRAIT;
return x * aspectRatio + y;
@@ -719,6 +725,7 @@
private float twoPanelPortraitMinCellWidthDps;
private float twoPanelLandscapeMinCellHeightDps;
private float twoPanelLandscapeMinCellWidthDps;
+ private float allAppsCellSpacing;
private float borderSpacing;
private final float[] iconSizes = new float[COUNT_TOTAL];
@@ -750,6 +757,8 @@
R.styleable.ProfileDisplayOption_twoPanelLandscapeMinCellWidthDps,
twoPanelPortraitMinCellWidthDps);
borderSpacing = a.getFloat(R.styleable.ProfileDisplayOption_borderSpacingDps, 0);
+ allAppsCellSpacing = a.getFloat(R.styleable.ProfileDisplayOption_allAppsCellSpacingDps,
+ borderSpacing);
iconSizes[INDEX_DEFAULT] =
a.getFloat(R.styleable.ProfileDisplayOption_iconImageSize, 0);
@@ -810,6 +819,7 @@
twoPanelLandscapeMinCellHeightDps *= w;
twoPanelLandscapeMinCellWidthDps *= w;
borderSpacing *= w;
+ allAppsCellSpacing *= w;
return this;
}
@@ -825,6 +835,7 @@
twoPanelLandscapeMinCellHeightDps += p.twoPanelLandscapeMinCellHeightDps;
twoPanelLandscapeMinCellWidthDps += p.twoPanelLandscapeMinCellWidthDps;
borderSpacing += p.borderSpacing;
+ allAppsCellSpacing += p.allAppsCellSpacing;
return this;
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0340694..f429d76 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2132,6 +2132,10 @@
IntSet result = new IntSet();
if (visibleIds.isEmpty()) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "getPagesToBindSynchronously (1): "
+ + result);
+ }
return result;
}
for (int id : orderedScreenIds.toArray()) {
@@ -2152,6 +2156,10 @@
// pages being hidden in single panel.
result.add(pairId);
}
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "getPagesToBindSynchronously (2): "
+ + result);
+ }
return result;
}
@@ -2297,7 +2305,7 @@
final boolean focusFirstItemForAccessibility) {
// Get the list of added items and intersect them with the set of items here
final Collection<Animator> bounceAnims = new ArrayList<>();
- final boolean animateIcons = forceAnimateIcons && canRunNewAppsAnimation();
+ boolean canAnimatePageChange = canAnimatePageChange();
Workspace workspace = mWorkspace;
int newItemsScreenId = -1;
int end = items.size();
@@ -2358,7 +2366,7 @@
}
}
workspace.addInScreenFromBind(view, item);
- if (animateIcons) {
+ if (forceAnimateIcons) {
// Animate all the applications up now
view.setAlpha(0f);
view.setScaleX(0f);
@@ -2374,7 +2382,7 @@
View viewToFocus = newView;
// Animate to the correct pager
- if (animateIcons && newItemsScreenId > -1) {
+ if (forceAnimateIcons && newItemsScreenId > -1) {
AnimatorSet anim = new AnimatorSet();
anim.playTogether(bounceAnims);
if (focusFirstItemForAccessibility && viewToFocus != null) {
@@ -2390,7 +2398,7 @@
final int newScreenIndex = mWorkspace.getPageIndexForScreenId(newItemsScreenId);
final Runnable startBounceAnimRunnable = anim::start;
- if (newItemsScreenId != currentScreenId) {
+ if (canAnimatePageChange && newItemsScreenId != currentScreenId) {
// We post the animation slightly delayed to prevent slowdowns
// when we are loading right after we return to launcher.
mWorkspace.postDelayed(new Runnable() {
@@ -2671,7 +2679,7 @@
TraceHelper.INSTANCE.endSection(traceToken);
}
- private boolean canRunNewAppsAnimation() {
+ private boolean canAnimatePageChange() {
if (mDragController.isDragging()) {
return false;
} else {
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 9a5fd05..3f1f915 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -382,12 +382,10 @@
public void setInsets(Rect insets) {
mInsets.set(insets);
DeviceProfile grid = mLauncher.getDeviceProfile();
- int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
- + grid.cellLayoutPaddingLeftRightPx;
for (int i = 0; i < mAH.length; i++) {
mAH[i].padding.bottom = insets.bottom;
- mAH[i].padding.left = mAH[i].padding.right = leftRightPadding;
+ mAH[i].padding.left = mAH[i].padding.right = grid.allAppsLeftRightPadding;
mAH[i].applyPadding();
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index e89549d..f230648 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -159,9 +159,6 @@
public static final BooleanFlag ENABLE_WIDGETS_PICKER_AIAI_SEARCH = new DeviceFlag(
"ENABLE_WIDGETS_PICKER_AIAI_SEARCH", false, "Enable AiAi search in the widgets picker");
- public static final BooleanFlag ENABLE_OVERVIEW_SHARE = getDebugFlag(
- "ENABLE_OVERVIEW_SHARE", false, "Show Share button in Overview Actions");
-
public static final BooleanFlag ENABLE_OVERVIEW_SHARING_TO_PEOPLE = getDebugFlag(
"ENABLE_OVERVIEW_SHARING_TO_PEOPLE", true,
"Show indicators for content on Overview to share with top people. ");
diff --git a/src/com/android/launcher3/model/BaseLoaderResults.java b/src/com/android/launcher3/model/BaseLoaderResults.java
index 0e132c2..e9feb1c 100644
--- a/src/com/android/launcher3/model/BaseLoaderResults.java
+++ b/src/com/android/launcher3/model/BaseLoaderResults.java
@@ -32,6 +32,7 @@
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.LooperExecutor;
@@ -173,8 +174,18 @@
ArrayList<LauncherAppWidgetInfo> currentAppWidgets = new ArrayList<>();
ArrayList<LauncherAppWidgetInfo> otherAppWidgets = new ArrayList<>();
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "bind (1) currentScreenIds: "
+ + currentScreenIds
+ + ", mCallBacks: "
+ + mCallbacks.getClass().getSimpleName());
+ }
filterCurrentWorkspaceItems(currentScreenIds, mWorkspaceItems, currentWorkspaceItems,
otherWorkspaceItems);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "bind (2) currentScreenIds: "
+ + currentScreenIds);
+ }
filterCurrentWorkspaceItems(currentScreenIds, mAppWidgets, currentAppWidgets,
otherAppWidgets);
final InvariantDeviceProfile idp = mApp.getInvariantDeviceProfile();
diff --git a/src/com/android/launcher3/model/ModelUtils.java b/src/com/android/launcher3/model/ModelUtils.java
index 58aa9e5..ef5eef1 100644
--- a/src/com/android/launcher3/model/ModelUtils.java
+++ b/src/com/android/launcher3/model/ModelUtils.java
@@ -31,6 +31,7 @@
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
@@ -66,6 +67,10 @@
(lhs, rhs) -> Integer.compare(lhs.container, rhs.container));
for (T info : allWorkspaceItems) {
if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "filterCurrentWorkspaceItems: "
+ + currentScreenIds);
+ }
if (currentScreenIds.contains(info.screenId)) {
currentScreenItems.add(info);
itemsOnScreen.add(info.id);
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 117ae42..2230914 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -270,6 +270,15 @@
backgroundColor = colors[numVisibleChild % colors.length];
}
+ if (!ENABLE_LOCAL_COLOR_POPUPS.get()) {
+ // Arrow color matches the first child or the last child.
+ if (!mIsAboveIcon && numVisibleChild == 0 && viewGroup == this) {
+ mArrowColor = backgroundColor;
+ } else if (mIsAboveIcon) {
+ mArrowColor = backgroundColor;
+ }
+ }
+
if (view instanceof ViewGroup && mIterateChildrenTag.equals(view.getTag())) {
assignMarginsAndBackgrounds((ViewGroup) view, backgroundColor);
numVisibleChild++;
@@ -293,12 +302,6 @@
if (!ENABLE_LOCAL_COLOR_POPUPS.get()) {
setChildColor(view, backgroundColor, colorAnimator);
- // Arrow color matches the first child or the last child.
- if (!mIsAboveIcon && numVisibleChild == 0) {
- mArrowColor = backgroundColor;
- } else if (mIsAboveIcon) {
- mArrowColor = backgroundColor;
- }
}
numVisibleChild++;
@@ -495,7 +498,7 @@
mArrow.setPivotY(mIsAboveIcon ? mArrowHeight : 0);
}
- private void updateArrowColor() {
+ protected void updateArrowColor() {
if (!Gravity.isVertical(mGravity)) {
mArrow.setBackground(new RoundedArrowDrawable(
mArrowWidth, mArrowHeight, mArrowPointRadius,
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index e340b21..65dd8ea 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -593,6 +593,7 @@
mNotificationContainer.setVisibility(GONE);
updateHiddenShortcuts();
assignMarginsAndBackgrounds(PopupContainerWithArrow.this);
+ updateArrowColor();
} else {
mNotificationContainer.trimNotifications(
NotificationKeyData.extractKeysOnly(dotInfo.getNotificationKeys()));
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 232acd9..ce01d4e 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -102,6 +102,8 @@
public static final String REQUEST_GET_ACTIVITIES_CREATED_COUNT =
"get-activities-created-count";
public static final String REQUEST_GET_ACTIVITIES = "get-activities";
+ public static final String REQUEST_GET_FOCUSED_TASK_WIDTH_FOR_TABLET =
+ "get-focused-task-width-for-tablet";
public static Long sForcePauseTimeout;
public static final String REQUEST_SET_FORCE_PAUSE_TIMEOUT = "set-force-pause-timeout";
@@ -110,7 +112,6 @@
public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
- public static final String REQUEST_OVERVIEW_SHARE_ENABLED = "overview-share-enabled";
public static boolean sDisableSensorRotation;
public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation";
@@ -119,4 +120,5 @@
public static final String WORK_PROFILE_REMOVED = "b/159671700";
public static final String TASK_VIEW_ID_CRASH = "b/195430732";
public static final String NO_DROP_TARGET = "b/195031154";
+ public static final String NULL_INT_SET = "b/200572078";
}
diff --git a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java
index 57a6d3f..b6bb6aa 100644
--- a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java
+++ b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java
@@ -268,8 +268,8 @@
if (availableWidth > 0) {
// Recreate the setup text.
mSetupTextLayout = new StaticLayout(
- getResources().getText(R.string.gadget_setup_text), mPaint, availableWidth,
- Layout.Alignment.ALIGN_CENTER, 1, 0, true);
+ getResources().getText(R.string.gadget_complete_setup_text), mPaint,
+ availableWidth, Layout.Alignment.ALIGN_CENTER, 1, 0, true);
int textHeight = mSetupTextLayout.getHeight();
// Extra icon size due to the setting icon
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 68532ca..b152ddc 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -183,15 +183,16 @@
TableLayout widgetsTable = findViewById(R.id.widgets_table);
widgetsTable.removeAllViews();
- WidgetsTableUtils.groupWidgetItemsIntoTable(widgets, mMaxHorizontalSpan).forEach(row -> {
- TableRow tableRow = new TableRow(getContext());
- tableRow.setGravity(Gravity.TOP);
- row.forEach(widgetItem -> {
- WidgetCell widget = addItemCell(tableRow);
- widget.applyFromCellItem(widgetItem);
- });
- widgetsTable.addView(tableRow);
- });
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithReordering(widgets, mMaxHorizontalSpan)
+ .forEach(row -> {
+ TableRow tableRow = new TableRow(getContext());
+ tableRow.setGravity(Gravity.TOP);
+ row.forEach(widgetItem -> {
+ WidgetCell widget = addItemCell(tableRow);
+ widget.applyFromCellItem(widgetItem);
+ });
+ widgetsTable.addView(tableRow);
+ });
}
@Override
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 9e12f6f..894c4c9 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -535,8 +535,8 @@
- noWidgetsViewHeight) * RECOMMENDATION_TABLE_HEIGHT_RATIO;
List<ArrayList<WidgetItem>> recommendedWidgetsInTable =
- WidgetsTableUtils.groupWidgetItemsIntoTable(recommendedWidgets,
- mMaxSpansPerRow);
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithoutReordering(
+ recommendedWidgets, mMaxSpansPerRow);
table.setRecommendedWidgets(recommendedWidgetsInTable, maxTableHeight);
} else {
table.setVisibility(GONE);
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java b/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java
index 8c9ff09..05e26ad 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java
@@ -93,7 +93,7 @@
}
table.setListDrawableState(((position & POSITION_LAST) != 0) ? LAST : MIDDLE);
List<ArrayList<WidgetItem>> widgetItemsTable =
- WidgetsTableUtils.groupWidgetItemsIntoTable(
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithReordering(
entry.mWidgets, entry.getMaxSpanSizeInCells());
recycleTableBeforeBinding(table, widgetItemsTable);
diff --git a/src/com/android/launcher3/widget/util/WidgetsTableUtils.java b/src/com/android/launcher3/widget/util/WidgetsTableUtils.java
index 54aaf93..72e27bf 100644
--- a/src/com/android/launcher3/widget/util/WidgetsTableUtils.java
+++ b/src/com/android/launcher3/widget/util/WidgetsTableUtils.java
@@ -45,9 +45,20 @@
return item.spanX > otherItem.spanX ? 1 : -1;
};
+ /**
+ * Groups {@code widgetItems} items into a 2D array which matches their appearance in a UI
+ * table. This takes liberty to rearrange widgets to make the table visually appealing.
+ */
+ public static List<ArrayList<WidgetItem>> groupWidgetItemsIntoTableWithReordering(
+ List<WidgetItem> widgetItems, final int maxSpansPerRow) {
+ List<WidgetItem> sortedWidgetItems = widgetItems.stream().sorted(WIDGET_SHORTCUT_COMPARATOR)
+ .collect(Collectors.toList());
+ return groupWidgetItemsIntoTableWithoutReordering(sortedWidgetItems, maxSpansPerRow);
+ }
/**
- * Groups widgets items into a 2D array which matches their appearance in a UI table.
+ * Groups {@code widgetItems} into a 2D array which matches their appearance in a UI table while
+ * maintaining their order.
*
* <p>Grouping:
* 1. Widgets and shortcuts never group together in the same row.
@@ -64,13 +75,12 @@
* should be moved to a new row.
* Example 3: Row 1: 6x4. This is okay because this is the only item in the row.
*/
- public static List<ArrayList<WidgetItem>> groupWidgetItemsIntoTable(
+ public static List<ArrayList<WidgetItem>> groupWidgetItemsIntoTableWithoutReordering(
List<WidgetItem> widgetItems, final int maxSpansPerRow) {
- List<WidgetItem> sortedWidgetItems = widgetItems.stream().sorted(WIDGET_SHORTCUT_COMPARATOR)
- .collect(Collectors.toList());
+
List<ArrayList<WidgetItem>> widgetItemsTable = new ArrayList<>();
ArrayList<WidgetItem> widgetItemsAtRow = null;
- for (WidgetItem widgetItem : sortedWidgetItems) {
+ for (WidgetItem widgetItem : widgetItems) {
if (widgetItemsAtRow == null) {
widgetItemsAtRow = new ArrayList<>();
widgetItemsTable.add(widgetItemsAtRow);
diff --git a/src_plugins/com/android/systemui/plugins/RecentsExtraCard.java b/src_plugins/com/android/systemui/plugins/RecentsExtraCard.java
deleted file mode 100644
index cd9f33d..0000000
--- a/src_plugins/com/android/systemui/plugins/RecentsExtraCard.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.systemui.plugins;
-
-import android.app.Activity;
-import android.content.Context;
-import android.widget.FrameLayout;
-
-import com.android.systemui.plugins.annotations.ProvidesInterface;
-
-/**
- * Implement this interface to allow extra card on recents overview.
- */
-@ProvidesInterface(action = RecentsExtraCard.ACTION, version = RecentsExtraCard.VERSION)
-public interface RecentsExtraCard extends Plugin {
-
- String ACTION = "com.android.systemui.action.PLUGIN_RECENTS_EXTRA_CARD";
- int VERSION = 1;
-
- /**
- * Sets up the recents overview extra card and fills in data.
- *
- * @param context Plugin context
- * @param frameLayout PlaceholderView
- * @param activity Recents activity to hold extra view
- */
- void setupView(Context context, FrameLayout frameLayout, Activity activity);
-}
diff --git a/tests/src/com/android/launcher3/widget/picker/util/WidgetsTableUtilsTest.java b/tests/src/com/android/launcher3/widget/picker/util/WidgetsTableUtilsTest.java
index d6da776..715dcca 100644
--- a/tests/src/com/android/launcher3/widget/picker/util/WidgetsTableUtilsTest.java
+++ b/tests/src/com/android/launcher3/widget/picker/util/WidgetsTableUtilsTest.java
@@ -92,12 +92,13 @@
@Test
- public void groupWidgetItemsIntoTable_widgetsOnly_maxSpansPerRow5_shouldGroupWidgetsInTable() {
+ public void groupWidgetItemsIntoTableWithReordering_widgetsOnly_maxSpansPerRow5_shouldGroupWidgetsInTable() {
List<WidgetItem> widgetItems = List.of(mWidget4x4, mWidget2x3, mWidget1x1, mWidget2x4,
mWidget2x2);
- List<ArrayList<WidgetItem>> widgetItemInTable = WidgetsTableUtils.groupWidgetItemsIntoTable(
- widgetItems, /* maxSpansPerRow= */ 5);
+ List<ArrayList<WidgetItem>> widgetItemInTable =
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithReordering(
+ widgetItems, /* maxSpansPerRow= */ 5);
// Row 0: 1x1, 2x2
// Row 1: 2x3, 2x4
@@ -109,12 +110,13 @@
}
@Test
- public void groupWidgetItemsIntoTable_widgetsOnly_maxSpansPerRow4_shouldGroupWidgetsInTable() {
+ public void groupWidgetItemsIntoTableWithReordering_widgetsOnly_maxSpansPerRow4_shouldGroupWidgetsInTable() {
List<WidgetItem> widgetItems = List.of(mWidget4x4, mWidget2x3, mWidget1x1, mWidget2x4,
mWidget2x2);
- List<ArrayList<WidgetItem>> widgetItemInTable = WidgetsTableUtils.groupWidgetItemsIntoTable(
- widgetItems, /* maxSpansPerRow= */ 4);
+ List<ArrayList<WidgetItem>> widgetItemInTable =
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithReordering(
+ widgetItems, /* maxSpansPerRow= */ 4);
// Row 0: 1x1, 2x2
// Row 1: 2x3,
@@ -128,12 +130,13 @@
}
@Test
- public void groupWidgetItemsIntoTable_mixItems_maxSpansPerRow4_shouldGroupWidgetsInTable() {
+ public void groupWidgetItemsIntoTableWithReordering_mixItems_maxSpansPerRow4_shouldGroupWidgetsInTable() {
List<WidgetItem> widgetItems = List.of(mWidget4x4, mShortcut3, mWidget2x3, mShortcut1,
mWidget1x1, mShortcut2, mWidget2x4, mWidget2x2);
- List<ArrayList<WidgetItem>> widgetItemInTable = WidgetsTableUtils.groupWidgetItemsIntoTable(
- widgetItems, /* maxSpansPerRow= */ 4);
+ List<ArrayList<WidgetItem>> widgetItemInTable =
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithReordering(
+ widgetItems, /* maxSpansPerRow= */ 4);
// Row 0: 1x1, 2x2
// Row 1: 2x3,
@@ -148,6 +151,24 @@
assertThat(widgetItemInTable.get(4)).containsExactly(mShortcut3, mShortcut2, mShortcut1);
}
+ @Test
+ public void groupWidgetItemsIntoTableWithoutReordering_shouldMaintainTheOrder() {
+ List<WidgetItem> widgetItems =
+ List.of(mWidget4x4, mWidget2x3, mWidget1x1, mWidget2x4, mWidget2x2);
+
+ List<ArrayList<WidgetItem>> widgetItemInTable =
+ WidgetsTableUtils.groupWidgetItemsIntoTableWithoutReordering(
+ widgetItems, /* maxSpansPerRow= */ 5);
+
+ // Row 0: 4x4
+ // Row 1: 2x3, 1x1
+ // Row 2: 2x4, 2x2
+ assertThat(widgetItemInTable).hasSize(3);
+ assertThat(widgetItemInTable.get(0)).containsExactly(mWidget4x4);
+ assertThat(widgetItemInTable.get(1)).containsExactly(mWidget2x3, mWidget1x1);
+ assertThat(widgetItemInTable.get(2)).containsExactly(mWidget2x4, mWidget2x2);
+ }
+
private void initTestWidgets() {
List<Point> widgetSizes = List.of(new Point(1, 1), new Point(2, 2), new Point(2, 3),
new Point(2, 4), new Point(4, 4));
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 588b6b8..7137c00 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -35,6 +35,7 @@
BaseOverview(LauncherInstrumentation launcher) {
super(launcher);
verifyActiveContainer();
+ verifyActionsViewVisibility();
}
@Override
@@ -59,7 +60,11 @@
final int leftMargin = mLauncher.getTargetInsets().left;
mLauncher.scroll(
overview, Direction.LEFT, new Rect(leftMargin + 1, 0, 0, 0), 20, false);
- verifyActiveContainer();
+ try (LauncherInstrumentation.Closable c2 =
+ mLauncher.addContextLayer("flung forwards")) {
+ verifyActiveContainer();
+ verifyActionsViewVisibility();
+ }
}
}
@@ -95,7 +100,11 @@
final int rightMargin = mLauncher.getTargetInsets().right;
mLauncher.scroll(
overview, Direction.RIGHT, new Rect(0, 0, rightMargin + 1, 0), 20, false);
- verifyActiveContainer();
+ try (LauncherInstrumentation.Closable c2 =
+ mLauncher.addContextLayer("flung backwards")) {
+ verifyActiveContainer();
+ verifyActionsViewVisibility();
+ }
}
}
@@ -150,4 +159,55 @@
return new OverviewActions(overviewActions, mLauncher);
}
}
+
+ /* TODO(b/197630182): Once b/188790554 is fixed, remove instanceof check. Currently, when
+ swiping from app to overview in Fallback Recents, taskbar remains and no action buttons
+ are visible, so we are only testing Overview for now, not BaseOverview. */
+ private void verifyActionsViewVisibility() {
+ if (!(this instanceof Overview)) {
+ return;
+ }
+ try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
+ "want to assert overview actions view visibility")) {
+ if (mLauncher.isTablet() && !isOverviewSnappedToFocusedTask()) {
+ mLauncher.waitUntilLauncherObjectGone("action_buttons");
+ } else {
+ mLauncher.waitForLauncherObject("action_buttons");
+ }
+ }
+ }
+
+ /**
+ * Returns if focused task is currently snapped task in overview.
+ */
+ private boolean isOverviewSnappedToFocusedTask() {
+ if (!mLauncher.isTablet()) {
+ // Focused task only exists in tablet's grid-overview
+ return false;
+ }
+ UiObject2 focusedTask = getFocusedTask();
+ if (focusedTask == null) {
+ return false;
+ }
+ return Math.abs(
+ focusedTask.getVisibleBounds().exactCenterX() - mLauncher.getExactScreenCenterX())
+ < 1;
+ }
+
+ /**
+ * Returns Overview focused task if it exists.
+ */
+ private UiObject2 getFocusedTask() {
+ final List<UiObject2> taskViews = getTasks();
+ if (taskViews.size() == 0) {
+ return null;
+ }
+ int focusedTaskWidth = mLauncher.getFocusedTaskWidth();
+ for (UiObject2 task : taskViews) {
+ if (task.getVisibleBounds().width() == focusedTaskWidth) {
+ return task;
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 69c97c5..f83c031 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -321,6 +321,15 @@
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
+ int getFocusedTaskWidth() {
+ return getTestInfo(TestProtocol.REQUEST_GET_FOCUSED_TASK_WIDTH_FOR_TABLET).getInt(
+ TestProtocol.TEST_INFO_RESPONSE_FIELD);
+ }
+
+ float getExactScreenCenterX() {
+ return getRealDisplaySize().x / 2f;
+ }
+
private void setForcePauseTimeout(long timeout) {
getTestInfo(TestProtocol.REQUEST_SET_FORCE_PAUSE_TIMEOUT, Long.toString(timeout));
}
@@ -1455,11 +1464,6 @@
getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING);
}
- boolean overviewShareEnabled() {
- return getTestInfo(TestProtocol.REQUEST_OVERVIEW_SHARE_ENABLED).getBoolean(
- TestProtocol.TEST_INFO_RESPONSE_FIELD);
- }
-
private void disableSensorRotation() {
getTestInfo(TestProtocol.REQUEST_MOCK_SENSOR_ROTATION);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java
index 4d673a8..0d06be3 100644
--- a/tests/tapl/com/android/launcher3/tapl/Overview.java
+++ b/tests/tapl/com/android/launcher3/tapl/Overview.java
@@ -30,7 +30,6 @@
Overview(LauncherInstrumentation launcher) {
super(launcher);
- verifyActiveContainer();
}
@Override
diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewActions.java b/tests/tapl/com/android/launcher3/tapl/OverviewActions.java
index aa4cc4c..c8c06e4 100644
--- a/tests/tapl/com/android/launcher3/tapl/OverviewActions.java
+++ b/tests/tapl/com/android/launcher3/tapl/OverviewActions.java
@@ -66,35 +66,6 @@
}
/**
- * Click share button, then drags sharesheet down to remove it.
- *
- * Share is currently hidden behind flag, test is kept in case share becomes a default feature.
- * If share is completely removed then remove this test as well.
- */
- @NonNull
- public Overview clickAndDismissShare() {
- if (mLauncher.overviewShareEnabled()) {
- try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
- LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "want to click share button and dismiss sharesheet")) {
- UiObject2 share = mLauncher.waitForObjectInContainer(mOverviewActions,
- "action_share");
- mLauncher.clickLauncherObject(share);
- try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
- "clicked share button")) {
- mLauncher.waitForAndroidObject("contentPanel");
- mLauncher.getDevice().pressBack();
- try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer(
- "dismissed sharesheet")) {
- return new Overview(mLauncher);
- }
- }
- }
- }
- return new Overview(mLauncher);
- }
-
- /**
* Click select button
*
* @return The select mode buttons that are now shown instead of action buttons.