From f535787571c37fea4a7a5c8ce5c97389c99a825c Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 20 May 2019 12:35:00 -0700 Subject: [PATCH 01/47] Use spring to update window/icon scale for swipe up animation. Bug: 123900446 Change-Id: I644dae6210ab3c8b72c777a556dfde4ae4cdce8f --- .../quickstep/util/RectFSpringAnim.java | 59 ++++++++----------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java index 3f4ad58ab8..77dc6f32e7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java @@ -16,26 +16,22 @@ package com.android.quickstep.util; import android.animation.Animator; -import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; -import android.animation.ValueAnimator; import android.content.res.Resources; import android.graphics.PointF; import android.graphics.RectF; -import android.util.FloatProperty; import androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener; import androidx.dynamicanimation.animation.FloatPropertyCompat; +import androidx.dynamicanimation.animation.SpringAnimation; +import androidx.dynamicanimation.animation.SpringForce; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.FlingSpringAnim; import java.util.ArrayList; import java.util.List; -import static com.android.launcher3.anim.Interpolators.DEACCEL; /** * Applies spring forces to animate from a starting rect to a target rect, @@ -43,14 +39,6 @@ import static com.android.launcher3.anim.Interpolators.DEACCEL; */ public class RectFSpringAnim { - /** - * Although the rect position animation takes an indefinite amount of time since it depends on - * the initial velocity and applied forces, scaling from the starting rect to the target rect - * can be done in parallel at a fixed duration. Update callbacks are sent based on the progress - * of this animation, while the end callback is sent after all animations finish. - */ - private static final long RECT_SCALE_DURATION = 250; - private static final FloatPropertyCompat RECT_CENTER_X = new FloatPropertyCompat("rectCenterXSpring") { @Override @@ -79,17 +67,17 @@ public class RectFSpringAnim { } }; - private static final FloatProperty RECT_SCALE_PROGRESS = - new FloatProperty("rectScaleProgress") { + private static final FloatPropertyCompat RECT_SCALE_PROGRESS = + new FloatPropertyCompat("rectScaleProgress") { @Override - public Float get(RectFSpringAnim anim) { - return anim.mCurrentScaleProgress; + public float getValue(RectFSpringAnim object) { + return object.mCurrentScaleProgress; } @Override - public void setValue(RectFSpringAnim anim, float currentScaleProgress) { - anim.mCurrentScaleProgress = currentScaleProgress; - anim.onUpdate(); + public void setValue(RectFSpringAnim object, float value) { + object.mCurrentScaleProgress = value; + object.onUpdate(); } }; @@ -106,7 +94,7 @@ public class RectFSpringAnim { private float mCurrentScaleProgress; private FlingSpringAnim mRectXAnim; private FlingSpringAnim mRectYAnim; - private ValueAnimator mRectScaleAnim; + private SpringAnimation mRectScaleAnim; private boolean mAnimsStarted; private boolean mRectXAnimEnded; private boolean mRectYAnimEnded; @@ -177,17 +165,18 @@ public class RectFSpringAnim { mRectYAnim = new FlingSpringAnim(this, RECT_Y, startY, endY, startVelocityY, mMinVisChange, minYValue, maxYValue, springVelocityFactor, onYEndListener); - mRectScaleAnim = ObjectAnimator.ofPropertyValuesHolder(this, - PropertyValuesHolder.ofFloat(RECT_SCALE_PROGRESS, 1)) - .setDuration(RECT_SCALE_DURATION); - mRectScaleAnim.setInterpolator(DEACCEL); - mRectScaleAnim.addListener(new AnimationSuccessListener() { - @Override - public void onAnimationSuccess(Animator animator) { - mRectScaleAnimEnded = true; - maybeOnEnd(); - } - }); + float minVisibleChange = 1f / mStartRect.height(); + mRectScaleAnim = new SpringAnimation(this, RECT_SCALE_PROGRESS) + .setSpring(new SpringForce(1f) + .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY) + .setStiffness(SpringForce.STIFFNESS_LOW)) + .setStartVelocity(velocityPxPerMs.y * minVisibleChange) + .setMaxValue(1f) + .setMinimumVisibleChange(minVisibleChange) + .addEndListener((animation, canceled, value, velocity) -> { + mRectScaleAnimEnded = true; + maybeOnEnd(); + }); mRectXAnim.start(); mRectYAnim.start(); @@ -202,7 +191,9 @@ public class RectFSpringAnim { if (mAnimsStarted) { mRectXAnim.end(); mRectYAnim.end(); - mRectScaleAnim.end(); + if (mRectScaleAnim.canSkipToEnd()) { + mRectScaleAnim.skipToEnd(); + } } } From 2524b82369265c3b8f5c6b5b6495376df6781770 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 17 May 2019 16:33:37 -0700 Subject: [PATCH 02/47] Remove unnecessary dispatchInsets routing Insets are dispatched to all views. We never consume the insets and let each view decide what to do with it. Also fixing scrim in all-apps when in full-gesture navigation Change-Id: Ib1c6bef5b32aac0c6ea03078b5138d2d0408c6d8 --- .../android/quickstep/fallback/RecentsRootView.java | 9 +-------- src/com/android/launcher3/LauncherRootView.java | 9 +-------- .../launcher3/allapps/AllAppsContainerView.java | 12 +++++++++++- src/com/android/launcher3/views/BaseDragLayer.java | 4 +++- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java index 09d323ee69..1820729576 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java @@ -20,7 +20,6 @@ import android.content.Context; import android.graphics.Point; import android.graphics.Rect; import android.util.AttributeSet; -import android.view.WindowInsets; import com.android.launcher3.BaseActivity; import com.android.launcher3.R; @@ -71,7 +70,7 @@ public class RecentsRootView extends BaseDragLayer { // Update device profile before notifying the children. mActivity.getDeviceProfile().updateInsets(insets); setInsets(insets); - return true; // I'll take it from here + return false; // Let children get the full insets } @Override @@ -89,10 +88,4 @@ public class RecentsRootView extends BaseDragLayer { mActivity.getDeviceProfile().updateInsets(mInsets); super.setInsets(mInsets); } - - @Override - public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) { - updateTouchExcludeRegion(insets); - return super.dispatchApplyWindowInsets(insets); - } } \ No newline at end of file diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java index 20eec05d44..49b380b41f 100644 --- a/src/com/android/launcher3/LauncherRootView.java +++ b/src/com/android/launcher3/LauncherRootView.java @@ -14,7 +14,6 @@ import android.os.Build; import android.util.AttributeSet; import android.view.View; import android.view.ViewDebug; -import android.view.WindowInsets; import java.util.Collections; import java.util.List; @@ -101,7 +100,7 @@ public class LauncherRootView extends InsettableFrameLayout { mLauncher.getStateManager().reapplyState(true /* cancelCurrentAnimation */); } - return true; // I'll take it from here + return false; // Let children get the full insets } @Override @@ -156,12 +155,6 @@ public class LauncherRootView extends InsettableFrameLayout { } } - @Override - public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) { - mLauncher.getDragLayer().updateTouchExcludeRegion(insets); - return super.dispatchApplyWindowInsets(insets); - } - @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 41252aab54..0db563f597 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -31,6 +31,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.WindowInsets; import com.android.launcher3.AppInfo; import com.android.launcher3.DeviceProfile; @@ -313,12 +314,21 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } setLayoutParams(mlp); - mNavBarScrimHeight = insets.bottom; InsettableFrameLayout.dispatchInsets(this, insets); mLauncher.getAllAppsController() .setScrollRangeDelta(mSearchUiManager.getScrollRangeDelta(insets)); } + @Override + public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) { + if (Utilities.ATLEAST_Q) { + mNavBarScrimHeight = insets.getTappableElementInsets().bottom; + } else { + mNavBarScrimHeight = insets.getStableInsetBottom(); + } + return super.dispatchApplyWindowInsets(insets); + } + @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index 3c81bcf399..bcf299fd63 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -487,12 +487,14 @@ public abstract class BaseDragLayer } } + @Override @TargetApi(Build.VERSION_CODES.Q) - public void updateTouchExcludeRegion(WindowInsets insets) { + public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) { if (Utilities.ATLEAST_Q) { Insets gestureInsets = insets.getMandatorySystemGestureInsets(); mSystemGestureRegion.set(gestureInsets.left, gestureInsets.top, gestureInsets.right, gestureInsets.bottom); } + return super.dispatchApplyWindowInsets(insets); } } From be8c34077cb06da736053926f931c3e4f0be44dc Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 22 May 2019 15:17:52 -0700 Subject: [PATCH 03/47] Lock launcher rotation during activity transition to allow proper seamless transition at the end Bug: 131360075 Change-Id: I2b76d4b3e0528e56b7b4709fd3708bc858bf1612 --- src/com/android/launcher3/Launcher.java | 6 ++++-- .../android/launcher3/states/RotationHelper.java | 14 ++++++++++++++ .../android/launcher3/views/FloatingIconView.java | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 40eb912df5..07bacf325b 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -29,6 +29,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.logging.LoggerUtils.newTarget; +import static com.android.launcher3.states.RotationHelper.REQUEST_NONE; import static com.android.launcher3.util.RaceConditionTracker.ENTER; import static com.android.launcher3.util.RaceConditionTracker.EXIT; @@ -76,8 +77,6 @@ import android.view.accessibility.AccessibilityEvent; import android.view.animation.OvershootInterpolator; import android.widget.Toast; -import androidx.annotation.Nullable; - import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.allapps.AllAppsContainerView; @@ -154,6 +153,8 @@ import java.util.HashSet; import java.util.List; import java.util.function.Predicate; +import androidx.annotation.Nullable; + /** * Default launcher application. */ @@ -406,6 +407,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, super.onEnterAnimationComplete(); UiFactory.onEnterAnimationComplete(this); mAllAppsController.highlightWorkTabIfNecessary(); + mRotationHelper.setCurrentTransitionRequest(REQUEST_NONE); } @Override diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java index 3727fa6632..b6c3c35b89 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -62,6 +62,10 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { * Rotation request made by {@link InternalStateHandler}. This supersedes any other request. */ private int mStateHandlerRequest = REQUEST_NONE; + /** + * Rotation request made by an app transition + */ + private int mCurrentTransitionRequest = REQUEST_NONE; /** * Rotation request made by a Launcher State */ @@ -123,6 +127,13 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { } } + public void setCurrentTransitionRequest(int request) { + if (mCurrentTransitionRequest != request) { + mCurrentTransitionRequest = request; + notifyChange(); + } + } + public void setCurrentStateRequest(int request) { if (mCurrentStateRequest != request) { mCurrentStateRequest = request; @@ -163,6 +174,9 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { if (mStateHandlerRequest != REQUEST_NONE) { activityFlags = mStateHandlerRequest == REQUEST_LOCK ? SCREEN_ORIENTATION_LOCKED : SCREEN_ORIENTATION_UNSPECIFIED; + } else if (mCurrentTransitionRequest != REQUEST_NONE) { + activityFlags = mCurrentTransitionRequest == REQUEST_LOCK ? + SCREEN_ORIENTATION_LOCKED : SCREEN_ORIENTATION_UNSPECIFIED; } else if (mCurrentStateRequest == REQUEST_LOCK) { activityFlags = SCREEN_ORIENTATION_LOCKED; } else if (mIgnoreAutoRotateSettings || mCurrentStateRequest == REQUEST_ROTATE diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 3d5877a597..3b18621af9 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -20,6 +20,7 @@ import static com.android.launcher3.Utilities.getBadge; import static com.android.launcher3.Utilities.mapToRange; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM; +import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -169,6 +170,7 @@ public class FloatingIconView extends View implements protected void onAttachedToWindow() { super.onAttachedToWindow(); getViewTreeObserver().addOnGlobalLayoutListener(this); + mLauncher.getRotationHelper().setCurrentTransitionRequest(REQUEST_LOCK); } @Override From aa8b2d86fcb709a23f7ef676500f11284cdd144b Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 22 May 2019 14:39:52 -0700 Subject: [PATCH 04/47] Capture screenshot when animating to home This is to ensure the task thumbnail is captured in the correct orientation, rather than waiting until after the task pauses which might be after the device rotates to portrait. Also update the state to wait until screenshot is captured before finishing the transition to home. Test: testStressPressHome Test: Swipe up from a forced landscape app, enter overview; ensure task view thumbnail is shown correctly Bug: 132687470 Change-Id: I5cd5f4b2a413628a8bdcb456e2d132c1c2da5258 --- .../quickstep/WindowTransformSwipeHandler.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 2ff5c0c6a5..bbc6eb3a5e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -170,7 +170,8 @@ public class WindowTransformSwipeHandler STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED; public enum GestureEndTarget { - HOME(1, STATE_SCALED_CONTROLLER_HOME, true, false, ContainerType.WORKSPACE, false), + HOME(1, STATE_SCALED_CONTROLLER_HOME | STATE_CAPTURE_SCREENSHOT, true, false, + ContainerType.WORKSPACE, false), RECENTS(1, STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT | STATE_SCREENSHOT_VIEW_SHOWN, true, false, ContainerType.TASKSWITCHER, true), @@ -331,9 +332,8 @@ public class WindowTransformSwipeHandler | STATE_SCALED_CONTROLLER_RECENTS, this::finishCurrentTransitionToRecents); - mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_GESTURE_COMPLETED - | STATE_SCALED_CONTROLLER_HOME | STATE_APP_CONTROLLER_RECEIVED - | STATE_LAUNCHER_DRAWN, + mStateCallback.addCallback(STATE_SCREENSHOT_CAPTURED | STATE_GESTURE_COMPLETED + | STATE_SCALED_CONTROLLER_HOME, this::finishCurrentTransitionToHome); mStateCallback.addCallback(STATE_SCALED_CONTROLLER_HOME | STATE_CURRENT_TASK_FINISHED, this::reset); @@ -1251,7 +1251,14 @@ public class WindowTransformSwipeHandler if (mTaskSnapshot == null) { mTaskSnapshot = controller.screenshotTask(mRunningTaskId); } - TaskView taskView = mRecentsView.updateThumbnail(mRunningTaskId, mTaskSnapshot); + final TaskView taskView; + if (mGestureEndTarget == HOME) { + // Capture the screenshot before finishing the transition to home to ensure it's + // taken in the correct orientation, but no need to update the thumbnail. + taskView = null; + } else { + taskView = mRecentsView.updateThumbnail(mRunningTaskId, mTaskSnapshot); + } if (taskView != null) { // Defer finishing the animation until the next launcher frame with the // new thumbnail From 7664a483f28359f98ea01445cd04bbacba9eeb5c Mon Sep 17 00:00:00 2001 From: Perumaal S Date: Wed, 22 May 2019 15:45:48 -0700 Subject: [PATCH 05/47] Chips flag turn on by default Change-Id: Ia5d23a4711ec507cce75d205d3b8e17434ab6b1e --- src/com/android/launcher3/config/BaseFlags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index bad8282f54..2a14ea0ddd 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -107,7 +107,7 @@ abstract class BaseFlags { "ENABLE_QUICKSTEP_LIVE_TILE", false, "Enable live tile in Quickstep overview"); public static final TogglableFlag ENABLE_HINTS_IN_OVERVIEW = new TogglableFlag( - "ENABLE_HINTS_IN_OVERVIEW", false, + "ENABLE_HINTS_IN_OVERVIEW", true, "Show chip hints and gleams on the overview screen"); public static final TogglableFlag FAKE_LANDSCAPE_UI = new TogglableFlag( From 41f9347653286803a5ca417f5a23a4e4480bbe26 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 22 May 2019 19:08:24 -0700 Subject: [PATCH 06/47] TAPL: Little cleanup Change-Id: I254ad6679b19700bd86c49a2acea3de7eae90fb7 --- .../launcher3/tapl/LauncherInstrumentation.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a4711f5f19..8f4bef0baf 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -541,25 +541,22 @@ public final class LauncherInstrumentation { @NonNull UiObject2 waitForLauncherObject(String resName) { - final BySelector selector = getLauncherObjectSelector(resName); - final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS); - assertNotNull("Can't find a launcher object; selector: " + selector, object); - return object; + return waitForObjectBySelector(getLauncherObjectSelector(resName)); } @NonNull UiObject2 waitForLauncherObjectByClass(String clazz) { - final BySelector selector = getLauncherObjectSelectorByClass(clazz); - final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS); - assertNotNull("Can't find a launcher object; selector: " + selector, object); - return object; + return waitForObjectBySelector(getLauncherObjectSelectorByClass(clazz)); } @NonNull UiObject2 waitForFallbackLauncherObject(String resName) { - final BySelector selector = getFallbackLauncherObjectSelector(resName); + return waitForObjectBySelector(getFallbackLauncherObjectSelector(resName)); + } + + private UiObject2 waitForObjectBySelector(BySelector selector) { final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS); - assertNotNull("Can't find a fallback launcher object; selector: " + selector, object); + assertNotNull("Can't find a launcher object; selector: " + selector, object); return object; } From a8700f69ebaed9ffee1481da4d1a0fb9046a440a Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Thu, 30 Aug 2018 16:01:47 -0700 Subject: [PATCH 07/47] Adding 1 more icon to all apps for virtual devices Change-Id: I1ebde81ab03b46c325e49196c89ed5866f5d838a --- tests/AndroidManifest-common.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml index 75ff66e6ea..61c7306e57 100644 --- a/tests/AndroidManifest-common.xml +++ b/tests/AndroidManifest-common.xml @@ -184,5 +184,13 @@ + + + + + + From 40bbfbed0f9104b83ffe5c8c16000d726177c91b Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 22 May 2019 19:20:57 -0700 Subject: [PATCH 08/47] Reducing test wait time from 60 sec to 10 sec Bug: 112282235 Bug: 121279417 Change-Id: Id88e782145b5fdae42354f6fce830aa05b78857a --- .../tests/src/com/android/quickstep/TaplTestsQuickstep.java | 2 +- .../src/com/android/launcher3/ui/AbstractLauncherUiTest.java | 5 ++--- .../com/android/launcher3/tapl/LauncherInstrumentation.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 43d6311843..f02859f462 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -127,7 +127,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { assertNotNull("OverviewTask.open returned null", task.open()); assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject( By.pkg(getAppPackageName()).text("TestActivity2")), - LONG_WAIT_TIME_MS)); + DEFAULT_UI_TIMEOUT)); executeOnLauncher(launcher -> assertTrue( "Launcher activity is the top activity; expecting another activity to be the top " + "one", diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 74cece836c..92bc77fac5 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -91,7 +91,6 @@ public abstract class AbstractLauncherUiTest { public static final long SHORT_UI_TIMEOUT = 300; public static final long DEFAULT_UI_TIMEOUT = 10000; - protected static final int LONG_WAIT_TIME_MS = 60000; private static final String TAG = "AbstractLauncherUiTest"; private static int sScreenshotCount = 0; @@ -394,7 +393,7 @@ public abstract class AbstractLauncherUiTest { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); instrumentation.getTargetContext().startActivity(intent); assertTrue(packageName + " didn't start", - mDevice.wait(Until.hasObject(By.pkg(packageName).depth(0)), LONG_WAIT_TIME_MS)); + mDevice.wait(Until.hasObject(By.pkg(packageName).depth(0)), DEFAULT_UI_TIMEOUT)); } protected void startTestActivity(int activityNumber) { @@ -410,7 +409,7 @@ public abstract class AbstractLauncherUiTest { assertTrue(packageName + " didn't start", mDevice.wait( Until.hasObject(By.pkg(packageName).text("TestActivity" + activityNumber)), - LONG_WAIT_TIME_MS)); + DEFAULT_UI_TIMEOUT)); } protected static String resolveSystemApp(String category) { diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a4711f5f19..57d84b10c7 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -115,7 +115,7 @@ public final class LauncherInstrumentation { private static final String APPS_RES_ID = "apps_view"; private static final String OVERVIEW_RES_ID = "overview_panel"; private static final String WIDGETS_RES_ID = "widgets_list_view"; - public static final int WAIT_TIME_MS = 60000; + public static final int WAIT_TIME_MS = 10000; private static final String SYSTEMUI_PACKAGE = "com.android.systemui"; private static WeakReference sActiveContainer = new WeakReference<>(null); From f5d02b069a28e759dd3484ef2e807f32fe53516f Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 22 May 2019 14:52:37 -0700 Subject: [PATCH 09/47] Reading navigation_bar_gesture_height for bottom swipe region Bug: 132917885 Change-Id: I39d266fc34a69c3ba50246b5a66350942a85becb --- .../android/quickstep/TouchInteractionService.java | 14 +++----------- src/com/android/launcher3/ResourceUtils.java | 5 ++--- .../launcher3/ui/AbstractLauncherUiTest.java | 2 +- tests/tapl/com/android/launcher3/tapl/AllApps.java | 2 +- tests/tapl/com/android/launcher3/tapl/Widgets.java | 2 +- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 0c997dd598..6ba1bf5c55 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -331,16 +331,8 @@ public class TouchInteractionService extends Service implements defaultDisplay.getRealSize(realSize); mSwipeTouchRegion.set(0, 0, realSize.x, realSize.y); if (mMode == Mode.NO_BUTTON) { - switch (defaultDisplay.getRotation()) { - case Surface.ROTATION_90: - case Surface.ROTATION_270: - mSwipeTouchRegion.top = mSwipeTouchRegion.bottom - getNavbarSize( - ResourceUtils.NAVBAR_LANDSCAPE_BOTTOM_SIZE); - break; - default: - mSwipeTouchRegion.top = mSwipeTouchRegion.bottom - getNavbarSize( - ResourceUtils.NAVBAR_PORTRAIT_BOTTOM_SIZE); - } + mSwipeTouchRegion.top = mSwipeTouchRegion.bottom - + getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE); } else { switch (defaultDisplay.getRotation()) { case Surface.ROTATION_90: @@ -353,7 +345,7 @@ public class TouchInteractionService extends Service implements break; default: mSwipeTouchRegion.top = mSwipeTouchRegion.bottom - - getNavbarSize(ResourceUtils.NAVBAR_PORTRAIT_BOTTOM_SIZE); + - getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE); } } } diff --git a/src/com/android/launcher3/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java index 0c80d130ea..73e705b586 100644 --- a/src/com/android/launcher3/ResourceUtils.java +++ b/src/com/android/launcher3/ResourceUtils.java @@ -21,10 +21,9 @@ import android.util.DisplayMetrics; import android.util.TypedValue; public class ResourceUtils { - public static final String NAVBAR_PORTRAIT_BOTTOM_SIZE = "navigation_bar_frame_height"; public static final String NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE = "navigation_bar_width"; - public static final String NAVBAR_LANDSCAPE_BOTTOM_SIZE - = "navigation_bar_frame_height_landscape"; + public static final String NAVBAR_BOTTOM_GESTURE_SIZE = "navigation_bar_gesture_height"; + public static int getNavbarSize(String resName, Resources res) { return getDimenByName(resName, res, 48); diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 74cece836c..b4355ae15e 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -243,7 +243,7 @@ public abstract class AbstractLauncherUiTest { */ protected UiObject2 scrollAndFind(UiObject2 container, BySelector condition) { final int margin = ResourceUtils.getNavbarSize( - ResourceUtils.NAVBAR_PORTRAIT_BOTTOM_SIZE, mLauncher.getResources()) + 1; + ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources()) + 1; container.setGestureMargins(0, 0, 0, margin); int i = 0; diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java index 70405fed8a..b2043cb5a2 100644 --- a/tests/tapl/com/android/launcher3/tapl/AllApps.java +++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java @@ -97,7 +97,7 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { 0, getSearchBox(allAppsContainer).getVisibleBounds().bottom + 1, 0, - ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_PORTRAIT_BOTTOM_SIZE, + ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources()) + 1); final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher); if (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector)) { diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index b780df4adb..94003be919 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -41,7 +41,7 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { LauncherInstrumentation.log("Widgets.flingForward enter"); final UiObject2 widgetsContainer = verifyActiveContainer(); widgetsContainer.setGestureMargins(0, 0, 0, - ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_PORTRAIT_BOTTOM_SIZE, + ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources()) + 1); widgetsContainer.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity())); From 0c1ed7cb4cf6f5e46211731bb243bdb308c1eaac Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 23 May 2019 11:30:09 -0700 Subject: [PATCH 10/47] Quick patch for PredictionUiStateManager.applyState interrupting allapps Constructor of PredictionUiStateManager posts an action in 5 sec, which may interfere with the process of opening all apps. Waiting until the posted action happens. Hopefully this will fix massive flakes. Bug: 131854153 Change-Id: I6544eae1a3b063c03e78185826c05a76add1f71b --- .../launcher3/appprediction/PredictionUiStateManager.java | 3 +++ .../src/com/android/quickstep/AppPredictionsUITests.java | 3 +++ src/com/android/launcher3/Launcher.java | 4 ++++ tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java | 2 ++ 4 files changed, 12 insertions(+) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java index 6dad9afe57..28ecce07ea 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java @@ -197,7 +197,10 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf } } + public boolean mDebugHadStateUpdate; + private void updatePredictionStateAfterCallback() { + mDebugHadStateUpdate = true; boolean validResults = false; for (List l : mPredictionServicePredictions) { validResults |= l != null && !l.isEmpty(); diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java index 5e20e5643c..c6f7544fef 100644 --- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java +++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java @@ -70,6 +70,9 @@ public class AppPredictionsUITests extends AbstractQuickStepTest { AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker()); PredictionUiStateManager.INSTANCE.initializeForTesting(null); + waitForLauncherCondition("Prediction never had state update", + launcher -> PredictionUiStateManager.INSTANCE.get( + mTargetContext).mDebugHadStateUpdate); mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback( Client.HOME); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index a59189beaa..35113d2131 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2553,4 +2553,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, void onLauncherResume(); } + + public boolean debugIsPredictionInitialized() { + return true; + } } diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index d4cfe3aa29..d0ea142689 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -64,6 +64,8 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { test.mDevice.pressHome(); } test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null); + test.waitForLauncherCondition("Prediction never had state update", + launcher -> launcher.debugIsPredictionInitialized()); test.waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL); test.waitForResumed("Launcher internal state is still Background"); // Check that we switched to home. From ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 23 May 2019 00:50:08 -0700 Subject: [PATCH 11/47] Moving TestInformationProvider to Launcher3 so that it can be used for testing Launcher3 without quickstep Also keeping the provider as disabled until needed Change-Id: Ib5f459e02ae551724b390f3b74f43d601568d749 --- Android.bp | 2 +- AndroidManifest-common.xml | 7 + quickstep/AndroidManifest.xml | 8 -- quickstep/res/values/config.xml | 2 + .../QuickstepTestInformationHandler.java | 36 +++++ .../quickstep/TestInformationProvider.java | 127 ------------------ res/values/config.xml | 1 + .../launcher3/BaseDraggingActivity.java | 9 +- src/com/android/launcher3/Launcher.java | 5 +- src/com/android/launcher3/LauncherState.java | 14 +- .../launcher3/LauncherStateManager.java | 9 +- src/com/android/launcher3/Workspace.java | 11 +- .../allapps/AllAppsContainerView.java | 2 +- .../compat/AccessibilityManagerCompat.java | 2 +- .../launcher3/dragndrop/DragController.java | 13 +- .../testing/TestInformationHandler.java | 83 ++++++++++++ .../testing/TestInformationProvider.java | 67 +++++++++ .../launcher3/{ => testing}/TestProtocol.java | 2 +- .../launcher3/touch/ItemClickHandler.java | 21 +-- .../launcher3/views/BaseDragLayer.java | 9 +- tests/Android.mk | 2 +- .../com/android/launcher3/tapl/AllApps.java | 2 +- .../launcher3/tapl/AllAppsFromOverview.java | 4 +- .../android/launcher3/tapl/Background.java | 4 +- .../tapl/com/android/launcher3/tapl/Home.java | 2 +- .../android/launcher3/tapl/Launchable.java | 2 +- .../tapl/LauncherInstrumentation.java | 35 ++++- .../com/android/launcher3/tapl/Overview.java | 2 +- .../com/android/launcher3/tapl/Workspace.java | 4 +- 29 files changed, 290 insertions(+), 197 deletions(-) create mode 100644 quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java delete mode 100644 quickstep/src/com/android/quickstep/TestInformationProvider.java create mode 100644 src/com/android/launcher3/testing/TestInformationHandler.java create mode 100644 src/com/android/launcher3/testing/TestInformationProvider.java rename src/com/android/launcher3/{ => testing}/TestProtocol.java (98%) diff --git a/Android.bp b/Android.bp index b80282eb54..4c38205979 100644 --- a/Android.bp +++ b/Android.bp @@ -25,7 +25,7 @@ android_library { "tests/tapl/**/*.java", "src/com/android/launcher3/util/SecureSettingsObserver.java", "src/com/android/launcher3/ResourceUtils.java", - "src/com/android/launcher3/TestProtocol.java", + "src/com/android/launcher3/testing/TestProtocol.java", ], manifest: "tests/tapl/AndroidManifest.xml", platform_apis: true, diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index ef5bb2672f..5318a12edd 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -176,5 +176,12 @@ + diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index be275e0e8a..a38979d41d 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -73,14 +73,6 @@ - - - diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index e84543b378..5c4d6d869f 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -25,6 +25,8 @@ com.android.quickstep.logging.StatsLogCompatManager + com.android.quickstep.QuickstepTestInformationHandler + 3 diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java new file mode 100644 index 0000000000..89513634fe --- /dev/null +++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -0,0 +1,36 @@ +package com.android.quickstep; + +import android.content.Context; +import android.os.Bundle; + +import com.android.launcher3.testing.TestInformationHandler; +import com.android.launcher3.testing.TestProtocol; +import com.android.launcher3.uioverrides.states.OverviewState; +import com.android.quickstep.util.LayoutUtils; + +public class QuickstepTestInformationHandler extends TestInformationHandler { + + public QuickstepTestInformationHandler(Context context) { } + + @Override + public Bundle call(String method) { + final Bundle response = new Bundle(); + switch (method) { + case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: { + final float swipeHeight = + OverviewState.getDefaultSwipeHeight(mDeviceProfile); + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); + return response; + } + + case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: { + final float swipeHeight = + LayoutUtils.getShelfTrackingDistance(mContext, mDeviceProfile); + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); + return response; + } + } + + return super.call(method); + } +} diff --git a/quickstep/src/com/android/quickstep/TestInformationProvider.java b/quickstep/src/com/android/quickstep/TestInformationProvider.java deleted file mode 100644 index d96f9af6fe..0000000000 --- a/quickstep/src/com/android/quickstep/TestInformationProvider.java +++ /dev/null @@ -1,127 +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; - -import android.content.ContentProvider; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; - -import com.android.launcher3.DeviceProfile; -import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherState; -import com.android.launcher3.TestProtocol; -import com.android.launcher3.Utilities; -import com.android.launcher3.uioverrides.states.OverviewState; -import com.android.quickstep.util.LayoutUtils; - -public class TestInformationProvider extends ContentProvider { - @Override - public boolean onCreate() { - return true; - } - - @Override - public int update(Uri uri, ContentValues contentValues, String s, String[] strings) { - return 0; - } - - @Override - public int delete(Uri uri, String s, String[] strings) { - return 0; - } - - @Override - public Uri insert(Uri uri, ContentValues contentValues) { - return null; - } - - @Override - public String getType(Uri uri) { - return null; - } - - @Override - public Cursor query(Uri uri, String[] strings, String s, String[] strings1, String s1) { - return null; - } - - @Override - public Bundle call(String method, String arg, Bundle extras) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - final Bundle response = new Bundle(); - final Context context = getContext(); - final DeviceProfile deviceProfile = InvariantDeviceProfile.INSTANCE. - get(context).getDeviceProfile(context); - final LauncherAppState launcherAppState = LauncherAppState.getInstanceNoCreate(); - final Launcher launcher = launcherAppState != null ? - (Launcher) launcherAppState.getModel().getCallback() : null; - - switch (method) { - case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: { - final float swipeHeight = - OverviewState.getDefaultSwipeHeight(deviceProfile); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); - break; - } - - case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: { - final float swipeHeight = - LayoutUtils.getShelfTrackingDistance(context, deviceProfile); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); - break; - } - - case TestProtocol.REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT: { - if (launcher == null) return null; - - final float progress = LauncherState.OVERVIEW.getVerticalProgress(launcher) - - LauncherState.ALL_APPS.getVerticalProgress(launcher); - final float distance = - launcher.getAllAppsController().getShiftRange() * progress; - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance); - break; - } - - case TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT: { - if (launcher == null) return null; - - final float progress = LauncherState.NORMAL.getVerticalProgress(launcher) - - LauncherState.ALL_APPS.getVerticalProgress(launcher); - final float distance = - launcher.getAllAppsController().getShiftRange() * progress; - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance); - break; - } - - case TestProtocol.REQUEST_ENABLE_DEBUG_TRACING: - TestProtocol.sDebugTracing = true; - break; - - case TestProtocol.REQUEST_DISABLE_DEBUG_TRACING: - TestProtocol.sDebugTracing = false; - break; - } - return response; - } - return null; - } -} diff --git a/res/values/config.xml b/res/values/config.xml index 984729b20f..638a411be6 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -71,6 +71,7 @@ + diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java index bd6ac90f39..f69b172480 100644 --- a/src/com/android/launcher3/BaseDraggingActivity.java +++ b/src/com/android/launcher3/BaseDraggingActivity.java @@ -34,6 +34,7 @@ import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.shortcuts.DeepShortcutManager; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.DisplayRotationListener; import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.util.Themes; @@ -134,8 +135,8 @@ public abstract class BaseDraggingActivity extends BaseActivity public boolean startActivitySafely(View v, Intent intent, @Nullable ItemInfo item, @Nullable String sourceContainer) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "startActivitySafely 1"); } if (mIsSafeModeEnabled && !Utilities.isSystemApp(this, intent)) { @@ -161,8 +162,8 @@ public abstract class BaseDraggingActivity extends BaseActivity startShortcutIntentSafely(intent, optsBundle, item, sourceContainer); } else if (user == null || user.equals(Process.myUserHandle())) { // Could be launching some bookkeeping activity - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "startActivitySafely 2"); } startActivity(intent, optsBundle); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 35113d2131..7790475f63 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -110,6 +110,7 @@ import com.android.launcher3.popup.PopupDataProvider; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.states.InternalStateHandler; import com.android.launcher3.states.RotationHelper; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.uioverrides.UiFactory; import com.android.launcher3.userevent.nano.LauncherLogProto; @@ -1782,8 +1783,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, public boolean startActivitySafely(View v, Intent intent, ItemInfo item, @Nullable String sourceContainer) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "startActivitySafely outer"); } boolean success = super.startActivitySafely(v, intent, item, sourceContainer); diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index eff58a7013..3a92dfb961 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -18,13 +18,13 @@ package com.android.launcher3; import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO; import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED; -import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.OVERVIEW_PEEK_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.QUICK_SWITCH_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.SPRING_LOADED_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.OVERVIEW_PEEK_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.SPRING_LOADED_STATE_ORDINAL; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.states.RotationHelper.REQUEST_NONE; diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 49ae33894a..3edd8385ab 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -48,6 +48,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.anim.PropertySetter.AnimatedPropertySetter; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.UiFactory; import java.io.PrintWriter; @@ -447,8 +448,8 @@ public class LauncherStateManager { } private void onStateTransitionStart(LauncherState state) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "onStateTransitionStart"); } if (mState != state) { @@ -576,8 +577,8 @@ public class LauncherStateManager { private final AnimatorSet mAnim; public StartAnimRunnable(AnimatorSet anim) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "StartAnimRunnable"); } mAnim = anim; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index d19f9cd73f..f784226a51 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -20,8 +20,6 @@ import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; -import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; -import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.SPRING_LOADED; @@ -86,6 +84,7 @@ import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.pageindicators.WorkspacePageIndicator; import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.WorkspaceTouchListener; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; @@ -371,8 +370,8 @@ public class Workspace extends PagedView @Override public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "onDragStart 1"); } if (ENFORCE_DRAG_EVENT_ORDER) { @@ -425,8 +424,8 @@ public class Workspace extends PagedView } // Always enter the spring loaded mode - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "onDragStart 2"); } mLauncher.getStateManager().goToState(SPRING_LOADED); diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 63682c73ac..d8094ea62d 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -43,7 +43,7 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index 86f773fa31..8e59d32bdc 100644 --- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java +++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java @@ -23,7 +23,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.Utilities; import java.util.function.Consumer; diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index bf692fe472..9d3c8f75dc 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -41,6 +41,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.accessibility.DragViewStateAnnouncer; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.TouchController; @@ -472,8 +473,8 @@ public class DragController implements DragDriver.EventListener, TouchController } private void handleMoveEvent(int x, int y) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "handleMoveEvent 1"); } mDragObject.dragView.move(x, y); @@ -492,8 +493,8 @@ public class DragController implements DragDriver.EventListener, TouchController if (mIsInPreDrag && mOptions.preDragCondition != null && mOptions.preDragCondition.shouldStartDrag(mDistanceSinceScroll)) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "handleMoveEvent 2"); } callOnDragStart(); @@ -533,8 +534,8 @@ public class DragController implements DragDriver.EventListener, TouchController * Call this from a drag source view. */ public boolean onControllerTouchEvent(MotionEvent ev) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "onControllerTouchEvent"); } if (mDragDriver == null || mOptions == null || mOptions.isAccessibleDrag) { diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java new file mode 100644 index 0000000000..b8476aa1da --- /dev/null +++ b/src/com/android/launcher3/testing/TestInformationHandler.java @@ -0,0 +1,83 @@ +/* + * 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.launcher3.testing; + +import android.content.Context; +import android.os.Bundle; + +import com.android.launcher3.DeviceProfile; +import com.android.launcher3.InvariantDeviceProfile; +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherAppState; +import com.android.launcher3.LauncherState; +import com.android.launcher3.R; +import com.android.launcher3.util.ResourceBasedOverride; + +public class TestInformationHandler implements ResourceBasedOverride { + + public static TestInformationHandler newInstance(Context context) { + return Overrides.getObject(TestInformationHandler.class, + context, R.string.test_information_handler_class); + } + + protected Context mContext; + protected DeviceProfile mDeviceProfile; + protected LauncherAppState mLauncherAppState; + protected Launcher mLauncher; + + public void init(Context context) { + mContext = context; + mDeviceProfile = InvariantDeviceProfile.INSTANCE. + get(context).getDeviceProfile(context); + mLauncherAppState = LauncherAppState.getInstanceNoCreate(); + mLauncher = mLauncherAppState != null ? + (Launcher) mLauncherAppState.getModel().getCallback() : null; + } + + public Bundle call(String method) { + final Bundle response = new Bundle(); + switch (method) { + case TestProtocol.REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT: { + if (mLauncher == null) return null; + + final float progress = LauncherState.OVERVIEW.getVerticalProgress(mLauncher) + - LauncherState.ALL_APPS.getVerticalProgress(mLauncher); + final float distance = mLauncher.getAllAppsController().getShiftRange() * progress; + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance); + break; + } + + case TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT: { + if (mLauncher == null) return null; + + final float progress = LauncherState.NORMAL.getVerticalProgress(mLauncher) + - LauncherState.ALL_APPS.getVerticalProgress(mLauncher); + final float distance = mLauncher.getAllAppsController().getShiftRange() * progress; + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance); + break; + } + + case TestProtocol.REQUEST_ENABLE_DEBUG_TRACING: + TestProtocol.sDebugTracing = true; + break; + + case TestProtocol.REQUEST_DISABLE_DEBUG_TRACING: + TestProtocol.sDebugTracing = false; + break; + } + return response; + } +} diff --git a/src/com/android/launcher3/testing/TestInformationProvider.java b/src/com/android/launcher3/testing/TestInformationProvider.java new file mode 100644 index 0000000000..bd177c0031 --- /dev/null +++ b/src/com/android/launcher3/testing/TestInformationProvider.java @@ -0,0 +1,67 @@ +/* + * 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.launcher3.testing; + +import android.content.ContentProvider; +import android.content.ContentValues; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; + +import com.android.launcher3.Utilities; + +public class TestInformationProvider extends ContentProvider { + @Override + public boolean onCreate() { + return true; + } + + @Override + public int update(Uri uri, ContentValues contentValues, String s, String[] strings) { + return 0; + } + + @Override + public int delete(Uri uri, String s, String[] strings) { + return 0; + } + + @Override + public Uri insert(Uri uri, ContentValues contentValues) { + return null; + } + + @Override + public String getType(Uri uri) { + return null; + } + + @Override + public Cursor query(Uri uri, String[] strings, String s, String[] strings1, String s1) { + return null; + } + + @Override + public Bundle call(String method, String arg, Bundle extras) { + if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { + TestInformationHandler handler = TestInformationHandler.newInstance(getContext()); + handler.init(getContext()); + return handler.call(method); + } + return null; + } +} diff --git a/src/com/android/launcher3/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java similarity index 98% rename from src/com/android/launcher3/TestProtocol.java rename to src/com/android/launcher3/testing/TestProtocol.java index a0440e877e..9fd44a1c4a 100644 --- a/src/com/android/launcher3/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.testing; /** * Protocol for custom accessibility events for communication with UI Automation tests. diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index 99b9f25b18..f858dc4c69 100644 --- a/src/com/android/launcher3/touch/ItemClickHandler.java +++ b/src/com/android/launcher3/touch/ItemClickHandler.java @@ -47,6 +47,7 @@ import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.widget.PendingAppWidgetHostView; import com.android.launcher3.widget.WidgetAddFlowHandler; @@ -66,15 +67,15 @@ public class ItemClickHandler { } private static void onClick(View v, String sourceContainer) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "onClick 1"); } // Make sure that rogue clicks don't get through while allapps is launching, or after the // view has detached (it's possible for this to happen if the view is removed mid touch). if (v.getWindowToken() == null) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "onClick 2"); } return; @@ -82,8 +83,8 @@ public class ItemClickHandler { Launcher launcher = Launcher.getLauncher(v.getContext()); if (!launcher.getWorkspace().isFinishedSwitchingState()) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "onClick 3"); } return; @@ -97,8 +98,8 @@ public class ItemClickHandler { onClickFolderIcon(v); } } else if (tag instanceof AppInfo) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "onClick 4"); } startAppShortcutOrInfoActivity(v, (AppInfo) tag, launcher, @@ -232,8 +233,8 @@ public class ItemClickHandler { private static void startAppShortcutOrInfoActivity(View v, ItemInfo item, Launcher launcher, @Nullable String sourceContainer) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_START_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, "startAppShortcutOrInfoActivity"); } Intent intent; diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index 4964182409..001951ac11 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -41,6 +41,7 @@ import android.widget.FrameLayout; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.Utilities; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.launcher3.util.TouchController; @@ -213,8 +214,8 @@ public abstract class BaseDragLayer @Override public boolean onTouchEvent(MotionEvent ev) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "onTouchEvent " + ev); } int action = ev.getAction(); @@ -226,8 +227,8 @@ public abstract class BaseDragLayer } if (mActiveController != null) { - if (com.android.launcher3.TestProtocol.sDebugTracing) { - android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_DRAG_TAG, "onTouchEvent 1"); } return mActiveController.onControllerTouchEvent(ev); diff --git a/tests/Android.mk b/tests/Android.mk index 0991a0439d..978209febf 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -32,7 +32,7 @@ else LOCAL_SRC_FILES := $(call all-java-files-under, tapl) \ ../src/com/android/launcher3/ResourceUtils.java \ ../src/com/android/launcher3/util/SecureSettingsObserver.java \ - ../src/com/android/launcher3/TestProtocol.java + ../src/com/android/launcher3/testing/TestProtocol.java endif LOCAL_MODULE := ub-launcher-aosp-tapl diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java index b2043cb5a2..18a8f2755a 100644 --- a/tests/tapl/com/android/launcher3/tapl/AllApps.java +++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java @@ -27,7 +27,7 @@ import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; import com.android.launcher3.ResourceUtils; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; /** * Operations on AllApps opened from Home. Also a parent for All Apps opened from Overview. diff --git a/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java b/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java index a472d31344..f48d4dd4c7 100644 --- a/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java +++ b/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java @@ -16,14 +16,14 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; import android.graphics.Point; import androidx.annotation.NonNull; import androidx.test.uiautomator.UiObject2; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; /** * Operations on AllApps opened from Overview. diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index 55e14cc80c..8627f485b5 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -16,7 +16,7 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; import android.graphics.Point; import android.os.SystemClock; @@ -24,7 +24,7 @@ import android.view.MotionEvent; import androidx.annotation.NonNull; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; /** * Indicates the base state with a UI other than Overview running as foreground. It can also diff --git a/tests/tapl/com/android/launcher3/tapl/Home.java b/tests/tapl/com/android/launcher3/tapl/Home.java index 20c116ce21..cfc43749d1 100644 --- a/tests/tapl/com/android/launcher3/tapl/Home.java +++ b/tests/tapl/com/android/launcher3/tapl/Home.java @@ -16,7 +16,7 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; import androidx.annotation.NonNull; diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 3295ddbef4..ee90d37b6e 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -24,7 +24,7 @@ import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; /** * Ancestor for AppIcon and AppMenuItem. diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 7978c7928d..8d69b37832 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -16,16 +16,23 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; -import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL; +import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED; +import static android.content.pm.PackageManager.DONT_KILL_APP; +import static android.content.pm.PackageManager.MATCH_ALL; +import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; + +import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL; import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName; import android.app.ActivityManager; import android.app.Instrumentation; import android.app.UiAutomation; +import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; +import android.content.pm.ProviderInfo; import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; @@ -53,7 +60,7 @@ import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; import com.android.systemui.shared.system.QuickStepContract; import org.junit.Assert; @@ -149,9 +156,10 @@ public final class LauncherInstrumentation { getLauncherPackageName() : targetPackage; + String testProviderAuthority = authorityPackage + ".TestInfo"; mTestProviderUri = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) - .authority(authorityPackage + ".TestInfo") + .authority(testProviderAuthority) .build(); try { @@ -160,6 +168,25 @@ public final class LauncherInstrumentation { } catch (IOException e) { fail(e.toString()); } + + + PackageManager pm = getContext().getPackageManager(); + ProviderInfo pi = pm.resolveContentProvider( + testProviderAuthority, MATCH_ALL | MATCH_DISABLED_COMPONENTS); + ComponentName cn = new ComponentName(pi.packageName, pi.name); + + if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) { + if (TestHelpers.isInLauncherProcess()) { + getContext().getPackageManager().setComponentEnabledSetting( + cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP); + } else { + try { + mDevice.executeShellCommand("pm enable " + cn.flattenToString()); + } catch (IOException e) { + fail(e.toString()); + } + } + } } Context getContext() { diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java index ec99d26c19..1aa957a17e 100644 --- a/tests/tapl/com/android/launcher3/tapl/Overview.java +++ b/tests/tapl/com/android/launcher3/tapl/Overview.java @@ -16,7 +16,7 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL; import androidx.annotation.NonNull; import androidx.test.uiautomator.UiObject2; diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java index 10b253d443..7dcc426b9d 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -16,7 +16,7 @@ package com.android.launcher3.tapl; -import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL; import static junit.framework.TestCase.assertTrue; @@ -30,7 +30,7 @@ import androidx.annotation.Nullable; import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; -import com.android.launcher3.TestProtocol; +import com.android.launcher3.testing.TestProtocol; /** * Operations on the workspace screen. From 68ff2d91cf9bbbbbc2c43ed9a4dfbeb40fb59101 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 23 May 2019 14:15:38 -0700 Subject: [PATCH 12/47] Making some fields accessible to subclasses Bug: 132975416 Change-Id: Icc7043d8299c88fcf505068f8cabd4705d19010d --- .../android/launcher3/appprediction/PredictionAppTracker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java index af67e1bbbc..8f1282dedc 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java @@ -56,7 +56,7 @@ public class PredictionAppTracker extends AppLaunchTracker { private static final int MSG_LAUNCH = 2; private static final int MSG_PREDICT = 3; - private final Context mContext; + protected final Context mContext; private final Handler mMessageHandler; // Accessed only on worker thread From dd71ca04370a8885cfeeb1d2c6846f5299e8edcc Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 23 May 2019 13:56:10 -0700 Subject: [PATCH 13/47] Support individual lock task features - If screen pinning is enabled, disable gestures and wrap with input consumer to break out of screen pinning (existing logic) - If Home & Overview are both disabled, disable gestures completely - If only Home is disabled, then always launch the user into fallback recents (to simplify logic around breaking out of overview into Home) - If only Overview is disabled, then prevent swiping from going into overview or from triggering overview from home - Switch to using screen pinning flag check instead of binder call Bug: 133113732 Bug: 131698989 Change-Id: Ie6f447520d4cc3fa1eaaf8427ee014851688bf37 --- .../FlingAndHoldTouchController.java | 6 ++- .../QuickSwitchTouchController.java | 7 +++ .../quickstep/TouchInteractionService.java | 40 ++++++++------- .../WindowTransformSwipeHandler.java | 50 ++++++++++++------- .../PortraitStatesTouchController.java | 6 +++ .../quickstep/OverviewComponentObserver.java | 15 +++++- .../quickstep/OverviewInteractionState.java | 10 ++++ 7 files changed, 96 insertions(+), 38 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java index 7a6cd2d550..e3e339add1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java @@ -22,6 +22,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; import static com.android.launcher3.LauncherStateManager.ANIM_ALL; import static com.android.launcher3.LauncherStateManager.ATOMIC_OVERVIEW_PEEK_COMPONENT; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -34,8 +35,10 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; +import com.android.quickstep.OverviewInteractionState; import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.views.RecentsView; +import com.android.systemui.shared.system.QuickStepContract; /** * Touch controller which handles swipe and hold to go to Overview @@ -99,7 +102,8 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController { * having it as part of the existing animation to the target state. */ private boolean handlingOverviewAnim() { - return mStartState == NORMAL; + int stateFlags = OverviewInteractionState.INSTANCE.get(mLauncher).getSystemUiStateFlags(); + return mStartState == NORMAL && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0; } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index e1dd124a9d..18b8af4fa7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -30,6 +30,7 @@ import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.view.MotionEvent; @@ -44,10 +45,12 @@ import com.android.launcher3.touch.AbstractStateChangeTouchController; import com.android.launcher3.touch.SwipeDetector; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; +import com.android.quickstep.OverviewInteractionState; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; +import com.android.systemui.shared.system.QuickStepContract; /** * Handles quick switching to a recent task from the home screen. @@ -80,6 +83,10 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll @Override protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { + int stateFlags = OverviewInteractionState.INSTANCE.get(mLauncher).getSystemUiStateFlags(); + if ((stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0) { + return NORMAL; + } return isDragTowardPositive ? QUICK_SWITCH : NORMAL; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 0c997dd598..906ce5d5fa 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -22,8 +22,11 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INP import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; import android.annotation.TargetApi; import android.app.ActivityManager; @@ -79,6 +82,7 @@ import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.InputMonitorCompat; +import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags; import java.io.FileDescriptor; @@ -197,6 +201,8 @@ public class TouchInteractionService extends Service implements public void onSystemUiStateChanged(int stateFlags) { mSystemUiStateFlags = stateFlags; + mOverviewInteractionState.setSystemUiStateFlags(stateFlags); + mOverviewComponentObserver.onSystemUiStateChanged(stateFlags); } /** Deprecated methods **/ @@ -472,16 +478,13 @@ public class TouchInteractionService extends Service implements private boolean validSystemUiFlags() { return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0 - && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0; - } - - private boolean topTaskLocked() { - return ActivityManagerWrapper.getInstance().isLockToAppActive(); + && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0 + && ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0 + || (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0); } private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) { - boolean topTaskLocked = topTaskLocked(); - boolean isInValidSystemUiState = validSystemUiFlags() && !topTaskLocked; + boolean isInValidSystemUiState = validSystemUiFlags(); if (!mIsUserUnlocked) { if (isInValidSystemUiState) { @@ -498,13 +501,15 @@ public class TouchInteractionService extends Service implements if (mMode == Mode.NO_BUTTON) { final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); - if (mAssistantAvailable && !topTaskLocked - && AssistantTouchConsumer.withinTouchRegion(this, event)) { + if (mAssistantAvailable + && !QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags) + && AssistantTouchConsumer.withinTouchRegion(this, event) + && !ActivityManagerWrapper.getInstance().isLockToAppActive()) { base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base, mInputMonitorCompat); } - if (ActivityManagerWrapper.getInstance().isScreenPinningActive()) { + if ((mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) != 0) { // Note: we only allow accessibility to wrap this, and it replaces the previous // base input consumer (which should be NO_OP anyway since topTaskLocked == true). base = new ScreenPinnedInputConsumer(this, mISystemUiProxy, activityControl); @@ -593,17 +598,14 @@ public class TouchInteractionService extends Service implements // Dump everything pw.println("TouchState:"); pw.println(" navMode=" + mMode); - pw.println(" validSystemUiFlags=" + validSystemUiFlags() - + " flags=" + mSystemUiStateFlags); - pw.println(" topTaskLocked=" + topTaskLocked()); + pw.println(" validSystemUiFlags=" + validSystemUiFlags()); + pw.println(" systemUiFlags=" + mSystemUiStateFlags); + pw.println(" systemUiFlagsDesc=" + + QuickStepContract.getSystemUiStateString(mSystemUiStateFlags)); pw.println(" isDeviceLocked=" + mKM.isDeviceLocked()); - pw.println(" screenPinned=" + - ActivityManagerWrapper.getInstance().isScreenPinningActive()); pw.println(" assistantAvailable=" + mAssistantAvailable); - pw.println(" a11yClickable=" - + ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0)); - pw.println(" a11yLongClickable=" - + ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0)); + pw.println(" assistantDisabled=" + + QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)); pw.println(" resumed=" + mOverviewComponentObserver.getActivityControlHelper().isResumed()); pw.println(" useSharedState=" + mConsumer.useSharedSwipeState()); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 2ff5c0c6a5..2484d2f0e0 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -39,6 +39,7 @@ import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.NEW_TASK; import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget.RECENTS; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.Animator; import android.animation.AnimatorSet; @@ -105,6 +106,7 @@ import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.LatencyTrackerCompat; +import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat; import com.android.systemui.shared.system.WindowCallbacksCompat; @@ -835,16 +837,9 @@ public class WindowTransformSwipeHandler } } - @UiThread - private void handleNormalGestureEnd(float endVelocity, boolean isFling, PointF velocity, + private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, boolean isFling, boolean isCancel) { - PointF velocityPxPerMs = new PointF(velocity.x / 1000, velocity.y / 1000); - long duration = MAX_SWIPE_DURATION; - float currentShift = mCurrentShift.value; final GestureEndTarget endTarget; - float endShift; - final float startShift; - Interpolator interpolator = DEACCEL; final boolean goingToNewTask; if (mRecentsView != null) { if (!mRecentsAnimationWrapper.hasTargets()) { @@ -859,7 +854,7 @@ public class WindowTransformSwipeHandler } else { goingToNewTask = false; } - final boolean reachedOverviewThreshold = currentShift >= MIN_PROGRESS_FOR_OVERVIEW; + final boolean reachedOverviewThreshold = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW; if (!isFling) { if (isCancel) { endTarget = LAST_TASK; @@ -869,7 +864,7 @@ public class WindowTransformSwipeHandler } else if (goingToNewTask) { endTarget = NEW_TASK; } else { - endTarget = currentShift < MIN_PROGRESS_FOR_OVERVIEW ? LAST_TASK : HOME; + endTarget = !reachedOverviewThreshold ? LAST_TASK : HOME; } } else { endTarget = reachedOverviewThreshold && mGestureStarted @@ -878,12 +873,6 @@ public class WindowTransformSwipeHandler ? NEW_TASK : LAST_TASK; } - endShift = endTarget.endShift; - long expectedDuration = Math.abs(Math.round((endShift - currentShift) - * MAX_SWIPE_DURATION * SWIPE_DURATION_MULTIPLIER)); - duration = Math.min(MAX_SWIPE_DURATION, expectedDuration); - startShift = currentShift; - interpolator = endTarget == RECENTS ? OVERSHOOT_1_2 : DEACCEL; } else { if (mMode == Mode.NO_BUTTON && endVelocity < 0 && !mIsShelfPeeking) { // If swiping at a diagonal, base end target on the faster velocity. @@ -896,7 +885,34 @@ public class WindowTransformSwipeHandler } else { endTarget = goingToNewTask ? NEW_TASK : LAST_TASK; } - endShift = endTarget.endShift; + } + + int stateFlags = OverviewInteractionState.INSTANCE.get(mActivity).getSystemUiStateFlags(); + if ((stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0 + && (endTarget == RECENTS || endTarget == LAST_TASK)) { + return LAST_TASK; + } + return endTarget; + } + + @UiThread + private void handleNormalGestureEnd(float endVelocity, boolean isFling, PointF velocity, + boolean isCancel) { + PointF velocityPxPerMs = new PointF(velocity.x / 1000, velocity.y / 1000); + long duration = MAX_SWIPE_DURATION; + float currentShift = mCurrentShift.value; + final GestureEndTarget endTarget = calculateEndTarget(velocity, endVelocity, + isFling, isCancel); + float endShift = endTarget.endShift; + final float startShift; + Interpolator interpolator = DEACCEL; + if (!isFling) { + long expectedDuration = Math.abs(Math.round((endShift - currentShift) + * MAX_SWIPE_DURATION * SWIPE_DURATION_MULTIPLIER)); + duration = Math.min(MAX_SWIPE_DURATION, expectedDuration); + startShift = currentShift; + interpolator = endTarget == RECENTS ? OVERSHOOT_1_2 : DEACCEL; + } else { startShift = Utilities.boundToRange(currentShift - velocityPxPerMs.y * SINGLE_FRAME_MS / mTransitionDragLength, 0, 1); float minFlingVelocity = mContext.getResources() diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 0c29fcf5ab..6030cea938 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -26,6 +26,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; @@ -46,9 +47,11 @@ import com.android.launcher3.touch.SwipeDetector; import com.android.launcher3.uioverrides.states.OverviewState; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; +import com.android.quickstep.OverviewInteractionState; import com.android.quickstep.RecentsModel; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.util.LayoutUtils; +import com.android.systemui.shared.system.QuickStepContract; /** * Touch controller for handling various state transitions in portrait UI. @@ -135,7 +138,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr } else if (fromState == OVERVIEW) { return isDragTowardPositive ? ALL_APPS : NORMAL; } else if (fromState == NORMAL && isDragTowardPositive) { + int stateFlags = OverviewInteractionState.INSTANCE.get(mLauncher) + .getSystemUiStateFlags(); return mAllowDragToOverview && TouchInteractionService.isConnected() + && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0 ? OVERVIEW : ALL_APPS; } return fromState; diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index a2f07e318f..b5da836e65 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED; import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter; import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -32,6 +33,7 @@ import android.content.pm.ResolveInfo; import com.android.systemui.shared.system.PackageManagerWrapper; +import com.android.systemui.shared.system.QuickStepContract; import java.util.ArrayList; /** @@ -56,6 +58,7 @@ public final class OverviewComponentObserver { private String mUpdateRegisteredPackage; private ActivityControlHelper mActivityControlHelper; private Intent mOverviewIntent; + private int mSystemUiStateFlags; public OverviewComponentObserver(Context context) { mContext = context; @@ -71,6 +74,15 @@ public final class OverviewComponentObserver { updateOverviewTargets(); } + public void onSystemUiStateChanged(int stateFlags) { + boolean homeDisabledChanged = (mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) + != (stateFlags & SYSUI_STATE_HOME_DISABLED); + mSystemUiStateFlags = stateFlags; + if (homeDisabledChanged) { + updateOverviewTargets(); + } + } + /** * Update overview intent and {@link ActivityControlHelper} based off the current launcher home * component. @@ -81,7 +93,8 @@ public final class OverviewComponentObserver { final String overviewIntentCategory; ComponentName overviewComponent; - if (defaultHome == null || mMyHomeComponent.equals(defaultHome)) { + if ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0 && + (defaultHome == null || mMyHomeComponent.equals(defaultHome))) { // User default home is same as out home app. Use Overview integrated in Launcher. overviewComponent = mMyHomeComponent; mActivityControlHelper = new LauncherActivityControllerHelper(); diff --git a/quickstep/src/com/android/quickstep/OverviewInteractionState.java b/quickstep/src/com/android/quickstep/OverviewInteractionState.java index 79d922c240..78b48d77a4 100644 --- a/quickstep/src/com/android/quickstep/OverviewInteractionState.java +++ b/quickstep/src/com/android/quickstep/OverviewInteractionState.java @@ -53,6 +53,8 @@ public class OverviewInteractionState { private ISystemUiProxy mISystemUiProxy; private float mBackButtonAlpha = 1; + private int mSystemUiStateFlags; + private OverviewInteractionState(Context context) { mContext = context; @@ -83,6 +85,14 @@ public class OverviewInteractionState { mBgHandler.obtainMessage(MSG_SET_PROXY, proxy).sendToTarget(); } + public void setSystemUiStateFlags(int stateFlags) { + mSystemUiStateFlags = stateFlags; + } + + public int getSystemUiStateFlags() { + return mSystemUiStateFlags; + } + private boolean handleUiMessage(Message msg) { if (msg.what == MSG_SET_BACK_BUTTON_ALPHA) { mBackButtonAlpha = (float) msg.obj; From 9b832295c30a352be52922b3d542d6d7518aa93d Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 23 May 2019 14:42:24 -0700 Subject: [PATCH 14/47] Set scroller to new max duration if snapping too slowly Change-Id: I87bfc8f767f7ae9cbe838c2a9ba229bec179f526 --- .../com/android/quickstep/WindowTransformSwipeHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 2ff5c0c6a5..9cc65457bf 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -936,8 +936,10 @@ public class WindowTransformSwipeHandler } else if (endTarget == RECENTS) { mLiveTileOverlay.startIconAnimation(); if (mRecentsView != null) { - duration = Utilities.boundToRange(mRecentsView.getScroller().getDuration(), - duration, MAX_SWIPE_DURATION); + if (mRecentsView.getScroller().getDuration() > MAX_SWIPE_DURATION) { + mRecentsView.snapToPage(mRecentsView.getNextPage(), (int) MAX_SWIPE_DURATION); + } + duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } if (mMode == Mode.NO_BUTTON) { setShelfState(ShelfAnimState.OVERVIEW, interpolator, duration); From aadf5c2dabaab31166579d6f8ef09a247a294f67 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Thu, 23 May 2019 15:45:50 -0700 Subject: [PATCH 15/47] Setup OWNERS file for ub-l3-qt-dev Change-Id: Ib7b01562c1f15524f0e3599864a95ad9fb9d4be6 --- OWNERS | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 OWNERS diff --git a/OWNERS b/OWNERS new file mode 100644 index 0000000000..6c1273f56b --- /dev/null +++ b/OWNERS @@ -0,0 +1,12 @@ +# Use this reviewer by default. +# gnl-eng@google.com (Googlers only) + +# People who can approve changes for submission +# + +adamcohen@google.com +hyunyoungs@google.com +mrcasey@google.com +sunnygoyal@google.com +twickham@google.com +winsonc@google.com From 9820c05f2bb091762f334269f11061467b4ba6ba Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 23 May 2019 16:54:59 -0700 Subject: [PATCH 16/47] Removing prediciton loading state Also fixing test flakyness due to delayed prediction loading Bug: 132993129 Bug: 131854153 Change-Id: I85f7afff0e3ee0ca9e40e92e91681f797a0bc2de --- .../res/layout/prediction_load_progress.xml | 11 -------- .../appprediction/PredictionRowView.java | 25 +++---------------- .../PredictionUiStateManager.java | 14 ----------- .../quickstep/AppPredictionsUITests.java | 4 --- src/com/android/launcher3/Launcher.java | 4 --- .../launcher3/ui/AbstractLauncherUiTest.java | 4 +++ .../launcher3/ui/TaplTestsLauncher3.java | 2 -- 7 files changed, 8 insertions(+), 56 deletions(-) delete mode 100644 quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml diff --git a/quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml b/quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml deleted file mode 100644 index 20c400441a..0000000000 --- a/quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml +++ /dev/null @@ -1,11 +0,0 @@ - - diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index 55f4c98e9a..4a486f8e5c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -28,7 +28,6 @@ import android.os.Build; import android.util.AttributeSet; import android.util.IntProperty; import android.util.Log; -import android.view.LayoutInflater; import android.view.View; import android.view.animation.Interpolator; import android.widget.LinearLayout; @@ -115,8 +114,6 @@ public class PredictionRowView extends LinearLayout implements private final AnimatedFloat mOverviewScrollFactor = new AnimatedFloat(this::updateTranslationAndAlpha); - private View mLoadingProgress; - private boolean mPredictionsEnabled = false; public PredictionRowView(@NonNull Context context) { @@ -165,7 +162,6 @@ public class PredictionRowView extends LinearLayout implements public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) { mParent = parent; - setPredictionsEnabled(mPredictionUiStateManager.arePredictionsEnabled()); } private void setPredictionsEnabled(boolean predictionsEnabled) { @@ -205,7 +201,7 @@ public class PredictionRowView extends LinearLayout implements @Override public boolean hasVisibleContent() { - return mPredictionUiStateManager.arePredictionsEnabled(); + return mPredictionsEnabled; } /** @@ -241,9 +237,6 @@ public class PredictionRowView extends LinearLayout implements } private void applyPredictionApps() { - if (mLoadingProgress != null) { - removeView(mLoadingProgress); - } if (!mPredictionsEnabled) { mParent.onHeightUpdated(); return; @@ -290,15 +283,8 @@ public class PredictionRowView extends LinearLayout implements } if (predictionCount == 0) { - if (mLoadingProgress == null) { - mLoadingProgress = LayoutInflater.from(getContext()) - .inflate(R.layout.prediction_load_progress, this, false); - } - addView(mLoadingProgress); - } else { - mLoadingProgress = null; + setPredictionsEnabled(false); } - mParent.onHeightUpdated(); } @@ -342,11 +328,8 @@ public class PredictionRowView extends LinearLayout implements public void setTextAlpha(int alpha) { mIconCurrentTextAlpha = alpha; int iconColor = setColorAlphaBound(mIconTextColor, mIconCurrentTextAlpha); - - if (mLoadingProgress == null) { - for (int i = 0; i < getChildCount(); i++) { - ((BubbleTextView) getChildAt(i)).setTextColor(iconColor); - } + for (int i = 0; i < getChildCount(); i++) { + ((BubbleTextView) getChildAt(i)).setTextColor(iconColor); } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java index 28ecce07ea..64cb4b465f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java @@ -24,7 +24,6 @@ import android.app.prediction.AppPredictor; import android.app.prediction.AppTarget; import android.content.ComponentName; import android.content.Context; -import android.os.Handler; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import com.android.launcher3.AppInfo; @@ -63,7 +62,6 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf OnIDPChangeListener, OnUpdateListener { public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state"; - private static final long INITIAL_CALLBACK_WAIT_TIMEOUT_MS = 5000; // TODO (b/129421797): Update the client constants public enum Client { @@ -110,13 +108,8 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf for (int i = 0; i < mPredictionServicePredictions.length; i++) { mPredictionServicePredictions[i] = Collections.emptyList(); } - mGettingValidPredictionResults = Utilities.getDevicePrefs(context) .getBoolean(LAST_PREDICTION_ENABLED_STATE, true); - if (mGettingValidPredictionResults) { - new Handler().postDelayed( - this::updatePredictionStateAfterCallback, INITIAL_CALLBACK_WAIT_TIMEOUT_MS); - } // Call this last mCurrentState = parseLastState(); @@ -197,10 +190,7 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf } } - public boolean mDebugHadStateUpdate; - private void updatePredictionStateAfterCallback() { - mDebugHadStateUpdate = true; boolean validResults = false; for (List l : mPredictionServicePredictions) { validResults |= l != null && !l.isEmpty(); @@ -296,10 +286,6 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf dispatchOnChange(false); } - public boolean arePredictionsEnabled() { - return mCurrentState.isEnabled; - } - private boolean canApplyPredictions(PredictionState newState) { if (mAppsView == null) { // If there is no apps view, no need to schedule. diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java index c6f7544fef..d9fcf4d97a 100644 --- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java +++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java @@ -68,11 +68,7 @@ public class AppPredictionsUITests extends AbstractQuickStepTest { // Disable app tracker AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker()); - PredictionUiStateManager.INSTANCE.initializeForTesting(null); - waitForLauncherCondition("Prediction never had state update", - launcher -> PredictionUiStateManager.INSTANCE.get( - mTargetContext).mDebugHadStateUpdate); mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback( Client.HOME); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 35113d2131..a59189beaa 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2553,8 +2553,4 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, void onLauncherResume(); } - - public boolean debugIsPredictionInitialized() { - return true; - } } diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index a19857c786..44401c73c2 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -54,6 +54,7 @@ import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.ResourceUtils; import com.android.launcher3.Utilities; import com.android.launcher3.compat.LauncherAppsCompat; +import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.TestHelpers; import com.android.launcher3.util.Wait; @@ -197,6 +198,9 @@ public abstract class AbstractLauncherUiTest { @Before public void setUp() throws Exception { + // Disable app tracker + AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker()); + mTargetContext = InstrumentationRegistry.getTargetContext(); mTargetPackage = mTargetContext.getPackageName(); // Unlock the phone diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index d0ea142689..d4cfe3aa29 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -64,8 +64,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { test.mDevice.pressHome(); } test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null); - test.waitForLauncherCondition("Prediction never had state update", - launcher -> launcher.debugIsPredictionInitialized()); test.waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL); test.waitForResumed("Launcher internal state is still Background"); // Check that we switched to home. From 9fd2d0ee0a604bb14ba4cff132fd277e36c3fbef Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 23 May 2019 18:13:19 -0700 Subject: [PATCH 17/47] Fix crash when launching some apps which require icons to be loaded on the model thread Change-Id: I945a94c458d872b41e44b4b3a2d023f85d8a7c88 --- src/com/android/launcher3/dragndrop/DragView.java | 4 ++-- src/com/android/launcher3/views/FloatingIconView.java | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index 9d46cf2abf..d1bd2db134 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -44,6 +44,7 @@ import android.view.View; import com.android.launcher3.FastBitmapDrawable; import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager; @@ -54,7 +55,6 @@ import com.android.launcher3.anim.Interpolators; import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; -import com.android.launcher3.util.UiThreadHelper; import java.util.Arrays; @@ -210,7 +210,7 @@ public class DragView extends View implements LauncherStateManager.StateListener return; } // Load the adaptive icon on a background thread and add the view in ui thread. - new Handler(UiThreadHelper.getBackgroundLooper()).postAtFrontOfQueue(new Runnable() { + new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(new Runnable() { @Override public void run() { Object[] outObj = new Object[1]; diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index f63bcddf0d..f4a3822558 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -40,7 +40,6 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.CancellationSignal; import android.os.Handler; -import android.os.Looper; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; @@ -63,7 +62,6 @@ import com.android.launcher3.graphics.ShiftedBitmapDrawable; import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.shortcuts.DeepShortcutView; -import com.android.launcher3.util.UiThreadHelper; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; @@ -642,7 +640,7 @@ public class FloatingIconView extends View implements originalView.setVisibility(INVISIBLE); }; CancellationSignal loadIconSignal = view.mLoadIconSignal; - new Handler(UiThreadHelper.getBackgroundLooper()).postAtFrontOfQueue(() -> { + new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> { view.getIcon(originalView, (ItemInfo) originalView.getTag(), isOpening, onIconLoaded, loadIconSignal); }); From 877ed56f2c74b9f346b83bba3ea9ca03f571beb5 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 23 May 2019 18:19:07 -0700 Subject: [PATCH 18/47] Increasing swipe-to-overview gesture speed to avoid dragging icon Change-Id: Iebbd6249d09342b3dba226716dc1835e20e8158b --- tests/tapl/com/android/launcher3/tapl/Background.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index 8627f485b5..e1537e94a4 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -89,7 +89,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { mLauncher.swipeToState( centerX, startY, centerX, startY - swipeHeight - mLauncher.getTouchSlop(), - 60, + 10, expectedState); break; } From addaab60fa803839107e28d87993a0924f151a98 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 24 May 2019 10:54:12 -0700 Subject: [PATCH 19/47] Adding myself as an owner of test directories Change-Id: I3d6649a2b804715cebb80b8cac881ef227738088 --- quickstep/tests/OWNERS | 1 + tests/OWNERS | 1 + 2 files changed, 2 insertions(+) create mode 100644 quickstep/tests/OWNERS create mode 100644 tests/OWNERS diff --git a/quickstep/tests/OWNERS b/quickstep/tests/OWNERS new file mode 100644 index 0000000000..046d871163 --- /dev/null +++ b/quickstep/tests/OWNERS @@ -0,0 +1 @@ +vadimt@google.com diff --git a/tests/OWNERS b/tests/OWNERS new file mode 100644 index 0000000000..046d871163 --- /dev/null +++ b/tests/OWNERS @@ -0,0 +1 @@ +vadimt@google.com From 6632195d0377c46850dfd3c46ebf3b20b14404d1 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 24 May 2019 13:46:28 -0700 Subject: [PATCH 20/47] Increasing wait time for a window to appear after starting an app This is likely due to a bug with stale accessibility hierarchy. Bug: 112282235 Change-Id: If0a47bcc4b850fd619d9ac13984c42244ad3014b --- tests/tapl/com/android/launcher3/tapl/Launchable.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index ee90d37b6e..4261988409 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -30,6 +30,7 @@ import com.android.launcher3.testing.TestProtocol; * Ancestor for AppIcon and AppMenuItem. */ abstract class Launchable { + private static final int WAIT_TIME_MS = 60000; protected final LauncherInstrumentation mLauncher; protected final UiObject2 mObject; @@ -56,7 +57,7 @@ abstract class Launchable { mLauncher.getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING); mLauncher.assertTrue( "Launching an app didn't open a new window: " + mObject.getText(), - mObject.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS)); + mObject.clickAndWait(Until.newWindow(), WAIT_TIME_MS)); mLauncher.getTestInfo(TestProtocol.REQUEST_DISABLE_DEBUG_TRACING); mLauncher.assertTrue( "App didn't start: " + selector, From 55d1e44c47d118e23c0ec452c5e5b31e8cd32690 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 24 May 2019 17:17:45 -0700 Subject: [PATCH 21/47] Fixing user getting stuck in quick-switch state If we are cancelled after the animation has completed, but before the deferred frame was captured, we set the state as cancelled, and start the new consumer with the existing recents controller. But after the deferred frame, we finish the controller (and since the state was set to cancelled, do not launch the new task) Bug: 132756514 Change-Id: If30af713c76b6d895d0b01b93d31c0e1403b7214 --- .../android/quickstep/WindowTransformSwipeHandler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index a1bcb9bf20..ffef1cf325 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1261,7 +1261,7 @@ public class WindowTransformSwipeHandler } else { taskView = mRecentsView.updateThumbnail(mRunningTaskId, mTaskSnapshot); } - if (taskView != null) { + if (taskView != null && !mCanceled) { // Defer finishing the animation until the next launcher frame with the // new thumbnail finishTransitionPosted = new WindowCallbacksCompat(taskView) { @@ -1271,6 +1271,13 @@ public class WindowTransformSwipeHandler @Override public void onPostDraw(Canvas canvas) { + // If we were cancelled after this was attached, do not update + // the state. + if (mCanceled) { + detach(); + return; + } + if (mDeferFrameCount > 0) { mDeferFrameCount--; // Workaround, detach and reattach to invalidate the root node for From a8a98a16408de6b5b88105d786da4ebef5ec6745 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 24 May 2019 18:52:21 -0700 Subject: [PATCH 22/47] Swiping from Overview to All Apps from apps_view Used to swipe from an app icon, but in the lab, there were icons at weird positions. Change-Id: I271dd800f1b714997282512eb64ebc5d34b24f13 --- tests/tapl/com/android/launcher3/tapl/Overview.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java index 1aa957a17e..058831f180 100644 --- a/tests/tapl/com/android/launcher3/tapl/Overview.java +++ b/tests/tapl/com/android/launcher3/tapl/Overview.java @@ -51,10 +51,9 @@ public final class Overview extends BaseOverview { // Swipe from an app icon to the top. LauncherInstrumentation.log("Overview.switchToAllApps before swipe"); - final UiObject2 appIcon = mLauncher.waitForLauncherObjectByClass( - "android.widget.TextView"); + final UiObject2 allApps = mLauncher.waitForLauncherObject("apps_view"); mLauncher.swipeToState(mLauncher.getDevice().getDisplayWidth() / 2, - appIcon.getVisibleBounds().centerY(), + allApps.getVisibleBounds().top, mLauncher.getDevice().getDisplayWidth() / 2, 0, 50, ALL_APPS_STATE_ORDINAL); From 2d6cd80bc9c125d5212695da99c1b1ed47611443 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 23 May 2019 17:41:07 -0700 Subject: [PATCH 23/47] Launcher reports whe 0-button swipe-up gesture pause is detected. This eliminates an unreliable timeout. Also removing an unnecessary check for harness that is done by the called method. Change-Id: If954580060415cbb2952532c16ea0ae4dc7b9469 --- .../android/quickstep/util/MotionPauseDetector.java | 4 ++++ .../launcher3/allapps/AllAppsRecyclerView.java | 2 +- .../compat/AccessibilityManagerCompat.java | 7 +++++++ src/com/android/launcher3/testing/TestProtocol.java | 1 + .../tapl/com/android/launcher3/tapl/Background.java | 13 +++++++++---- .../launcher3/tapl/LauncherInstrumentation.java | 2 +- 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java index 893c053565..801a5604f5 100644 --- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java +++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java @@ -21,6 +21,7 @@ import android.view.MotionEvent; import com.android.launcher3.Alarm; import com.android.launcher3.R; +import com.android.launcher3.compat.AccessibilityManagerCompat; /** * Given positions along x- or y-axis, tracks velocity and acceleration and determines when there is @@ -47,6 +48,7 @@ public class MotionPauseDetector { private final float mSpeedFast; private final Alarm mForcePauseTimeout; private final boolean mMakePauseHarderToTrigger; + private final Context mContext; private Long mPreviousTime = null; private Float mPreviousPosition = null; @@ -71,6 +73,7 @@ public class MotionPauseDetector { * @param makePauseHarderToTrigger Used for gestures that require a more explicit pause. */ public MotionPauseDetector(Context context, boolean makePauseHarderToTrigger) { + mContext = context; Resources res = context.getResources(); mSpeedVerySlow = res.getDimension(R.dimen.motion_pause_detector_speed_very_slow); mSpeedSlow = res.getDimension(R.dimen.motion_pause_detector_speed_slow); @@ -165,6 +168,7 @@ public class MotionPauseDetector { if (mIsPaused != isPaused) { mIsPaused = isPaused; if (mIsPaused) { + AccessibilityManagerCompat.sendPauseDetectedEventToTest(mContext); mHasEverBeenPaused = true; } if (mOnMotionPauseListener != null) { diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 548d5de0e0..a0e9dc5d8e 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -425,7 +425,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine public void onScrollStateChanged(int state) { super.onScrollStateChanged(state); - if (state == SCROLL_STATE_IDLE && Utilities.IS_RUNNING_IN_TEST_HARNESS) { + if (state == SCROLL_STATE_IDLE) { AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext()); } } diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index 8e59d32bdc..81c95cbdd4 100644 --- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java +++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java @@ -69,6 +69,13 @@ public class AccessibilityManagerCompat { sendEventToTest(accessibilityManager, TestProtocol.SCROLL_FINISHED_MESSAGE, null); } + public static void sendPauseDetectedEventToTest(Context context) { + final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context); + if (accessibilityManager == null) return; + + sendEventToTest(accessibilityManager, TestProtocol.PAUSE_DETECTED_MESSAGE, null); + } + private static void sendEventToTest( AccessibilityManager accessibilityManager, String eventTag, Bundle data) { final AccessibilityEvent e = AccessibilityEvent.obtain( diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 9fd44a1c4a..a678ef248d 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -25,6 +25,7 @@ public final class TestProtocol { public static final String STATE_FIELD = "state"; public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE"; public static final String SCROLL_FINISHED_MESSAGE = "TAPL_SCROLL_FINISHED"; + public static final String PAUSE_DETECTED_MESSAGE = "TAPL_PAUSE_DETECTED"; public static final String RESPONSE_MESSAGE_POSTFIX = "_RESPONSE"; public static final int NORMAL_STATE_ORDINAL = 0; public static final int SPRING_LOADED_STATE_ORDINAL = 1; diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index e1537e94a4..ce952983f9 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -32,7 +32,6 @@ import com.android.launcher3.testing.TestProtocol; */ public class Background extends LauncherInstrumentation.VisibleContainer { private static final int ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION = 500; - private static final int ZERO_BUTTON_SWIPE_UP_HOLD_DURATION = 400; Background(LauncherInstrumentation launcher) { super(launcher); @@ -72,9 +71,15 @@ public class Background extends LauncherInstrumentation.VisibleContainer { final long downTime = SystemClock.uptimeMillis(); mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start); - mLauncher.movePointer( - downTime, downTime, ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION, start, end); - LauncherInstrumentation.sleep(ZERO_BUTTON_SWIPE_UP_HOLD_DURATION); + mLauncher.executeAndWaitForEvent( + () -> mLauncher.movePointer( + downTime, + downTime, + ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION, + start, + end), + event -> TestProtocol.PAUSE_DETECTED_MESSAGE.equals(event.getClassName()), + "Pause wasn't detected"); mLauncher.sendPointer( downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, end); break; diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 8d69b37832..a442e2b020 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -364,7 +364,7 @@ public final class LauncherInstrumentation { } } - private Parcelable executeAndWaitForEvent(Runnable command, + Parcelable executeAndWaitForEvent(Runnable command, UiAutomation.AccessibilityEventFilter eventFilter, String message) { try { final AccessibilityEvent event = From 5aef526e95ef91bc375498f55bca9c2b714b2828 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 24 May 2019 13:32:14 -0700 Subject: [PATCH 24/47] More logging for lab-only flake when an app doesn't start I suspect that All Apps gets refreshed around the time of the click. Bug: 132900132 Change-Id: I6d3053f7d8f998e08ca495c005e14ddece634164 --- src/com/android/launcher3/allapps/AlphabeticalAppsList.java | 6 ++++++ tests/tapl/com/android/launcher3/tapl/Launchable.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 434918d2a7..2ad92e16f8 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -23,6 +23,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AlphabeticIndexCompat; import com.android.launcher3.shortcuts.DeepShortcutManager; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LabelComparator; @@ -300,6 +301,11 @@ public class AlphabeticalAppsList implements AllAppsStore.OnUpdateListener { } private void refreshRecyclerView() { + if (TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TAG, + "refreshRecyclerView @ " + android.util.Log.getStackTraceString( + new Throwable())); + } if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 4261988409..5190f001a7 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -53,7 +53,7 @@ abstract class Launchable { private Background launch(BySelector selector) { LauncherInstrumentation.log("Launchable.launch before click " + - mObject.getVisibleCenter()); + mObject.getVisibleCenter() + " in " + mObject.getVisibleBounds()); mLauncher.getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING); mLauncher.assertTrue( "Launching an app didn't open a new window: " + mObject.getText(), From bef6a44e7b8869a4f311db778b9ebfe2f3d40428 Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 20 May 2019 21:35:59 -0400 Subject: [PATCH 25/47] Continue scaling down recents past final position in 0 button mode - Previously, we clamped the progress to 1 when reaching mTransitionDragLength. Now, we allow dragging all the way to the top of the screen, and store this new top progress in mDragLengthFactor (> 1f). - Because the launcher animation controller is inherently bound to a progress between 0 and 1, we have to do a bit of trickery involving interpolators. Specifically, we normalize the progress to 0 to 1 by dividing by mDragLengthFactor, but then we set the interpolators to multiply their progress by mDragLengthFactor. The result is that the animation progress appears to go from 0 to mDragLengthFactor, just like the window progress. - To avoid scaling too small, we start interpolating the progress at a certain point, ending at a specified max progress when reaching the top of the screen. Bug: 131741395 Change-Id: Ie8b4b56d37249cd1456f93c110c26c78fe052dc0 --- .../LauncherActivityControllerHelper.java | 38 ++++++++++++++++--- .../WindowTransformSwipeHandler.java | 33 ++++++++++++++-- .../quickstep/util/ClipAnimationHelper.java | 9 +++-- .../com/android/quickstep/views/TaskView.java | 1 + .../quickstep/ActivityControlHelper.java | 2 + 5 files changed, 70 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index 4b2e487da9..00e4a9d5a8 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -30,6 +30,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; +import android.animation.TimeInterpolator; import android.content.Context; import android.graphics.Rect; import android.graphics.RectF; @@ -68,6 +69,8 @@ import java.util.function.Consumer; */ public final class LauncherActivityControllerHelper implements ActivityControlHelper { + private Runnable mAdjustInterpolatorsRunnable; + @Override public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) { LayoutUtils.calculateLauncherTaskSize(context, dp, outRect); @@ -193,6 +196,13 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe } } + @Override + public void adjustActivityControllerInterpolators() { + if (mAdjustInterpolatorsRunnable != null) { + mAdjustInterpolatorsRunnable.run(); + } + } + @Override public void onTransitionCancelled() { activity.getStateManager().goToState(startState, false /* animate */); @@ -275,6 +285,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe playScaleDownAnim(anim, activity, fromState, endState); anim.setDuration(transitionLength * 2); + anim.setInterpolator(LINEAR); AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(anim, transitionLength * 2); activity.getStateManager().setCurrentUserControlledAnimation(controller); @@ -291,7 +302,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe Animator shiftAnim = new SpringObjectAnimator<>(activity.getAllAppsController(), "allAppsSpringFromACH", activity.getAllAppsController().getShiftRange(), SPRING_DAMPING_RATIO, SPRING_STIFFNESS, progressValues); - shiftAnim.setInterpolator(LINEAR); return shiftAnim; } @@ -310,19 +320,37 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe = fromState.getOverviewScaleAndTranslation(launcher); LauncherState.ScaleAndTranslation endScaleAndTranslation = endState.getOverviewScaleAndTranslation(launcher); + float fromTranslationY = fromScaleAndTranslation.translationY; + float endTranslationY = endScaleAndTranslation.translationY; float fromFullscreenProgress = fromState.getOverviewFullscreenProgress(); float endFullscreenProgress = endState.getOverviewFullscreenProgress(); Animator scale = ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, fromScaleAndTranslation.scale, endScaleAndTranslation.scale); Animator translateY = ObjectAnimator.ofFloat(recentsView, TRANSLATION_Y, - fromScaleAndTranslation.translationY, endScaleAndTranslation.translationY); + fromTranslationY, endTranslationY); Animator applyFullscreenProgress = ObjectAnimator.ofFloat(recentsView, RecentsView.FULLSCREEN_PROGRESS, fromFullscreenProgress, endFullscreenProgress); - scale.setInterpolator(LINEAR); - translateY.setInterpolator(LINEAR); - applyFullscreenProgress.setInterpolator(LINEAR); anim.playTogether(scale, translateY, applyFullscreenProgress); + + mAdjustInterpolatorsRunnable = () -> { + // Adjust the translateY interpolator to account for the running task's top inset. + // When progress <= 1, this is handled by each task view as they set their fullscreen + // progress. However, once we go to progress > 1, fullscreen progress stays at 0, so + // recents as a whole needs to translate further to keep up with the app window. + TaskView runningTaskView = recentsView.getRunningTaskView(); + if (runningTaskView == null) { + runningTaskView = recentsView.getTaskViewAt(recentsView.getCurrentPage()); + } + TimeInterpolator oldInterpolator = translateY.getInterpolator(); + Rect fallbackInsets = launcher.getDeviceProfile().getInsets(); + float extraTranslationY = runningTaskView.getThumbnail().getInsets(fallbackInsets).top; + float normalizedTranslationY = extraTranslationY / (fromTranslationY - endTranslationY); + translateY.setInterpolator(t -> { + float newT = oldInterpolator.getInterpolation(t); + return newT <= 1f ? newT : newT + normalizedTranslationY * (newT - 1); + }); + }; } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index ffef1cf325..16beb79527 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -217,6 +217,12 @@ public class WindowTransformSwipeHandler private static final long SHELF_ANIM_DURATION = 120; public static final long RECENTS_ATTACH_DURATION = 300; + // Start resisting when swiping past this factor of mTransitionDragLength. + private static final float DRAG_LENGTH_FACTOR_START_PULLBACK = 1.4f; + // This is how far down we can scale down, where 0f is full screen and 1f is recents. + private static final float DRAG_LENGTH_FACTOR_MAX_PULLBACK = 1.8f; + private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL; + /** * Used as the page index for logging when we return to the last task at the end of the gesture. */ @@ -231,7 +237,10 @@ public class WindowTransformSwipeHandler private RunningWindowAnim mRunningWindowAnim; private boolean mIsShelfPeeking; private DeviceProfile mDp; + // The distance needed to drag to reach the task size in recents. private int mTransitionDragLength; + // How much further we can drag past recents, as a factor of mTransitionDragLength. + private float mDragLengthFactor = 1; // Shift in the range of [0, 1]. // 0 => preview snapShot is completely visible, and hotseat is completely translated down @@ -375,6 +384,10 @@ public class WindowTransformSwipeHandler mTransitionDragLength = mActivityControlHelper.getSwipeUpDestinationAndLength( dp, mContext, tempRect); mClipAnimationHelper.updateTargetRect(tempRect); + if (mMode == Mode.NO_BUTTON) { + // We can drag all the way to the top of the screen. + mDragLengthFactor = (float) dp.heightPx / mTransitionDragLength; + } } private long getFadeInDuration() { @@ -546,11 +559,18 @@ public class WindowTransformSwipeHandler public void updateDisplacement(float displacement) { // We are moving in the negative x/y direction displacement = -displacement; - if (displacement > mTransitionDragLength && mTransitionDragLength > 0) { - mCurrentShift.updateValue(1); + if (displacement > mTransitionDragLength * mDragLengthFactor && mTransitionDragLength > 0) { + mCurrentShift.updateValue(mDragLengthFactor); } else { float translation = Math.max(displacement, 0); float shift = mTransitionDragLength == 0 ? 0 : translation / mTransitionDragLength; + if (shift > DRAG_LENGTH_FACTOR_START_PULLBACK) { + float pullbackProgress = Utilities.getProgress(shift, + DRAG_LENGTH_FACTOR_START_PULLBACK, mDragLengthFactor); + pullbackProgress = PULLBACK_INTERPOLATOR.getInterpolation(pullbackProgress); + shift = DRAG_LENGTH_FACTOR_START_PULLBACK + pullbackProgress + * (DRAG_LENGTH_FACTOR_MAX_PULLBACK - DRAG_LENGTH_FACTOR_START_PULLBACK); + } mCurrentShift.updateValue(shift); } } @@ -638,6 +658,8 @@ public class WindowTransformSwipeHandler private void onAnimatorPlaybackControllerCreated(AnimatorPlaybackController anim) { mLauncherTransitionController = anim; + mLauncherTransitionController.dispatchSetInterpolator(t -> t * mDragLengthFactor); + mAnimationFactory.adjustActivityControllerInterpolators(); mLauncherTransitionController.dispatchOnStart(); updateLauncherTransitionProgress(); } @@ -690,7 +712,9 @@ public class WindowTransformSwipeHandler if (mGestureEndTarget == HOME) { return; } - float progress = mCurrentShift.value; + // Normalize the progress to 0 to 1, as the animation controller will clamp it to that + // anyway. The controller mimics the drag length factor by applying it to its interpolators. + float progress = mCurrentShift.value / mDragLengthFactor; mLauncherTransitionController.setPlayFraction( progress <= mShiftAtGestureStart || mShiftAtGestureStart >= 1 ? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart)); @@ -898,7 +922,7 @@ public class WindowTransformSwipeHandler } endShift = endTarget.endShift; startShift = Utilities.boundToRange(currentShift - velocityPxPerMs.y - * SINGLE_FRAME_MS / mTransitionDragLength, 0, 1); + * SINGLE_FRAME_MS / mTransitionDragLength, 0, mDragLengthFactor); float minFlingVelocity = mContext.getResources() .getDimension(R.dimen.quickstep_fling_min_velocity); if (Math.abs(endVelocity) > minFlingVelocity && mTransitionDragLength > 0) { @@ -1057,6 +1081,7 @@ public class WindowTransformSwipeHandler mLauncherTransitionController.getAnimationPlayer().end(); } else { mLauncherTransitionController.dispatchSetInterpolator(adjustedInterpolator); + mAnimationFactory.adjustActivityControllerInterpolators(); mLauncherTransitionController.getAnimationPlayer().setDuration(duration); if (QUICKSTEP_SPRINGS.get()) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java index c164a2450f..e2fb602d92 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -23,7 +23,6 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD import android.annotation.TargetApi; import android.content.Context; -import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Matrix.ScaleToFit; import android.graphics.Rect; @@ -160,14 +159,16 @@ public class ClipAnimationHelper { public RectF applyTransform(RemoteAnimationTargetSet targetSet, TransformParams params, boolean launcherOnTop) { + float progress = params.progress; if (params.currentRect == null) { RectF currentRect; mTmpRectF.set(mTargetRect); Utilities.scaleRectFAboutCenter(mTmpRectF, params.offsetScale); - float progress = params.progress; currentRect = mRectFEvaluator.evaluate(progress, mSourceRect, mTmpRectF); currentRect.offset(params.offsetX, 0); + // Don't clip past progress > 1. + progress = Math.min(1, progress); final RectF sourceWindowClipInsets = params.forLiveTile ? mSourceWindowClipInsetsForLiveTile : mSourceWindowClipInsets; mClipRectF.left = sourceWindowClipInsets.left * progress; @@ -189,7 +190,7 @@ public class ClipAnimationHelper { float alpha = 1f; int layer = RemoteAnimationProvider.getLayer(app, mBoostModeTargetLayers); float cornerRadius = 0f; - float scale = params.currentRect.width() / crop.width(); + float scale = Math.max(params.currentRect.width(), mTargetRect.width()) / crop.width(); if (app.mode == targetSet.targetMode) { if (app.activityType != RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) { mTmpMatrix.setRectToRect(mSourceRect, params.currentRect, ScaleToFit.FILL); @@ -198,7 +199,7 @@ public class ClipAnimationHelper { if (mSupportsRoundedCornersOnWindows) { float windowCornerRadius = mUseRoundedCornersOnWindows ? mWindowCornerRadius : 0; - cornerRadius = Utilities.mapRange(params.progress, windowCornerRadius, + cornerRadius = Utilities.mapRange(progress, windowCornerRadius, mTaskCornerRadius); mCurrentCornerRadius = cornerRadius; } 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 053b7389cc..3364377e9d 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 @@ -633,6 +633,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { * @param progress: 0 = show icon and no insets; 1 = don't show icon and show full insets. */ public void setFullscreenProgress(float progress) { + progress = Utilities.boundToRange(progress, 0, 1); if (progress == mFullscreenProgress) { return; } diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index 17f88c980e..b0acd9b1b6 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -118,6 +118,8 @@ public interface ActivityControlHelper { void createActivityController(long transitionLength); + default void adjustActivityControllerInterpolators() { } + default void onTransitionCancelled() { } default void setShelfState(ShelfAnimState animState, Interpolator interpolator, From ed7d7148058d2857054c71ed449aedd2b05520d1 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 28 May 2019 14:40:29 -0700 Subject: [PATCH 26/47] Fix bug where DiscoveryBounce is not cancelled after state change. Bug: 131768436 Change-Id: I7d389671969a75ae7ec9f9f5cc1326f7105e2071 --- .../launcher3/allapps/DiscoveryBounce.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index 1d62b435d8..8c596269de 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -30,6 +30,9 @@ import android.view.MotionEvent; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherState; +import com.android.launcher3.LauncherStateManager; +import com.android.launcher3.LauncherStateManager.StateListener; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.compat.UserManagerCompat; @@ -52,6 +55,16 @@ public class DiscoveryBounce extends AbstractFloatingView { private final Launcher mLauncher; private final Animator mDiscoBounceAnimation; + private final StateListener mStateListener = new StateListener() { + @Override + public void onStateTransitionStart(LauncherState toState) { + handleClose(false); + } + + @Override + public void onStateTransitionComplete(LauncherState finalState) {} + }; + public DiscoveryBounce(Launcher launcher, float delta) { super(launcher, null); mLauncher = launcher; @@ -67,6 +80,7 @@ public class DiscoveryBounce extends AbstractFloatingView { } }); mDiscoBounceAnimation.addListener(controller.getProgressAnimatorListener()); + launcher.getStateManager().addStateListener(mStateListener); } @Override @@ -105,6 +119,7 @@ public class DiscoveryBounce extends AbstractFloatingView { // Reset the all-apps progress to what ever it was previously. mLauncher.getAllAppsController().setProgress(mLauncher.getStateManager() .getState().getVerticalProgress(mLauncher)); + mLauncher.getStateManager().removeStateListener(mStateListener); } } From 560fe0744808d412b39655c522ab1ffd3b5742aa Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Tue, 28 May 2019 14:53:41 -0700 Subject: [PATCH 27/47] Chips container - Don't hard code the height of the chips container. When the container was present, but empty, it was showing it's background. Bug: 133783088 Change-Id: I97b65435d66e9ced7f5487dc50a00665794f8fcd Tested: manual --- quickstep/res/layout/task.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml index ba4ea8bc6d..18691889ff 100644 --- a/quickstep/res/layout/task.xml +++ b/quickstep/res/layout/task.xml @@ -44,7 +44,7 @@ From 221895d06b4e8c0cbe8c52b63115d673f1061a5d Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 28 May 2019 01:26:19 -0700 Subject: [PATCH 28/47] Improving swipe up interaction when device is locked When device is locked, only scale down the top task as a response to the user interaction. When user flings or lifts his finger, the task is dismissed to go to the lock screen LockScreenRecentsActivity is an empty activity which starts on top of lock screen and finishes immediately. This allows us to start a recents transition with just the top activity as the animation target. This target is then used for swipe up interaction Bug: 133167096 Change-Id: I466ed142ea33d626c78cb9cc5f6311bad26b8d98 --- quickstep/AndroidManifest.xml | 5 + .../quickstep/LockScreenRecentsActivity.java | 31 +++ .../quickstep/TouchInteractionService.java | 22 +- .../DeviceLockedInputConsumer.java | 210 +++++++++++++++++- 4 files changed, 254 insertions(+), 14 deletions(-) create mode 100644 quickstep/recents_ui_overrides/src/com/android/quickstep/LockScreenRecentsActivity.java diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index a38979d41d..332e0fa360 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -84,6 +84,11 @@ android:clearTaskOnLaunch="true" android:exported="false" /> + + diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LockScreenRecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LockScreenRecentsActivity.java new file mode 100644 index 0000000000..65f323c7d6 --- /dev/null +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LockScreenRecentsActivity.java @@ -0,0 +1,31 @@ +/* + * 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; + +import android.app.Activity; +import android.os.Bundle; + +/** + * Empty activity to start a recents transition + */ +public class LockScreenRecentsActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + finish(); + } +} diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 6ba1bf5c55..14bdec5621 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -479,7 +479,7 @@ public class TouchInteractionService extends Service implements if (isInValidSystemUiState) { // This handles apps launched in direct boot mode (e.g. dialer) as well as apps // launched while device is locked even after exiting direct boot mode (e.g. camera). - return new DeviceLockedInputConsumer(this); + return createDeviceLockedInputConsumer(mAM.getRunningTask(0)); } else { return InputConsumer.NO_OP; } @@ -512,16 +512,15 @@ public class TouchInteractionService extends Service implements } private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) { - if (mKM.isDeviceLocked()) { - // This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched - // while device is locked even after exiting direct boot mode (e.g. camera). - return new DeviceLockedInputConsumer(this); - } - final RunningTaskInfo runningTaskInfo = mAM.getRunningTask(0); if (!useSharedState) { mSwipeSharedState.clearAllState(); } + if (mKM.isDeviceLocked()) { + // This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched + // while device is locked even after exiting direct boot mode (e.g. camera). + return createDeviceLockedInputConsumer(runningTaskInfo); + } final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); @@ -559,6 +558,15 @@ public class TouchInteractionService extends Service implements mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion); } + private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) { + if (mMode == Mode.NO_BUTTON && taskInfo != null) { + return new DeviceLockedInputConsumer(this, mSwipeSharedState, mInputMonitorCompat, + mSwipeTouchRegion, taskInfo.taskId); + } else { + return InputConsumer.NO_OP; + } + } + /** * To be called by the consumer when it's no longer active. */ diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java index d01b5ec19d..db2af59aca 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java @@ -15,26 +15,102 @@ */ package com.android.quickstep.inputconsumers; +import static android.view.MotionEvent.ACTION_CANCEL; +import static android.view.MotionEvent.ACTION_POINTER_DOWN; +import static android.view.MotionEvent.ACTION_UP; + import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.Utilities.squaredTouchSlop; +import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; +import static com.android.quickstep.WindowTransformSwipeHandler.MIN_PROGRESS_FOR_OVERVIEW; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.graphics.Point; import android.graphics.PointF; +import android.graphics.Rect; +import android.graphics.RectF; import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.ViewConfiguration; +import android.view.WindowManager; + +import com.android.launcher3.R; +import com.android.launcher3.Utilities; +import com.android.quickstep.LockScreenRecentsActivity; +import com.android.quickstep.MultiStateCallback; +import com.android.quickstep.SwipeSharedState; +import com.android.quickstep.util.ClipAnimationHelper; +import com.android.quickstep.util.RecentsAnimationListenerSet; +import com.android.quickstep.util.SwipeAnimationTargetSet; +import com.android.systemui.shared.system.ActivityManagerWrapper; +import com.android.systemui.shared.system.BackgroundExecutor; +import com.android.systemui.shared.system.InputMonitorCompat; +import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** * A dummy input consumer used when the device is still locked, e.g. from secure camera. */ -public class DeviceLockedInputConsumer implements InputConsumer { +public class DeviceLockedInputConsumer implements InputConsumer, + SwipeAnimationTargetSet.SwipeAnimationListener { + + private static final float SCALE_DOWN = 0.75f; + + private static final String[] STATE_NAMES = DEBUG_STATES ? new String[2] : null; + private static int getFlagForIndex(int index, String name) { + if (DEBUG_STATES) { + STATE_NAMES[index] = name; + } + return 1 << index; + } + + private static final int STATE_TARGET_RECEIVED = + getFlagForIndex(0, "STATE_TARGET_RECEIVED"); + private static final int STATE_HANDLER_INVALIDATED = + getFlagForIndex(1, "STATE_HANDLER_INVALIDATED"); private final Context mContext; private final float mTouchSlopSquared; - private final PointF mTouchDown = new PointF(); + private final SwipeSharedState mSwipeSharedState; + private final InputMonitorCompat mInputMonitorCompat; - public DeviceLockedInputConsumer(Context context) { + private final PointF mTouchDown = new PointF(); + private final ClipAnimationHelper mClipAnimationHelper; + private final ClipAnimationHelper.TransformParams mTransformParams; + private final Point mDisplaySize; + private final MultiStateCallback mStateCallback; + private final RectF mSwipeTouchRegion; + public final int mRunningTaskId; + + private VelocityTracker mVelocityTracker; + private float mProgress; + + private boolean mThresholdCrossed = false; + + private SwipeAnimationTargetSet mTargetSet; + + public DeviceLockedInputConsumer(Context context, SwipeSharedState swipeSharedState, + InputMonitorCompat inputMonitorCompat, RectF swipeTouchRegion, int runningTaskId) { mContext = context; mTouchSlopSquared = squaredTouchSlop(context); + mSwipeSharedState = swipeSharedState; + mClipAnimationHelper = new ClipAnimationHelper(context); + mTransformParams = new ClipAnimationHelper.TransformParams(); + mInputMonitorCompat = inputMonitorCompat; + mSwipeTouchRegion = swipeTouchRegion; + mRunningTaskId = runningTaskId; + + // Do not use DeviceProfile as the user data might be locked + mDisplaySize = new Point(); + context.getSystemService(WindowManager.class).getDefaultDisplay().getRealSize(mDisplaySize); + + // Init states + mStateCallback = new MultiStateCallback(STATE_NAMES); + mStateCallback.addCallback(STATE_TARGET_RECEIVED | STATE_HANDLER_INVALIDATED, + this::endRemoteAnimation); + + mVelocityTracker = VelocityTracker.obtain(); } @Override @@ -44,17 +120,137 @@ public class DeviceLockedInputConsumer implements InputConsumer { @Override public void onMotionEvent(MotionEvent ev) { + if (mVelocityTracker == null) { + return; + } + mVelocityTracker.addMovement(ev); + float x = ev.getX(); float y = ev.getY(); - if (ev.getAction() == MotionEvent.ACTION_DOWN) { - mTouchDown.set(x, y); - } else if (ev.getAction() == MotionEvent.ACTION_MOVE) { - if (squaredHypot(x - mTouchDown.x, y - mTouchDown.y) > mTouchSlopSquared) { + switch (ev.getAction()) { + case MotionEvent.ACTION_DOWN: + mTouchDown.set(x, y); + break; + case ACTION_POINTER_DOWN: { + if (!mThresholdCrossed) { + // Cancel interaction in case of multi-touch interaction + int ptrIdx = ev.getActionIndex(); + if (!mSwipeTouchRegion.contains(ev.getX(ptrIdx), ev.getY(ptrIdx))) { + int action = ev.getAction(); + ev.setAction(ACTION_CANCEL); + finishTouchTracking(ev); + ev.setAction(action); + } + } + break; + } + case MotionEvent.ACTION_MOVE: { + if (!mThresholdCrossed) { + if (squaredHypot(x - mTouchDown.x, y - mTouchDown.y) > mTouchSlopSquared) { + startRecentsTransition(); + } + } else { + float dy = Math.max(mTouchDown.y - y, 0); + mProgress = dy / mDisplaySize.y; + mTransformParams.setProgress(mProgress); + if (mTargetSet != null) { + mClipAnimationHelper.applyTransform(mTargetSet, mTransformParams); + } + } + break; + } + case MotionEvent.ACTION_CANCEL: + case MotionEvent.ACTION_UP: + finishTouchTracking(ev); + break; + } + } + + /** + * Called when the gesture has ended. Does not correlate to the completion of the interaction as + * the animation can still be running. + */ + private void finishTouchTracking(MotionEvent ev) { + mStateCallback.setState(STATE_HANDLER_INVALIDATED); + if (mThresholdCrossed && ev.getAction() == ACTION_UP) { + mVelocityTracker.computeCurrentVelocity(1000, + ViewConfiguration.get(mContext).getScaledMaximumFlingVelocity()); + + float velocityY = mVelocityTracker.getYVelocity(); + float flingThreshold = mContext.getResources() + .getDimension(R.dimen.quickstep_fling_threshold_velocity); + + boolean dismissTask; + if (Math.abs(velocityY) > flingThreshold) { + // Is fling + dismissTask = velocityY < 0; + } else { + dismissTask = mProgress >= (1 - MIN_PROGRESS_FOR_OVERVIEW); + } + if (dismissTask) { // For now, just start the home intent so user is prompted to unlock the device. mContext.startActivity(new Intent(Intent.ACTION_MAIN) .addCategory(Intent.CATEGORY_HOME) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } } + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + + private void startRecentsTransition() { + mThresholdCrossed = true; + RecentsAnimationListenerSet newListenerSet = + mSwipeSharedState.newRecentsAnimationListenerSet(); + newListenerSet.addListener(this); + Intent intent = new Intent(Intent.ACTION_MAIN) + .addCategory(Intent.CATEGORY_DEFAULT) + .setComponent(new ComponentName(mContext, LockScreenRecentsActivity.class)) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + + mInputMonitorCompat.pilferPointers(); + BackgroundExecutor.get().submit( + () -> ActivityManagerWrapper.getInstance().startRecentsActivity( + intent, null, newListenerSet, null, null)); + } + + @Override + public void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet) { + mTargetSet = targetSet; + + Rect displaySize = new Rect(0, 0, mDisplaySize.x, mDisplaySize.y); + RemoteAnimationTargetCompat targetCompat = targetSet.findTask(mRunningTaskId); + if (targetCompat != null) { + mClipAnimationHelper.updateSource(displaySize, targetCompat); + } + + Utilities.scaleRectAboutCenter(displaySize, SCALE_DOWN); + displaySize.offsetTo(displaySize.left, 0); + mClipAnimationHelper.updateTargetRect(displaySize); + mClipAnimationHelper.applyTransform(mTargetSet, mTransformParams); + + mStateCallback.setState(STATE_TARGET_RECEIVED); + } + + @Override + public void onRecentsAnimationCanceled() { + mTargetSet = null; + } + + private void endRemoteAnimation() { + if (mTargetSet != null) { + mTargetSet.finishController( + false /* toRecents */, null /* callback */, false /* sendUserLeaveHint */); + } + } + + @Override + public void onConsumerAboutToBeSwitched() { + mStateCallback.setState(STATE_HANDLER_INVALIDATED); + } + + @Override + public boolean allowInterceptByParent() { + return !mThresholdCrossed; } } From c0f1f4f3afe1d6cf275ad4f54fabfc134f0294c3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 28 May 2019 15:49:09 -0700 Subject: [PATCH 29/47] Fix bug where changing the display size does not update the launcher grid. The bug is caused by launcher saving the grid name and using that grid name to look for matching display options. This makes sense when changing the grid size, but doesn't work well when changing the display size. Example: Initial Pixel display size is set to Default, so we save "normal" as the KEY_IDP_GRID_NAME. When we change display size to Largest, the KEY_IDP_GRID_NAME is still "normal" and so we only look at display options under "normal". Before this, Pixel with display size set to Largest would be set to "reasonable". This should be safe change for Q, and we can have a proper fix when we officially support changing grid size. Bug: 131867841 Change-Id: If5f3b0a13b90069973e929024b26bd9b9c45a7d8 --- src/com/android/launcher3/InvariantDeviceProfile.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 8a8a2fbe55..bde87cb505 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -288,7 +288,9 @@ public class InvariantDeviceProfile { InvariantDeviceProfile oldProfile = new InvariantDeviceProfile(this); // Re-init grid - initGrid(context, Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null)); + // TODO(b/131867841): We pass in null here so that we can calculate the closest profile + // without the bias of the grid name. + initGrid(context, null); int changeFlags = 0; if (numRows != oldProfile.numRows || From aa8019308b75ccb9558021aeb1f89ecaf6c7b21f Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 28 May 2019 17:31:03 -0700 Subject: [PATCH 30/47] Fixing pressHome when a context menu is visible Bug: 132460627 Change-Id: I78064166fccd3a29bcb3fa6175bd4937ae032a98 --- .../com/android/launcher3/ui/TaplTestsLauncher3.java | 8 ++++++++ .../launcher3/tapl/LauncherInstrumentation.java | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index d4cfe3aa29..4e4ba73296 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -100,6 +100,14 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { executeOnLauncher( launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu", OptionsPopupView.getOptionsPopup(launcher) != null)); + // Check that pressHome works when the menu is shown. + mLauncher.pressHome(); + } + + @Test + public void testPressHomeOnAllAppsContextMenu() throws Exception { + mLauncher.getWorkspace().switchToAllApps().getAppIcon("TestActivity7").openMenu(); + mLauncher.pressHome(); } public static void runAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) { diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a442e2b020..f7befd1408 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -400,13 +400,22 @@ public final class LauncherInstrumentation { // accessibility events prior to pressing Home. final String action; if (getNavigationModel() == NavigationModel.ZERO_BUTTON) { + final Point displaySize = getRealDisplaySize(); + + if (hasLauncherObject("deep_shortcuts_container")) { + linearGesture( + displaySize.x / 2, displaySize.y - 1, + displaySize.x / 2, 0, + ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME); + assertTrue("Context menu is still visible afterswiping up to home", + !hasLauncherObject("deep_shortcuts_container")); + } if (hasLauncherObject(WORKSPACE_RES_ID)) { log(action = "already at home"); } else { log(action = "swiping up to home"); final int finalState = mDevice.hasObject(By.pkg(getLauncherPackageName())) ? NORMAL_STATE_ORDINAL : BACKGROUND_APP_STATE_ORDINAL; - final Point displaySize = getRealDisplaySize(); swipeToState( displaySize.x / 2, displaySize.y - 1, From f9bf37d569888b34555a50fef073482bb2aad391 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 28 May 2019 18:35:36 -0700 Subject: [PATCH 31/47] Increasing activated-task wait time to 60000 ms Bug: 112282235 Change-Id: I14f63ce77395b9f95743a6fb36c0b02a80a8983f --- tests/tapl/com/android/launcher3/tapl/OverviewTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java index b9668513c3..2ea76185ea 100644 --- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java +++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java @@ -25,6 +25,7 @@ import androidx.test.uiautomator.Until; */ public final class OverviewTask { static final int FLING_SPEED = 3000; + private static final long WAIT_TIME_MS = 60000; private final LauncherInstrumentation mLauncher; private final UiObject2 mTask; private final BaseOverview mOverview; @@ -60,7 +61,7 @@ public final class OverviewTask { verifyActiveContainer(); mLauncher.assertTrue("Launching task didn't open a new window: " + mTask.getParent().getContentDescription(), - mTask.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS)); + mTask.clickAndWait(Until.newWindow(), WAIT_TIME_MS)); return new Background(mLauncher); } } From 9789beae0eb926fb9291659ed32ec43dcde70820 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 28 May 2019 19:13:27 -0700 Subject: [PATCH 32/47] Import translations. DO NOT MERGE Auto-generated-cl: translation import Bug: 64712476 Change-Id: I029f3fe3ecc187db70a0e86ed98f498f04be1d0a --- quickstep/res/values-ar/strings.xml | 2 +- quickstep/res/values-de/strings.xml | 2 +- quickstep/res/values-gl/strings.xml | 2 +- res/values-ar/strings.xml | 4 ++-- res/values-b+sr+Latn/strings.xml | 2 +- res/values-bn/strings.xml | 4 ++-- res/values-bs/strings.xml | 4 ++-- res/values-ca/strings.xml | 4 ++-- res/values-da/strings.xml | 8 ++++---- res/values-de/strings.xml | 8 ++++---- res/values-en-rAU/strings.xml | 2 +- res/values-en-rGB/strings.xml | 2 +- res/values-en-rIN/strings.xml | 2 +- res/values-es/strings.xml | 8 ++++---- res/values-et/strings.xml | 20 ++++++++++---------- res/values-eu/strings.xml | 10 +++++----- res/values-fa/strings.xml | 2 +- res/values-fr-rCA/strings.xml | 2 +- res/values-fr/strings.xml | 2 +- res/values-gl/strings.xml | 8 ++++---- res/values-hi/strings.xml | 14 +++++++------- res/values-in/strings.xml | 6 +++--- res/values-iw/strings.xml | 4 ++-- res/values-kk/strings.xml | 2 +- res/values-km/strings.xml | 4 ++-- res/values-kn/strings.xml | 2 +- res/values-ky/strings.xml | 4 ++-- res/values-ml/strings.xml | 2 +- res/values-mn/strings.xml | 2 +- res/values-mr/strings.xml | 2 +- res/values-my/strings.xml | 4 ++-- res/values-nl/strings.xml | 4 ++-- res/values-pl/strings.xml | 2 +- res/values-pt-rPT/strings.xml | 2 +- res/values-pt/strings.xml | 4 ++-- res/values-ro/strings.xml | 6 +++--- res/values-ru/strings.xml | 4 ++-- res/values-si/strings.xml | 4 ++-- res/values-sk/strings.xml | 2 +- res/values-sr/strings.xml | 2 +- res/values-sw/strings.xml | 2 +- res/values-ta/strings.xml | 24 ++++++++++++------------ res/values-te/strings.xml | 2 +- res/values-tl/strings.xml | 2 +- res/values-uk/strings.xml | 6 +++--- res/values-ur/strings.xml | 2 +- res/values-uz/strings.xml | 14 +++++++------- res/values-vi/strings.xml | 4 ++-- res/values-zh-rHK/strings.xml | 2 +- res/values-zh-rTW/strings.xml | 4 ++-- 50 files changed, 118 insertions(+), 118 deletions(-) diff --git a/quickstep/res/values-ar/strings.xml b/quickstep/res/values-ar/strings.xml index 73c7c5c033..b036bc1ebd 100644 --- a/quickstep/res/values-ar/strings.xml +++ b/quickstep/res/values-ar/strings.xml @@ -27,7 +27,7 @@ "إغلاق" "إعدادات استخدام التطبيق" "محو الكل" - "التطبيقات التي تمّ استخدامها مؤخرًا" + "التطبيقات المستخدمة مؤخرًا" "%1$s، %2$s" "أقل من دقيقة" "يتبقى اليوم %1$s." diff --git a/quickstep/res/values-de/strings.xml b/quickstep/res/values-de/strings.xml index 7f4e56d260..449cc8c11d 100644 --- a/quickstep/res/values-de/strings.xml +++ b/quickstep/res/values-de/strings.xml @@ -20,7 +20,7 @@ "Splitscreen" - "Fixieren" + "Anpinnen" "Freeform-Modus" "Übersicht" "Keine kürzlich verwendeten Elemente" diff --git a/quickstep/res/values-gl/strings.xml b/quickstep/res/values-gl/strings.xml index c6698bb480..356d10d5da 100644 --- a/quickstep/res/values-gl/strings.xml +++ b/quickstep/res/values-gl/strings.xml @@ -27,7 +27,7 @@ "Pecha a aplicación" "Configuración do uso de aplicacións" "Borrar todo" - "Aplicacións recentes" + "Apps recentes" "%1$s (%2$s)" "<1 min" "Tempo restante hoxe %1$s" diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml index bf00e9541d..a80ecb0b14 100644 --- a/res/values-ar/strings.xml +++ b/res/values-ar/strings.xml @@ -85,7 +85,7 @@ "الأدوات" "الخلفيات" "الأنماط والخلفيات" - "إعدادات الصفحة الرئيسية" + "إعدادات الشاشة الرئيسية" "أوقف المشرف هذه الميزة" "السماح بتدوير الشاشة الرئيسية" "عند تدوير الهاتف" @@ -108,7 +108,7 @@ "أدوات %1$s" "قائمة الأدوات" "تم إغلاق قائمة الأدوات." - "إضافة إلى الشاشة الرئيسية" + "الإضافة إلى الشاشة الرئيسية" "نقل العنصر إلى هنا" "تمت إضافة العنصر إلى الشاشة الرئيسية" "تم حذف العنصر" diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml index 5158a78164..883003c5c0 100644 --- a/res/values-b+sr+Latn/strings.xml +++ b/res/values-b+sr+Latn/strings.xml @@ -105,7 +105,7 @@ "Vidžeti za %1$s" "Lista vidžeta" "Lista vidžeta je zatvorena" - "Dodaj na početni ekran" + "Dodajte na početni ekran" "Premesti stavku ovde" "Stavka je dodata na početni ekran" "Stavka je uklonjena" diff --git a/res/values-bn/strings.xml b/res/values-bn/strings.xml index 6d80329988..775885caac 100644 --- a/res/values-bn/strings.xml +++ b/res/values-bn/strings.xml @@ -83,7 +83,7 @@ "স্টাইল এবং ওয়ালপেপার" "হোম সেটিংস" "আপনার প্রশাসক দ্বারা অক্ষম করা হয়েছে" - "হোমস্ক্রীন ঘোরানোর অনুমতি দিন" + "হোম স্ক্রিন ঘোরানোর অনুমতি দিন" "যখন ফোনটি ঘোরানো হয়" "বিজ্ঞপ্তি ডট" "চালু" @@ -104,7 +104,7 @@ "%1$s উইজেট" "উইজেটের তালিকা" "উইজেটের তালিকা বন্ধ করা হয়েছে" - "হোম স্ক্রীনে যোগ করুন" + "হোম স্ক্রিনে যোগ করুন" "এখানে আইটেম সরান" "হোম স্ক্রীনে আইটেম যোগ করা হয়েছে" "আইটেম সরানো হয়েছে" diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml index 53bdeb2d7b..5650457071 100644 --- a/res/values-bs/strings.xml +++ b/res/values-bs/strings.xml @@ -79,7 +79,7 @@ "Folder je zatvoren" "Ime foldera je promijenjeno u %1$s" "Folder: %1$s" - "Dodaci" + "Vidžeti" "Pozadinske slike" "Stilovi i pozadinske slike" "Postavke početnog ekrana" @@ -90,7 +90,7 @@ "Uključeno" "Isključeno" "Potreban je pristup obavještenjima" - "Za prikaz tačaka obavještenja, uključite obavještenja za aplikacije za aplikaciju %1$s" + "Za prikaz tačaka za obavještenja, uključite obavještenja za aplikacije za aplikaciju %1$s" "Promijeni postavke" "Prikaži tačke za obavještenja" "Dodaj ikonu na početni ekran" diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml index 19f537ffbd..c0859d3b4d 100644 --- a/res/values-ca/strings.xml +++ b/res/values-ca/strings.xml @@ -81,7 +81,7 @@ "Widgets" "Fons de pantalla" "Estils i fons de pantalla" - "Configuració de pantalla d\'inici" + "Config. pantalla d\'inici" "Desactivada per l\'administrador" "Permet la rotació de la pantalla d\'inici" "En girar el telèfon" @@ -92,7 +92,7 @@ "Per veure els punts de notificació, activa les notificacions de l\'aplicació %1$s" "Canvia la configuració" "Mostra els punts de notificació" - "Afegeix la icona a la pantalla d\'inici" + "Afegeix icona a la pantalla d\'inici" "Per a les aplicacions noves" "Desconegut" "Suprimeix" diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml index 008910dc93..dc17516bce 100644 --- a/res/values-da/strings.xml +++ b/res/values-da/strings.xml @@ -33,7 +33,7 @@ "Tryk to gange, og hold fingeren nede for at vælge en widget eller bruge tilpassede handlinger." "%1$d × %2$d" "%1$d i bredden og %2$d i højden" - "Tryk og hold nede for at placere manuelt" + "Tryk og hold for at placere manuelt" "Tilføj automatisk" "Søg efter apps" "Indlæser apps…" @@ -48,7 +48,7 @@ "Liste med apps" "Liste over personlige apps" "Liste over apps til arbejdet" - "Startskærm" + "Hjem" "Fjern" "Afinstaller" "Appinfo" @@ -80,8 +80,8 @@ "Mappe: %1$s" "Widgets" "Baggrunde" - "Stilarter og baggrunde" - "Indstillinger for startskærmen" + "Stil og baggrunde" + "Startskærmindstillinger" "Deaktiveret af din administrator" "Tillad rotation af startskærmen" "Når telefonen roteres" diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 1b7cd22c31..a345babd5c 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -80,11 +80,11 @@ "Ordner: %1$s" "Widgets" "Hintergründe" - "Stile und Hintergründe" - "Einstellungen für den Startbildschirm" + "Designs und Hintergründe" + "Startbildschirm-Einstellungen" "Von deinem Administrator deaktiviert" "Drehung des Startbildschirms zulassen" - "Bei Drehung des Smartphones" + "Beim Drehen des Smartphones" "App-Benachrichtigungspunkte" "An" "Aus" @@ -93,7 +93,7 @@ "Einstellungen ändern" "App-Benachrichtigungspunkte anzeigen" "Symbol zum Startbildschirm hinzufügen" - "Für neue Apps" + "Bei neuen Apps" "Unbekannt" "Entfernen" "Suchen" diff --git a/res/values-en-rAU/strings.xml b/res/values-en-rAU/strings.xml index 6692370896..0c48b5d2cb 100644 --- a/res/values-en-rAU/strings.xml +++ b/res/values-en-rAU/strings.xml @@ -83,7 +83,7 @@ "Styles & wallpapers" "Home settings" "Disabled by your admin" - "Allow Homescreen rotation" + "Allow Home screen rotation" "When phone is rotated" "Notification dots" "On" diff --git a/res/values-en-rGB/strings.xml b/res/values-en-rGB/strings.xml index 6692370896..0c48b5d2cb 100644 --- a/res/values-en-rGB/strings.xml +++ b/res/values-en-rGB/strings.xml @@ -83,7 +83,7 @@ "Styles & wallpapers" "Home settings" "Disabled by your admin" - "Allow Homescreen rotation" + "Allow Home screen rotation" "When phone is rotated" "Notification dots" "On" diff --git a/res/values-en-rIN/strings.xml b/res/values-en-rIN/strings.xml index 6692370896..0c48b5d2cb 100644 --- a/res/values-en-rIN/strings.xml +++ b/res/values-en-rIN/strings.xml @@ -83,7 +83,7 @@ "Styles & wallpapers" "Home settings" "Disabled by your admin" - "Allow Homescreen rotation" + "Allow Home screen rotation" "When phone is rotated" "Notification dots" "On" diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index ac6ffaa35f..09b1239972 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -85,13 +85,13 @@ "Inhabilitado por el administrador" "Permitir rotación de la pantalla de inicio" "Al girar el teléfono" - "Burbujas de notificación" - "Activadas" + "Puntos de notificación" + "Activados" "Desactivadas" "Se necesita acceso a las notificaciones" - "Para mostrar burbujas de notificación, activa las notificaciones de %1$s" + "Para mostrar puntos de notificación, activa las notificaciones de %1$s" "Cambiar ajustes" - "Mostrar burbujas de notificación" + "Mostrar puntos de notificación" "Añadir icono a la pantalla de inicio" "Para aplicaciones nuevas" "Desconocido" diff --git a/res/values-et/strings.xml b/res/values-et/strings.xml index cea321da27..1e470e15a7 100644 --- a/res/values-et/strings.xml +++ b/res/values-et/strings.xml @@ -27,7 +27,7 @@ "Allalaetud rakendus on turvarežiimis keelatud" "Turvarežiimis on vidinad keelatud" "Otsetee pole saadaval" - "Avaekraan" + "Avakuva" "Kohandatud toimingud" "Vidina valimiseks vajutage ja hoidke seda all." "Topeltpuudutage ja hoidke vidina valimiseks või kohandatud toimingute kasutamiseks." @@ -48,16 +48,16 @@ "Rakenduste loend" "Isiklike rakenduste loend" "Töörakenduste loend" - "Avaekraan" + "Avakuva" "Eemalda" "Desinstalli" "Rakenduse teave" "Installimine" "installi otseteed" "Võimaldab rakendusel lisada otseteid kasutaja sekkumiseta." - "loe avaekraani seadeid ja otseteid" + "avakuva seadete ja otseteede lugemine" "Võimaldab rakendusel lugeda avaekraanil seadeid ja otseteid." - "kirjuta avaekraani seaded ja otseteed" + "avakuva seadete ja otseteede kirjutamine" "Võimaldab rakendusel muuta avaekraanil seadeid ja otseteid." "Rakendusel %1$s pole lubatud helistada" "Probleem vidina laadimisel" @@ -70,8 +70,8 @@ %1$s, %2$d märguanne "Leht %1$d/%2$d" - "Avaekraan %1$d/%2$d" - "Uus avaekraan" + "Avakuva %1$d/%2$d" + "Uus avakuva leht" "Kaust on avatud, %1$d x %2$d" "Puudutage kausta sulgemiseks" "Puudutage ümbernimetamise salvestamiseks" @@ -81,9 +81,9 @@ "Vidinad" "Taustapildid" "Stiilid ja taustapildid" - "Avaekraani seaded" + "Avakuva seaded" "Keelas administraator" - "Luba avaekraani pööramine" + "Luba avakuva pööramine" "Kui telefoni pööratakse" "Märguandetäpid" "Sees" @@ -92,7 +92,7 @@ "Märguandetäppide kuvamiseks lülitage sisse rakenduse %1$s märguanded" "Seadete muutmine" "Kuva märguandetäpid" - "Lisa ikoon avaekraanile" + "Lisa ikoon avakuvasse" "Uute rakenduste puhul" "Teadmata" "Eemalda" @@ -104,7 +104,7 @@ "Teenuse %1$s vidinad" "Vidinate loend" "Vidinate loend on suletud" - "Lisa avaekraanile" + "Lisa avakuvasse" "Teisalda üksus siia" "Üksus lisati avaekraanile" "Üksus eemaldati" diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml index 18af2fb0fc..9ba46c171d 100644 --- a/res/values-eu/strings.xml +++ b/res/values-eu/strings.xml @@ -54,11 +54,11 @@ "Aplikazioaren datuak" "Instalatu" "Instalatu lasterbideak" - "Erabiltzaileak ezer egin gabe lasterbideak gehitzea baimentzen die aplikazioei." + "Erabiltzaileak ezer egin gabe lasterbideak gehitzeko baimena ematen die aplikazioei." "Irakurri hasierako ezarpenak eta lasterbideak" - "Hasierako pantailako ezarpenak eta lasterbideak irakurtzea baimentzen die aplikazioei." + "Hasierako pantailako ezarpenak eta lasterbideak irakurtzeko baimena ematen die aplikazioei." "Idatzi hasierako ezarpenak eta lasterbideak" - "Hasierako pantailako ezarpenak eta lasterbideak aldatzea baimentzen die aplikazioei." + "Hasierako pantailako ezarpenak eta lasterbideak aldatzeko baimena ematen die aplikazioei." "%1$s aplikazioak ez du telefono-deiak egiteko baimenik" "Arazo bat izan da widgeta kargatzean" "Konfigurazioa" @@ -83,7 +83,7 @@ "Estiloak eta horma-paperak" "Hasierako pantailaren ezarpenak" "Administratzaileak desgaitu du" - "Baimendu hasierako pantaila biratzea" + "Eman hasierako pantaila biratzeko baimena" "Telefonoa biratzen denean" "Jakinarazpen-biribiltxoak" "Aktibatuta" @@ -93,7 +93,7 @@ "Aldatu ezarpenak" "Erakutsi jakinarazpen-biribiltxoak" "Gehitu ikonoa hasierako pantailan" - "Aplikazio berrietan" + "Aplikazio berrien kasuan" "Ezezaguna" "Kendu" "Bilatu" diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 7e3cbdc810..926cdb9b1c 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -33,7 +33,7 @@ "برای انتخاب یک ابزارک، دو ضربه سریع بزنید و نگه‌دارید یا از کنش‌های سفارشی استفاده کنید." "%1$d × %2$d" "‏%1$d عرض در %2$d طول" - "برای قرار دادن به‌صورت دستی لمس کنید و بکشید" + "آن را لمس کنید و بکشید تا به‌صورت دستی اضافه شود" "افزودن خودکار" "جستجوی برنامه‌ها" "درحال بارگیری برنامه‌‌ها…" diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml index 9d0e3a0b0c..5ac514d448 100644 --- a/res/values-fr-rCA/strings.xml +++ b/res/values-fr-rCA/strings.xml @@ -51,7 +51,7 @@ "Accueil" "Supprimer" "Désinstaller" - "Détails de l\'appli" + "Détails de l\'application" "Installer" "installer des raccourcis" "Permet à une application d\'ajouter des raccourcis sans l\'intervention de l\'utilisateur." diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 585139c758..7b4bcb1d82 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -81,7 +81,7 @@ "Widgets" "Fonds d\'écran" "Styles et fonds d\'écran" - "Paramètres accueil" + "Paramètres d\'écran d\'accueil" "Désactivé par votre administrateur" "Autoriser la rotation de l\'écran d\'accueil" "Lorsque vous faites pivoter le téléphone" diff --git a/res/values-gl/strings.xml b/res/values-gl/strings.xml index 769586e78a..e115a72624 100644 --- a/res/values-gl/strings.xml +++ b/res/values-gl/strings.xml @@ -80,14 +80,14 @@ "Cartafol: %1$s" "Widgets" "Fondos de pantalla" - "Estilos e fondos de pantalla" - "Configuración da pantalla de Inicio" + "Estilos/fondos de pantalla" + "Axustes de Inicio" "Función desactivada polo administrador" "Permitir xirar a pantalla de inicio" "Ao xirar o teléfono" "Puntos de notificacións" - "Opción activada" - "Opción desactivada" + "Activados" + "Desactivados" "Necesítase acceso ás notificacións" "Para que se mostren os puntos de notificacións, activa as notificacións da aplicación %1$s" "Cambiar configuración" diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml index 5f24b05210..b796140e5e 100644 --- a/res/values-hi/strings.xml +++ b/res/values-hi/strings.xml @@ -22,9 +22,9 @@ "Launcher3" "कार्यस्‍थल" - "एप्‍लिकेशन इंस्‍टॉल नहीं है." - "ऐप्स उपलब्ध नहीं है" - "डाउनलोड किए गए ऐप्स सुरक्षित मोड में अक्षम है" + "ऐप्‍लिकेशन इंस्‍टॉल नहीं है." + "ऐप्लिकेशन उपलब्ध नहीं है" + "डाउनलोड किए गए ऐप्लिकेशन सुरक्षित मोड में अक्षम है" "विजेट सुरक्षित मोड में अक्षम हैं" "शॉर्टकट उपलब्ध नहीं है" "होम स्क्रीन" @@ -78,7 +78,7 @@ "फ़ोल्डर बंद किया गया" "फ़ोल्डर का नाम बदलकर %1$s किया गया" "फ़ोल्डर: %1$s" - "शॉर्टकट" + "विजेट" "वॉलपेपर" "स्टाइल और वॉलपेपर" "होम पेज की सेटिंग" @@ -97,9 +97,9 @@ "अज्ञात" "निकालें" "सर्च करें" - "यह ऐप्स इंस्टॉल नहीं है" + "यह ऐप्लिकेशन इंस्टॉल नहीं है" "इस आइकॉन का ऐप इंस्टॉल नहीं है. आप उसे निकाल सकते हैं या ऐप को खोज कर उसे मैन्युअल रूप से इंस्टॉल कर सकते हैं." - "%1$s डाउनलोड हो रहा है, %2$s पूर्ण" + "%1$s डाउनलोड हो रहा है, %2$s पूरी हुई" "%1$s के इंस्टॉल होने की प्रतीक्षा की जा रही है" "%1$s विजेट" "विजेट की सूची" @@ -132,7 +132,7 @@ "सूचना को खारिज किया गया" "निजी ऐप" "काम से जुड़े ऐप" - "कार्य प्रोफ़ाइल" + "वर्क प्रोफ़ाइल" "काम से जुड़े सभी ऐप्लिकेशन यहां पाएं" "काम से जुड़े हर ऐप्लिकेशन पर एक बैज (निशान) होता है और इन ऐप्लिकेशन की सुरक्षा आपका संगठन करता है. आसानी से इस्तेमाल करने के लिए ऐप्लिकेशन को अपनी होम स्क्रीन पर ले जाएं." "आपका संगठन प्रबंधित कर रहा है" diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml index 0841be0fd1..3054214b5e 100644 --- a/res/values-in/strings.xml +++ b/res/values-in/strings.xml @@ -33,7 +33,7 @@ "Tap dua kalip & tahan untuk mengambil widget atau menggunakan tindakan khusus." "%1$d × %2$d" "lebar %1$d x tinggi %2$d" - "Sentuh & tahan untuk menempatkan secara manual" + "Tap lama untuk menempatkan secara manual" "Tambahkan otomatis" "Telusuri aplikasi" "Memuat aplikasi…" @@ -81,9 +81,9 @@ "Widget" "Wallpaper" "Gaya & wallpaper" - "Setelan layar Utama" + "Setelan layar utama" "Dinonaktifkan oleh admin" - "Izinkan layar Utama diputar" + "Izinkan Layar utama diputar" "Saat ponsel diputar" "Titik notifikasi" "Aktif" diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml index 6f5a4009ee..c25e8795f7 100644 --- a/res/values-iw/strings.xml +++ b/res/values-iw/strings.xml @@ -50,7 +50,7 @@ "רשימת אפליקציות עבודה" "דף הבית" "הסר" - "הסר התקנה" + "להסרת התקנה" "פרטי אפליקציה" "התקנה" "התקן קיצורי דרך" @@ -61,7 +61,7 @@ "מאפשר לאפליקציה לשנות את ההגדרות וקיצורי הדרך בדף הבית." "%1$s אינו רשאי להתקשר" "בעיה בטעינת ווידג\'ט" - "הגדר" + "הגדרה" "זוהי אפליקציית מערכת ולא ניתן להסיר את התקנתה." "תיקיה ללא שם" "%1$s מושבתת" diff --git a/res/values-kk/strings.xml b/res/values-kk/strings.xml index 2e953a6cdd..1cd9045b76 100644 --- a/res/values-kk/strings.xml +++ b/res/values-kk/strings.xml @@ -34,7 +34,7 @@ "%1$d × %2$d" "Ені: %1$d, биіктігі: %2$d" "Қолмен қою үшін басып тұрыңыз" - "Автоматты енгізу" + "Автоматты қосу" "Қолданбаларды іздеу" "Қолданбалар жүктелуде…" "\"%1$s\" сұрауына сәйкес келетін қолданбалар жоқ" diff --git a/res/values-km/strings.xml b/res/values-km/strings.xml index b953ea337b..f4a328df14 100644 --- a/res/values-km/strings.xml +++ b/res/values-km/strings.xml @@ -84,7 +84,7 @@ "ការកំណត់​ទំព័រដើម" "បានបិទដំណើរការដោយអ្នកគ្រប់គ្រងរបស់អ្នក" "អនុញ្ញាតការបងិ្វលអេក្រង់ដើម" - "នៅពេលដែលបង្វិលទូរស័ព្ទរបស់អ្នក" + "នៅពេលដែលបង្វិលទូរសព្ទ" "ស្លាកជូនដំណឹង" "បើក" "បិទ" @@ -104,7 +104,7 @@ "ធាតុ​ក្រាហ្វិក %1$s" "បញ្ជីធាតុ​ក្រាហ្វិក" "បាន​បិទ​បញ្ជីធាតុ​ក្រាហ្វិក" - "បន្ថែមទៅអេក្រង់ដើម" + "បញ្ចូលទៅអេក្រង់ដើម" "ផ្លាស់ធាតុមកទីនេះ" "ធាតុដែលត្រូវបានបន្ថែមទៅអេក្រង់ដើម" "ធាតុដែលបានដកចេញ" diff --git a/res/values-kn/strings.xml b/res/values-kn/strings.xml index 2e96a7ce19..14c830064b 100644 --- a/res/values-kn/strings.xml +++ b/res/values-kn/strings.xml @@ -104,7 +104,7 @@ "%1$s ವಿಜೆಟ್‌ಗಳು" "ವಿಜೆಟ್ ಪಟ್ಟಿ" "ವಿಜೆಟ್ ಪಟ್ಟಿಯನ್ನು ಮುಚ್ಚಲಾಗಿದೆ" - "ಮುಖಪುಟಕ್ಕೆ ಸೇರಿಸು" + "ಮುಖಪುಟಕ್ಕೆ ಸೇರಿಸಿ" "ಐಟಂ ಇಲ್ಲಿಗೆ ಸರಿಸಿ" "ಮುಖಪುಟ ಪರದೆಗೆ ಐಟಂ ಸೇರಿಸಲಾಗಿದೆ" "ಐಟಂ ತೆಗೆದುಹಾಕಲಾಗಿದೆ" diff --git a/res/values-ky/strings.xml b/res/values-ky/strings.xml index 36b63851c5..046a66253e 100644 --- a/res/values-ky/strings.xml +++ b/res/values-ky/strings.xml @@ -33,7 +33,7 @@ "Виджет тандоо үчүн эки жолу таптап, кармап туруңуз же ыңгайлаштырылган аракеттерди колдонуңуз." "%1$d × %2$d" "Туурасы: %1$d, бийиктиги: %2$d" - "Кол менен жайгаштыруу үчүн басып туруп, таштаңыз" + "Кол менен кошуу үчүн кое бербей басып туруңуз" "Автоматтык түрдө кошуу" "Колдонмолорду издөө" "Колдонмолор жүктөлүүдө…" @@ -81,7 +81,7 @@ "Виджеттер" "Тушкагаздар" "Стилдер жана тушкагаздар" - "Башкы беттин жөндөөлөрү" + "Башкы бет жөндөөлөрү" "Администраторуңуз өчүрүп койгон" "Башкы экранды айлантууга уруксат берүү" "Телефон айланганда" diff --git a/res/values-ml/strings.xml b/res/values-ml/strings.xml index e03340bdb1..4362e7cca5 100644 --- a/res/values-ml/strings.xml +++ b/res/values-ml/strings.xml @@ -78,7 +78,7 @@ "ഫോൾഡർ അടച്ചു" "ഫോൾഡറിന്റെ പേര് %1$s എന്നായി മാറ്റി" "ഫോൾഡർ: %1$s" - "വിജറ്റുകൾ" + "വിഡ്ജെറ്റുകൾ" "വാൾപേപ്പർ" "സ്‌റ്റൈലുകളും വാൾപേപ്പറുകളും" "ഹോം ക്രമീകരണം" diff --git a/res/values-mn/strings.xml b/res/values-mn/strings.xml index f52f46171c..ab02ac655c 100644 --- a/res/values-mn/strings.xml +++ b/res/values-mn/strings.xml @@ -104,7 +104,7 @@ "%1$s жижиг хэрэгсэл" "Жижиг хэрэгслийн жагсаалт" "Жижиг хэрэгслийн жагсаалтыг хаасан" - "Нүүр дэлгэц нэмэх" + "Нүүр дэлгэцэд нэмэх" "Энд байршуулах" "Нүүр дэлгэцэнд нэмсэн зүйл" "Арилгасан зүйл" diff --git a/res/values-mr/strings.xml b/res/values-mr/strings.xml index f6eac53997..19c06976b0 100644 --- a/res/values-mr/strings.xml +++ b/res/values-mr/strings.xml @@ -66,8 +66,8 @@ "अनामित फोल्डर" "%1$s अक्षम केला आहे" - %1$sसाठी%2$dसूचना आहेत %1$sसाठी %2$d सूचना आहेत + %1$sसाठी%2$dसूचना आहे "%2$d पैकी %1$d पृष्ठ" "%2$d पैकी %1$d मुख्य स्क्रीन" diff --git a/res/values-my/strings.xml b/res/values-my/strings.xml index 7ae4446d5f..fd1f7d9535 100644 --- a/res/values-my/strings.xml +++ b/res/values-my/strings.xml @@ -50,7 +50,7 @@ "အလုပ်သုံး အက်ပ်စာရင်း" "ပင်မစာမျက်နှာ" "ဖယ်ရှားမည်" - "ဖယ်ထုတ်မည်" + "ဖြုတ်ရန်" "အက်ပ်အချက်အလက်များ" "ထည့်သွင်းရန်" "အတိုကောက်မှတ်သားမှုများအား ထည့်သွင်းခြင်း" @@ -94,7 +94,7 @@ "သတိပေးချက် အစက်များ ပြရန်" "ပင်မစာမျက်နှာသို့ သင်္ကေတပုံ ထည့်ရန်" "အက်ပ်အသစ်များအတွက်" - "မသိရ" + "မသိ" "ဖယ်ရှားရန်" "ရှာဖွေရန်" "အက်ပ်မတပ်ဆင်ရသေးပါ" diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index bc1b45036c..ec30d8c6b2 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -33,7 +33,7 @@ "Dubbeltik en blijf aanraken om een widget toe te voegen of aangepaste acties te gebruiken." "%1$d × %2$d" "%1$d breed en %2$d hoog" - "Tik op een item en houd dit vast om het handmatig te plaatsen" + "Tik en houd vast om handmatig te plaatsen" "Automatisch toevoegen" "Apps zoeken" "Apps laden…" @@ -80,7 +80,7 @@ "Map: %1$s" "Widgets" "Achtergrond" - "Stijlen en achtergronden" + "Stijl en achtergrond" "Instellingen startscherm" "Uitgeschakeld door je beheerder" "Draaien van startscherm toestaan" diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index e33ef7da70..68859605fb 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -106,7 +106,7 @@ "%1$s – widżety" "Lista widgetów" "Lista widgetów zamknięta" - "Dodaj do strony głównej" + "Dodaj do ekranu głównego" "Przenieś element tutaj" "Element został dodany do ekranu głównego" "Element został usunięty" diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml index 68a08a9eb5..071b71e38f 100644 --- a/res/values-pt-rPT/strings.xml +++ b/res/values-pt-rPT/strings.xml @@ -81,7 +81,7 @@ "Widgets" "Imagens de fundo" "Estilos e imagens de fundo" - "Definições da página inicial" + "Definições de início" "Desativada pelo gestor" "Permitir rotação do ecrã principal" "Quando o telemóvel é rodado" diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 1744fa16cc..e88ff18b42 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -33,7 +33,7 @@ "Toque duas vezes e segure para selecionar um widget ou usar ações personalizadas." "%1$d × %2$d" "%1$d de largura por %2$d de altura" - "Toque e mantenha pressionado para posicionar manualmente" + "Toque e mantenha pressionado para mover manualmente" "Adicionar automaticamente" "Apps de pesquisa" "Carregando apps…" @@ -81,7 +81,7 @@ "Widgets" "Planos de fundo" "Estilos e planos de fundo" - "Configurações da tela inicial" + "Config. tela inicial" "Desativado pelo administrador" "Permitir rotação da tela inicial" "Quando o smartphone for girado" diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index a7e8f05844..1251d7e3f8 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -51,7 +51,7 @@ "Ecran de pornire" "Eliminați" "Dezinstalați" - "Informații aplicație" + "Informații despre aplicații" "Instalați" "instalează comenzi rapide" "Permite unei aplicații să adauge comenzi rapide fără intervenția utilizatorului." @@ -82,9 +82,9 @@ "Widgeturi" "Imagini de fundal" "Stiluri și imagini de fundal" - "Setări pentru ecranul de pornire" + "Setări ecran de pornire" "Dezactivată de administrator" - "Permiteți rotirea ecranului de pornire" + "Permite rotirea ecranului de pornire" "Când telefonul este rotit" "Puncte de notificare" "Activate" diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 9030a75eed..34e267da9b 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -82,8 +82,8 @@ "Папка: %1$s" "Виджеты" "Обои" - "Темы и обои" - "Настройки главного экрана" + "Стили и обои" + "Главный экран" "Функция отключена администратором" "Разрешить поворачивать главный экран" "Когда телефон повернут" diff --git a/res/values-si/strings.xml b/res/values-si/strings.xml index 574d3ede01..ef99a59e4e 100644 --- a/res/values-si/strings.xml +++ b/res/values-si/strings.xml @@ -80,8 +80,8 @@ "ෆෝල්ඩරය: %1$s" "විජට්" "වෝල්පේපර" - "විලාස සහ බිතුපත්" - "Home සැකසීම්" + "විලාස සහ වෝල්පේපර" + "නිවසේ සැකසීම්" "ඔබගේ පරිපාලක විසින් අබල කරන ලදී" "මුල් පිටු තිරය කරකැවීමට ඉඩ දෙන්න" "දුරකථනය කරකවන විට" diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml index 77eeab25ec..340a128d2b 100644 --- a/res/values-sk/strings.xml +++ b/res/values-sk/strings.xml @@ -83,7 +83,7 @@ "Miniaplikácie" "Tapety" "Štýly a tapety" - "Nastavenia Home" + "Nastavenia plochy" "Zakázané vaším správcom" "Povoliť otáčanie plochy" "Pri otočení telefónu" diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index f74fde2eb8..4e52592687 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -105,7 +105,7 @@ "Виџети за %1$s" "Листа виџета" "Листа виџета је затворена" - "Додај на почетни екран" + "Додајте на почетни екран" "Премести ставку овде" "Ставка је додата на почетни екран" "Ставка је уклоњена" diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml index 7b84ed3c1d..6f33c4f046 100644 --- a/res/values-sw/strings.xml +++ b/res/values-sw/strings.xml @@ -106,7 +106,7 @@ "Wijeti za %1$s" "Orodha ya wijeti" "Orodha ya wijeti imefungwa" - "Ongeza kwenye skrini ya Kwanza" + "Ongeza kwenye Skrini ya Kwanza" "Hamishia kipengee hapa" "Kipengee kimeongezwa kwenye skrini ya kwanza" "Kipengee kimeondolewa" diff --git a/res/values-ta/strings.xml b/res/values-ta/strings.xml index 47b25816fb..672665e430 100644 --- a/res/values-ta/strings.xml +++ b/res/values-ta/strings.xml @@ -22,9 +22,9 @@ "Launcher3" "பணியிடம்" - "பயன்பாடு நிறுவப்படவில்லை." - "பயன்பாடு இல்லை" - "இறக்கிய பயன்பாடு பாதுகாப்பு முறையில் முடக்கப்பட்டது" + "ஆப்ஸ் நிறுவப்படவில்லை." + "ஆப்ஸ் இல்லை" + "இறக்கிய ஆப்ஸ் பாதுகாப்பு முறையில் முடக்கப்பட்டது" "பாதுகாப்புப் பயன்முறையில் விட்ஜெட்கள் முடக்கப்பட்டுள்ளன" "ஷார்ட்கட் இல்லை" "முகப்புத் திரை" @@ -51,18 +51,18 @@ "முகப்பு" "அகற்று" "நிறுவல் நீக்கு" - "பயன்பாட்டுத் தகவல்" + "ஆப்ஸ் தகவல்" "நிறுவு" "குறுக்குவழிகளை நிறுவுதல்" - "பயனரின் அனுமதி இல்லாமல் குறுக்குவழிகளைச் சேர்க்கப் பயன்பாட்டை அனுமதிக்கிறது." + "பயனரின் அனுமதி இல்லாமல் குறுக்குவழிகளைச் சேர்க்கப் ஆப்ஸை அனுமதிக்கிறது." "முகப்பின் அமைப்பு மற்றும் குறுக்குவழிகளைப் படித்தல்" - "முகப்பில் உள்ள அமைப்பு மற்றும் குறுக்குவழிகளைப் படிக்க பயன்பாட்டை அனுமதிக்கிறது." + "முகப்பில் உள்ள அமைப்பு மற்றும் குறுக்குவழிகளைப் படிக்க ஆப்ஸை அனுமதிக்கிறது." "முகப்பின் அமைப்பு மற்றும் குறுக்குவழிகளை எழுதுதல்" - "முகப்பில் உள்ள அமைப்பு மற்றும் குறுக்குவழிகளை மாற்ற பயன்பாட்டை அனுமதிக்கிறது." + "முகப்பில் உள்ள அமைப்பு மற்றும் குறுக்குவழிகளை மாற்ற ஆப்ஸை அனுமதிக்கிறது." "ஃபோன் அழைப்புகள் செய்ய, %1$s அனுமதிக்கப்படவில்லை" "விட்ஜெட்டை ஏற்றுவதில் சிக்கல்" "அமைவு" - "இது அமைப்பு பயன்பாடு என்பதால் நிறுவல் நீக்கம் செய்ய முடியாது." + "இது அமைப்பு ஆப்ஸ் என்பதால் நிறுவல் நீக்கம் செய்ய முடியாது." "பெயரிடப்படாத கோப்புறை" "%1$s முடக்கப்பட்டது" @@ -78,7 +78,7 @@ "கோப்புறை மூடப்பட்டது" "கோப்புறை %1$s என மறுபெயரிடப்பட்டது" "கோப்புறை: %1$s" - "ஷார்ட்கட்ஸ்" + "விட்ஜெட்கள்" "வால்பேப்பர்கள்" "ஸ்டைல்கள் & வால்பேப்பர்கள்" "முகப்பு அமைப்புகள்" @@ -93,12 +93,12 @@ "அமைப்புகளை மாற்று" "அறிவிப்புப் புள்ளிகளைக் காட்டு" "முகப்புத் திரையில் ஐகானைச் சேர்" - "புதிய பயன்பாடுகளுக்கு" + "புதிய ஆப்ஸை நிறுவும்போது" "தெரியாதது" "அகற்று" "தேடு" - "பயன்பாடு நிறுவப்படவில்லை" - "ஐகானுக்கான பயன்பாடு நிறுவப்படவில்லை. இதை அகற்றலாம் அல்லது பயன்பாட்டைத் தேடி கைமுறையாக நிறுவலாம்." + "ஆப்ஸ் நிறுவப்படவில்லை" + "ஐகானுக்கான ஆப்ஸ் நிறுவப்படவில்லை. இதை அகற்றலாம் அல்லது பயன்பாட்டைத் தேடி கைமுறையாக நிறுவலாம்." "%1$sஐப் பதிவிறக்குகிறது, %2$s முடிந்தது" "%1$sஐ நிறுவுவதற்காகக் காத்திருக்கிறது" "%1$s விட்ஜெட்டுகள்" diff --git a/res/values-te/strings.xml b/res/values-te/strings.xml index 528ce481bd..c8f70fe058 100644 --- a/res/values-te/strings.xml +++ b/res/values-te/strings.xml @@ -80,7 +80,7 @@ "ఫోల్డర్: %1$s" "విడ్జెట్‌లు" "వాల్‌పేపర్‌లు" - "శైలులు & వాల్‌పేపర్‌లు" + "స్ట‌యిల్స్‌ & వాల్‌పేపర్‌లు" "హోమ్ సెట్టింగ్‌లు" "మీ నిర్వాహకులు నిలిపివేసారు" "హోమ్ స్క్రీన్ భ్రమణాన్ని అనుమతించండి" diff --git a/res/values-tl/strings.xml b/res/values-tl/strings.xml index f0c241e9e8..0df94c7104 100644 --- a/res/values-tl/strings.xml +++ b/res/values-tl/strings.xml @@ -98,7 +98,7 @@ "Alisin" "Maghanap" "Hindi naka-install ang app na ito" - "Hindi naka-install ang app para sa icon na ito. Maaari mo itong alisin, o maaari mong hanapin ang app at i-install ito nang manu-mano." + "Hindi naka-install ang app para sa icon na ito. Puwede mo itong alisin, o maaari mong hanapin ang app at i-install ito nang manual." "Dina-download na ang %1$s, tapos na ang %2$s" "Hinihintay nang mag-install ang %1$s" "Mga widget ng %1$s" diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index ad51464a32..13ba701815 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -82,8 +82,8 @@ "Папка %1$s" "Віджети" "Фонові малюнки" - "Стилі й фонові малюнки" - "Налаштування Home" + "Стиль і фон" + "Налаштування головного екрана" "Вимкнув адміністратор" "Дозволити обертання головного екрана" "Коли телефон обертається" @@ -94,7 +94,7 @@ "Щоб показувати значки сповіщень, увімкніть сповіщення в додатку %1$s" "Змінити налаштування" "Показувати значки сповіщень" - "Додати значок на головний екран" + "Додавати значок на головний екран" "Для нових додатків" "Невідомо" "Прибрати" diff --git a/res/values-ur/strings.xml b/res/values-ur/strings.xml index 5d7218d37e..4f776701e5 100644 --- a/res/values-ur/strings.xml +++ b/res/values-ur/strings.xml @@ -33,7 +33,7 @@ "کوئی ویجٹ منتخب کرنے یا حسب ضرورت کاروائیاں استعمال کرنے کیلئے دو بار تھپتھپائیں اور پکڑے رکھیں۔" "%1$d × %2$d" "‏%1$d چوڑا اور ‎%2$d اونچا" - "‏دستی طور پر رکھنے کیلئے ‎& ٹچ کرکے ہولڈ کریں" + "‏دستی طور پر رکھنے کیلئے ‎ٹچ کر کے دبائے رکھیں" "خود کار طور پر شامل کریں" "ایپس تلاش کریں" "ایپس لوڈ کی جا رہی ہیں…" diff --git a/res/values-uz/strings.xml b/res/values-uz/strings.xml index d34a64f93a..69084d7041 100644 --- a/res/values-uz/strings.xml +++ b/res/values-uz/strings.xml @@ -33,7 +33,7 @@ "Ikki marta bosib va bosib turgan holatda vidjetni tanlang yoki maxsus amaldan foydalaning." "%1$d × %2$d" "Eni %1$d, bo‘yi %2$d" - "Qo‘lda joylashtirish uchun bosib turing" + "Joylash uchun bosib turing" "Avtomatik chiqarish" "Ilovalarni qidirish" "Ilovalar yuklanmoqda…" @@ -83,7 +83,7 @@ "Mavzu va fon rasmlari" "Bosh ekran sozlamalari" "Administrator tomonidan o‘chirilgan" - "Asosiy ekranni aylantirishga ruxsat berish" + "Bosh ekranni burishga ruxsat" "Telefon burilganda" "Bildirishnoma belgilari" "Yoniq" @@ -95,7 +95,7 @@ "Bosh ekranga ikonka chiqarish" "Yangi o‘rnatilgan ilovalar ikonkasini bosh ekranga chiqarish" "Noma’lum" - "O‘chirish" + "Olib tashlash" "Qidirish" "Ushbu ilova o‘rnatilmagan" "Ilova o‘rnatilmagan. Belgini o‘chirib tashlashingiz yoki ilovani topib, uni qo‘lda o‘rnatishingiz mumkin." @@ -104,15 +104,15 @@ "%1$s vidjetlari" "Vidjetlar ro‘yxati" "Vidjetlar ro‘yxati yopildi" - "Bosh ekranga qo‘shish" + "Bosh ekranga chiqarish" "Obyektni bu yerga ko‘chirish" "Obyekt bosh ekranga qo‘shildi" "Obyekt o‘chirib tashlandi" "Qaytarish" "Obyektni ko‘chirib o‘tkazish" - "%1$s %2$s katakka ko‘chirib o‘tkazish" - "%1$s-joyga ko‘chirib o‘tkazish" - "Sevimlilarga (%1$s) ko‘chirib o‘tkazish" + "%1$s %2$s katakka olish" + "%1$s-joyga olish" + "Sevimlilarga olish (%1$s)" "Element ko‘chirib o‘tkazildi" "%1$s jildiga qo‘shish" "%1$s ilovasi bor jildga qo‘shish" diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index 174ec7fe95..71decfca68 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -33,7 +33,7 @@ "Nhấn đúp và giữ để chọn tiện ích hoặc sử dụng tác vụ tùy chỉnh." "%1$d × %2$d" "Rộng %1$d x cao %2$d" - "Chạm và giữ để đặt theo cách thủ công" + "Chạm và giữ để thêm theo cách thủ công" "Tự động thêm" "Tìm kiếm ứng dụng" "Đang tải ứng dụng…" @@ -78,7 +78,7 @@ "Đã đóng thư mục" "Đã đổi tên thư mục thành %1$s" "Thư mục: %1$s" - "Tiện ích con" + "Tiện ích" "Hình nền" "Kiểu và hình nền" "Cài đặt màn hình chính" diff --git a/res/values-zh-rHK/strings.xml b/res/values-zh-rHK/strings.xml index de0fa89a0c..e7377440c1 100644 --- a/res/values-zh-rHK/strings.xml +++ b/res/values-zh-rHK/strings.xml @@ -81,7 +81,7 @@ "小工具" "桌布" "樣式和桌布" - "主螢幕設定" + "主畫面設定" "已由您的管理員停用" "允許主畫面旋轉" "當手機旋轉時" diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 4d37d721f7..e971b69f1f 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -33,7 +33,7 @@ "輕觸兩下並按住小工具即可選取,你也可以使用自訂動作。" "%1$d × %2$d" "寬度為 %1$d,高度為 %2$d" - "按住即可手動放置" + "按住圖示即可手動新增" "自動新增" "搜尋應用程式" "正在載入應用程式…" @@ -81,7 +81,7 @@ "小工具" "桌布" "樣式和桌布" - "Home 設定" + "主螢幕設定" "已由你的管理員停用" "允許旋轉主螢幕" "當手機旋轉時" From 3369d7308f1504547bcadcafd41868d29358a034 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 28 May 2019 19:15:04 -0700 Subject: [PATCH 33/47] Ignoring testPressHomeOnAllAppsContextMenu for now as it flakes Bug: 132460627 Change-Id: I2af5bba289781a122cf9253833915b0e8cddd79c --- tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index 4e4ba73296..4f8b87c519 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -42,6 +42,7 @@ import com.android.launcher3.widget.WidgetsFullSheet; import com.android.launcher3.widget.WidgetsRecyclerView; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -105,6 +106,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } @Test + @Ignore public void testPressHomeOnAllAppsContextMenu() throws Exception { mLauncher.getWorkspace().switchToAllApps().getAppIcon("TestActivity7").openMenu(); mLauncher.pressHome(); From 51f220dac29f3b988b668893f29f78c4c9a33473 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 29 May 2019 11:05:30 -0700 Subject: [PATCH 34/47] Fixing ANR when loader task could run while helding the lock object During AppWidgetRestoredReceiver, we call forceReload from worker thread which in turn starts the loader while holding mLock. This causes other loader calls on UI thread to cause ANR Bug: 133651528 Change-Id: Iabf983c4319bd6e6ef88e74fe6076289294454f9 --- src/com/android/launcher3/LauncherModel.java | 24 +++++++++----------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index e7b4ff4fed..ac392a6e65 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -165,17 +165,6 @@ public class LauncherModel extends BroadcastReceiver mBgAllAppsList = new AllAppsList(iconCache, appFilter); } - /** Runs the specified runnable immediately if called from the worker thread, otherwise it is - * posted on the worker thread handler. */ - private static void runOnWorkerThread(Runnable r) { - if (sWorkerThread.getThreadId() == Process.myTid()) { - r.run(); - } else { - // If we are not on the worker thread, then post to the worker handler - sWorker.post(r); - } - } - public void setPackageState(PackageInstallInfo installInfo) { enqueueModelUpdateTask(new PackageInstallStateChangedTask(installInfo)); } @@ -400,7 +389,10 @@ public class LauncherModel extends BroadcastReceiver synchronized (mLock) { stopLoader(); mLoaderTask = new LoaderTask(mApp, mBgAllAppsList, sBgDataModel, results); - runOnWorkerThread(mLoaderTask); + + // Always post the loader task, instead of running directly (even on same thread) so + // that we exit any nested synchronized blocks + sWorker.post(mLoaderTask); } } @@ -505,7 +497,13 @@ public class LauncherModel extends BroadcastReceiver public void enqueueModelUpdateTask(ModelUpdateTask task) { task.init(mApp, this, sBgDataModel, mBgAllAppsList, mUiExecutor); - runOnWorkerThread(task); + + if (sWorkerThread.getThreadId() == Process.myTid()) { + task.run(); + } else { + // If we are not on the worker thread, then post to the worker handler + sWorker.post(task); + } } /** From 7aa9000642acc2f6d05e7a85d2596cdb9b63b1ab Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 29 May 2019 11:41:46 -0700 Subject: [PATCH 35/47] Hide original icon immediately for app close. Bug: 123900446 Change-Id: I46e54da39e3bf4fe79e0583b52c568c702a9f16a --- src/com/android/launcher3/views/FloatingIconView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 03cbb21437..95b37bdaf1 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -641,6 +641,10 @@ public class FloatingIconView extends View implements view.setVisibility(VISIBLE); originalView.setVisibility(INVISIBLE); }; + if (!isOpening) { + // Hide immediately since the floating view starts at a different location. + originalView.setVisibility(INVISIBLE); + } CancellationSignal loadIconSignal = view.mLoadIconSignal; new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> { view.getIcon(originalView, (ItemInfo) originalView.getTag(), isOpening, From 8296c6132d0eb2d4faa20121e89247040a34c90d Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 29 May 2019 12:07:55 -0700 Subject: [PATCH 36/47] Enabling tests for pausing apps Bug: 123892607 Change-Id: I1fa90f6dd4312b9311b8e706b2119dc04e3e2389 --- tests/Android.mk | 2 ++ tests/res/raw/aardwolf_dummy_app.apk | Bin 83296 -> 75762 bytes 2 files changed, 2 insertions(+) diff --git a/tests/Android.mk b/tests/Android.mk index 978209febf..0c412415c2 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -69,3 +69,5 @@ LOCAL_PACKAGE_NAME := Launcher3Tests LOCAL_INSTRUMENTATION_FOR := Launcher3 include $(BUILD_PACKAGE) + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tests/res/raw/aardwolf_dummy_app.apk b/tests/res/raw/aardwolf_dummy_app.apk index 39fb368ca9fe16e9d641ea800fb8bad5499f7f22..c10732d81b6cce78440a53174a96605858cfe75c 100644 GIT binary patch delta 5620 zcmd^@_fwP2yT%gPRIpW0)Z$sL-ES-z;6&6l}Fr3t#>=|+W?0^LihDR%8bAZhHhC7 zWlul8=J_e&p&~CkrzYnn`x$3;Alw!h%*AFK$lJZ=Z+%A{3fYKA?UuC8xVZa@KLBD+ z`aOcFQon^84p|6Cvv<2Kr-1M9ns?iG9tTx-+b+u-rd+5*Wd;$;RQ9m-aj4PyIczob zB=VUAvRuX-hZSZ;^RLQp#%-DDE!whIcX;dm85cUIpgj(U?LP~vb_m~>+PHkYH&!)Z z*}`3hu}l8L=h~yih0NB???~)0C%JyMwj6zYR)L9(nT-oTn|=3sU=5-*53Rw#n!9U_ zN{(B559O1M;La>WpHkb)8Yh2Z6r?J2kx`Go*-=+1WrD?=Bs~qlVIKDQHvP4Q-?DW3 zEVuJA1h$^2GnIB@ze1PTyxRt=Z4_BnOuik@Tlf0a$ZexVyT-0pA@N|G+=1qPn`C~>+cWl148EYgqWVD z`G?g#NjuN5EEC7EkyN1}6O$0j99k6Uv*QRc@nF7?vi`H+ht+h0S! zPF-Jgx2FWsJ$Z{rjv-Dun*^EX5%l`J(bsv|OB2q8{=yev8?_b1Fv0um=m#rI{mN>v zIwRhR|6003o4VNyZg%OPG9jw!rnorj(~sgdCxLKY5e?$w?e>PdJIf-!)9ezDo8E5niIlMvr7BnAi2efNhqo!l*Cfp%;2jw(6=5~^Q@e84st(yCE6hhv z*Ab<*)W(BK8iU>DEOzso{*I?-yC~!94*@&Ye|(D%Ql=hPUW<>|4a~e(BTWx5^P8E7 zIKF==*Q)Y5gEd8SL%z~lL=-@7asZR|=$D`iQ;F*DaB546FAt11k86Sn|> zOmGr4kOfOY1Y|*5$0a>g;lS5tP2tm<=yet3xedYCe1wGT+Aq{LXpI;z=L&@1fIj3#e%xWBdF-?7Sr}}fqK6#EZe*f=D+tV_WG^#G^)ccDvD;C>lH-z z>NC9A6U)omlDA3~{g%v`?g9XiKG3QWSy=LsDt^wDBHgF40U67gIc$4Tm9B@UB4`(-f=|TZQ6&n%g7BAahE(cg5(A*{511ly`xpZMw~6EeHL%eQC9AE{B2L>D&{*^&3sWl?x37DQ%843-8x5Xb&5mSqlQ<) z2`TgIOBhiV5fw*()E0hvOj_E`BrBdPh%J5j7uUiGqihmsZ`w$xI6_J>wjjtJnn-6K zg?`4pkgGh8Xt2t1kWX4!Oga-zku|7XpH}I~Dlrr|){3o?uvpFCl1KL2h=|JB7F#C@ z*S{8cGVg>C*O9Q_upe%`v+`u6>}pnXyTgC4Adc_dw@tlHrSp#q=z#|mMXLVqnYKG{ z{t5n?DEH`Hb?JyTMV@5X)3eaH$Wd%7F=Hc4wy8N8mh|Tu{1?&SW9{wu8$@BCzlhfN zkpLkebboXX3_!5xm)oKmEr~IFBYZa(Uct*r^bx>0n`iSWkf@mxs=pwusJNYHIAJ6^ zm~=fl={BvROkC9TCY~EAJ}~|({8b7$7)7Lv-x~4NKb7GRZ@y(Rr<+YHlJa?FOHz&FXwC5M;S9bIM$4J`^2IXzNTQSCK5vUGqv;q zJ)uhcKK?v$?dYIb!aKn!gIM-2NK&!Ti~iufSxuD2r5Nyh+2f}aFln}U&=X>BnOi2xo@b12(JxEVoH>I5kL)Kh3g*>1QjBWETSUOaz zml9GEEryhwdl99sU2aUrJKv6^d?Fb~#y={)tEd|i*rZY(RcqE~IsFjvY6M(k<1u78 zwG$#3a4UxmfqP9{{_vFYIozA-qvZnAApEP&VzFK^DVKs%;$z%S*YF=mQrx632p6rgadF$r`TSS=8Rm1t?ZC=g4>3(}P zxl9E&ON^X%ok-3oq^VCxxeVaX7NCDv*Uf2Ju?n$9#Tj{dWWS!=K6E!X7_R#Q&;IkV zrb!zcb?c-7-eptStn^NN%>J~8I(_1;n|-F_Q0Esh##f}5?UTEXnft|BWh|tTwO;c^ zEq<{)6FGWV;cDZn7Y18lWJ~J%<)+5i{hb4_)^3|FFWupzd}#g{gF{+=Gaiq8!95p( zZv136ei{W zp7^TFq78!F){5GWm`sL7h7#lsd(-%V+CyUEDDp^xnyiOZ?e6Q{&X%@cdA__6$-cx^ z$sgB3ZxOuWa2K)i`rML`eKkb$o=`TFP*O#$|1NN!Ku<$_NiDnqFJV%9WK=qadPBNG zOiZFmN=ynZBO@LO*^riz7L%0F7`XZ}bMb`@RXDHj8ISH*UX=^{9(K=$?!FTw( zr|OH@wdH`MxP&P33NdyuahHyvsp=Kf8p_2MOKMfOEsxv*&6;8pG|QImeB*W)^MUY` z4~_ebWx7AbGnOV{wikB%0M~q|LTwnm0`x_zzYqBqm>hekWR61+N z5*nU6pT6wfEUUVGx|SVD?s{kfq56Z~VUe`|isNlsn3lt!Xe2V&Mw*+WL##6Li^;>z zvzlB%~ofYHyMyx?0s|{4hYhFSM9BD@PPTS1@Rc@9J{ApwBolahsd> zkJ=IU%gv!Z_ZX0#-XSp4*9%A$Y`w^AE6MGfLmV02uYZ9qL?dwZQXS^}Z@k^eR#>W^ zq}s{RveC4&+jv}VZuAO{f)B8VyQMc3Q}GeD#uJy_ZJCg?u`+x0-0czbyuZ30F+(CCf_+en{w z@%4Iqf})5`D;T9jm~zE2#-Uu;)U;%VCEY+1 zI(Z2>@#~Iv{JoTS=f34>j|kj(hJ7+B>fv4AjR+gk1H(6_w)GFBt5kTrw?S|ETi-<( z4orC2$aPbpcB6j{ZzgnoPc#+uo@CQb^%GTkcJ$P@O|k$EFEw*~!t~>ar+b6gZN*$R zWYk3K8n?YMbntZ0+{Y@;Yo4boHzw(`cT{o3H;I_8E+4v*}wgglE_tg!3MMn40&FB5WAdt&6tj79d|3Ne62**?+YXv7G61 z)B~F++@DRN$L@GQ%cLcjM(r4dS21aQ3)c~$0=Kmv!SM_I+56jF;arz$OMGal5O=4?m{YQ>XdzApLh4)`Hk@H|v8y zYcrF`1v;sn#_*xbUc5&$1HpFpqYTixn>J6da)9N19 zk+o;9P!B3anD6E8Y1>(d6dYSzatP0IODp&0OuRvl>dZ{pfpLz87dVi!BXk(Rcr~XH8XoUzFYxw0lmg zC5A6H<{4`5WwEaZJP81<>?4}}jU&yB>2!FiH(FA?Oei1nD)jvHQp|qEw)Cx`Kw+Km zI*RsJF~#EPX>bQiQ6-yEs_Am*H2k@gSG*`+dcI^tq(y?3R}mk^@}A zgclOMK7LGvW|OcRe)6$Igdbv-7h#a`=`a^sDy3udi+hJ8aoS1D)x3u~rJKey&|0q6 zJXNXW)k+`jn5x0vxv_Ay;1%Xf+5T5P65?K0U5r38P;?v#{)8VC35FiC;9==$DlnW5N7dt-0HB?9h%|g(T{LwnYY1U~fe9E>La=X{&LWslzq{lSB zCG!_sd|U6Slh|FNv2+dPWaRpiPO78u<*bdm`r_;XSd(a>ASD~v?MaA#j!$oExx~8i zNF|oEI$$@vzLdm3Q=Kex{kzE3KjdrJrwA0Kfw<;GZV;w^zLpQy7u^?VAbD zjW%!W0lj&4`$l*`0D$ABhvb!)5zI=JqPFTAxmkYMTyt$!Mo)Ny_Kf}Z2JyU=_ zB5QpG{2u~swZ4vlpRt>H+ZSlJe2U& zvA*yw=d${Mi%xnJB;LqXk@UsQfYx~Z1*28T*r zIJL9!(uVE)HVLG}P~Z?5=mB<1w0xyubt%iwSUeFoIe0+Pp~py@*c=PI#(2YjO$Zw= zT%tVh$*ENZ@|s;;@(V$(3V~;$r$aBB;H?Dph92cd4yB!VcAEF5UzQaJ%y?2iqUkOa z$$cUH#>7F0GXoK@!eiAHDn6|17xl<6HraC_ZGR2EHbn=4Y5D;fNb_~P&u1}%1tI;T zs+VlWFLGHUMi*fo*q@?6-v96Z1OMZ{2jKc`C7>D}(Z5$oSXosdjO9Pab^w6nFGc@0 z7!fv76)1}bA_ZaxNq}tF6;+@hFc3?w27GvHm>f%?2IP)^c8!mXR0C47{Ck`s001ce y-Q%ADCAMA-$i@6`NpcfG^}iwvuqSFj9+v-^xoQ4a03!odN*%~Y5Xbcw?f(L*%X~%v delta 7655 zcmeHMbx>SimhQ$0?vTbkXrsX;Xz)M>f)he;cYi<<+^vD&!Cgau1Of!t1b2c3NJHbn zS@N5it^I9HZOtFEQ?<2otIoUkU3vBDd*?gfx$hp1qOC-t2Q`3oF#uSrBZ(}jB>R5(NJL*-9WR-hYT>SLv+|VmaU3Z5J7JK3JLqx z%Fv>|pM?Gq=xC1t$Cmfz`}2wJYYs zdmmI5=shDaT$KIk+W=x|Ea@)qyCHdhhBhLW%_X+Ft-J^d?|!N@xgc_r=k!QagNp_b z`UrShb4-z9wC@dNLWCsTS*#mzFq#%L|_I4!& zCODfAC!W|IGu?3FEbka>6g7!fA+~ab(UhyXLzHuL9P8i$=mH-#{DY~R!DMn5XqhM2 z8Uh~M=FBPbMza|n5*9a@2qNbVUKj4UlQKEKz6B3K%FEb6&L)Lhv`m-OyL%$7Qyiv)ZxbP(Dg+)=iK*Xbex507n6XRl9?mAX@eE2GJH}a52P||)Y&BRdB-}=b z*6fXA>l^n9=Q+{uYn;y{LJDA^`{DkIr5sO~Lgmw*+RDq2rBgg(3Ut{*w#!@e0S(@g zQ{B3&j%!a6tA*ZQUNzW;4i0dSHFg;C8}W3HdR;XD0k4kAzU$)Yd77VG7Lk|V?qxw>ErLYVPYuG#J9Nb zVBtoGAC9yYfHiK;vX_tikU!UH*RHpZhZ(QtT94NhJ6pV*uP$CaRL^lrj@wjit)?A@ zfM`L-cFkxdC)$`IIC%i^tP*1%z>ryiy?zh;8HaXtw-RGzE%3F!T;L$(1+K-t=Fs(o zrxqkW!5?Lp7?25?eH81U^H^#oqKUlHr6-d*JL!*#5_H0=;s>?-S)bcKI=4!`PRX1J z3-;s=A9NC-L5O8yd!kytYC$uXMectpiBx)u|Kud>GFHl;HP|WVweQCd$3V}%c!SJO zrQ<=md3D!3h&zA+K=yUh+fA5!+CTQg)Vv+_oZL2w|m2 z=Yf+f!gJBfH&(ij%kdj6x;DD`D@Q#C5htCFxvDO%9iOTFPy9nMSB||c<75^6gU%l7 z2vPsRy6w-q7f-)hYv(lex&a~1cup@roV6c0&hPrZ{NOmfnA&~Wup!helqfrIKj_0Q`S~P+h#wtG<BNqA6U@?XzFH z>c3BQAWel^XKhZWdM7+&H{~JUNhZ@z;3=$?k82WtMwP@L)!c0#d60cBeUSHm;^ZE1Nqs$;x$~Ihk-` zjE=XpnxsqmY>3xwouG0W?`rqr$4bA!(F9=H9r>m2Y^sU4X?! z1uv^9KUaAd<7;lXXSkHV@YG6X^t&if}Y{(JJh; zrJX%=Z=sfVEq?xvC!_^TNNuDbJEZpG<|eT*=hGK;+pemH9b!i>gf(H~D}b!FyK096 zZrw3Ody2D4_2XkjAlB(h6HbJlV*fR%o~Ms@eZQ z>gSY1FCEuv>wMcaX_b^6=IqF}RHgBwX;Tc&s?6B#FocX;%LFR=6$ABYL-|F?#Q{A7 z^^1;F-{lcznN>&S5Q>HnC8fHe4C8nH@|VUo9|m=!u_n;Op(%}*fiSQ~=%`fF==n?TtL^eUIiJ~+DwY3O@@WbzxElFZ zx6`q6A{{sw*a~Fy)j0E@V`2$&VA0uHe!10XwRYQr=!xOM(4(Zi<);0IzbT^$!q2;p z3IeIaHAukT!00svV})MaFzWUz4hswP9lK2PK8Mf!J=6o8tV5*t?b+?=u~wb2+(g+n zEs8cMHeRyckE99@LYsZ#6L6$@q(UrkMB2%(Gl++ddnU7L)QO1od7yBf{s2nkh)ZPo zIy^BLWdScU+PpJ@&;^sd5}ui3N6$85XKig}V{Kz$2AElzld_E1+1r>|n4xUo>smeJ zHY<^;VY4IxEB~Y+~2yiZ^py z^ZZO*Z|4?IK^8n5TL(b4*(WH4u^oKsdes6W_$ z6hUb>`BlerDC+9xwML^=wP;IC>Ca=y)OSCe*p5F4@bU9HUcDGQ8x#A5i0*$~|CKHc2l$$dz4d!>F(&7alSACK3=|^qRGRx)=2@ z5(?myg9Vt@fQGAHTotmt=|D(UOVddAhVzCc#d%IEn&lz8sl@}ao%ZXK;jSrzRdUN7 z5B^m?0g(kg_Y14xim|uvimfvRAIJ;bl(ziPY<(5?gJaI5Z^K0N*TMTrJ;&GA7kY=e zPrNT#Ik#(gNiM6f9&^=XXRKy?tKohc{NNgJ6`f9ApN|#R-}8f1muFWsO87jFoLPV8 zc1kuWCeq^;PAm1?vV9Fst25d<+zQamv-^m*Y<11!wbGQ|B6yq6qa5~_DuL&!&7)EP zi`ElM?9hH?pNWV?+w!_h;kNqcW)1AUs#(bLMs)J-6NrY7Qm8XA>}LT--{6NO1*0xG$AdG@QoE3&!!G+STC{BX!<)?zZhfZ+3L4YN*e*%!n!Pm_Kbq-a8dSCLA2J!$;+})GuXu+j zT3o}ss|mI>w-%2Mv@WwSgL}ch!wVOYjcOzs2-NaBywJb}D8csuW2ZW0N{p2w)@uUV zy`E=iu!erxa7Jx3bfWkqOG-tl*Uza#d4cPBgkxQ+(|o}Ec>j9aX8*MXZqPVR*-W28 zgNo{v#7a(2906w}NbalhUJhndhm+quvsjGs#Kc6DQ%~ft-mqRw64EW7nlD7$<9%o1 z+oha`yOw)tPkUFY z`ANE4`7UZ0Sy?vY#HTp-{ZmRbnSxkqdv~$t{c7wNi$3gnRJ`VHpK@qTj1W^Z7kbPJ zWbjvQ6;xsOIxqA<`f~*px9f{}bY_MMW#X`VCwtYQIJG1I??wx^*Is|Cu^P#VtD{Gq(-N4i!NupOOVwC0qSop|gW2^h=hX5wCcd z{wJ3$Jg-9<^|NP&YG#6Pa$&~%F}xDB53~Fygms2pU;W&i+Yy;vs{X`~vliD_rFt{L zdP@_tawhp6;2(lbRfWwl*}v3blQ1ayaCEL_sPkZ-vr*rx_mVJ7{RB_#jB=hXQjsUJ zY@PUx^jhGYsqDbSYI5iNq^x&#{N&llX(lQVlX516wtsQaZ$>+Q9%SRtLLS=9aOfTw zMUf=)@WT)r&A_x{)k|BgM@%<~9uFQ|45<*@J8+!h2e1;nXd1nNb> zKMHtuB}Pa$1b#wNnhgXU#D(JLh7!Glv{{Tu$zluG5Y~?-Q zkS;Ob+UO=78)oK{@t_m3>+>UF?3Q)-T9?y2SD@d1 zpO-9b+|0C%N=!3}@UlFS5XfHOMKA0-IuFZKN}Y!~mlw)>rNp@TqXcirrF zh6)CO=s4#NsQvzcR(Z47p9D1NF~l|#sX%!n+5{a+%2fMGiV4}2{Z&XJ{J`Q zjDms<`nbGBiayzs4KIU$%OHGwP*FZnekfE}kl%m;Pe2sP4;B2&E!>G3+zcRnBL!#3 zXwZD}MdSIO-)OOR(@)MsPwCV5$6`CMIUlDA&*fZc1buO>F`VL%GYzp!;K+ZcLV0@p z#wq)Ri||7Er8oIpg)la|Cpe8SeUm9=mmWScbvJyiUqad6R5lfj#xOgJKS zQUyreLvp%(a_uVm$Km(qH}L@Rvqlly;9oLoxcePMpWhkOlzO7Eu2&ORP7AOh;43$`pc{q(HmN+ONzfI+cPI`3u_d4<->w2f{z8;j}~>erSz{x z_E%Lr1fLI6ADA+}XM8f|PLA%|Js^deuL)=jgxOVe=Y>QLE}?ag&YQual~BN_?}D$O z!RJsK4AiGI_-N#4q$uZb%QvzY?l$5(HW_-B5n{p|#?avY-{VYZ!5z@xwxGW|Coedo zAQ%pJrUt`tLjKFQpr!*e0!mYt`~yo>^736i_40J*ErjW~OkdGlyEU7B&UT4&P>2W% z1X5ENrC}+RL}=Qkd-G)SFbJ3@!XB7zusuGP>R8KSkQ{TsDa~4Y-#9U&dvW8w5=_!m zCkD|yPKcc#rpy&ju~4uGdjFCh#cJH^Uh<21SqWREPr=hHg8`!bV?Z)_Qg>#XYk-Wb zDHd5*pRn|Y3m%l{z53S6o?5DTL)ZP?npRoAt9JL<3yiE)jvL)VoZ%lkgx>CNn-TXG z@EukZENItCxb!R)$Z=GfUGOC8>FJnK0!o(RUw>}v7yH`Ri7uORAd%=$;~%w5W+gW2 z;6vLno;&@$UI|U9VitJjhI{9?cN_uX?IYXnGT1)~oRz8&hj@e~ix1*28aa-!G+>7R@1Y9#BUJrOb3R+^?Eg)3nE&@R=gu1$|E)Ry)|~%) znnQW#y0^Etz+DCUTl>Fj4wcBu(yeSDczE77t=J`DV=yYb`A2o-l2FZd@6xOeutiuy zo{F&AN#!{`;UIsYV)!I&Uoy$3vC3HGg+A#3qZ4&I<~&UZ?Aw<@&gC2lRMJ<%wV?0O z^v3{?3-aK>D|Xd8fn$OF_X*A zJiOk)CGISffbER8N@R1HC$n|R5@yFm*oFhKs(r~@QkDAUMA*dz{>s@-o=FDCox;wE z48nC1TYH;EDid>6=7r$@syY8eG=M+D@h?Y1?9XugqiFnFbN-qh6aAq%efYo00|I%y zbba(cZI1rlhUp*ZD?~Y?Yw~9V%cEld=kXN0p9L&J{rhy_kHdkxYzXHs@9@{_2^O4& z75osj3I_~lzy;I7Jy^jUU=DaLD_94`3m=}x3T8?&yG4i7uz?Aw|MQnA1_(s>r{|Or vz#p@L8PWgv>j8IW1CxPK;Gt|_X7oSygYfFR9+W`}cn=$x6$2#mJ4gKwmDMC% From b06f9f8c78e144bb630114063041ff7a4e78cc23 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 29 May 2019 13:05:06 -0700 Subject: [PATCH 37/47] Increasing wait time after mode switch. This is temporary. Apparently, it takes time for Sys UI to update after the mode switch. Change-Id: I434b86af15d9987a448682684c790d89acab85dc --- .../src/com/android/quickstep/NavigationModeSwitchRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index e552f56ba6..c3e46ea110 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -133,7 +133,7 @@ public class NavigationModeSwitchRule implements TestRule { for (int i = 0; i != 100; ++i) { if (mLauncher.getNavigationModel() == expectedMode) { - Thread.sleep(1000); + Thread.sleep(5000); return; } Thread.sleep(100); From 17f9d57ac7ba0d53cd33f0f7a387f2c6f1248aac Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 29 May 2019 14:10:28 -0700 Subject: [PATCH 38/47] Add debug tracing for a lab-only flake This time, Launcher doesn't send a completion event upon switching from Home to all apps. Bug: 133867119 Change-Id: I3738cf10a14ea288df2dfda387aafda022beb349 --- .../launcher3/compat/AccessibilityManagerCompat.java | 3 +++ src/com/android/launcher3/testing/TestProtocol.java | 1 + .../touch/AbstractStateChangeTouchController.java | 11 +++++++++++ src/com/android/launcher3/touch/SwipeDetector.java | 6 ++++++ tests/tapl/com/android/launcher3/tapl/Workspace.java | 2 ++ 5 files changed, 23 insertions(+) diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index 81c95cbdd4..43ae65175f 100644 --- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java +++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java @@ -53,6 +53,9 @@ public class AccessibilityManagerCompat { } public static void sendStateEventToTest(Context context, int stateOrdinal) { + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, "sendStateEventToTest"); + } final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context); if (accessibilityManager == null) return; diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index a678ef248d..aff7861a8c 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -68,6 +68,7 @@ public final class TestProtocol { public static boolean sDebugTracing = false; 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 NO_ALLAPPS_EVENT_TAG = "b/133867119"; public static final String NO_DRAG_TAG = "b/133009122"; public static final String NO_START_TAG = "b/132900132"; } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 35fc8731f3..9703aa6267 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -43,6 +43,7 @@ import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.compat.AccessibilityManagerCompat; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; @@ -363,6 +364,9 @@ public abstract class AbstractStateChangeTouchController @Override public void onDragEnd(float velocity, boolean fling) { + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onDragEnd"); + } final int logAction = fling ? Touch.FLING : Touch.SWIPE; boolean blockedFling = fling && mFlingBlockCheck.isBlocked(); @@ -499,6 +503,9 @@ public abstract class AbstractStateChangeTouchController } protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) { + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onSwipeInteractionCompleted 1"); + } if (mAtomicComponentsController != null) { mAtomicComponentsController.getAnimationPlayer().end(); mAtomicComponentsController = null; @@ -517,6 +524,10 @@ public abstract class AbstractStateChangeTouchController } mLauncher.getStateManager().goToState(targetState, false /* animated */); + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.e( + TestProtocol.NO_ALLAPPS_EVENT_TAG, "onSwipeInteractionCompleted 2"); + } AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal); } } diff --git a/src/com/android/launcher3/touch/SwipeDetector.java b/src/com/android/launcher3/touch/SwipeDetector.java index 4e3dcf8b8d..4616e58fec 100644 --- a/src/com/android/launcher3/touch/SwipeDetector.java +++ b/src/com/android/launcher3/touch/SwipeDetector.java @@ -25,6 +25,7 @@ import android.view.VelocityTracker; import android.view.ViewConfiguration; import com.android.launcher3.Utilities; +import com.android.launcher3.testing.TestProtocol; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; @@ -174,6 +175,11 @@ public class SwipeDetector { } mState = newState; + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, + "setState: " + newState + " @ " + android.util.Log.getStackTraceString( + new Throwable())); + } } public boolean isDraggingOrSettling() { diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java index 7dcc426b9d..33754c125b 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -66,6 +66,7 @@ public final class Workspace extends Home { "switchToAllApps: swipeHeight = " + swipeHeight + ", slop = " + mLauncher.getTouchSlop()); + mLauncher.getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING); mLauncher.swipeToState( start.x, start.y, @@ -73,6 +74,7 @@ public final class Workspace extends Home { start.y - swipeHeight - mLauncher.getTouchSlop(), 60, ALL_APPS_STATE_ORDINAL); + mLauncher.getTestInfo(TestProtocol.REQUEST_DISABLE_DEBUG_TRACING); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( "swiped to all apps")) { From 928fc8d1e26b0af9cec86dd12237bed808c19dc2 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 29 May 2019 14:19:16 -0700 Subject: [PATCH 39/47] Fix bug where shape reveal progress gets started too early. * This caused the shape to not match the window size on app close. Bug: 123900446 Change-Id: Iaa2c06f19c535f72ae4c080b4bc847d336f1a77d --- .../com/android/quickstep/WindowTransformSwipeHandler.java | 6 ++---- src/com/android/launcher3/views/FloatingIconView.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index ca966c8fdb..081682288d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1134,12 +1134,10 @@ public class WindowTransformSwipeHandler // FolderIconView can be seen morphing into the icon shape. final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f; anim.addOnUpdateListener((currentRect, progress) -> { - float interpolatedProgress = Interpolators.ACCEL_1_5.getInterpolation(progress); - homeAnim.setPlayFraction(progress); - float windowAlpha = Utilities.mapToRange(interpolatedProgress, 0, - windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR); + float windowAlpha = Math.max(0, Utilities.mapToRange(progress, 0, + windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR)); mTransformParams.setProgress(progress) .setCurrentRectAndTargetAlpha(currentRect, windowAlpha); mClipAnimationHelper.applyTransform(targetSet, mTransformParams, diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 03cbb21437..cf0ee62c7d 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -229,7 +229,7 @@ public class FloatingIconView extends View implements mTaskCornerRadius = cornerRadius / scale; if (mIsAdaptiveIcon) { - if (!isOpening && shapeRevealProgress >= 0) { + if (!isOpening && progress >= shapeProgressStart) { if (mRevealAnimator == null) { mRevealAnimator = (ValueAnimator) IconShape.getShape().createRevealAnimator( this, mStartRevealRect, mOutline, mTaskCornerRadius, !isOpening); From c69d1ffd923e37166cc3dadf8938dc8a8b38e0c7 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 28 May 2019 13:03:02 -0700 Subject: [PATCH 40/47] Add staggered springs animation when swiping up to home. Bug: 123900446 Change-Id: I275e34c6dca5b026f272ab216b18651c0df27bc4 --- .../res/values/dimens.xml | 1 + .../LauncherActivityControllerHelper.java | 16 +- .../WindowTransformSwipeHandler.java | 1 + .../util/StaggeredWorkspaceAnim.java | 154 ++++++++++++++++++ .../quickstep/ActivityControlHelper.java | 4 + .../launcher3/anim/SpringObjectAnimator.java | 12 +- 6 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml index b316edd737..c80e531e63 100644 --- a/quickstep/recents_ui_overrides/res/values/dimens.xml +++ b/quickstep/recents_ui_overrides/res/values/dimens.xml @@ -27,4 +27,5 @@ 18dp 10dp + -80dp \ No newline at end of file diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index 00e4a9d5a8..5af09f7fd9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -57,6 +57,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.views.FloatingIconView; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.LayoutUtils; +import com.android.quickstep.util.StaggeredWorkspaceAnim; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; @@ -151,8 +152,21 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe @NonNull @Override public AnimatorPlaybackController createActivityAnimationToHome() { + // Return an empty APC here since we have an non-user controlled animation to home. long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx); - return activity.getStateManager().createAnimationToNewWorkspace(NORMAL, accuracy); + AnimatorSet as = new AnimatorSet(); + as.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + activity.getStateManager().goToState(NORMAL, false); + } + }); + return AnimatorPlaybackController.wrap(as, accuracy); + } + + @Override + public void playAtomicAnimation(float velocity) { + new StaggeredWorkspaceAnim(activity, workspaceView, velocity).start(); } }; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index ca966c8fdb..187e5317f8 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1057,6 +1057,7 @@ public class WindowTransformSwipeHandler setStateOnUiThread(target.endState); } }); + homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y); windowAnim.start(velocityPxPerMs); mRunningWindowAnim = RunningWindowAnim.wrap(windowAnim); mLauncherTransitionController = null; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java new file mode 100644 index 0000000000..93b6e4ba5d --- /dev/null +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -0,0 +1,154 @@ +/* + * 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.util; + +import android.animation.Animator; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; +import androidx.dynamicanimation.animation.SpringForce; + +import com.android.launcher3.CellLayout; +import com.android.launcher3.DeviceProfile; +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherAnimUtils.ViewProgressProperty; +import com.android.launcher3.R; +import com.android.launcher3.ShortcutAndWidgetContainer; +import com.android.launcher3.anim.SpringObjectAnimator; + +import java.util.ArrayList; +import java.util.List; + +import static com.android.launcher3.anim.Interpolators.LINEAR; + +/** + * Creates an animation where all the workspace items are moved into their final location, + * staggered row by row from the bottom up. + * This is used in conjunction with the swipe up to home animation. + */ +public class StaggeredWorkspaceAnim { + + private static final int APP_CLOSE_ROW_START_DELAY_MS = 16; + private static final int ALPHA_DURATION_MS = 200; + + private static final float MAX_VELOCITY_PX_PER_S = 22f; + + private static final float DAMPING_RATIO = + (SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY + SpringForce.DAMPING_RATIO_LOW_BOUNCY) / 2f; + private static final float STIFFNESS = SpringForce.STIFFNESS_LOW; + + private final float mVelocity; + private final float mSpringTransY; + private final View mViewToIgnore; + + private final List mAnimators = new ArrayList<>(); + + /** + * @param floatingViewOriginalView The FloatingIconView's original view. + */ + public StaggeredWorkspaceAnim(Launcher launcher, @Nullable View floatingViewOriginalView, + float velocity) { + mVelocity = velocity; + // We ignore this view since it's visibility and position is controlled by + // the FloatingIconView. + mViewToIgnore = floatingViewOriginalView; + + // Scale the translationY based on the initial velocity to better sync the workspace items + // with the floating view. + float transFactor = 0.1f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S; + mSpringTransY = transFactor * launcher.getResources() + .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);; + + DeviceProfile grid = launcher.getDeviceProfile(); + ShortcutAndWidgetContainer currentPage = ((CellLayout) launcher.getWorkspace() + .getChildAt(launcher.getWorkspace().getCurrentPage())) + .getShortcutsAndWidgets(); + + // Hotseat and QSB takes up two additional rows. + int totalRows = grid.inv.numRows + (grid.isVerticalBarLayout() ? 0 : 2); + + // Set up springs on workspace items. + for (int i = currentPage.getChildCount() - 1; i >= 0; i--) { + View child = currentPage.getChildAt(i); + CellLayout.LayoutParams lp = ((CellLayout.LayoutParams) child.getLayoutParams()); + addStaggeredAnimationForView(child, lp.cellY + lp.cellVSpan, totalRows); + } + + // Set up springs for the hotseat and qsb. + if (grid.isVerticalBarLayout()) { + ViewGroup hotseat = (ViewGroup) launcher.getHotseat().getChildAt(0); + for (int i = hotseat.getChildCount() - 1; i >= 0; i--) { + View child = hotseat.getChildAt(i); + CellLayout.LayoutParams lp = ((CellLayout.LayoutParams) child.getLayoutParams()); + addStaggeredAnimationForView(child, lp.cellY + 1, totalRows); + } + } else { + View hotseat = launcher.getHotseat().getChildAt(0); + addStaggeredAnimationForView(hotseat, grid.inv.numRows + 1, totalRows); + + View qsb = launcher.findViewById(R.id.search_container_all_apps); + addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows); + } + } + + /** + * Starts the animation. + */ + public void start() { + for (Animator a : mAnimators) { + if (a instanceof SpringObjectAnimator) { + ((SpringObjectAnimator) a).startSpring(1f, mVelocity, null); + } else { + a.start(); + } + } + } + + /** + * Adds an alpha/trans animator for {@param v}, with a start delay based on the view's row. + * + * @param v A view on the workspace. + * @param row The bottom-most row that contains the view. + * @param totalRows Total number of rows. + */ + private void addStaggeredAnimationForView(View v, int row, int totalRows) { + if (v == mViewToIgnore) { + return; + } + + // Invert the rows, because we stagger starting from the bottom of the screen. + int invertedRow = totalRows - row; + // Add 1 to the inverted row so that the bottom most row has a start delay. + long startDelay = (long) ((invertedRow + 1) * APP_CLOSE_ROW_START_DELAY_MS); + + v.setTranslationY(mSpringTransY); + SpringObjectAnimator springTransY = new SpringObjectAnimator<>( + new ViewProgressProperty(v, View.TRANSLATION_Y), "staggeredSpringTransY", 1f, + DAMPING_RATIO, STIFFNESS, mSpringTransY, 0); + springTransY.setStartDelay(startDelay); + mAnimators.add(springTransY); + + v.setAlpha(0); + ObjectAnimator alpha = ObjectAnimator.ofFloat(v, View.ALPHA, 0f, 1f); + alpha.setInterpolator(LINEAR); + alpha.setDuration(ALPHA_DURATION_MS); + alpha.setStartDelay(startDelay); + mAnimators.add(alpha); + } +} diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index b0acd9b1b6..279a946195 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -143,5 +143,9 @@ public interface ActivityControlHelper { @NonNull RectF getWindowTargetRect(); @NonNull AnimatorPlaybackController createActivityAnimationToHome(); + + default void playAtomicAnimation(float velocity) { + // No-op + } } } diff --git a/src/com/android/launcher3/anim/SpringObjectAnimator.java b/src/com/android/launcher3/anim/SpringObjectAnimator.java index f74590bba3..b1395af89f 100644 --- a/src/com/android/launcher3/anim/SpringObjectAnimator.java +++ b/src/com/android/launcher3/anim/SpringObjectAnimator.java @@ -22,6 +22,8 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; +import android.os.Handler; +import android.os.Looper; import android.util.Log; import android.util.Property; @@ -139,7 +141,7 @@ public class SpringObjectAnimator extends ValueAnim /** * Initializes and sets up the spring to take over controlling the object. */ - void startSpring(float end, float velocity, OnAnimationEndListener endListener) { + public void startSpring(float end, float velocity, OnAnimationEndListener endListener) { // Cancel the spring so we can set new start velocity and final position. We need to remove // the listener since the spring is not actually ending. mSpring.removeEndListener(endListener); @@ -149,7 +151,13 @@ public class SpringObjectAnimator extends ValueAnim mProperty.switchToSpring(); mSpring.setStartVelocity(velocity); - mSpring.animateToFinalPosition(end == 0 ? mValues[0] : mValues[1]); + + float startValue = end == 0 ? mValues[1] : mValues[0]; + float endValue = end == 0 ? mValues[0] : mValues[1]; + mSpring.setStartValue(startValue); + new Handler(Looper.getMainLooper()).postDelayed(() -> { + mSpring.animateToFinalPosition(endValue); + }, getStartDelay()); } @Override From 119a58624573580c21989ad60db786f9df46c447 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 29 May 2019 14:39:01 -0700 Subject: [PATCH 41/47] Animate workspace upwards when opening an app. Bug: 123900446 Change-Id: I3d08985f8362038f50728e91e2fedf1c97e326ff --- .../android/launcher3/QuickstepAppTransitionManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java index 95ae312891..79540c1645 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java @@ -278,7 +278,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans if (launcherClosing) { Pair launcherContentAnimator = getLauncherContentAnimator(true /* isAppOpening */, - new float[] {0, mContentTransY}); + new float[] {0, -mContentTransY}); anim.play(launcherContentAnimator.first); anim.addListener(new AnimatorListenerAdapter() { @Override From 1b902a3128f68088b83da3be8a33a83b5f5aabcf Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 29 May 2019 14:44:47 -0700 Subject: [PATCH 42/47] Printing TouchInteractionService state on test failures Change-Id: I41078238c8f49c929ccb026ca329e730ab96822c --- .../com/android/launcher3/ui/AbstractLauncherUiTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 44401c73c2..c7c36b0d40 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -192,6 +192,14 @@ public abstract class AbstractLauncherUiTest { ", track trace is below, UI object dump is further below:\n" + Log.getStackTraceString(e)); dumpViewHierarchy(); + + try { + final String dumpsysResult = mDevice.executeShellCommand( + "dumpsys activity service TouchInteractionService"); + Log.d(TAG, "TouchInteractionService: " + dumpsysResult); + } catch (IOException ex) { + } + mDevice.takeScreenshot(new File(pathname)); } }; From 3f6019fde4d7fed20f6919c0df0e34dd7b24170d Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Wed, 29 May 2019 16:53:29 -0700 Subject: [PATCH 43/47] Overview - Add motion to the footer shown on overview tasks. The motion mirrors the icon view. Bug: 125844074 Test: manual Change-Id: Ib980657763aa82c45319c7c93be652f6fc89ffe4 --- .../com/android/quickstep/views/TaskView.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) 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 053b7389cc..022201fe2a 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 @@ -145,11 +145,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { }; private final TaskOutlineProvider mOutlineProvider; + private final FooterOutlineProvider mFooterOutlineProvider; private Task mTask; private TaskThumbnailView mSnapshotView; private TaskMenuView mMenuView; private IconView mIconView; + private View mTaskFooterContainer; private DigitalWellBeingToast mDigitalWellBeingToast; private float mCurveScale; private float mFullscreenProgress; @@ -203,6 +205,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context.getResources()); mCurrentFullscreenParams = new FullscreenDrawParams(mCornerRadius); mOutlineProvider = new TaskOutlineProvider(getResources(), mCurrentFullscreenParams); + mFooterOutlineProvider = new FooterOutlineProvider(mCurrentFullscreenParams); setOutlineProvider(mOutlineProvider); } @@ -212,6 +215,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { mSnapshotView = findViewById(R.id.snapshot); mIconView = findViewById(R.id.icon); mDigitalWellBeingToast = findViewById(R.id.digital_well_being_toast); + mTaskFooterContainer = findViewById(R.id.task_footer_container); + mTaskFooterContainer.setOutlineProvider(mFooterOutlineProvider); + mTaskFooterContainer.setClipToOutline(true); } public TaskMenuView getMenuView() { @@ -410,6 +416,15 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { .getInterpolation(progress); mIconView.setScaleX(scale); mIconView.setScaleY(scale); + + int footerVerticalOffset = (int) (mTaskFooterContainer.getHeight() * (1.0f - scale)); + mTaskFooterContainer.setTranslationY( + mCurrentFullscreenParams.mCurrentDrawnInsets.bottom + + mCurrentFullscreenParams.mCurrentDrawnInsets.top + + footerVerticalOffset); + mFooterOutlineProvider.setFullscreenDrawParams( + mCurrentFullscreenParams, footerVerticalOffset); + mTaskFooterContainer.invalidateOutline(); } public void setIconScaleAnimStartProgress(float startProgress) { @@ -550,6 +565,29 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } } + private static final class FooterOutlineProvider extends ViewOutlineProvider { + + private FullscreenDrawParams mFullscreenDrawParams; + private int mVerticalOffset; + private final Rect mOutlineRect = new Rect(); + + FooterOutlineProvider(FullscreenDrawParams params) { + mFullscreenDrawParams = params; + } + + void setFullscreenDrawParams(FullscreenDrawParams params, int verticalOffset) { + mFullscreenDrawParams = params; + mVerticalOffset = verticalOffset; + } + + @Override + public void getOutline(View view, Outline outline) { + mOutlineRect.set(0, 0, view.getWidth(), view.getHeight()); + mOutlineRect.offset(0, -mVerticalOffset); + outline.setRoundRect(mOutlineRect, mFullscreenDrawParams.mCurrentDrawnCornerRadius); + } + } + @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); @@ -638,7 +676,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } mFullscreenProgress = progress; boolean isFullscreen = mFullscreenProgress > 0; - setIconScaleAndDim(progress, true /* invert */); mIconView.setVisibility(progress < 1 ? VISIBLE : INVISIBLE); setClipChildren(!isFullscreen); setClipToPadding(!isFullscreen); @@ -662,6 +699,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { / (getWidth() + currentInsetsLeft + currentInsetsRight)); } + // Some of the items in here are dependent on the current fullscreen params + setIconScaleAndDim(progress, true /* invert */); + thumbnail.setFullscreenParams(mCurrentFullscreenParams); mOutlineProvider.setFullscreenParams(mCurrentFullscreenParams); invalidateOutline(); From 6f871d423b01f2472115fee4d135e8bdd30c6a40 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 29 May 2019 18:33:06 -0700 Subject: [PATCH 44/47] More debug tracing for RemoteActionShortcut Change-Id: If7bbc0817f4a833243f46ca15dde86ffc573ab58 --- .../android/launcher3/popup/RemoteActionShortcut.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/popup/RemoteActionShortcut.java b/src/com/android/launcher3/popup/RemoteActionShortcut.java index f8b62427c0..41ab4df7bf 100644 --- a/src/com/android/launcher3/popup/RemoteActionShortcut.java +++ b/src/com/android/launcher3/popup/RemoteActionShortcut.java @@ -33,6 +33,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto; public class RemoteActionShortcut extends SystemShortcut { private static final String TAG = "RemoteActionShortcut"; + private static final boolean DEBUG = false; private final RemoteAction mAction; @@ -48,7 +49,10 @@ public class RemoteActionShortcut extends SystemShortcut { return view -> { AbstractFloatingView.closeAllOpenViews(activity); + final String actionIdentity = mAction.getTitle() + ", " + + itemInfo.getTargetComponent().getPackageName(); try { + if (DEBUG) Log.d(TAG, "Sending action: " + actionIdentity); mAction.getActionIntent().send( activity, 0, @@ -56,15 +60,16 @@ public class RemoteActionShortcut extends SystemShortcut { Intent.EXTRA_PACKAGE_NAME, itemInfo.getTargetComponent().getPackageName()), (pendingIntent, intent, resultCode, resultData, resultExtras) -> { + if (DEBUG) Log.d(TAG, "Action is complete: " + actionIdentity); if (resultData != null && !resultData.isEmpty()) { - Log.e(TAG, "Remote action returned result: " + mAction.getTitle() + Log.e(TAG, "Remote action returned result: " + actionIdentity + " : " + resultData); Toast.makeText(activity, resultData, Toast.LENGTH_SHORT).show(); } }, new Handler(Looper.getMainLooper())); } catch (PendingIntent.CanceledException e) { - Log.e(TAG, "Remote action canceled: " + mAction.getTitle(), e); + Log.e(TAG, "Remote action canceled: " + actionIdentity, e); Toast.makeText(activity, activity.getString( R.string.remote_action_failed, mAction.getTitle()), From 26185e1feddbb92cbf251c4910116e81923e79a5 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 28 May 2019 12:03:05 -0700 Subject: [PATCH 45/47] Adding debug tracing for a lab-only issue Task doesn't get resumed upon clicking at it. Bug: 133765434 Change-Id: I8c5c1308041949d94c6982c78b8337ea81ad400f --- .../src/com/android/quickstep/views/TaskView.java | 10 ++++++++++ src/com/android/launcher3/testing/TestProtocol.java | 1 + .../com/android/launcher3/tapl/OverviewTask.java | 13 ++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) 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 917465f631..f8d454f34e 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 @@ -52,6 +52,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.logging.UserEventDispatcher; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; @@ -182,6 +183,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { super(context, attrs, defStyleAttr); mActivity = BaseDraggingActivity.fromContext(context); setOnClickListener((view) -> { + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TASK_TAG, "TaskView onClick"); + } if (getTask() == null) { return; } @@ -285,6 +289,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { public void launchTask(boolean animate, boolean freezeTaskList, Consumer resultCallback, Handler resultCallbackHandler) { + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TASK_TAG, "launchTask"); + } if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { if (isRunningTask()) { getRecentsView().finishRecentsAnimation(false /* toRecents */, @@ -299,6 +306,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private void launchTaskInternal(boolean animate, boolean freezeTaskList, Consumer resultCallback, Handler resultCallbackHandler) { + if (com.android.launcher3.testing.TestProtocol.sDebugTracing) { + android.util.Log.d(TestProtocol.NO_START_TASK_TAG, "launchTaskInternal"); + } if (mTask != null) { final ActivityOptions opts; if (animate) { diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index a678ef248d..ae178e79eb 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -70,4 +70,5 @@ public final class TestProtocol { public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing"; public static final String NO_DRAG_TAG = "b/133009122"; public static final String NO_START_TAG = "b/132900132"; + public static final String NO_START_TASK_TAG = "b/133765434"; } diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java index 2ea76185ea..8b124641f6 100644 --- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java +++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java @@ -20,6 +20,8 @@ import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; +import com.android.launcher3.testing.TestProtocol; + /** * A recent task in the overview panel carousel. */ @@ -59,9 +61,14 @@ public final class OverviewTask { */ public Background open() { verifyActiveContainer(); - mLauncher.assertTrue("Launching task didn't open a new window: " + - mTask.getParent().getContentDescription(), - mTask.clickAndWait(Until.newWindow(), WAIT_TIME_MS)); + mLauncher.getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING); + try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "clicking an overview task")) { + mLauncher.assertTrue("Launching task didn't open a new window: " + + mTask.getParent().getContentDescription(), + mTask.clickAndWait(Until.newWindow(), WAIT_TIME_MS)); + } + mLauncher.getTestInfo(TestProtocol.REQUEST_DISABLE_DEBUG_TRACING); return new Background(mLauncher); } } From da14cf8b9febb39b42545d4fe3c3cbda0b9cc156 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 30 May 2019 10:31:09 -0700 Subject: [PATCH 46/47] Disabling seamless rotation in multiwindow mode Bug: 133765491 Change-Id: If68c709fa5b8216d63fc516f16f03bf2aa83172a --- src/com/android/launcher3/Launcher.java | 5 ++--- src/com/android/launcher3/states/RotationHelper.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 711cfd2885..ed0b90fcce 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -490,9 +490,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize); } - if (supportsFakeLandscapeUI() - && mDeviceProfile.isVerticalBarLayout() - && !mDeviceProfile.isMultiWindowMode) { + if (supportsFakeLandscapeUI() && mDeviceProfile.isVerticalBarLayout()) { mStableDeviceProfile = mDeviceProfile.inv.portraitProfile; mRotationMode = UiFactory.getRotationMode(mDeviceProfile); } else { @@ -500,6 +498,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, mRotationMode = RotationMode.NORMAL; } + mRotationHelper.updateRotationAnimation(); onDeviceProfileInitiated(); mModelWriter = mModel.getWriter(getWallpaperDeviceProfile().isVerticalBarLayout(), true); } diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java index b6c3c35b89..cd96d6ed84 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -94,16 +94,20 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { public boolean homeScreenCanRotate() { return mIgnoreAutoRotateSettings || mAutoRotateEnabled - || mStateHandlerRequest != REQUEST_NONE; + || mStateHandlerRequest != REQUEST_NONE + || mLauncher.getDeviceProfile().isMultiWindowMode; } - private void updateRotationAnimation() { + public void updateRotationAnimation() { if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) { WindowManager.LayoutParams lp = mLauncher.getWindow().getAttributes(); + int oldAnim = lp.rotationAnimation; lp.rotationAnimation = homeScreenCanRotate() ? WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE : WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS; - mLauncher.getWindow().setAttributes(lp); + if (oldAnim != lp.rotationAnimation) { + mLauncher.getWindow().setAttributes(lp); + } } } @@ -123,6 +127,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { public void setStateHandlerRequest(int request) { if (mStateHandlerRequest != request) { mStateHandlerRequest = request; + updateRotationAnimation(); notifyChange(); } } From a1898247cae3e259dc8cad37207ddaf56fdc1a82 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 30 May 2019 11:22:50 -0700 Subject: [PATCH 47/47] Hide original icon immediately for app close. Bug: 123900446 Change-Id: I12d906267dafe80a9dc5d5e39452bddd95b0f748 --- src/com/android/launcher3/views/FloatingIconView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 5f626a3fc2..7a6da3eec5 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -644,6 +644,7 @@ public class FloatingIconView extends View implements if (!isOpening) { // Hide immediately since the floating view starts at a different location. originalView.setVisibility(INVISIBLE); + view.mLoadIconSignal.setOnCancelListener(() -> originalView.setVisibility(VISIBLE)); } CancellationSignal loadIconSignal = view.mLoadIconSignal; new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {