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

Commit b7be1991 authored by Wenhui Yang's avatar Wenhui Yang
Browse files

Deprecate setZOrderOnTop() and setZOrderMediaOverlay() APIs

Deprecate the old z order APIs and suggest users to use
setCompositionOrder() and getCompositionOrder() instead.

Fixes: 372521625
Test: SurfaceViewTest
Flag: android.view.flags.deprecate_surface_view_z_order_apis
Change-Id: I8943a635cad0b88f7ca851fb5298a8c900604731
parent 16233171
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -53801,8 +53801,8 @@ package android.view {
    method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public void setDesiredHdrHeadroom(@FloatRange(from=0.0f, to=10000.0) float);
    method public void setSecure(boolean);
    method public void setSurfaceLifecycle(int);
    method public void setZOrderMediaOverlay(boolean);
    method public void setZOrderOnTop(boolean);
    method @Deprecated @FlaggedApi("android.view.flags.deprecate_surface_view_z_order_apis") public void setZOrderMediaOverlay(boolean);
    method @Deprecated @FlaggedApi("android.view.flags.deprecate_surface_view_z_order_apis") public void setZOrderOnTop(boolean);
    field public static final int SURFACE_LIFECYCLE_DEFAULT = 0; // 0x0
    field public static final int SURFACE_LIFECYCLE_FOLLOWS_ATTACHMENT = 2; // 0x2
    field public static final int SURFACE_LIFECYCLE_FOLLOWS_VISIBILITY = 1; // 0x1
+15 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.view.flags.Flags.FLAG_DEPRECATE_SURFACE_VIEW_Z_ORDER_APIS;
import static android.view.flags.Flags.FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE;
import static android.view.flags.Flags.FLAG_SURFACE_VIEW_SET_COMPOSITION_ORDER;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
@@ -812,7 +813,12 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
     * window is attached to the window manager.
     *
     * <p>Calling this overrides any previous call to {@link #setZOrderOnTop}.
     *
     * @deprecated Use {@link #setCompositionOrder(int)} instead. It provides more
     * control over the Z ordering behavior.
     */
    @Deprecated
    @FlaggedApi(FLAG_DEPRECATE_SURFACE_VIEW_Z_ORDER_APIS)
    public void setZOrderMediaOverlay(boolean isMediaOverlay) {
        mRequestedSubLayer = isMediaOverlay
            ? APPLICATION_MEDIA_OVERLAY_SUBLAYER : APPLICATION_MEDIA_SUBLAYER;
@@ -834,7 +840,12 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
     * <p>Calling this overrides any previous call to {@link #setZOrderMediaOverlay}.
     *
     * @param onTop Whether to show the surface on top of this view's window.
     *
     * @deprecated Use {@link #setCompositionOrder(int)} instead. It provides more
     * control over the Z ordering behavior.
     */
    @Deprecated
    @FlaggedApi(FLAG_DEPRECATE_SURFACE_VIEW_Z_ORDER_APIS)
    public void setZOrderOnTop(boolean onTop) {
        // In R and above we allow dynamic layer changes.
        final boolean allowDynamicChange = getContext().getApplicationInfo().targetSdkVersion
@@ -866,7 +877,11 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
     * @return Whether the Z ordering changed.
     *
     * @hide
     *
     * @deprecated Use {@link #setCompositionOrder(int)} instead. It provides more control
     * over the Z ordering behavior.
     */
    @Deprecated
    public boolean setZOrderedOnTop(boolean onTop, boolean allowDynamicChange) {
        final int subLayer;
        if (onTop) {
+8 −0
Original line number Diff line number Diff line
@@ -128,6 +128,14 @@ flag {
    is_exported: true
}

flag {
    name: "deprecate_surface_view_z_order_apis"
    namespace: "window_surfaces"
    description: "Deprecate SurfaceView z order control APIs."
    bug: "341021569"
    is_fixed_read_only: true
}

flag {
    name: "use_refactored_round_scrollbar"
    namespace: "wear_frameworks"