Handle transitining out of overview more gracefully for 3P launchers
Bug: 183897242
Test: Tested with Pixel Custom Launcher, as suggested on the bug
Change-Id: I46ceddb9f5eed6b16b7e66406dd68d94e7a30aee
diff --git a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
index e13d1a4..8168e88 100644
--- a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java
@@ -27,6 +27,7 @@
import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.ActivityInitListener;
@@ -139,7 +140,25 @@
@Override
public void onExitOverview(RotationTouchHelper deviceState, Runnable exitRunnable) {
- // no-op, fake landscape not supported for 3P
+ final StateManager<RecentsState> stateManager = getCreatedActivity().getStateManager();
+ if (stateManager.getState() == HOME) {
+ exitRunnable.run();
+ notifyRecentsOfOrientation(deviceState);
+ return;
+ }
+
+ stateManager.addStateListener(
+ new StateManager.StateListener<RecentsState>() {
+ @Override
+ public void onStateTransitionComplete(RecentsState toState) {
+ // Are we going from Recents to Workspace?
+ if (toState == HOME) {
+ exitRunnable.run();
+ notifyRecentsOfOrientation(deviceState);
+ stateManager.removeStateListener(this);
+ }
+ }
+ });
}
@Override