Merge changes Iceb7c9cf,I1e802e67 into main

* changes:
  Fix NPE in LauncherSwipeHandlerV2Test.setup
  Update recents states sent to tests by RecentsWindowManager
This commit is contained in:
Schneider Victor-tulias
2025-01-07 07:46:03 -08:00
committed by Android (Google) Code Review
8 changed files with 37 additions and 10 deletions
@@ -43,6 +43,8 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_EXIT_DESKTOP_MODE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT;
import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;
import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK;
@@ -114,6 +116,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.contextualeducation.ContextualEduStatsManager;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.logging.StatsLogManager;
@@ -170,8 +173,6 @@ import com.android.wm.shell.shared.startingsurface.SplashScreenExitAnimationUtil
import com.google.android.msdl.data.model.MSDLToken;
import kotlin.Unit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -181,6 +182,8 @@ import java.util.Optional;
import java.util.OptionalInt;
import java.util.function.Consumer;
import kotlin.Unit;
/**
* Handles the navigation gestures when Launcher is the default home activity.
*/
@@ -1185,11 +1188,13 @@ public abstract class AbsSwipeUpHandler<
if (endTarget != HOME) {
InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
} else {
AccessibilityManagerCompat.sendStateEventToTest(mContext, NORMAL_STATE_ORDINAL);
InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
}
if (endTarget != RECENTS) {
InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
} else {
AccessibilityManagerCompat.sendStateEventToTest(mContext, OVERVIEW_STATE_ORDINAL);
InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
}
@@ -42,6 +42,7 @@ import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory
import com.android.launcher3.statemanager.StatefulContainer
import com.android.launcher3.taskbar.TaskbarUIController
import com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL
import com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_SPLIT_SELECT_ORDINAL
import com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL
import com.android.launcher3.util.ContextTracker
import com.android.launcher3.util.DisplayController
@@ -350,17 +351,23 @@ class RecentsWindowManager(context: Context) :
cleanupRecentsWindow()
}
when (state) {
HOME ->
HOME,
BG_LAUNCHER ->
AccessibilityManagerCompat.sendStateEventToTest(baseContext, NORMAL_STATE_ORDINAL)
DEFAULT ->
AccessibilityManagerCompat.sendStateEventToTest(baseContext, OVERVIEW_STATE_ORDINAL)
OVERVIEW_SPLIT_SELECT ->
AccessibilityManagerCompat.sendStateEventToTest(
baseContext,
OVERVIEW_SPLIT_SELECT_ORDINAL,
)
}
}
private fun getStateName(state: RecentsState?): String {
return when (state) {
null -> "NULL"
DEFAULT -> "default"
DEFAULT -> "DEFAULT"
MODAL_TASK -> "MODAL_TASK"
BACKGROUND_APP -> "BACKGROUND_APP"
HOME -> "HOME"
@@ -53,8 +53,6 @@ class LauncherSwipeHandlerV2Test {
@Mock private lateinit var systemUiProxy: SystemUiProxy
@Mock private lateinit var recentsDisplayModel: RecentsDisplayModel
@Mock private lateinit var msdlPlayerWrapper: MSDLPlayerWrapper
private lateinit var underTest: LauncherSwipeHandlerV2
@@ -72,7 +70,7 @@ class LauncherSwipeHandlerV2Test {
sandboxContext.initDaggerComponent(
DaggerTestComponent.builder()
.bindSystemUiProxy(systemUiProxy)
.bindRecentsDisplayModel(recentsDisplayModel)
.bindRecentsDisplayModel(RecentsDisplayModel(sandboxContext))
)
val deviceState = mock(RecentsAnimationDeviceState::class.java)
@@ -170,6 +170,7 @@ public final class TestProtocol {
public static final String ICON_MISSING = "b/282963545";
public static final String REQUEST_FLAG_ENABLE_GRID_ONLY_OVERVIEW = "enable-grid-only-overview";
public static final String REQUEST_FLAG_ENABLE_APP_PAIRS = "enable-app-pairs";
public static final String REQUEST_IS_RECENTS_WINDOW_ENABLED = "recents-window-enabled";
public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED =
"unstash-bubble-bar-if-stashed";
@@ -15,7 +15,9 @@
*/
package com.android.launcher3.testing;
import static com.android.launcher3.Flags.enableFallbackOverviewInWindow;
import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.launcher3.Flags.enableLauncherOverviewInWindow;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
@@ -330,6 +332,12 @@ public class TestInformationHandler implements ResourceBasedOverride {
return response;
}
case TestProtocol.REQUEST_IS_RECENTS_WINDOW_ENABLED: {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
enableLauncherOverviewInWindow() || enableFallbackOverviewInWindow());
return response;
}
case TestProtocol.REQUEST_APP_LIST_FREEZE_FLAGS: {
return getLauncherUIProperty(Bundle::putInt,
l -> l.getAppsView().getAppsStore().getDeferUpdatesFlags());
@@ -60,7 +60,8 @@ public abstract class Home extends Background {
@Override
protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
return true;
return !mLauncher.isRecentsWindowEnabled()
|| super.zeroButtonToOverviewGestureStateTransitionWhileHolding();
}
@Override
@@ -954,7 +954,7 @@ public final class LauncherInstrumentation {
waitUntilLauncherObjectGone(APPS_RES_ID);
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
if (isTablet() && !is3PLauncher()) {
if (isTablet() && !is3PLauncher() && !isRecentsWindowEnabled()) {
waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
@@ -1008,6 +1008,11 @@ public final class LauncherInstrumentation {
}
}
boolean isRecentsWindowEnabled() {
return getTestInfo(TestProtocol.REQUEST_IS_RECENTS_WINDOW_ENABLED)
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
public void waitForModelQueueCleared() {
getTestInfo(TestProtocol.REQUEST_MODEL_QUEUE_CLEARED);
}
@@ -843,7 +843,9 @@ public final class Workspace extends Home {
@Override
protected String getSwipeHeightRequestName() {
return TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT;
return mLauncher.isRecentsWindowEnabled()
? super.getSwipeHeightRequestName()
: TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT;
}
@Override