diff options
author | Winson Chung <winsonc@google.com> | 2019-05-30 13:15:54 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2019-05-30 13:18:41 -0700 |
commit | 0ef6fe00b0e2a7ef59db149b5031a0fbcdde86b2 (patch) | |
tree | 8c22093ed56fde2969f13c73aee87aea99de05f0 /src | |
parent | 8be337b8a761709ea2679dd3776ff23f884987ff (diff) | |
parent | a1898247cae3e259dc8cad37207ddaf56fdc1a82 (diff) | |
download | android_packages_apps_Trebuchet-0ef6fe00b0e2a7ef59db149b5031a0fbcdde86b2.tar.gz android_packages_apps_Trebuchet-0ef6fe00b0e2a7ef59db149b5031a0fbcdde86b2.tar.bz2 android_packages_apps_Trebuchet-0ef6fe00b0e2a7ef59db149b5031a0fbcdde86b2.zip |
Merging ub-launcher3-qt-dev, build 5619253
Test: Manual
Bug:112282235 P3 Starting an app from Launcher very rarely takes > 10 sec
Bug:121279417 P2 Why LauncherInstrumentation.WAIT_TIME_MS == 60000?
Bug:123892607 P1 Test broken: WellbeingTests.testPauseAppFromAllApps
Bug:123900446 P1 App to home animation should zoom into the app icon
Bug:125844074 P2 Final UX and animations for Launcher DWB integration
Bug:131360075 P1 [Gesture Nav] Polish/finish landscape
Bug:131698989 P2 Add task callback for locked state change
Bug:131741395 P2 Allow windows to scale/move past overview positioning
Bug:131768436 P1 Bad placement of search bar
Bug:131854153 P1 Lots of Cuttlefish (and not only) tests are broken
Bug:131867841 P1 Changing display size does not update the grid
Bug:132460627 P1 Unable to swipe to all apps screen on devices
Bug:132687470 P1 Swiping home from forced landscape app creates cutoff task thumbnail
Bug:132756514 P1 Sometimes (when quick switching?) user gets stuck in full-screen recents view
Bug:132900132 P1 Apparently, tests start running while provisioning is still in progress
Bug:132917885 P1 Reduce swipe-up gesture region height in landscape
Bug:132975416 P1 Flake in NexusPredictionAppTracker.getAppPredictionContextExtras
Bug:132993129 P1 If predictions disabled, app predictions loading bar appears briefly on device restart
Bug:133113732 P1 [B1/C1][QT][CTS_Verifier_9.0_r1]Device Owner Tests-LockTask UI-Enable Overview button failure
Bug:133167096 P1 It is way too easy to dismiss apps from the lock screen
Bug:133651528 P1 [QT]"Pixel Launcher isn't responding" dialog pop up ,after DUT restored.
Bug:133765434 P1 [Flaky test] Launching task didn't open a new window
Bug:133765491 P1 App docked in split screen flickers with emptiness observed while rotating the device
Bug:133783088 P1 Footer showing up on all overview task snapshots even with no items showing.
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:64712476 P3 Import translations for dev branches
Change-Id: Ib4bcefdbb4027992e75e2742d72f199e13467875
Diffstat (limited to 'src')
27 files changed, 338 insertions, 88 deletions
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java index bd6ac90f3..f69b17248 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/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 8a8a2fbe5..bde87cb50 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 || diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index a59189bea..ed0b90fcc 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; @@ -110,6 +109,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; @@ -154,6 +154,8 @@ import java.util.HashSet; import java.util.List; import java.util.function.Predicate; +import androidx.annotation.Nullable; + /** * Default launcher application. */ @@ -406,6 +408,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, super.onEnterAnimationComplete(); UiFactory.onEnterAnimationComplete(this); mAllAppsController.highlightWorkTabIfNecessary(); + mRotationHelper.setCurrentTransitionRequest(REQUEST_NONE); } @Override @@ -487,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 { @@ -497,6 +498,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, mRotationMode = RotationMode.NORMAL; } + mRotationHelper.updateRotationAnimation(); onDeviceProfileInitiated(); mModelWriter = mModel.getWriter(getWallpaperDeviceProfile().isVerticalBarLayout(), true); } @@ -1782,8 +1784,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/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index e7b4ff4fe..ac392a6e6 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); + } } /** diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java index 20eec05d4..49b380b41 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 @@ -157,12 +156,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); SYSTEM_GESTURE_EXCLUSION_RECT.get(0).set(l, t, r, b); diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index eff58a701..3a92dfb96 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 49ae33894..3edd8385a 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/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java index 0c80d130e..73e705b58 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/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index d19f9cd73..f784226a5 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<WorkspacePageIndicator> @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<WorkspacePageIndicator> } // 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 63682c73a..053c57004 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; @@ -43,7 +44,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; @@ -321,13 +322,22 @@ 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/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 548d5de0e..a0e9dc5d8 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/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 434918d2a..2ad92e16f 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/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index 1d62b435d..8c596269d 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); } } diff --git a/src/com/android/launcher3/anim/SpringObjectAnimator.java b/src/com/android/launcher3/anim/SpringObjectAnimator.java index f74590bba..b1395af89 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<T extends ProgressInterface> 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<T extends ProgressInterface> 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 diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index 86f773fa3..43ae65175 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; @@ -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; @@ -69,6 +72,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/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index 7e20d11c2..54d0db100 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", false, + "ENABLE_HINTS_IN_OVERVIEW", true, "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/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index bf692fe47..9d3c8f75d 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/popup/RemoteActionShortcut.java b/src/com/android/launcher3/popup/RemoteActionShortcut.java index f8b62427c..41ab4df7b 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<BaseDraggingActivity> { 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<BaseDraggingActivity> { 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<BaseDraggingActivity> { 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()), diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java index 3727fa663..cd96d6ed8 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -63,6 +63,10 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { */ private int mStateHandlerRequest = REQUEST_NONE; /** + * Rotation request made by an app transition + */ + private int mCurrentTransitionRequest = REQUEST_NONE; + /** * Rotation request made by a Launcher State */ private int mCurrentStateRequest = REQUEST_NONE; @@ -90,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); + } } } @@ -119,6 +127,14 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { public void setStateHandlerRequest(int request) { if (mStateHandlerRequest != request) { mStateHandlerRequest = request; + updateRotationAnimation(); + notifyChange(); + } + } + + public void setCurrentTransitionRequest(int request) { + if (mCurrentTransitionRequest != request) { + mCurrentTransitionRequest = request; notifyChange(); } } @@ -163,6 +179,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/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java new file mode 100644 index 000000000..b8476aa1d --- /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 000000000..bd177c003 --- /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 index a0440e877..99efb22cf 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. @@ -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; @@ -67,6 +68,8 @@ 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"; + public static final String NO_START_TASK_TAG = "b/133765434"; } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 35fc8731f..9703aa626 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/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index 99b9f25b1..f858dc4c6 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/touch/SwipeDetector.java b/src/com/android/launcher3/touch/SwipeDetector.java index 4e3dcf8b8..4616e58fe 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/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index 496418240..939b0f2b9 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<T extends Context & ActivityContext> @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<T extends Context & ActivityContext> } 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); @@ -495,12 +496,14 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext> } } + @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); } } diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index f4a382255..7a6da3eec 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; @@ -178,6 +179,7 @@ public class FloatingIconView extends View implements protected void onAttachedToWindow() { super.onAttachedToWindow(); getViewTreeObserver().addOnGlobalLayoutListener(this); + mLauncher.getRotationHelper().setCurrentTransitionRequest(REQUEST_LOCK); } @Override @@ -227,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); @@ -639,6 +641,11 @@ 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); + view.mLoadIconSignal.setOnCancelListener(() -> originalView.setVisibility(VISIBLE)); + } CancellationSignal loadIconSignal = view.mLoadIconSignal; new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> { view.getIcon(originalView, (ItemInfo) originalView.getTag(), isOpening, |