Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8fa7b03 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Prevent putting any stage on top if split is not visible when breaking pair

* If the split breaks in the background when split is not
visible, we don't put any stage on top

Test: Tested w/ Camera + Messages, toast and app don't
show up if you swipe to home before folding the device
Fixes: 323461567

Change-Id: I4ebce1ce795976a1ec61b8e1f35c8840863e4f92
parent 688a322b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -3393,7 +3393,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    return;
                }

                final int stageType = isMainStage ? STAGE_TYPE_MAIN : STAGE_TYPE_SIDE;
                // If visible, we preserve the app and keep it running. If an app becomes
                // unsupported in the bg, break split without putting anything on top
                boolean splitScreenVisible = isSplitScreenVisible();
                int stageType = STAGE_TYPE_UNDEFINED;
                if (splitScreenVisible) {
                    stageType = isMainStage ? STAGE_TYPE_MAIN : STAGE_TYPE_SIDE;
                }
                final WindowContainerTransaction wct = new WindowContainerTransaction();
                prepareExitSplitScreen(stageType, wct);
                clearSplitPairedInRecents(EXIT_REASON_APP_DOES_NOT_SUPPORT_MULTIWINDOW);
@@ -3402,9 +3408,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                Log.w(TAG, splitFailureMessage("onNoLongerSupportMultiWindow",
                        "app package " + taskInfo.baseActivity.getPackageName()
                        + " does not support splitscreen, or is a controlled activity type"));
                if (splitScreenVisible) {
                    mSplitUnsupportedToast.show();
                }
            }
        }

        private void reset() {
            mHasRootTask = false;