Loading quickstep/src/com/android/quickstep/util/NavigationModeFeatureFlag.java +8 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TI import android.content.Context; import com.android.quickstep.OverviewComponentObserver; import com.android.quickstep.RecentsAnimationDeviceState; import com.android.quickstep.SysUINavigationMode; import java.util.function.Predicate; Loading @@ -35,6 +37,7 @@ public class NavigationModeFeatureFlag implements private final Supplier<Boolean> mBasePredicate; private final Predicate<SysUINavigationMode.Mode> mModePredicate; private boolean mSupported; private OverviewComponentObserver mObserver; private NavigationModeFeatureFlag(Supplier<Boolean> basePredicate, Predicate<SysUINavigationMode.Mode> modePredicate) { Loading @@ -43,12 +46,16 @@ public class NavigationModeFeatureFlag implements } public boolean get() { return mBasePredicate.get() && mSupported; return mBasePredicate.get() && mSupported && mObserver.isHomeAndOverviewSame(); } public void initialize(Context context) { onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(context).getMode()); SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this); // Temporary solution to disable live tile for the fallback launcher RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(context); mObserver = new OverviewComponentObserver(context, rads); } @Override Loading quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java +53 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,15 @@ package com.android.quickstep; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; import static org.junit.Assert.assertTrue; import com.android.launcher3.Launcher; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.quickstep.views.RecentsView; import org.junit.rules.RuleChain; import org.junit.rules.TestRule; Loading @@ -31,4 +39,49 @@ public abstract class AbstractQuickStepTest extends AbstractLauncherUiTest { outerRule(new NavigationModeSwitchRule(mLauncher)). around(super.getRulesInsideActivityMonitor()); } @Override protected void onLauncherActivityClose(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); if (recentsView != null) { recentsView.finishRecentsAnimation(true, null); } } @Override protected void checkLauncherState(Launcher launcher, ContainerType expectedContainerType, boolean isResumed, boolean isStarted) { if (!isInLiveTileMode(launcher, expectedContainerType)) { super.checkLauncherState(launcher, expectedContainerType, isResumed, isStarted); } else { assertTrue("[Live Tile] hasBeenResumed() == isStarted(), hasBeenResumed(): " + isResumed, isResumed != isStarted); } } @Override protected void checkLauncherStateInOverview(Launcher launcher, ContainerType expectedContainerType, boolean isStarted, boolean isResumed) { if (!isInLiveTileMode(launcher, expectedContainerType)) { super.checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, isResumed); } else { assertTrue( "[Live Tile] Launcher is not started or has been resumed in state: " + expectedContainerType, isStarted && !isResumed); } } private boolean isInLiveTileMode(Launcher launcher, LauncherInstrumentation.ContainerType expectedContainerType) { if (!LIVE_TILE.get() || expectedContainerType != LauncherInstrumentation.ContainerType.OVERVIEW) { return false; } RecentsView recentsView = launcher.getOverviewPanel(); return recentsView.getSizeStrategy().isInLiveTileMode() && recentsView.getRunningTaskId() != -1; } } quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest { // The test action. mLauncher.getBackground().switchToOverview(); } closeLauncherActivity(); mLauncher.pressHome(); } } tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +21 −7 Original line number Diff line number Diff line Loading @@ -503,6 +503,7 @@ public abstract class AbstractLauncherUiTest { // Destroy Launcher activity. executeOnLauncher(launcher -> { if (launcher != null) { onLauncherActivityClose(launcher); launcher.finish(); } }); Loading @@ -524,7 +525,7 @@ public abstract class AbstractLauncherUiTest { return launcher.getAppsView().getActiveRecyclerView().getCurrentScrollY(); } private static void checkLauncherIntegrity( private void checkLauncherIntegrity( Launcher launcher, ContainerType expectedContainerType) { if (launcher != null) { final StateManager<LauncherState> stateManager = launcher.getStateManager(); Loading @@ -535,10 +536,8 @@ public abstract class AbstractLauncherUiTest { stableState == stateManager.getState()); final boolean isResumed = launcher.hasBeenResumed(); assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == launcher.isStarted()); assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive()); final boolean isStarted = launcher.isStarted(); checkLauncherState(launcher, expectedContainerType, isResumed, isStarted); final int ordinal = stableState.ordinal; Loading @@ -561,8 +560,7 @@ public abstract class AbstractLauncherUiTest { break; } case OVERVIEW: { assertTrue( "Launcher is not resumed in state: " + expectedContainerType, checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, isResumed); assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL); Loading @@ -587,4 +585,20 @@ public abstract class AbstractLauncherUiTest { expectedContainerType == ContainerType.FALLBACK_OVERVIEW); } } protected void checkLauncherState(Launcher launcher, ContainerType expectedContainerType, boolean isResumed, boolean isStarted) { assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == isStarted); assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive()); } protected void checkLauncherStateInOverview(Launcher launcher, ContainerType expectedContainerType, boolean isStarted, boolean isResumed) { assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed); } protected void onLauncherActivityClose(Launcher launcher) { } } Loading
quickstep/src/com/android/quickstep/util/NavigationModeFeatureFlag.java +8 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TI import android.content.Context; import com.android.quickstep.OverviewComponentObserver; import com.android.quickstep.RecentsAnimationDeviceState; import com.android.quickstep.SysUINavigationMode; import java.util.function.Predicate; Loading @@ -35,6 +37,7 @@ public class NavigationModeFeatureFlag implements private final Supplier<Boolean> mBasePredicate; private final Predicate<SysUINavigationMode.Mode> mModePredicate; private boolean mSupported; private OverviewComponentObserver mObserver; private NavigationModeFeatureFlag(Supplier<Boolean> basePredicate, Predicate<SysUINavigationMode.Mode> modePredicate) { Loading @@ -43,12 +46,16 @@ public class NavigationModeFeatureFlag implements } public boolean get() { return mBasePredicate.get() && mSupported; return mBasePredicate.get() && mSupported && mObserver.isHomeAndOverviewSame(); } public void initialize(Context context) { onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(context).getMode()); SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this); // Temporary solution to disable live tile for the fallback launcher RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(context); mObserver = new OverviewComponentObserver(context, rads); } @Override Loading
quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java +53 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,15 @@ package com.android.quickstep; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; import static org.junit.Assert.assertTrue; import com.android.launcher3.Launcher; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.quickstep.views.RecentsView; import org.junit.rules.RuleChain; import org.junit.rules.TestRule; Loading @@ -31,4 +39,49 @@ public abstract class AbstractQuickStepTest extends AbstractLauncherUiTest { outerRule(new NavigationModeSwitchRule(mLauncher)). around(super.getRulesInsideActivityMonitor()); } @Override protected void onLauncherActivityClose(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); if (recentsView != null) { recentsView.finishRecentsAnimation(true, null); } } @Override protected void checkLauncherState(Launcher launcher, ContainerType expectedContainerType, boolean isResumed, boolean isStarted) { if (!isInLiveTileMode(launcher, expectedContainerType)) { super.checkLauncherState(launcher, expectedContainerType, isResumed, isStarted); } else { assertTrue("[Live Tile] hasBeenResumed() == isStarted(), hasBeenResumed(): " + isResumed, isResumed != isStarted); } } @Override protected void checkLauncherStateInOverview(Launcher launcher, ContainerType expectedContainerType, boolean isStarted, boolean isResumed) { if (!isInLiveTileMode(launcher, expectedContainerType)) { super.checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, isResumed); } else { assertTrue( "[Live Tile] Launcher is not started or has been resumed in state: " + expectedContainerType, isStarted && !isResumed); } } private boolean isInLiveTileMode(Launcher launcher, LauncherInstrumentation.ContainerType expectedContainerType) { if (!LIVE_TILE.get() || expectedContainerType != LauncherInstrumentation.ContainerType.OVERVIEW) { return false; } RecentsView recentsView = launcher.getOverviewPanel(); return recentsView.getSizeStrategy().isInLiveTileMode() && recentsView.getRunningTaskId() != -1; } }
quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest { // The test action. mLauncher.getBackground().switchToOverview(); } closeLauncherActivity(); mLauncher.pressHome(); } }
tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +21 −7 Original line number Diff line number Diff line Loading @@ -503,6 +503,7 @@ public abstract class AbstractLauncherUiTest { // Destroy Launcher activity. executeOnLauncher(launcher -> { if (launcher != null) { onLauncherActivityClose(launcher); launcher.finish(); } }); Loading @@ -524,7 +525,7 @@ public abstract class AbstractLauncherUiTest { return launcher.getAppsView().getActiveRecyclerView().getCurrentScrollY(); } private static void checkLauncherIntegrity( private void checkLauncherIntegrity( Launcher launcher, ContainerType expectedContainerType) { if (launcher != null) { final StateManager<LauncherState> stateManager = launcher.getStateManager(); Loading @@ -535,10 +536,8 @@ public abstract class AbstractLauncherUiTest { stableState == stateManager.getState()); final boolean isResumed = launcher.hasBeenResumed(); assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == launcher.isStarted()); assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive()); final boolean isStarted = launcher.isStarted(); checkLauncherState(launcher, expectedContainerType, isResumed, isStarted); final int ordinal = stableState.ordinal; Loading @@ -561,8 +560,7 @@ public abstract class AbstractLauncherUiTest { break; } case OVERVIEW: { assertTrue( "Launcher is not resumed in state: " + expectedContainerType, checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, isResumed); assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL); Loading @@ -587,4 +585,20 @@ public abstract class AbstractLauncherUiTest { expectedContainerType == ContainerType.FALLBACK_OVERVIEW); } } protected void checkLauncherState(Launcher launcher, ContainerType expectedContainerType, boolean isResumed, boolean isStarted) { assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == isStarted); assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive()); } protected void checkLauncherStateInOverview(Launcher launcher, ContainerType expectedContainerType, boolean isStarted, boolean isResumed) { assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed); } protected void onLauncherActivityClose(Launcher launcher) { } }