Replace compat UI related z values with constants in TaskConstants

Introduce a new constant in TaskConstants for compat UI components,
unifying previous individual constants.

Replace z-values in compatui window manager classes and in
Letterbox.

Fixes: 262403744
Test: atest WMShellUnitTests:LetterboxEduWindowManagerTest
Test: atest WMShellUnitTests:ReachabilityEduWindowManagerTest
Test: atest WMShellUnitTests:CompatUIWindowManagerTest
Test: atest WMShellUnitTests:RestartDialogLayoutTest
Test: atest LetterboxTest
Change-Id: If5e22014e38f22c0bd4371da459b52486c7f2d27
This commit is contained in:
Eghosa Ewansiha-Vlachavas
2023-04-11 16:39:13 +00:00
parent f247d365ed
commit e84bed2135
6 changed files with 18 additions and 41 deletions

View File

@@ -47,37 +47,31 @@ public class TaskConstants {
-2 * TASK_CHILD_LAYER_REGION_SIZE;
/**
* When a unresizable app is moved in the different configuration, a restart button appears
* allowing to adapt (~resize) app to the new configuration mocks.
* Compat UI components: reachability education, size compat restart
* button, letterbox education, restart dialog.
* @hide
*/
public static final int TASK_CHILD_LAYER_SIZE_COMPAT_RESTART_BUTTON =
TASK_CHILD_LAYER_REGION_SIZE;
public static final int TASK_CHILD_LAYER_COMPAT_UI = TASK_CHILD_LAYER_REGION_SIZE;
/**
* Shown the first time an app is opened in size compat mode in landscape.
* @hide
*/
public static final int TASK_CHILD_LAYER_LETTERBOX_EDUCATION = 2 * TASK_CHILD_LAYER_REGION_SIZE;
/**
* Captions, window frames and resize handlers around task windows.
* @hide
*/
public static final int TASK_CHILD_LAYER_WINDOW_DECORATIONS = 3 * TASK_CHILD_LAYER_REGION_SIZE;
public static final int TASK_CHILD_LAYER_WINDOW_DECORATIONS = 2 * TASK_CHILD_LAYER_REGION_SIZE;
/**
* Overlays the task when going into PIP w/ gesture navigation.
* @hide
*/
public static final int TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY =
4 * TASK_CHILD_LAYER_REGION_SIZE;
3 * TASK_CHILD_LAYER_REGION_SIZE;
/**
* Allows other apps to add overlays on the task (i.e. game dashboard)
* @hide
*/
public static final int TASK_CHILD_LAYER_TASK_OVERLAY = 5 * TASK_CHILD_LAYER_REGION_SIZE;
public static final int TASK_CHILD_LAYER_TASK_OVERLAY = 4 * TASK_CHILD_LAYER_REGION_SIZE;
/**
* Z-orders of task child layers other than activities, task fragments and layers interleaved
@@ -87,8 +81,7 @@ public class TaskConstants {
@IntDef({
TASK_CHILD_LAYER_TASK_BACKGROUND,
TASK_CHILD_LAYER_LETTERBOX_BACKGROUND,
TASK_CHILD_LAYER_SIZE_COMPAT_RESTART_BUTTON,
TASK_CHILD_LAYER_LETTERBOX_EDUCATION,
TASK_CHILD_LAYER_COMPAT_UI,
TASK_CHILD_LAYER_WINDOW_DECORATIONS,
TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY,
TASK_CHILD_LAYER_TASK_OVERLAY

View File

@@ -20,6 +20,7 @@ import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_DISMISSED;
import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_HIDDEN;
import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED;
import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED;
import static android.window.TaskConstants.TASK_CHILD_LAYER_COMPAT_UI;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -46,11 +47,6 @@ import java.util.function.Consumer;
*/
class CompatUIWindowManager extends CompatUIWindowManagerAbstract {
/**
* The Compat UI should be below the Letterbox Education.
*/
private static final int Z_ORDER = LetterboxEduWindowManager.Z_ORDER - 1;
private final CompatUICallback mCallback;
private final CompatUIConfiguration mCompatUIConfiguration;
@@ -92,7 +88,7 @@ class CompatUIWindowManager extends CompatUIWindowManagerAbstract {
@Override
protected int getZOrder() {
return Z_ORDER;
return TASK_CHILD_LAYER_COMPAT_UI + 1;
}
@Override

View File

@@ -17,6 +17,7 @@
package com.android.wm.shell.compatui;
import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING;
import static android.window.TaskConstants.TASK_CHILD_LAYER_COMPAT_UI;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -46,12 +47,6 @@ import java.util.function.Consumer;
*/
class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract {
/**
* The Letterbox Education should be the topmost child of the Task in case there can be more
* than one child.
*/
public static final int Z_ORDER = Integer.MAX_VALUE;
private final DialogAnimationController<LetterboxEduDialogLayout> mAnimationController;
private final Transitions mTransitions;
@@ -118,7 +113,7 @@ class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract {
@Override
protected int getZOrder() {
return Z_ORDER;
return TASK_CHILD_LAYER_COMPAT_UI + 2;
}
@Override

View File

@@ -18,6 +18,7 @@ package com.android.wm.shell.compatui;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
import static android.window.TaskConstants.TASK_CHILD_LAYER_COMPAT_UI;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -41,11 +42,6 @@ import com.android.wm.shell.common.SyncTransactionQueue;
*/
class ReachabilityEduWindowManager extends CompatUIWindowManagerAbstract {
/**
* The Compat UI should be below the Letterbox Education.
*/
private static final int Z_ORDER = LetterboxEduWindowManager.Z_ORDER - 1;
// The time to wait before hiding the education
private static final long DISAPPEAR_DELAY_MS = 4000L;
@@ -102,7 +98,7 @@ class ReachabilityEduWindowManager extends CompatUIWindowManagerAbstract {
@Override
protected int getZOrder() {
return Z_ORDER;
return TASK_CHILD_LAYER_COMPAT_UI + 1;
}
@Override

View File

@@ -17,6 +17,7 @@
package com.android.wm.shell.compatui;
import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING;
import static android.window.TaskConstants.TASK_CHILD_LAYER_COMPAT_UI;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -47,12 +48,6 @@ import java.util.function.Consumer;
*/
class RestartDialogWindowManager extends CompatUIWindowManagerAbstract {
/**
* The restart dialog should be the topmost child of the Task in case there can be more
* than one child.
*/
private static final int Z_ORDER = Integer.MAX_VALUE;
private final DialogAnimationController<RestartDialogLayout> mAnimationController;
private final Transitions mTransitions;
@@ -112,7 +107,7 @@ class RestartDialogWindowManager extends CompatUIWindowManagerAbstract {
@Override
protected int getZOrder() {
return Z_ORDER;
return TASK_CHILD_LAYER_COMPAT_UI + 2;
}
@Override

View File

@@ -18,6 +18,7 @@ package com.android.server.wm;
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
import static android.view.SurfaceControl.HIDDEN;
import static android.window.TaskConstants.TASK_CHILD_LAYER_LETTERBOX_BACKGROUND;
import android.content.Context;
import android.graphics.Color;
@@ -361,7 +362,8 @@ public class Letterbox {
.setCallsite("LetterboxSurface.createSurface")
.build();
t.setLayer(mSurface, -1).setColorSpaceAgnostic(mSurface, true);
t.setLayer(mSurface, TASK_CHILD_LAYER_LETTERBOX_BACKGROUND)
.setColorSpaceAgnostic(mSurface, true);
}
void attachInput(WindowState win) {