diff --git a/quickstep/res/values-de/strings.xml b/quickstep/res/values-de/strings.xml index 86ea26461f..c7664be036 100644 --- a/quickstep/res/values-de/strings.xml +++ b/quickstep/res/values-de/strings.xml @@ -78,7 +78,7 @@ "Fertig!" "Nach oben wischen, um den Startbildschirm aufzurufen" "Startbildschirmtaste drücken, um zum Startbildschirm zu gehen" - "Du kannst dein Gerät (%1$s) jetzt verwenden" + "Du kannst dein %1$s jetzt verwenden" "Gerät" "Einstellungen der Systemsteuerung" "Teilen" diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 857ace25b1..8409475e4c 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -324,6 +324,9 @@ public abstract class AbsSwipeUpHandler, // May be set to false when mIsTransientTaskbar is true. private boolean mCanSlowSwipeGoHome = true; + @Nullable + private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null; + public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs, boolean continuingLastGesture, @@ -869,6 +872,9 @@ public abstract class AbsSwipeUpHandler, mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(mContext, targets); mRecentsAnimationController = controller; mRecentsAnimationTargets = targets; + mSwipePipToHomeReleaseCheck = new RemoteAnimationTargets.ReleaseCheck(); + mSwipePipToHomeReleaseCheck.setCanRelease(true); + mRecentsAnimationTargets.addReleaseCheck(mSwipePipToHomeReleaseCheck); // Only initialize the device profile, if it has not been initialized before, as in some // configurations targets.homeContentInsets may not be correct. @@ -1430,9 +1436,16 @@ public abstract class AbsSwipeUpHandler, mSwipePipToHomeAnimator = createWindowAnimationToPip( homeAnimFactory, runningTaskTarget, start); mSwipePipToHomeAnimators[0] = mSwipePipToHomeAnimator; + if (mSwipePipToHomeReleaseCheck != null) { + mSwipePipToHomeReleaseCheck.setCanRelease(false); + } windowAnim = mSwipePipToHomeAnimators; } else { mSwipePipToHomeAnimator = null; + if (mSwipePipToHomeReleaseCheck != null) { + mSwipePipToHomeReleaseCheck.setCanRelease(true); + mSwipePipToHomeReleaseCheck = null; + } windowAnim = createWindowAnimationToHome(start, homeAnimFactory); windowAnim[0].addAnimatorListener(new AnimationSuccessListener() { @@ -1954,6 +1967,10 @@ public abstract class AbsSwipeUpHandler, finishRecentsControllerToHome( () -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED)); } + if (mSwipePipToHomeReleaseCheck != null) { + mSwipePipToHomeReleaseCheck.setCanRelease(true); + mSwipePipToHomeReleaseCheck = null; + } doLogGesture(HOME, mRecentsView == null ? null : mRecentsView.getCurrentPageTaskView()); } diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 9a2fcc02d9..9f34775761 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -262,6 +262,19 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { return launchedAppState; } + private void quickSwitchToPreviousAppAndAssert(boolean toRight) { + final LaunchedAppState launchedAppState = getAndAssertLaunchedApp(); + if (toRight) { + launchedAppState.quickSwitchToPreviousApp(); + } else { + launchedAppState.quickSwitchToPreviousAppSwipeLeft(); + } + + // While enable shell transition, Launcher can be resumed due to transient launch. + waitForLauncherCondition("Launcher shouldn't stay in resume forever", + this::isInLaunchedApp, 3000 /* timeout */); + } + @Test @PortraitLandscape public void testAllAppsFromHome() throws Exception { @@ -288,13 +301,11 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { startTestActivity(3); startTestActivity(4); - LaunchedAppState launchedAppState = getAndAssertLaunchedApp(); - launchedAppState.quickSwitchToPreviousApp(); + quickSwitchToPreviousAppAndAssert(true /* toRight */); assertTrue("The first app we should have quick switched to is not running", isTestActivityRunning(3)); - launchedAppState = getAndAssertLaunchedApp(); - launchedAppState.quickSwitchToPreviousApp(); + quickSwitchToPreviousAppAndAssert(true /* toRight */); if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) { // 3-button mode toggles between 2 apps, rather than going back further. assertTrue("Second quick switch should have returned to the first app.", @@ -303,12 +314,12 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { assertTrue("The second app we should have quick switched to is not running", isTestActivityRunning(2)); } - launchedAppState = getAndAssertLaunchedApp(); - launchedAppState.quickSwitchToPreviousAppSwipeLeft(); + + quickSwitchToPreviousAppAndAssert(false /* toRight */); assertTrue("The 2nd app we should have quick switched to is not running", isTestActivityRunning(3)); - launchedAppState = getAndAssertLaunchedApp(); + final LaunchedAppState launchedAppState = getAndAssertLaunchedApp(); launchedAppState.switchToOverview(); } @@ -327,8 +338,10 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { launchedAppState.assertTaskbarHidden(); // Quick-switch to the test app with swiping to right. - launchedAppState.quickSwitchToPreviousApp(); + quickSwitchToPreviousAppAndAssert(true /* toRight */); + assertTrue("The first app we should have quick switched to is not running", + isTestActivityRunning(2)); // Expect task bar visible when the launched app was the test activity. launchedAppState = getAndAssertLaunchedApp(); launchedAppState.assertTaskbarVisible(); diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index fc1b830aed..29767bf465 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -239,23 +239,24 @@ public class AlphabeticalAppsList implement mAdapterItems.addAll(mSearchResults); } else { int position = 0; + boolean addApps = true; if (mWorkProviderManager != null) { position += mWorkProviderManager.addWorkItems(mAdapterItems); - if (!mWorkProviderManager.shouldShowWorkApps()) { - return; - } + addApps = mWorkProviderManager.shouldShowWorkApps(); } - String lastSectionName = null; - for (AppInfo info : mApps) { - mAdapterItems.add(AdapterItem.asApp(info)); + if (addApps) { + String lastSectionName = null; + for (AppInfo info : mApps) { + mAdapterItems.add(AdapterItem.asApp(info)); - String sectionName = info.sectionName; - // Create a new section if the section names do not match - if (!sectionName.equals(lastSectionName)) { - lastSectionName = sectionName; - mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, position)); + String sectionName = info.sectionName; + // Create a new section if the section names do not match + if (!sectionName.equals(lastSectionName)) { + lastSectionName = sectionName; + mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, position)); + } + position++; } - position++; } } mAccessibilityResultsCount = (int) mAdapterItems.stream() diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index ca08164a05..00e89bacc5 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -163,7 +163,8 @@ public abstract class BaseAllAppsContainerView mAllApps; private final Predicate mMatcher; + private final StatsLogManager mStatsLogManager; private WorkModeSwitch mWorkModeSwitch; @@ -88,11 +89,13 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP private SharedPreferences mPreferences; public WorkProfileManager( - UserManager userManager, BaseAllAppsContainerView allApps, SharedPreferences prefs) { + UserManager userManager, BaseAllAppsContainerView allApps, SharedPreferences prefs, + StatsLogManager statsLogManager) { mUserManager = userManager; mAllApps = allApps; mPreferences = prefs; mMatcher = mAllApps.mPersonalMatcher.negate(); + mStatsLogManager = statsLogManager; } /** @@ -227,9 +230,7 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP private void onWorkFabClicked(View view) { if (Utilities.ATLEAST_P && mCurrentState == STATE_ENABLED && mWorkModeSwitch.isEnabled()) { - ActivityContext activityContext = ActivityContext.lookupContext( - mWorkModeSwitch.getContext()); - activityContext.getStatsLogManager().logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP); + mStatsLogManager.logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP); setWorkProfileEnabled(false); } } diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 24d8c9dc5e..2159c6b68f 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -624,7 +624,13 @@ public class StatsLogManager implements ResourceBasedOverride { LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_RIGHT_BOTTOM(1232), @UiEvent(doc = "User has invoked split to left half with a keyboard shortcut.") - LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_LEFT_TOP(1233) + LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_LEFT_TOP(1233), + + @UiEvent(doc = "User has collapsed the work FAB button by swiping down") + LAUNCHER_WORK_FAB_BUTTON_COLLAPSE(1276), + + @UiEvent(doc = "User has collapsed the work FAB button by swiping up") + LAUNCHER_WORK_FAB_BUTTON_EXTEND(1277), ; // ADD MORE diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java index 3f4a1c128e..2c9785c93d 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java @@ -37,7 +37,6 @@ import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -65,7 +64,6 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest { mAppWidgetManager = AppWidgetManager.getInstance(mTargetContext); } - @Ignore @Test @PortraitLandscape public void testWidgetConfig() throws Throwable {