diff --git a/quickstep/src/com/android/launcher3/model/AppEventProducer.java b/quickstep/src/com/android/launcher3/model/AppEventProducer.java index 3f29e433d9..5c669441c7 100644 --- a/quickstep/src/com/android/launcher3/model/AppEventProducer.java +++ b/quickstep/src/com/android/launcher3/model/AppEventProducer.java @@ -18,6 +18,7 @@ package com.android.launcher3.model; import static android.app.prediction.AppTargetEvent.ACTION_DISMISS; import static android.app.prediction.AppTargetEvent.ACTION_LAUNCH; import static android.app.prediction.AppTargetEvent.ACTION_PIN; +import static android.app.prediction.AppTargetEvent.ACTION_UNDISMISS; import static android.app.prediction.AppTargetEvent.ACTION_UNPIN; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION; @@ -25,6 +26,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICT import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION; import static com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers.ContainerCase.DEVICE_SEARCH_RESULT_CONTAINER; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DISMISS_PREDICTION_UNDO; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_CONVERTED_TO_ICON; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOTSEAT_PREDICTION_PINNED; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED; @@ -176,6 +178,8 @@ public class AppEventProducer implements StatsLogConsumer { mContext.getPackageName(), Process.myUserHandle()) .build(); sendEvent(target, atomInfo, ACTION_LAUNCH, CONTAINER_PREDICTION); + } else if (event == LAUNCHER_DISMISS_PREDICTION_UNDO) { + sendEvent(atomInfo, ACTION_UNDISMISS, CONTAINER_HOTSEAT_PREDICTION); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 06107b8904..7abe6d4bfa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -65,6 +65,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba | FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_APP_ALL_APPS; + private static final int FLAGS_STASHED_IN_APP_IGNORING_IME = + FLAGS_STASHED_IN_APP & ~FLAG_STASHED_IN_APP_IME; + // If any of these flags are enabled, inset apps by our stashed height instead of our unstashed // height. This way the reported insets are consistent even during transitions out of the app. // Currently any flag that causes us to stash in an app is included, except for IME or All Apps @@ -238,6 +241,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba return hasAnyFlag(FLAGS_STASHED_IN_APP); } + /** + * Returns whether the taskbar should be stashed in apps regardless of the IME visibility. + */ + public boolean isStashedInAppIgnoringIme() { + return hasAnyFlag(FLAGS_STASHED_IN_APP_IGNORING_IME); + } + /** * Returns whether the taskbar should be stashed in the current LauncherState. */ @@ -586,7 +596,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private void notifyStashChange(boolean visible, boolean stashed) { mSystemUiProxy.notifyTaskbarStatus(visible, stashed); - mControllers.taskbarActivityContext.updateInsetRoundedCornerFrame(visible && !stashed); + // If stashing taskbar is caused by IME visibility, we could just skip updating rounded + // corner insets since the rounded corners will be covered by IME during IME is showing and + // taskbar will be restored back to unstashed when IME is hidden. + mControllers.taskbarActivityContext.updateInsetRoundedCornerFrame( + visible && !isStashedInAppIgnoringIme()); mControllers.rotationButtonController.onTaskbarStateChange(visible, stashed); } diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index a38728a357..53296b52c1 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -71,6 +71,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.provider.RestoreDbTask; import com.android.launcher3.statemanager.StatefulActivity; +import com.android.launcher3.taskbar.TaskbarActivityContext; import com.android.launcher3.taskbar.TaskbarManager; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; @@ -688,11 +689,9 @@ public class TouchInteractionService extends Service } // If Taskbar is present, we listen for long press to unstash it. - BaseActivityInterface activityInterface = newGestureState.getActivityInterface(); - StatefulActivity activity = activityInterface.getCreatedActivity(); - if (activity != null && activity.getDeviceProfile().isTaskbarPresent) { - base = new TaskbarStashInputConsumer(this, base, mInputMonitorCompat, - mTaskbarManager.getCurrentActivityContext()); + TaskbarActivityContext tac = mTaskbarManager.getCurrentActivityContext(); + if (tac != null) { + base = new TaskbarStashInputConsumer(this, base, mInputMonitorCompat, tac); } // If Bubbles is expanded, use the overlay input consumer, which will close Bubbles diff --git a/quickstep/src/com/android/quickstep/interaction/EdgeBackGestureHandler.java b/quickstep/src/com/android/quickstep/interaction/EdgeBackGestureHandler.java index c532f8e43d..d059d828f8 100644 --- a/quickstep/src/com/android/quickstep/interaction/EdgeBackGestureHandler.java +++ b/quickstep/src/com/android/quickstep/interaction/EdgeBackGestureHandler.java @@ -31,6 +31,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.ResourceUtils; import com.android.launcher3.Utilities; +import com.android.launcher3.util.DisplayController; /** * Utility class to handle edge swipes for back gestures. @@ -115,10 +116,9 @@ public class EdgeBackGestureHandler implements OnTouchListener { // Add a nav bar panel window. mEdgeBackPanel = new EdgeBackGesturePanel(mContext, parent, createLayoutParams()); mEdgeBackPanel.setBackCallback(mBackCallback); - if (mContext.getDisplay() != null) { - mContext.getDisplay().getRealSize(mDisplaySize); - mEdgeBackPanel.setDisplaySize(mDisplaySize); - } + Point currentSize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize; + mDisplaySize.set(currentSize.x, currentSize.y); + mEdgeBackPanel.setDisplaySize(mDisplaySize); } } diff --git a/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java b/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java index a8163afd2b..f9818600cf 100644 --- a/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java +++ b/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java @@ -37,7 +37,6 @@ import android.os.SystemClock; import android.view.Display; import android.view.GestureDetector; import android.view.MotionEvent; -import android.view.Surface; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewConfiguration; @@ -47,6 +46,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.ResourceUtils; import com.android.launcher3.anim.Interpolators; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DisplayController.NavigationMode; import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.NavBarPosition; @@ -92,13 +92,10 @@ public class NavBarGestureHandler implements OnTouchListener, NavBarGestureHandler(Context context) { mContext = context; final Display display = mContext.getDisplay(); - final int displayRotation; - if (display == null) { - displayRotation = Surface.ROTATION_0; - } else { - displayRotation = display.getRotation(); - display.getRealSize(mDisplaySize); - } + DisplayController.Info displayInfo = DisplayController.INSTANCE.get(mContext).getInfo(); + final int displayRotation = displayInfo.rotation; + Point currentSize = displayInfo.currentSize; + mDisplaySize.set(currentSize.x, currentSize.y); mSwipeUpTouchTracker = new TriggerSwipeUpTouchTracker(context, true /*disableHorizontalSwipe*/, new NavBarPosition(NavigationMode.NO_BUTTON, displayRotation), diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java index ae00d82fea..8a62c14309 100644 --- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java @@ -79,6 +79,8 @@ import java.util.function.Function; @RunWith(AndroidJUnit4.class) public class FallbackRecentsTest { + private static final String FALLBACK_LAUNCHER_TITLE = "Test launcher"; + private final UiDevice mDevice; private final LauncherInstrumentation mLauncher; private final ActivityInfo mOtherLauncherActivity; @@ -169,7 +171,7 @@ public class FallbackRecentsTest { public void goToOverviewFromHome() { mDevice.pressHome(); assertTrue("Fallback Launcher not visible", mDevice.wait(Until.hasObject(By.pkg( - mOtherLauncherActivity.packageName)), WAIT_TIME_MS)); + mOtherLauncherActivity.packageName).text(FALLBACK_LAUNCHER_TITLE)), WAIT_TIME_MS)); mLauncher.getLaunchedAppState().switchToOverview(); } @@ -258,7 +260,7 @@ public class FallbackRecentsTest { // Test dismissing all tasks. pressHomeAndGoToOverview().dismissAllTasks(); assertTrue("Fallback Launcher not visible", TestHelpers.wait(Until.hasObject(By.pkg( - mOtherLauncherActivity.packageName)), WAIT_TIME_MS)); + mOtherLauncherActivity.packageName).text(FALLBACK_LAUNCHER_TITLE)), WAIT_TIME_MS)); } private int getCurrentOverviewPage(RecentsActivity recents) { diff --git a/res/drawable/drop_target_frame.xml b/res/drawable/drop_target_frame.xml index 666a96e940..9f04103510 100644 --- a/res/drawable/drop_target_frame.xml +++ b/res/drawable/drop_target_frame.xml @@ -17,6 +17,6 @@ - + \ No newline at end of file diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml index 1517087fe2..73200de591 100644 --- a/res/layout/work_apps_edu.xml +++ b/res/layout/work_apps_edu.xml @@ -19,37 +19,49 @@ android:layout_marginTop="8dp" android:gravity="center"> - - - -