Merge "Add OWNERS to Launcher3/go" am: 278edf2938 am: dc71c0178a
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/1653167
Change-Id: Id3e60d2015fc099461d8ac18767bb909b75d3165
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index ff5bf0d..77f2428 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -154,7 +154,7 @@
TODO: Add proper permissions
-->
<provider
- android:name="com.android.launcher3.graphics.GridOptionsProvider"
+ android:name="com.android.launcher3.graphics.GridCustomizationsProvider"
android:authorities="${packageName}.grid_control"
android:exported="true" />
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 0130cae..23941fa 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -73,7 +73,6 @@
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.FloatProperty;
-import android.util.Property;
import android.util.SparseBooleanArray;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
@@ -1488,7 +1487,9 @@
}
int scrollDiff = newScroll[i] - oldScroll[i] + offset;
if (scrollDiff != 0) {
- Property translationProperty = mOrientationHandler.getPrimaryViewTranslate();
+ FloatProperty translationProperty = child instanceof TaskView
+ ? ((TaskView) child).getPrimaryFillDismissGapTranslationProperty()
+ : mOrientationHandler.getPrimaryViewTranslate();
ResourceProvider rp = DynamicResource.provider(mActivity);
SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_END)
@@ -1883,7 +1884,11 @@
? modalLeftOffsetSize
: modalRightOffsetSize;
float totalTranslation = translation + modalTranslation;
- mOrientationHandler.getPrimaryViewTranslate().set(getChildAt(i),
+ View child = getChildAt(i);
+ FloatProperty translationProperty = child instanceof TaskView
+ ? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty()
+ : mOrientationHandler.getPrimaryViewTranslate();
+ translationProperty.set(child,
totalTranslation * mOrientationHandler.getPrimaryTranslationDirectionFactor());
}
updateCurveProperties();
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index 0bc6e51..a8f2a1c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -153,6 +153,58 @@
}
};
+ private static final FloatProperty<TaskView> FILL_DISMISS_GAP_TRANSLATION_X =
+ new FloatProperty<TaskView>("fillDismissGapTranslationX") {
+ @Override
+ public void setValue(TaskView taskView, float v) {
+ taskView.setFillDismissGapTranslationX(v);
+ }
+
+ @Override
+ public Float get(TaskView taskView) {
+ return taskView.mFillDismissGapTranslationX;
+ }
+ };
+
+ private static final FloatProperty<TaskView> FILL_DISMISS_GAP_TRANSLATION_Y =
+ new FloatProperty<TaskView>("fillDismissGapTranslationY") {
+ @Override
+ public void setValue(TaskView taskView, float v) {
+ taskView.setFillDismissGapTranslationY(v);
+ }
+
+ @Override
+ public Float get(TaskView taskView) {
+ return taskView.mFillDismissGapTranslationY;
+ }
+ };
+
+ private static final FloatProperty<TaskView> TASK_OFFSET_TRANSLATION_X =
+ new FloatProperty<TaskView>("taskOffsetTranslationX") {
+ @Override
+ public void setValue(TaskView taskView, float v) {
+ taskView.setTaskOffsetTranslationX(v);
+ }
+
+ @Override
+ public Float get(TaskView taskView) {
+ return taskView.mTaskOffsetTranslationX;
+ }
+ };
+
+ private static final FloatProperty<TaskView> TASK_OFFSET_TRANSLATION_Y =
+ new FloatProperty<TaskView>("taskOffsetTranslationY") {
+ @Override
+ public void setValue(TaskView taskView, float v) {
+ taskView.setTaskOffsetTranslationY(v);
+ }
+
+ @Override
+ public Float get(TaskView taskView) {
+ return taskView.mTaskOffsetTranslationY;
+ }
+ };
+
private final OnAttachStateChangeListener mTaskMenuStateListener =
new OnAttachStateChangeListener() {
@Override
@@ -180,6 +232,13 @@
private final FullscreenDrawParams mCurrentFullscreenParams;
private final BaseDraggingActivity mActivity;
+ // Various causes of changing primary translation, which we aggregate to setTranslationX/Y().
+ // TODO: We should do this for secondary translation properties as well.
+ private float mFillDismissGapTranslationX;
+ private float mFillDismissGapTranslationY;
+ private float mTaskOffsetTranslationX;
+ private float mTaskOffsetTranslationY;
+
private ObjectAnimator mIconAndDimAnimator;
private float mIconScaleAnimStartProgress = 0;
private float mFocusTransitionProgress = 1;
@@ -619,6 +678,8 @@
protected void resetViewTransforms() {
setCurveScale(1);
+ mFillDismissGapTranslationX = mTaskOffsetTranslationX = 0f;
+ mFillDismissGapTranslationY = mTaskOffsetTranslationY = 0f;
setTranslationX(0f);
setTranslationY(0f);
setTranslationZ(0);
@@ -835,6 +896,44 @@
return mCurveScale;
}
+ private void setFillDismissGapTranslationX(float x) {
+ mFillDismissGapTranslationX = x;
+ applyTranslationX();
+ }
+
+ private void setFillDismissGapTranslationY(float y) {
+ mFillDismissGapTranslationY = y;
+ applyTranslationY();
+ }
+
+ private void setTaskOffsetTranslationX(float x) {
+ mTaskOffsetTranslationX = x;
+ applyTranslationX();
+ }
+
+ private void setTaskOffsetTranslationY(float y) {
+ mTaskOffsetTranslationY = y;
+ applyTranslationY();
+ }
+
+ private void applyTranslationX() {
+ setTranslationX(mFillDismissGapTranslationX + mTaskOffsetTranslationX);
+ }
+
+ private void applyTranslationY() {
+ setTranslationY(mFillDismissGapTranslationY + mTaskOffsetTranslationY);
+ }
+
+ public FloatProperty<TaskView> getPrimaryFillDismissGapTranslationProperty() {
+ return getPagedOrientationHandler().getPrimaryValue(
+ FILL_DISMISS_GAP_TRANSLATION_X, FILL_DISMISS_GAP_TRANSLATION_Y);
+ }
+
+ public FloatProperty<TaskView> getPrimaryTaskOffsetTranslationProperty() {
+ return getPagedOrientationHandler().getPrimaryValue(
+ TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y);
+ }
+
@Override
public boolean hasOverlappingRendering() {
// TODO: Clip-out the icon region from the thumbnail, since they are overlapping.
diff --git a/src/com/android/launcher3/CheckLongPressHelper.java b/src/com/android/launcher3/CheckLongPressHelper.java
index ff405ec..c707df0 100644
--- a/src/com/android/launcher3/CheckLongPressHelper.java
+++ b/src/com/android/launcher3/CheckLongPressHelper.java
@@ -115,7 +115,7 @@
private void triggerLongPress() {
if ((mView.getParent() != null)
&& mView.hasWindowFocus()
- && (!mView.isPressed() || mListener == null)
+ && (!mView.isPressed() || mListener != null)
&& !mHasPerformedLongPress) {
boolean handled;
if (mListener != null) {
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index bf63788..292a808 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -67,7 +67,7 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
-import com.android.launcher3.graphics.GridOptionsProvider;
+import com.android.launcher3.graphics.GridCustomizationsProvider;
import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.icons.IconProvider;
import com.android.launcher3.icons.LauncherIcons;
@@ -521,7 +521,7 @@
public static boolean isGridOptionsEnabled(Context context) {
return isComponentEnabled(context.getPackageManager(),
context.getPackageName(),
- GridOptionsProvider.class.getName());
+ GridCustomizationsProvider.class.getName());
}
private static boolean isComponentEnabled(PackageManager pm, String pkgName, String clsName) {
diff --git a/src/com/android/launcher3/graphics/GridOptionsProvider.java b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
similarity index 97%
rename from src/com/android/launcher3/graphics/GridOptionsProvider.java
rename to src/com/android/launcher3/graphics/GridCustomizationsProvider.java
index 08d7e4c..cb42e7a 100644
--- a/src/com/android/launcher3/graphics/GridOptionsProvider.java
+++ b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
@@ -40,9 +40,9 @@
* /default_grid: Call update to set the current grid, with values
* name: name of the grid to apply
*/
-public class GridOptionsProvider extends ContentProvider {
+public class GridCustomizationsProvider extends ContentProvider {
- private static final String TAG = "GridOptionsProvider";
+ private static final String TAG = "GridCustomizationsProvider";
private static final String KEY_NAME = "name";
private static final String KEY_ROWS = "rows";
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index e64d2bb..bfa24eb 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -42,12 +42,12 @@
public class LandscapePagedViewHandler implements PagedOrientationHandler {
@Override
- public int getPrimaryValue(int x, int y) {
+ public <T> T getPrimaryValue(T x, T y) {
return y;
}
@Override
- public int getSecondaryValue(int x, int y) {
+ public <T> T getSecondaryValue(T x, T y) {
return x;
}
diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java
index e4a2407..e7d2ad5 100644
--- a/src/com/android/launcher3/touch/PagedOrientationHandler.java
+++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java
@@ -83,8 +83,8 @@
boolean getRecentsRtlSetting(Resources resources);
float getDegreesRotated();
int getRotation();
- int getPrimaryValue(int x, int y);
- int getSecondaryValue(int x, int y);
+ <T> T getPrimaryValue(T x, T y);
+ <T> T getSecondaryValue(T x, T y);
void delegateScrollTo(PagedView pagedView, int secondaryScroll, int primaryScroll);
/** Uses {@params pagedView}.getScroll[X|Y]() method for the secondary amount*/
void delegateScrollTo(PagedView pagedView, int primaryScroll);
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index e4662de..e5a8967 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -40,12 +40,12 @@
public class PortraitPagedViewHandler implements PagedOrientationHandler {
@Override
- public int getPrimaryValue(int x, int y) {
+ public <T> T getPrimaryValue(T x, T y) {
return x;
}
@Override
- public int getSecondaryValue(int x, int y) {
+ public <T> T getSecondaryValue(T x, T y) {
return y;
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 0c4e5a9..816cd7d 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -210,6 +210,64 @@
}
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
}
+ /** Swipes left to switch to the previous app. */
+ public Background quickSwitchToPreviousAppSwipeLeft() {
+ try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
+ LauncherInstrumentation.Closable c =
+ mLauncher.addContextLayer("want to quick switch to the previous app")) {
+ verifyActiveContainer();
+ quickSwitchToPreviousAppSwipeLeft(getExpectedStateForQuickSwitch());
+ return new Background(mLauncher);
+ }
+ }
+
+ protected void quickSwitchToPreviousAppSwipeLeft(int expectedState) {
+ final boolean launcherWasVisible = mLauncher.isLauncherVisible();
+ boolean transposeInLandscape = false;
+ switch (mLauncher.getNavigationModel()) {
+ case TWO_BUTTON:
+ transposeInLandscape = true;
+ // Fall through, zero button and two button modes behave the same.
+ case ZERO_BUTTON: {
+ final int startX;
+ final int startY;
+ final int endX;
+ final int endY;
+ if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
+ // Swipe from the bottom right to the bottom left of the screen.
+ startX = mLauncher.getDevice().getDisplayWidth();
+ startY = getSwipeStartY();
+ endX = 0;
+ endY = startY;
+ } else {
+ // Swipe from the bottom right to the top right of the screen.
+ startX = getSwipeStartX();
+ startY = mLauncher.getRealDisplaySize().y - 1;
+ endX = startX;
+ endY = 0;
+ }
+ final boolean isZeroButton =
+ mLauncher.getNavigationModel()
+ == LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
+ mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState,
+ launcherWasVisible && isZeroButton
+ ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
+ : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
+ break;
+ }
+
+ case THREE_BUTTON:
+ // Double press the recents button.
+ UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps");
+ mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
+ mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL);
+ mLauncher.getOverview();
+ mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
+ recentsButton.click();
+ break;
+ }
+ mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
+ }
protected String getSwipeHeightRequestName() {
return TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT;