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

Commit 19612edd authored by Shubang Lu's avatar Shubang Lu
Browse files

[CSAI API] Unhide TvAdView

Bug: 318906105
Test: atest android.media.tv.ad.cts.TvAdViewTest
API-Coverage-Bug: 320723228
Change-Id: Iac3b3d047b480aed877b6fb21e78a79bb2759654
parent a2d48d9d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -27631,6 +27631,7 @@ package android.media.tv.ad {
  public abstract static class TvAdService.Session implements android.view.KeyEvent.Callback {
    ctor public TvAdService.Session(@NonNull android.content.Context);
    method @CallSuper public void layoutSurface(int, int, int, int);
    method public boolean onGenericMotionEvent(@NonNull android.view.MotionEvent);
    method public boolean onKeyDown(int, @Nullable android.view.KeyEvent);
    method public boolean onKeyLongPress(int, @Nullable android.view.KeyEvent);
@@ -27638,6 +27639,7 @@ package android.media.tv.ad {
    method public boolean onKeyUp(int, @Nullable android.view.KeyEvent);
    method public abstract void onRelease();
    method public abstract boolean onSetSurface(@Nullable android.view.Surface);
    method public void onSurfaceChanged(int, int, int);
    method public boolean onTouchEvent(@NonNull android.view.MotionEvent);
    method public boolean onTrackballEvent(@NonNull android.view.MotionEvent);
  }
@@ -27652,6 +27654,18 @@ package android.media.tv.ad {
    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.ad.TvAdServiceInfo> CREATOR;
  }
  @FlaggedApi("android.media.tv.flags.enable_ad_service_fw") public class TvAdView extends android.view.ViewGroup {
    ctor public TvAdView(@NonNull android.content.Context);
    ctor public TvAdView(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
    ctor public TvAdView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int);
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void onLayout(boolean, int, int, int, int);
    method public void onMeasure(int, int);
    method public void onVisibilityChanged(@NonNull android.view.View, int);
    method public void prepareAdService(@NonNull String, @NonNull String);
  }
}
package android.media.tv.interactive {
+0 −2
Original line number Diff line number Diff line
@@ -487,7 +487,6 @@ public abstract class TvAdService extends Service {
         * @param right Right position in pixels, relative to the overlay view.
         * @param bottom Bottom position in pixels, relative to the overlay view.
         *
         * @hide
         */
        @CallSuper
        public void layoutSurface(final int left, final int top, final int right,
@@ -534,7 +533,6 @@ public abstract class TvAdService extends Service {
         * @param format The new {@link PixelFormat} of the surface.
         * @param width The new width of the surface.
         * @param height The new height of the surface.
         * @hide
         */
        public void onSurfaceChanged(@PixelFormat.Format int format, int width, int height) {
        }
+14 −5
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media.tv.ad;

import android.annotation.CallbackExecutor;
import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
@@ -29,6 +30,7 @@ import android.media.tv.TvInputManager;
import android.media.tv.TvTrackInfo;
import android.media.tv.TvView;
import android.media.tv.ad.TvAdManager.Session.FinishedInputEventCallback;
import android.media.tv.flags.Flags;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -48,9 +50,9 @@ import java.util.List;
import java.util.concurrent.Executor;

/**
 * Displays contents of TV AD services.
 * @hide
 * Displays contents of TV advertisement services.
 */
@FlaggedApi(Flags.FLAG_ENABLE_AD_SERVICE_FW)
public class TvAdView extends ViewGroup {
    private static final String TAG = "TvAdView";
    private static final boolean DEBUG = false;
@@ -182,14 +184,12 @@ public class TvAdView extends ViewGroup {
        return true;
    }

    /** @hide */
    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        createSessionMediaView();
    }

    /** @hide */
    @Override
    public void onDetachedFromWindow() {
        removeSessionMediaView();
@@ -381,6 +381,7 @@ public class TvAdView extends ViewGroup {
     * @param event The input event.
     * @return If you handled the event, return {@code true}. If you want to allow the event to be
     *         handled by the next receiver, return {@code false}.
     * @hide
     */
    public boolean onUnhandledInputEvent(@NonNull InputEvent event) {
        return false;
@@ -422,7 +423,7 @@ public class TvAdView extends ViewGroup {
    }

    @Override
    public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
    public boolean dispatchKeyEvent(@Nullable KeyEvent event) {
        if (super.dispatchKeyEvent(event)) {
            return true;
        }
@@ -465,6 +466,7 @@ public class TvAdView extends ViewGroup {

    /**
     * Stops the AD service.
     * @hide
     */
    public void stopAdService() {
        if (DEBUG) {
@@ -479,6 +481,7 @@ public class TvAdView extends ViewGroup {
     * Resets the AD service.
     *
     * <p>This releases the resources of the corresponding {@link TvAdService.Session}.
     * @hide
     */
    public void resetAdService() {
        if (DEBUG) {
@@ -493,6 +496,7 @@ public class TvAdView extends ViewGroup {
     * Sends current video bounds to related TV AD service.
     *
     * @param bounds the rectangle area for rendering the current video.
     * @hide
     */
    public void sendCurrentVideoBounds(@NonNull Rect bounds) {
        if (DEBUG) {
@@ -508,6 +512,7 @@ public class TvAdView extends ViewGroup {
     *
     * @param channelUri The current channel URI; {@code null} if there is no currently tuned
     *                   channel.
     * @hide
     */
    public void sendCurrentChannelUri(@Nullable Uri channelUri) {
        if (DEBUG) {
@@ -520,6 +525,7 @@ public class TvAdView extends ViewGroup {

    /**
     * Sends track info list to related TV AD service.
     * @hide
     */
    public void sendTrackInfoList(@Nullable List<TvTrackInfo> tracks) {
        if (DEBUG) {
@@ -536,6 +542,7 @@ public class TvAdView extends ViewGroup {
     * @param inputId The current TV input ID whose channel is tuned. {@code null} if no channel is
     *                tuned.
     * @see android.media.tv.TvInputInfo
     * @hide
     */
    public void sendCurrentTvInputId(@Nullable String inputId) {
        if (DEBUG) {
@@ -577,6 +584,7 @@ public class TvAdView extends ViewGroup {
     *     can also be added to the params.
     *
     * @see #ERROR_KEY_METHOD_NAME
     * @hide
     */
    public void notifyError(@NonNull String errMsg, @NonNull Bundle params) {
        if (DEBUG) {
@@ -599,6 +607,7 @@ public class TvAdView extends ViewGroup {
     *             {@link TvInputManager#TV_MESSAGE_KEY_RAW_DATA}.
     *             See {@link TvInputManager#TV_MESSAGE_KEY_SUBTYPE} for more information on
     *             how to parse this data.
     * @hide
     */
    public void notifyTvMessage(@NonNull @TvInputManager.TvMessageType int type,
            @NonNull Bundle data) {