diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 2307b5f6c2..1316ddda25 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -121,7 +121,6 @@ import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.SafeCloseable; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; import com.android.launcher3.util.TouchController; -import com.android.launcher3.util.ViewCapture; import com.android.launcher3.widget.LauncherAppWidgetHost; import com.android.quickstep.OverviewCommandHelper; import com.android.quickstep.RecentsModel; @@ -135,6 +134,7 @@ import com.android.quickstep.util.RemoteAnimationProvider; import com.android.quickstep.util.RemoteFadeOutAnimationListener; import com.android.quickstep.util.SplitSelectStateController; import com.android.quickstep.util.TISBindHelper; +import com.android.quickstep.util.ViewCapture; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; @@ -586,6 +586,8 @@ public class QuickstepLauncher extends Launcher { public void onWidgetsTransition(float progress) { super.onWidgetsTransition(progress); onTaskbarInAppDisplayProgressUpdate(progress, WIDGETS_PAGE_PROGRESS_INDEX); + // Change of wallpaper depth in widget picker is disabled for tests as it causes flakiness + // on very slow cuttlefish devices. if (ENABLE_WIDGET_PICKER_DEPTH.get() && !Utilities.IS_RUNNING_IN_TEST_HARNESS) { WIDGET_DEPTH.set(getDepthController(), Utilities.mapToRange(progress, 0f, 1f, 0f, getDeviceProfile().bottomSheetDepth, diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index a580b4247c..4e635a7643 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -50,7 +50,6 @@ import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.FINISH_RECENTS_ANIMATION; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.ON_SETTLED_ON_END_TARGET; -import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION; import static com.android.quickstep.util.VibratorWrapper.OVERVIEW_HAPTIC; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; @@ -827,10 +826,6 @@ public abstract class AbsSwipeUpHandler, public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) { super.onRecentsAnimationStart(controller, targets); - ActiveGestureLog.INSTANCE.addLog( - /* event= */ "startRecentsAnimationCallback", - /* extras= */ targets.apps.length, - /* gestureEvent= */ START_RECENTS_ANIMATION); mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(mContext, targets); mRecentsAnimationController = controller; mRecentsAnimationTargets = targets; @@ -1449,6 +1444,7 @@ public abstract class AbsSwipeUpHandler, } } + @Nullable private SwipePipToHomeAnimator createWindowAnimationToPip(HomeAnimationFactory homeAnimFactory, RemoteAnimationTargetCompat runningTaskTarget, float startProgress) { // Directly animate the app to PiP (picture-in-picture) mode @@ -1474,6 +1470,10 @@ public abstract class AbsSwipeUpHandler, runningTaskTarget.taskInfo.pictureInPictureParams, homeRotation, hotseatKeepClearArea); + if (destinationBounds == null) { + // No destination bounds returned from SystemUI, bail early. + return null; + } final Rect appBounds = new Rect(); final WindowConfiguration winConfig = taskInfo.configuration.windowConfiguration; // Adjust the appBounds for TaskBar by using the calculated window crop Rect diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java index 04c0ab0aed..b233521ff2 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION; +import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION; import android.graphics.Rect; import android.util.ArraySet; @@ -114,6 +115,10 @@ public class RecentsAnimationCallbacks implements homeContentInsets, minimizedHomeBounds); Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> { + ActiveGestureLog.INSTANCE.addLog( + /* event= */ "RecentsAnimationCallbacks.onAnimationStart", + /* extras= */ targets.apps.length, + /* gestureEvent= */ START_RECENTS_ANIMATION); for (RecentsAnimationListener listener : getListeners()) { listener.onRecentsAnimationStart(mController, targets); } diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 944e2f985d..24d2b9bb70 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -45,6 +45,7 @@ import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.window.IOnBackInvokedCallback; +import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; import com.android.internal.logging.InstanceId; @@ -481,6 +482,10 @@ public class SystemUiProxy implements ISystemUiProxy { mPipAnimationListener = listener; } + /** + * @return Destination bounds of auto-pip animation, {@code null} if the animation is not ready. + */ + @Nullable public Rect startSwipePipToHome(ComponentName componentName, ActivityInfo activityInfo, PictureInPictureParams pictureInPictureParams, int launcherRotation, Rect hotseatKeepClearArea) { diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index be82f76981..b9a1b0629f 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -36,8 +36,6 @@ import androidx.annotation.UiThread; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.TopTaskTracker.CachedTaskInfo; -import com.android.quickstep.util.ActiveGestureErrorDetector; -import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -137,8 +135,6 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn // handling this call entirely return; } - ActiveGestureLog.INSTANCE.addLog("TaskAnimationManager.startRecentsAnimation", - ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION); mController = controller; mTargets = targets; mLastAppearedTaskTarget = mTargets.findTask(mLastGestureState.getRunningTaskId()); diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 040c55bb9c..4923948180 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -82,7 +82,6 @@ import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.TraceHelper; -import com.android.launcher3.util.ViewCapture; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.inputconsumers.AccessibilityInputConsumer; import com.android.quickstep.inputconsumers.AssistantInputConsumer; @@ -101,6 +100,7 @@ import com.android.quickstep.util.ActiveGestureLog.CompoundString; import com.android.quickstep.util.ProtoTracer; import com.android.quickstep.util.ProxyScreenStatusProvider; import com.android.quickstep.util.SplitScreenBounds; +import com.android.quickstep.util.ViewCapture; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -709,16 +709,19 @@ public class TouchInteractionService extends Service } public GestureState createGestureState(GestureState previousGestureState) { - GestureState gestureState = new GestureState(mOverviewComponentObserver, - ActiveGestureLog.INSTANCE.incrementLogId()); + final GestureState gestureState; TopTaskTracker.CachedTaskInfo taskInfo; if (mTaskAnimationManager.isRecentsAnimationRunning()) { + gestureState = new GestureState(mOverviewComponentObserver, + ActiveGestureLog.INSTANCE.getLogId()); taskInfo = previousGestureState.getRunningTask(); gestureState.updateRunningTask(taskInfo); gestureState.updateLastStartedTaskId(previousGestureState.getLastStartedTaskId()); gestureState.updatePreviouslyAppearedTaskIds( previousGestureState.getPreviouslyAppearedTaskIds()); } else { + gestureState = new GestureState(mOverviewComponentObserver, + ActiveGestureLog.INSTANCE.incrementLogId()); taskInfo = TopTaskTracker.INSTANCE.get(this).getCachedTopTask(false); gestureState.updateRunningTask(taskInfo); } diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java b/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java index 40eb31b727..23fdd58877 100644 --- a/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java +++ b/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java @@ -161,16 +161,14 @@ public class ActiveGestureLog { ArrayList eventLogs = new ArrayList<>(); for (int i = 0; i < logs.length; i++) { - EventLog eventLog = logs[(nextIndex + logs.length - i - 1) % logs.length]; + EventLog eventLog = logs[(nextIndex + i) % logs.length]; if (eventLog == null) { continue; } eventLogs.add(eventLog); writer.println(prefix + "\tLogs for logId: " + eventLog.logId); - List eventEntries = eventLog.eventEntries; - for (int j = eventEntries.size() - 1; j >= 0; j--) { - EventEntry eventEntry = eventEntries.get(j); + for (EventEntry eventEntry : eventLog.eventEntries) { date.setTime(eventEntry.time); StringBuilder msg = new StringBuilder(prefix + "\t\t").append(sdf.format(date)) @@ -215,6 +213,11 @@ public class ActiveGestureLog { return mCurrentLogId++; } + /** Returns the current log ID. This should be used when a log trace is being reused. */ + public int getLogId() { + return mCurrentLogId; + } + private boolean isEntrySame( EventEntry entry, int type, diff --git a/src/com/android/launcher3/util/ViewCapture.java b/quickstep/src/com/android/quickstep/util/ViewCapture.java similarity index 98% rename from src/com/android/launcher3/util/ViewCapture.java rename to quickstep/src/com/android/quickstep/util/ViewCapture.java index 0cf3ad7e4c..6071bc8261 100644 --- a/src/com/android/launcher3/util/ViewCapture.java +++ b/quickstep/src/com/android/quickstep/util/ViewCapture.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.util; +package com.android.quickstep.util; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; @@ -44,6 +44,9 @@ import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.util.LooperExecutor; +import com.android.launcher3.util.MainThreadInitializedObject; +import com.android.launcher3.util.SafeCloseable; import com.android.launcher3.view.ViewCaptureData.ExportedData; import com.android.launcher3.view.ViewCaptureData.FrameData; import com.android.launcher3.view.ViewCaptureData.ViewNode; diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index 879a159987..d8d3fa33dd 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -491,6 +491,7 @@ public abstract class BaseAllAppsContainerView 0) { // Before the child is rendered, apply the animation including it to avoid flicker. updateSearchRecyclerViewProgress(); diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 0e36dc0e60..ef6350ed54 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -289,10 +289,8 @@ public final class FeatureFlags { "Enable option to log the keyboard latency for both atomic and controlled keyboard " + "animations on an EditText"); - // Change of wallpaper depth in widget picker is disabled for tests as it causes flakiness on - // very slow cuttlefish devices. public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag( - "ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker."); + "ENABLE_WIDGET_PICKER_DEPTH", false, "Enable changing depth in widget picker."); public static void initialize(Context context) { synchronized (sDebugFlags) { diff --git a/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java b/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java index 8f095bc036..2846cae1e8 100644 --- a/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java +++ b/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java @@ -35,6 +35,7 @@ import com.android.launcher3.tapl.Widget; import com.android.launcher3.tapl.WidgetResizeFrame; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.TaplTestsLauncher3; +import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.views.DoubleShadowBubbleTextView; import com.android.launcher3.widget.LauncherAppWidgetHostView; @@ -145,22 +146,26 @@ public class ReorderWidgets extends AbstractLauncherUiTest { runTestCase(testCaseMap.get(iconGridDimensions)); } + @ScreenRecord // b/242323136 @Test public void simpleReorder() throws ExecutionException, InterruptedException { runTestCaseMap(SimpleReorderCase.TEST_BY_GRID_SIZE, SimpleReorderCase.class.getSimpleName()); } + @ScreenRecord // b/242323136 @Test public void pushTest() throws ExecutionException, InterruptedException { runTestCaseMap(PushReorderCase.TEST_BY_GRID_SIZE, PushReorderCase.class.getSimpleName()); } + @ScreenRecord // b/242323136 @Test public void fullReorder() throws ExecutionException, InterruptedException { runTestCaseMap(FullReorderCase.TEST_BY_GRID_SIZE, FullReorderCase.class.getSimpleName()); } + @ScreenRecord // b/242323136 @Test public void moveOutReorder() throws ExecutionException, InterruptedException { runTestCaseMap(MoveOutReorderCase.TEST_BY_GRID_SIZE, diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 15f74dc76b..3dcb4377e7 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -85,10 +85,9 @@ public abstract class Launchable { } Point startDrag(long downTime, Runnable expectLongClickEvents, boolean runToSpringLoadedState) { - Point iconCenter = getObject().getVisibleCenter(); - final Point displaySize = mLauncher.getRealDisplaySize(); - final Point dragStartCenter = new Point(displaySize.x / 2, - displaySize.y / 2 - getStartDragThreshold()); + final Point iconCenter = getObject().getVisibleCenter(); + final Point dragStartCenter = new Point(iconCenter.x, + iconCenter.y - getStartDragThreshold()); if (runToSpringLoadedState) { mLauncher.runToState(() -> movePointerForStartDrag(