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

Commit 51b38729 authored by Jerry Chang's avatar Jerry Chang
Browse files

Fix empty side stage after dropping foreground app icon to split

To prevent it entering stage split with empty side stage root, update to
not activate split explicitly when dropping app icons to split. Only
active stage split when the target activity is actually launching in
the side stage root.

Fix: 193200163
Test: drap and drop app icons to enter split, observed it won't active
stage split if the app is already showing in foreground.

Change-Id: I1cad96f6265eb1a14369bfc708871f701764066a
parent 1f172ff7
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                if (options == null) {
                    options = new Bundle();
                }
                updateActivityOptions(options, position, wct);
                updateActivityOptions(options, position);
                break;
            }
            case STAGE_TYPE_MAIN: {
@@ -387,7 +387,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                if (options == null) {
                    options = new Bundle();
                }
                updateActivityOptions(options, position, wct);
                updateActivityOptions(options, position);
                break;
            }
            default:
@@ -480,22 +480,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        opts.putParcelable(KEY_LAUNCH_ROOT_TASK_TOKEN, stage.mRootTaskInfo.token);
    }

    void updateActivityOptions(Bundle opts, @SplitPosition int position,
            @Nullable WindowContainerTransaction wct) {
    void updateActivityOptions(Bundle opts, @SplitPosition int position) {
        addActivityOptions(opts, position == mSideStagePosition ? mSideStage : mMainStage);

        if (!mMainStage.isActive()) {
            // Activate the main stage in anticipation of an app launch.
            boolean needsApply = wct == null;
            if (needsApply) {
                wct = new WindowContainerTransaction();
            }
            mMainStage.activate(getMainStageBounds(), wct);
            mSideStage.setBounds(getSideStageBounds(), wct);
            if (needsApply) {
                mTaskOrganizer.applyTransaction(wct);
            }
        }
    }

    void registerSplitScreenListener(SplitScreen.SplitScreenListener listener) {