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

Commit c23e6049 authored by Wenhui Yang's avatar Wenhui Yang Committed by Android (Google) Code Review
Browse files

Merge "Introduce setCompositionOrder() and getCompositionOrder() apis" into main

parents b4d62d95 081f39e3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -52578,10 +52578,12 @@ package android.view {
    ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int);
    ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int, int);
    method public void applyTransactionToFrame(@NonNull android.view.SurfaceControl.Transaction);
    method @FlaggedApi("android.view.flags.surface_view_set_composition_order") public int getCompositionOrder();
    method public android.view.SurfaceHolder getHolder();
    method @Deprecated @Nullable public android.os.IBinder getHostToken();
    method public android.view.SurfaceControl getSurfaceControl();
    method public void setChildSurfacePackage(@NonNull android.view.SurfaceControlViewHost.SurfacePackage);
    method @FlaggedApi("android.view.flags.surface_view_set_composition_order") public void setCompositionOrder(int);
    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);
+33 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.view.flags.Flags.FLAG_SURFACE_VIEW_SET_COMPOSITION_ORDER;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_OVERLAY_SUBLAYER;
import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_SUBLAYER;
@@ -769,6 +770,36 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
        return mCornerRadius;
    }

    /**
     * Controls the composition order of the SurfaceView. A non-negative composition order
     * value indicates that the SurfaceView is composited on top of the parent window, while
     * a negative composition order indicates that the SurfaceView is behind the parent
     * window. A SurfaceView with a higher value appears above its peers with lower values.
     * For SurfaceViews with the same composition order value, their relative order is
     * undefined.
     *
     * @param compositionOrder the composition order of the surface view.
     */
    @FlaggedApi(FLAG_SURFACE_VIEW_SET_COMPOSITION_ORDER)
    public void setCompositionOrder(int compositionOrder) {
        mRequestedSubLayer = compositionOrder;
        if (mSubLayer != mRequestedSubLayer) {
            updateSurface();
        }
    }

    /**
     * Returns the composition order of the SurfaceView.
     *
     * @return composition order of the SurfaceView.
     *
     * @see #setCompositionOrder(int)
     */
    @FlaggedApi(FLAG_SURFACE_VIEW_SET_COMPOSITION_ORDER)
    public int getCompositionOrder() {
        return mRequestedSubLayer;
    }

    /**
     * Control whether the surface view's surface is placed on top of another
     * regular surface view in the window (but still behind the window itself).
@@ -1257,7 +1288,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
                final Transaction surfaceUpdateTransaction = new Transaction();
                if (creating) {
                    updateOpaqueFlag();
                    final String name = "SurfaceView[" + viewRoot.getTitle().toString() + "]";
                    final String name = Integer.toHexString(System.identityHashCode(this))
                            + " SurfaceView[" + viewRoot.getTitle().toString() + "]";
                    createBlastSurfaceControls(viewRoot, name, surfaceUpdateTransaction);
                } else if (mSurfaceControl == null) {
                    return;
+8 −0
Original line number Diff line number Diff line
@@ -109,3 +109,11 @@ flag {
      purpose: PURPOSE_BUGFIX
  }
}

flag {
    name: "surface_view_set_composition_order"
    namespace: "window_surfaces"
    description: "Add a SurfaceView composition order control API."
    bug: "341021569"
    is_fixed_read_only: true
}
 No newline at end of file