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

Commit d19c4490 authored by Tony Huang's avatar Tony Huang
Browse files

Migrate show when lock behavior to handleRequset

Current show when lock behavior implementation sometimes doesn't
work due to both tasks are invisible and lead to the app could
only show half of screen.
Because show when lock it will get a TRANSIT_KEYGUARD_OCCLUDE
transition so we can handle it on the handleRequest and it will
also make the transition more smooth.

Fix: 284253219
Test: manual
Test: pass existing tests
Change-Id: I5a7f364a732faa26e9021054180bab40a1faaafe
parent 861cc9ab
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.transitTypeToString;
@@ -1293,20 +1294,12 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        final boolean mainStageVisible = mMainStage.mRootTaskInfo.isVisible;
        final boolean oneStageVisible =
                mMainStage.mRootTaskInfo.isVisible != mSideStage.mRootTaskInfo.isVisible;
        if (oneStageVisible) {
        if (oneStageVisible && !ENABLE_SHELL_TRANSITIONS) {
            // Dismiss split because there's show-when-locked activity showing on top of keyguard.
            // Also make sure the task contains show-when-locked activity remains on top after split
            // dismissed.
            if (!ENABLE_SHELL_TRANSITIONS) {
            final StageTaskListener toTop = mainStageVisible ? mMainStage : mSideStage;
            exitSplitScreen(toTop, EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP);
            } else {
                final int dismissTop = mainStageVisible ? STAGE_TYPE_MAIN : STAGE_TYPE_SIDE;
                final WindowContainerTransaction wct = new WindowContainerTransaction();
                prepareExitSplitScreen(dismissTop, wct);
                mSplitTransitions.startDismissTransition(wct, this, dismissTop,
                        EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP);
            }
        }
    }

@@ -2376,6 +2369,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    // so appends operations to exit split.
                    prepareExitSplitScreen(STAGE_TYPE_UNDEFINED, out);
                }
            } else if (type == TRANSIT_KEYGUARD_OCCLUDE && triggerTask.topActivity != null
                    && isSplitScreenVisible()) {
                // Split include show when lock activity case, check the top activity under which
                // stage and move it to the top.
                int top = triggerTask.topActivity.equals(mMainStage.mRootTaskInfo.topActivity)
                        ? STAGE_TYPE_MAIN : STAGE_TYPE_SIDE;
                prepareExitSplitScreen(top, out);
                mSplitTransitions.setDismissTransition(transition, top,
                        EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP);
            }

            // When split in the background, it should be only opening/dismissing transition and