Remove inSplitScreen function

WM-core should not have concept of split screen so remove this
function and refactor function that use inSplitScreen.

Bug: 199236198
Fix: 230819979
Test: pass exsiting tests
Change-Id: I7bd8b39c55decfe7b01328d9e5b697cad7ed6949
This commit is contained in:
Tony Huang
2022-04-27 10:35:03 +08:00
parent d42fff5d21
commit 0285f8f641
4 changed files with 16 additions and 38 deletions

View File

@@ -19,7 +19,6 @@ package com.android.server.wm;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION;
@@ -602,22 +601,12 @@ public class RecentsAnimationController implements DeathRecipient {
|| mDisplayContent.getAsyncRotationController() != null) {
return;
}
boolean shouldTranslateNavBar = false;
final boolean isDisplayLandscape =
mDisplayContent.getConfiguration().orientation == ORIENTATION_LANDSCAPE;
for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
final TaskAnimationAdapter adapter = mPendingAnimations.get(i);
final Task task = adapter.mTask;
final TaskFragment adjacentTask = task.getRootTask().getAdjacentTaskFragment();
final boolean inSplitScreen = task.inSplitScreen();
if (task.isActivityTypeHomeOrRecents()
// Skip if the task is in split screen and in landscape.
|| (inSplitScreen && isDisplayLandscape)
// Skip if the task is the top task in split screen.
|| (inSplitScreen && task.getBounds().top < adjacentTask.getBounds().top)) {
if (task.isActivityTypeHomeOrRecents()) {
continue;
}
shouldTranslateNavBar = inSplitScreen;
mNavBarAttachedApp = task.getTopVisibleActivity();
break;
}
@@ -630,9 +619,7 @@ public class RecentsAnimationController implements DeathRecipient {
navWindow.mToken.cancelAnimation();
final SurfaceControl.Transaction t = navWindow.mToken.getPendingTransaction();
final SurfaceControl navSurfaceControl = navWindow.mToken.getSurfaceControl();
if (shouldTranslateNavBar) {
navWindow.setSurfaceTranslationY(-mNavBarAttachedApp.getBounds().top);
}
navWindow.setSurfaceTranslationY(-mNavBarAttachedApp.getBounds().top);
t.reparent(navSurfaceControl, mNavBarAttachedApp.getSurfaceControl());
t.show(navSurfaceControl);

View File

@@ -28,7 +28,6 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.activityTypeToString;
@@ -1720,13 +1719,6 @@ class Task extends TaskFragment {
&& (topTask == null || topTask.supportsSplitScreenWindowingModeInner(tda));
}
/** Returns {@code true} if this task is currently in split-screen. */
boolean inSplitScreen() {
return getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW
&& getCreatedByOrganizerTask() != null
&& getCreatedByOrganizerTask().getAdjacentTaskFragment() != null;
}
private boolean supportsSplitScreenWindowingModeInner(@Nullable TaskDisplayArea tda) {
return super.supportsSplitScreenWindowingMode()
&& mAtmService.mSupportsSplitScreenMultiWindow

View File

@@ -1163,20 +1163,21 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
}
}
// For a better split UX, If a task is launching from a created-by-organizer task, it should
// be launched into the same created-by-organizer task as well. Unless, the candidate task
// is already positioned in the split.
Task preferredRootInSplit = sourceTask != null && sourceTask.inSplitScreen()
? sourceTask.getCreatedByOrganizerTask() : null;
if (preferredRootInSplit != null) {
if (candidateTask != null) {
final Task candidateRoot = candidateTask.getCreatedByOrganizerTask();
if (candidateRoot != null && candidateRoot != preferredRootInSplit
&& preferredRootInSplit == candidateRoot.getAdjacentTaskFragment()) {
preferredRootInSplit = candidateRoot;
// If a task is launching from a created-by-organizer task, it should be launched into the
// same created-by-organizer task as well. Unless, the candidate task is already positioned
// in the another adjacent task.
if (sourceTask != null) {
Task launchTarget = sourceTask.getCreatedByOrganizerTask();
if (launchTarget != null && launchTarget.getAdjacentTaskFragment() != null) {
if (candidateTask != null) {
final Task candidateRoot = candidateTask.getCreatedByOrganizerTask();
if (candidateRoot != null && candidateRoot != launchTarget
&& launchTarget == candidateRoot.getAdjacentTaskFragment()) {
launchTarget = candidateRoot;
}
}
return launchTarget;
}
return preferredRootInSplit;
}
return null;

View File

@@ -3639,13 +3639,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
final int requested = mLastRequestedExclusionHeight[side];
final int granted = mLastGrantedExclusionHeight[side];
final boolean inSplitScreen = getTask() != null && getTask().inSplitScreen();
FrameworkStatsLog.write(FrameworkStatsLog.EXCLUSION_RECT_STATE_CHANGED,
mAttrs.packageName, requested, requested - granted /* rejected */,
side + 1 /* Sides are 1-indexed in atoms.proto */,
(getConfiguration().orientation == ORIENTATION_LANDSCAPE),
inSplitScreen, (int) duration);
false /* (deprecated param) inSplitscreen */, (int) duration);
}
private void initExclusionRestrictions() {