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

Commit 382e19e7 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge changes Ib7d1a5a2,I96b59ce1 into main

* changes:
  Break split on any non-active change where tasks aren't all TO_FRONT or TO_BACK
  Prevent split on lockscreen checks directly using stage types
parents 11ff5fbf 859e3323
Loading
Loading
Loading
Loading
+29 −15
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ import android.util.ArraySet;
import android.util.IntArray;
import android.util.Log;
import android.util.Slog;
import android.util.SparseIntArray;
import android.view.Choreographer;
import android.view.IRemoteAnimationFinishedCallback;
import android.view.IRemoteAnimationRunner;
@@ -3012,11 +3013,18 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            final int transitType = info.getType();
            TransitionInfo.Change pipChange = null;
            int closingSplitTaskId = -1;
            // This array tracks where we are sending stages (TO_BACK/TO_FRONT) in this transition.
            // TODO (b/349828130): Update for n apps (needs to handle different indices than 0/1).
            //  Also make sure having multiple changes per stage (2+ tasks in one stage) is being
            //  handled properly.
            int[] stageChanges = new int[2];
            // This array tracks if we are sending stages TO_BACK/TO_FRONT in this transition.
            // TODO (b/349828130): Also make sure having multiple changes per stage (2+ tasks in
            //  one stage) is being handled properly.
            SparseIntArray stageChanges = new SparseIntArray();
            if (enableFlexibleSplit()) {
                mStageOrderOperator.getActiveStages()
                        .forEach(stage -> stageChanges.put(stage.getId(), -1));
            } else {
                stageChanges.put(STAGE_TYPE_MAIN, -1);
                stageChanges.put(STAGE_TYPE_SIDE, -1);
            }


            for (int iC = 0; iC < info.getChanges().size(); ++iC) {
                final TransitionInfo.Change change = info.getChanges().get(iC);
@@ -3090,14 +3098,12 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    // we'll break split
                    closingSplitTaskId = taskId;
                }
                if (transitType == WindowManager.TRANSIT_WAKE) {
                // Record which stages are receiving which changes
                if ((change.getMode() == TRANSIT_TO_BACK
                        || change.getMode() == TRANSIT_TO_FRONT)
                        && (stageOfTaskId == STAGE_TYPE_MAIN
                        || stageOfTaskId == STAGE_TYPE_SIDE)) {
                        stageChanges[stageOfTaskId] = change.getMode();
                    }
                    stageChanges.put(getStageOfTask(taskId), change.getMode());
                }
            }

@@ -3126,8 +3132,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            // If keyguard is active, check to see if we have all our stages showing. If one stage
            // was moved but not the other (which can happen with SHOW_ABOVE_LOCKED apps), we should
            // break split.
            if (mKeyguardActive && stageChanges[STAGE_TYPE_MAIN] != stageChanges[STAGE_TYPE_SIDE]) {
            if (mKeyguardActive && stageChanges.size() > 0) {
                int firstChangeMode = stageChanges.valueAt(0);
                for (int i = 0; i < stageChanges.size(); i++) {
                    int changeMode = stageChanges.valueAt(i);
                    // Compare each changeMode to the first one. If any are different, break split.
                    if (changeMode != firstChangeMode) {
                        dismissSplitKeepingLastActiveStage(EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP);
                        break;
                    }
                }
            }

            final ArraySet<StageTaskListener> dismissStages = record.getShouldDismissedStage();