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

Commit 4da9038c authored by Massimo Carli's avatar Massimo Carli
Browse files

[26/n] Move layer constants to TaskConstants

Flag: com.android.window.flags.app_compat_refactoring
Fix: 378673153
Test: m

Change-Id: I9bed213870097ccf0f20b076cb913142364658eb
parent c723ea80
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -91,6 +91,22 @@ public class TaskConstants {
     */
    public  static final int TASK_CHILD_LAYER_FLOATING_MENU = 7 * TASK_CHILD_LAYER_REGION_SIZE;

    /**
     * The layer to use for Letterbox surfaces in Shell. Letterbox surfaces need to stay below the
     * activity layer which is 0.
     * @hide
     */
    public static final int TASK_CHILD_SHELL_LAYER_LETTERBOX_BACKGROUND =
            -1 * TASK_CHILD_LAYER_REGION_SIZE;

    /**
     * The layer to use for Letterbox spy surfaces in Shell. Letterbox spy surfaces need to stay
     * above the activity layer which is 0.
     * @hide
     */
    public static final int TASK_CHILD_SHELL_LAYER_LETTERBOX_SPY =
            TASK_CHILD_LAYER_REGION_SIZE / 10;

    /**
     * Z-orders of task child layers other than activities, task fragments and layers interleaved
     * with them, e.g. IME windows. [-10000, 10000) is reserved for these layers.
@@ -104,7 +120,9 @@ public class TaskConstants {
            TASK_CHILD_LAYER_WINDOW_DECORATIONS,
            TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY,
            TASK_CHILD_LAYER_TASK_OVERLAY,
            TASK_CHILD_LAYER_RESIZE_VEIL
            TASK_CHILD_LAYER_RESIZE_VEIL,
            TASK_CHILD_SHELL_LAYER_LETTERBOX_BACKGROUND,
            TASK_CHILD_SHELL_LAYER_LETTERBOX_SPY
    })
    public @interface TaskChildLayer {}
}
+2 −10
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.wm.shell.compatui.letterbox

import android.view.SurfaceControl
import android.view.SurfaceControl.Transaction
import android.window.TaskConstants
import com.android.wm.shell.common.suppliers.SurfaceBuilderSupplier
import com.android.wm.shell.dagger.WMSingleton
import javax.inject.Inject
@@ -30,15 +31,6 @@ class LetterboxInputSurfaceBuilder @Inject constructor(
    private val surfaceBuilderSupplier: SurfaceBuilderSupplier
) {

    companion object {
        /*
         * Letterbox spy surfaces need to stay above the activity layer which is 0.
         */
        // TODO(b/378673153): Consider adding this to [TaskConstants].
        @JvmStatic
        private val TASK_CHILD_LAYER_LETTERBOX_SPY = 1000
    }

    fun createInputSurface(
        tx: Transaction,
        parentLeash: SurfaceControl,
@@ -50,7 +42,7 @@ class LetterboxInputSurfaceBuilder @Inject constructor(
        .setParent(parentLeash)
        .setCallsite(callSite)
        .build().apply {
            tx.setLayer(this, TASK_CHILD_LAYER_LETTERBOX_SPY)
            tx.setLayer(this, TaskConstants.TASK_CHILD_SHELL_LAYER_LETTERBOX_SPY)
                .setTrustedOverlay(this, true)
                .show(this)
                .apply()
+2 −10
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.compatui.letterbox

import android.view.SurfaceControl
import android.window.TaskConstants
import com.android.wm.shell.dagger.WMSingleton
import javax.inject.Inject

@@ -28,15 +29,6 @@ class LetterboxSurfaceBuilder @Inject constructor(
    private val letterboxConfiguration: LetterboxConfiguration
) {

    companion object {
        /*
         * Letterbox surfaces need to stay below the activity layer which is 0.
         */
        // TODO(b/378673153): Consider adding this to [TaskConstants].
        @JvmStatic
        private val TASK_CHILD_LAYER_LETTERBOX_BACKGROUND = -1000
    }

    fun createSurface(
        tx: SurfaceControl.Transaction,
        parentLeash: SurfaceControl,
@@ -52,7 +44,7 @@ class LetterboxSurfaceBuilder @Inject constructor(
        .build().apply {
            tx.setLayer(
                this,
                TASK_CHILD_LAYER_LETTERBOX_BACKGROUND
                TaskConstants.TASK_CHILD_SHELL_LAYER_LETTERBOX_BACKGROUND
            ).setColorSpaceAgnostic(this, true)
                .setColor(this, letterboxConfiguration.getBackgroundColorRgbArray())
        }