diff options
author | Winson Chung <winsonc@google.com> | 2019-06-04 12:20:05 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2019-06-04 12:20:05 -0700 |
commit | a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785 (patch) | |
tree | 09139ba2bf4725ca17c959fca1739034cbfa5053 /src | |
parent | 0ef6fe00b0e2a7ef59db149b5031a0fbcdde86b2 (diff) | |
parent | 8789aa05a1b5af25c727814331ac126a3007c528 (diff) | |
download | android_packages_apps_Trebuchet-a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785.tar.gz android_packages_apps_Trebuchet-a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785.tar.bz2 android_packages_apps_Trebuchet-a3ed49d566d9c2cabe17d5d4f0026f3d59f0a785.zip |
Merging ub-launcher3-qt-dev, build 5633311
Test: Manual
Bug:119330044 P1 [STOPSHIP] Add back shape detection in Launcher icons
Bug:123900446 P1 App to home animation should zoom into the app icon
Bug:132298752 P1 Adding widget locks home screen page
Bug:132757019 P1 Swipe up twice quickly from app in 2 button mode; can't access all apps
Bug:133518678 P1 In 2 button mode, flinging up strongly favours quickswitch
Bug:133806285 P1 All apps causes overview to peek in
Bug:133844237 P1 Respect limited width Exclusion Rects in bottom area?
Bug:133867119 P2 Lab-only flake: want to switch from workspace to all apps; Swipe failed to receive an event for the swipe end
Bug:134062513 P1 Quickswitch sends lifecycle events to -1
Bug:134094839 P1 Launcher kept crashing on OTA update
Bug:134096917 P1 Launcher animation component gets stuck during swipe up
Bug:134164918 P1 STOPSHIP: Disable chips hard-coded value in qt_dev Launcher
Bug:134172603 P1 Tracing for lab-only flakes
Bug:134442147 P1 Sometimes All Apps won't update on app install/uninstall/update
Change-Id: Ia530fbf9bb5fa67b602ce44aef0cc4a1d1494e13
Diffstat (limited to 'src')
16 files changed, 103 insertions, 43 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ed0b90fcc..855535b0f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -277,6 +277,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, final Handler mHandler = new Handler(); private final Runnable mHandleDeferredResume = this::handleDeferredResume; + private boolean mDeferredResumePending; private float mCurrentAssistantVisibility = 0f; @@ -889,26 +890,40 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, } private void handleDeferredResume() { - if (hasBeenResumed()) { + if (hasBeenResumed() && !mStateManager.getState().disableInteraction) { getUserEventDispatcher().logActionCommand(Action.Command.RESUME, mStateManager.getState().containerType, -1); getUserEventDispatcher().startSession(); UiFactory.onLauncherStateOrResumeChanged(this); AppLaunchTracker.INSTANCE.get(this).onReturnedToHome(); - resetPendingActivityResultIfNeeded(); - } - } - private void resetPendingActivityResultIfNeeded() { - if (hasBeenResumed() && mPendingActivityRequestCode != -1 && isInState(NORMAL)) { - UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode); + // Process any items that were added while Launcher was away. + InstallShortcutReceiver.disableAndFlushInstallQueue( + InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this); + + // Refresh shortcuts if the permission changed. + mModel.refreshShortcutsIfRequired(); + + DiscoveryBounce.showForHomeIfNeeded(this); + + if (mPendingActivityRequestCode != -1 && isInState(NORMAL)) { + UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode); + } + mDeferredResumePending = false; + } else { + mDeferredResumePending = true; } } protected void onStateSet(LauncherState state) { getAppWidgetHost().setResumed(state == LauncherState.NORMAL); - resetPendingActivityResultIfNeeded(); + if (mDeferredResumePending) { + handleDeferredResume(); + } + if (mLauncherCallbacks != null) { + mLauncherCallbacks.onStateChanged(); + } } @Override @@ -922,14 +937,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, Utilities.postAsyncCallback(mHandler, mHandleDeferredResume); setOnResumeCallback(null); - // Process any items that were added while Launcher was away. - InstallShortcutReceiver.disableAndFlushInstallQueue( - InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this); - - // Refresh shortcuts if the permission changed. - mModel.refreshShortcutsIfRequired(); - DiscoveryBounce.showForHomeIfNeeded(this); if (mLauncherCallbacks != null) { mLauncherCallbacks.onResume(); } diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index dc275161d..d07638a5c 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -68,9 +68,6 @@ public class LauncherAppState { } private LauncherAppState(Context context) { - if (!UserManagerCompat.getInstance(context).isUserUnlocked(Process.myUserHandle())) { - throw new RuntimeException("LauncherAppState should not start in direct boot mode"); - } if (getLocalProvider(context) == null) { throw new RuntimeException( "Initializing LauncherAppState in the absence of LauncherProvider"); diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java index edac516e1..dfe75ec34 100644 --- a/src/com/android/launcher3/LauncherCallbacks.java +++ b/src/com/android/launcher3/LauncherCallbacks.java @@ -21,7 +21,6 @@ import android.os.Bundle; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.util.ArrayList; /** * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks @@ -53,6 +52,11 @@ public interface LauncherCallbacks { boolean handleBackPressed(); void onTrimMemory(int level); + /** + * Called when the launcher state changed + */ + default void onStateChanged() { } + /* * Extension points for providing custom behavior on certain user interactions. */ diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 3edd8385a..fe6b52297 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -40,6 +40,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.os.Handler; import android.os.Looper; +import android.util.Log; import androidx.annotation.IntDef; @@ -474,6 +475,11 @@ public class LauncherStateManager { // Only change the stable states after the transitions have finished if (state != mCurrentStableState) { mLastStableState = state.getHistoryForState(mCurrentStableState); + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, + "mCurrentStableState = " + state.getClass().getSimpleName() + " @ " + + android.util.Log.getStackTraceString(new Throwable())); + } mCurrentStableState = state; } diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 053c57004..0d43e214e 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -625,15 +625,16 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo @Override public boolean dispatchTouchEvent(MotionEvent ev) { + final boolean result = super.dispatchTouchEvent(ev); switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: - mAllAppsStore.setDeferUpdates(true); + if (result) mAllAppsStore.setDeferUpdates(true); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mAllAppsStore.setDeferUpdates(false); break; } - return super.dispatchTouchEvent(ev); + return result; } } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index a7f89d9c0..c62fc3d8f 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -14,6 +14,7 @@ import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import android.util.Log; import android.util.Property; import android.view.animation.Interpolator; @@ -29,6 +30,7 @@ import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.SpringObjectAnimator; import com.android.launcher3.anim.PropertySetter; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ScrimView; @@ -162,6 +164,10 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil @Override public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, + "setStateWithAnimation " + toState.getClass().getSimpleName()); + } float targetProgress = toState.getVerticalProgress(mLauncher); if (Float.compare(mProgress, targetProgress) == 0) { setAlphas(toState, config, builder); diff --git a/src/com/android/launcher3/anim/FlingSpringAnim.java b/src/com/android/launcher3/anim/FlingSpringAnim.java index f53ea5150..eaf3b1cb2 100644 --- a/src/com/android/launcher3/anim/FlingSpringAnim.java +++ b/src/com/android/launcher3/anim/FlingSpringAnim.java @@ -29,7 +29,7 @@ public class FlingSpringAnim { private static final float FLING_FRICTION = 1.5f; private static final float SPRING_STIFFNESS = 200; - private static final float SPRING_DAMPING = 0.85f; + private static final float SPRING_DAMPING = 0.8f; private final FlingAnimation mFlingAnim; private SpringAnimation mSpringAnim; diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index 54d0db100..7e20d11c2 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -105,7 +105,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", true, + "ENABLE_HINTS_IN_OVERVIEW", false, "Show chip hints and gleams on the overview screen"); public static final TogglableFlag FAKE_LANDSCAPE_UI = new TogglableFlag( diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index b35e23ce9..6ba015b2e 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -130,16 +130,6 @@ public class DragLayer extends BaseDragLayer<Launcher> { return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event); } - @Override - protected boolean findActiveController(MotionEvent ev) { - if (mActivity.getStateManager().getState().disableInteraction) { - // You Shall Not Pass!!! - mActiveController = null; - return true; - } - return super.findActiveController(ev); - } - private boolean isEventOverAccessibleDropTargetBar(MotionEvent ev) { return isInAccessibleDrag() && isEventOverView(mActivity.getDropTargetBar(), ev); } diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index d1bd2db13..09c5e5b2b 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -243,7 +243,7 @@ public class DragView extends View implements LauncherStateManager.StateListener nDr = new AdaptiveIconDrawable(new ColorDrawable(Color.BLACK), null); } Utilities.scaleRectAboutCenter(bounds, - li.getNormalizer().getScale(nDr, null)); + li.getNormalizer().getScale(nDr, null, null, null)); } AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) dr; diff --git a/src/com/android/launcher3/graphics/IconShape.java b/src/com/android/launcher3/graphics/IconShape.java index 88e4452e1..4369385ae 100644 --- a/src/com/android/launcher3/graphics/IconShape.java +++ b/src/com/android/launcher3/graphics/IconShape.java @@ -91,6 +91,10 @@ public abstract class IconShape { private SparseArray<TypedValue> mAttrs; + public boolean enableShapeDetection(){ + return false; + }; + public abstract void drawShape(Canvas canvas, float offsetX, float offsetY, float radius, Paint paint); @@ -194,6 +198,11 @@ public abstract class IconShape { protected float getStartRadius(Rect startRect) { return startRect.width() / 2f; } + + @Override + public boolean enableShapeDetection() { + return true; + } } public static class RoundedSquare extends SimpleRectShape { diff --git a/src/com/android/launcher3/icons/LauncherIcons.java b/src/com/android/launcher3/icons/LauncherIcons.java index 5c4af1fe6..3b74307db 100644 --- a/src/com/android/launcher3/icons/LauncherIcons.java +++ b/src/com/android/launcher3/icons/LauncherIcons.java @@ -30,6 +30,7 @@ import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; +import com.android.launcher3.graphics.IconShape; import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.util.Themes; @@ -50,11 +51,15 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable { private static LauncherIcons sPool; private static int sPoolId = 0; + public static LauncherIcons obtain(Context context) { + return obtain(context, IconShape.getShape().enableShapeDetection()); + } + /** * Return a new Message instance from the global pool. Allows us to * avoid allocating new objects in many cases. */ - public static LauncherIcons obtain(Context context) { + public static LauncherIcons obtain(Context context, boolean shapeDetection) { int poolId; synchronized (sPoolSync) { if (sPool != null) { @@ -67,7 +72,8 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable { } InvariantDeviceProfile idp = LauncherAppState.getIDP(context); - return new LauncherIcons(context, idp.fillResIconDpi, idp.iconBitmapSize, poolId); + return new LauncherIcons(context, idp.fillResIconDpi, idp.iconBitmapSize, poolId, + shapeDetection); } public static void clearPool() { @@ -81,8 +87,9 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable { private LauncherIcons next; - private LauncherIcons(Context context, int fillResIconDpi, int iconBitmapSize, int poolId) { - super(context, fillResIconDpi, iconBitmapSize); + private LauncherIcons(Context context, int fillResIconDpi, int iconBitmapSize, int poolId, + boolean shapeDetection) { + super(context, fillResIconDpi, iconBitmapSize, shapeDetection); mPoolId = poolId; } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 9703aa626..4e5f7a59a 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -31,6 +31,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.os.SystemClock; +import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; @@ -118,6 +119,9 @@ public abstract class AbstractStateChangeTouchController @Override public final boolean onControllerInterceptTouchEvent(MotionEvent ev) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onControllerInterceptTouchEvent 1 " + ev); + } if (ev.getAction() == MotionEvent.ACTION_DOWN) { mNoIntercept = !canInterceptTouch(ev); if (mNoIntercept) { @@ -147,6 +151,9 @@ public abstract class AbstractStateChangeTouchController return false; } + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onControllerInterceptTouchEvent 2 "); + } onControllerTouchEvent(ev); return mDetector.isDraggingOrSettling(); } @@ -234,6 +241,9 @@ public abstract class AbstractStateChangeTouchController @Override public void onDragStart(boolean start) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onDragStart 1 " + start); + } mStartState = mLauncher.getStateManager().getState(); if (mStartState == ALL_APPS) { mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS; @@ -243,6 +253,9 @@ public abstract class AbstractStateChangeTouchController mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER; } if (mCurrentAnimation == null) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onDragStart 2"); + } mFromState = mStartState; mToState = null; cancelAnimationControllers(); @@ -552,6 +565,9 @@ public abstract class AbstractStateChangeTouchController } private void cancelAnimationControllers() { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "cancelAnimationControllers"); + } mCurrentAnimation = null; cancelAtomicComponentsController(); mDetector.finishedScrolling(); diff --git a/src/com/android/launcher3/touch/SwipeDetector.java b/src/com/android/launcher3/touch/SwipeDetector.java index 4616e58fe..3d454046a 100644 --- a/src/com/android/launcher3/touch/SwipeDetector.java +++ b/src/com/android/launcher3/touch/SwipeDetector.java @@ -158,6 +158,9 @@ public class SwipeDetector { // SETTLING -> (View settled) -> IDLE private void setState(ScrollState newState) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "setState -- start: " + newState); + } if (DBG) { Log.d(TAG, "setState:" + mState + "->" + newState); } @@ -165,6 +168,9 @@ public class SwipeDetector { if (newState == ScrollState.DRAGGING) { initializeDragging(); if (mState == ScrollState.IDLE) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "setState -- 1: " + newState); + } reportDragStart(false /* recatch */); } else if (mState == ScrollState.SETTLING) { reportDragStart(true /* recatch */); @@ -318,9 +324,15 @@ public class SwipeDetector { break; } mDisplacement = mDir.getDisplacement(ev, pointerIndex, mDownPos, mIsRtl); + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onTouchEvent 1"); + } // handle state and listener calls. if (mState != ScrollState.DRAGGING && shouldScrollStart(ev, pointerIndex)) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onTouchEvent 2"); + } setState(ScrollState.DRAGGING); } if (mState == ScrollState.DRAGGING) { diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java index 07ddccb31..310d598b2 100644 --- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java +++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java @@ -99,7 +99,6 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe handleLongPress = mTempRect.contains((int) ev.getX(), (int) ev.getY()); } - cancelLongPress(); if (handleLongPress) { mLongPressState = STATE_REQUESTED; mTouchDownPoint.set(ev.getX(), ev.getY()); @@ -148,6 +147,10 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe } } + if (action == ACTION_UP || action == ACTION_CANCEL) { + cancelLongPress(); + } + return result; } diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 7a6da3eec..95c96817a 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -77,7 +77,7 @@ import androidx.dynamicanimation.animation.SpringForce; public class FloatingIconView extends View implements Animator.AnimatorListener, ClipPathView, OnGlobalLayoutListener { - public static final float SHAPE_PROGRESS_DURATION = 0.15f; + public static final float SHAPE_PROGRESS_DURATION = 0.10f; private static final int FADE_DURATION_MS = 200; private static final Rect sTmpRect = new Rect(); private static final RectF sTmpRectF = new RectF(); @@ -85,8 +85,8 @@ public class FloatingIconView extends View implements // We spring the foreground drawable relative to the icon's movement in the DragLayer. // We then use these two factor values to scale the movement of the fg within this view. - private static final int FG_TRANS_X_FACTOR = 80; - private static final int FG_TRANS_Y_FACTOR = 100; + private static final int FG_TRANS_X_FACTOR = 60; + private static final int FG_TRANS_Y_FACTOR = 75; private static final FloatPropertyCompat<FloatingIconView> mFgTransYProperty = new FloatPropertyCompat<FloatingIconView>("FloatingViewFgTransY") { @@ -529,7 +529,8 @@ public class FloatingIconView extends View implements bounds.inset(mBlurSizeOutline / 2, mBlurSizeOutline / 2); try (LauncherIcons li = LauncherIcons.obtain(mLauncher)) { - Utilities.scaleRectAboutCenter(bounds, li.getNormalizer().getScale(drawable, null)); + Utilities.scaleRectAboutCenter(bounds, li.getNormalizer().getScale(drawable, null, + null, null)); } bounds.inset( |