use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherActivityInterface method onSwipeUpToHomeComplete.
@Override
public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
Launcher launcher = getCreatedActivity();
if (launcher == null) {
return;
}
// When going to home, the state animator we use has SKIP_OVERVIEW because we assume that
// setRecentsAttachedToAppWindow() will handle animating Overview instead. Thus, at the end
// of the animation, we should ensure recents is at the correct position for NORMAL state.
// For example, when doing a long swipe to home, RecentsView may be scaled down. This is
// relatively expensive, so do it on the next frame instead of critical path.
MAIN_EXECUTOR.getHandler().post(launcher.getStateManager()::reapplyState);
launcher.getRootView().setForceHideBackArrow(false);
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherActivityInterface method onLaunchTaskFailed.
@Override
public void onLaunchTaskFailed() {
Launcher launcher = getCreatedActivity();
if (launcher == null) {
return;
}
launcher.getStateManager().goToState(OVERVIEW);
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.
the class QuickstepLauncher method onStateOrResumeChanging.
/**
* Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
*/
private void onStateOrResumeChanging(boolean inTransition) {
LauncherState state = getStateManager().getState();
boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
if (started) {
DeviceProfile profile = getDeviceProfile();
boolean willUserBeActive = (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
boolean visible = (state == NORMAL || state == OVERVIEW) && (willUserBeActive || isUserActive()) && !profile.isVerticalBarLayout() && profile.isPhone && !profile.isLandscape;
UiThreadHelper.runAsyncCommand(this, SET_SHELF_HEIGHT, visible ? 1 : 0, profile.hotseatBarSizePx);
}
if (state == NORMAL && !inTransition) {
((RecentsView) getOverviewPanel()).setSwipeDownShouldLaunchApp(false);
}
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.
the class FallbackRecentsTest method testOverview.
// b/143488140
// @NavigationModeSwitch
@Test
public void testOverview() {
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
startTestActivity(2);
Wait.atMost("Expected three apps in the task list", () -> mLauncher.getRecentTasks().size() >= 3, DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
BaseOverview overview = mLauncher.getBackground().switchToOverview();
executeOnRecents(recents -> {
assertTrue("Don't have at least 3 tasks", getTaskCount(recents) >= 3);
});
// Test flinging forward and backward.
overview.flingForward();
final Integer currentTaskAfterFlingForward = getFromRecents(this::getCurrentOverviewPage);
executeOnRecents(recents -> assertTrue("Current task in Overview is still 0", currentTaskAfterFlingForward > 0));
overview.flingBackward();
executeOnRecents(recents -> assertTrue("Flinging back in Overview did nothing", getCurrentOverviewPage(recents) < currentTaskAfterFlingForward));
// Test opening a task.
overview = pressHomeAndGoToOverview();
OverviewTask task = overview.getCurrentTask();
assertNotNull("overview.getCurrentTask() returned null (1)", task);
assertNotNull("OverviewTask.open returned null", task.open());
assertTrue("Test activity didn't open from Overview", TestHelpers.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT));
// Test dismissing a task.
overview = pressHomeAndGoToOverview();
final Integer numTasks = getFromRecents(this::getTaskCount);
task = overview.getCurrentTask();
assertNotNull("overview.getCurrentTask() returned null (2)", task);
task.dismiss();
executeOnRecents(recents -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(recents)));
// Test dismissing all tasks.
pressHomeAndGoToOverview().dismissAllTasks();
assertTrue("Fallback Launcher not visible", TestHelpers.wait(Until.hasObject(By.pkg(mOtherLauncherActivity.packageName)), WAIT_TIME_MS));
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.
the class TaplTestsQuickstep method testOverviewActions.
/**
* Smoke test for action buttons: Presses all the buttons and makes sure no crashes occur.
*/
@Test
@NavigationModeSwitch
@PortraitLandscape
public void testOverviewActions() throws Exception {
// Experimenting for b/165029151:
final Overview overview = mLauncher.pressHome().switchToOverview();
if (overview.hasTasks())
overview.dismissAllTasks();
mLauncher.pressHome();
//
startTestAppsWithCheck();
OverviewActions actionsView = mLauncher.pressHome().switchToOverview().getOverviewActions();
actionsView.clickAndDismissScreenshot();
actionsView.clickAndDismissShare();
}
Aggregations