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

Commit 4691ed38 authored by Shubang Lu's avatar Shubang Lu
Browse files

Add APIs for Z-order in TV views

Flag: android.media.tv.flags.tiaf_v_apis
Test: CTS
Bug: 343796406
API-Coverage-Bug: 378154044
Change-Id: Id131b4910fb68d6785d9aa2500a41626ff111fb3
parent a0e0a436
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -28437,6 +28437,8 @@ package android.media.tv.ad {
    method public void setCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.ad.TvAdView.TvAdCallback);
    method public void setOnUnhandledInputEventListener(@NonNull android.media.tv.ad.TvAdView.OnUnhandledInputEventListener);
    method public boolean setTvView(@Nullable android.media.tv.TvView);
    method @FlaggedApi("android.media.tv.flags.enable_ad_service_fw") public void setZOrderMediaOverlay(boolean);
    method @FlaggedApi("android.media.tv.flags.enable_ad_service_fw") public void setZOrderOnTop(boolean);
    method public void startAdService();
    method public void stopAdService();
    field public static final String ERROR_KEY_ERROR_CODE = "error_code";
@@ -28709,6 +28711,8 @@ package android.media.tv.interactive {
    method public void setOnUnhandledInputEventListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.interactive.TvInteractiveAppView.OnUnhandledInputEventListener);
    method public void setTeletextAppEnabled(boolean);
    method public int setTvView(@Nullable android.media.tv.TvView);
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void setZOrderMediaOverlay(boolean);
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void setZOrderOnTop(boolean);
    method public void startInteractiveApp();
    method public void stopInteractiveApp();
    field public static final String BI_INTERACTIVE_APP_KEY_ALIAS = "alias";
+32 −0
Original line number Diff line number Diff line
@@ -240,6 +240,38 @@ public class TvAdView extends ViewGroup {
        }
    }

    /**
     * Controls whether the TvAdView's surface is placed on top of other regular surface views in
     * the window (but still behind the window itself).
     *
     * <p>Calling this overrides any previous call to {@link #setZOrderOnTop}.
     *
     * @param isMediaOverlay {@code true} to be on top of another regular surface, {@code false}
     *            otherwise.
     */
    @FlaggedApi(Flags.FLAG_ENABLE_AD_SERVICE_FW)
    public void setZOrderMediaOverlay(boolean isMediaOverlay) {
        if (mSurfaceView != null) {
            mSurfaceView.setZOrderOnTop(false);
            mSurfaceView.setZOrderMediaOverlay(isMediaOverlay);
        }
    }

    /**
     * Controls whether the TvAdView's surface is placed on top of its window.
     *
     * <p>Calling this overrides any previous call to {@link #setZOrderMediaOverlay}.
     *
     * @param onTop {@code true} to be on top of its window, {@code false} otherwise.
     */
    @FlaggedApi(Flags.FLAG_ENABLE_AD_SERVICE_FW)
    public void setZOrderOnTop(boolean onTop) {
        if (mSurfaceView != null) {
            mSurfaceView.setZOrderMediaOverlay(false);
            mSurfaceView.setZOrderOnTop(onTop);
        }
    }

    private void resetSurfaceView() {
        if (mSurfaceView != null) {
            mSurfaceView.getHolder().removeCallback(mSurfaceHolderCallback);
+32 −0
Original line number Diff line number Diff line
@@ -271,6 +271,38 @@ public class TvInteractiveAppView extends ViewGroup {
        }
    }

    /**
     * Controls whether the TvInteractiveAppView's surface is placed on top of other regular surface
     * views in the window (but still behind the window itself).
     *
     * <p>Calling this overrides any previous call to {@link #setZOrderOnTop}.
     *
     * @param isMediaOverlay {@code true} to be on top of another regular surface, {@code false}
     *            otherwise.
     */
    @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
    public void setZOrderMediaOverlay(boolean isMediaOverlay) {
        if (mSurfaceView != null) {
            mSurfaceView.setZOrderOnTop(false);
            mSurfaceView.setZOrderMediaOverlay(isMediaOverlay);
        }
    }

    /**
     * Controls whether the TvInterActiveAppView's surface is placed on top of its window.
     *
     * <p>Calling this overrides any previous call to {@link #setZOrderMediaOverlay}.
     *
     * @param onTop {@code true} to be on top of its window, {@code false} otherwise.
     */
    @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
    public void setZOrderOnTop(boolean onTop) {
        if (mSurfaceView != null) {
            mSurfaceView.setZOrderMediaOverlay(false);
            mSurfaceView.setZOrderOnTop(onTop);
        }
    }

    private void resetSurfaceView() {
        if (mSurfaceView != null) {
            mSurfaceView.getHolder().removeCallback(mSurfaceHolderCallback);