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

Commit 4e8636d1 authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge "TIAF: add IApp types and the getter"

parents 87c30d9a 4ecb5e7c
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media.tv.interactive;

import android.annotation.NonNull;
import android.annotation.StringDef;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -35,6 +36,8 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;

@@ -46,6 +49,21 @@ public final class TvIAppInfo implements Parcelable {
    private static final boolean DEBUG = false;
    private static final String TAG = "TvIAppInfo";

    @Retention(RetentionPolicy.SOURCE)
    @StringDef(prefix = { "INTERACTIVE_APP_TYPE_" }, value = {
            INTERACTIVE_APP_TYPE_HBBTV,
            INTERACTIVE_APP_TYPE_ATSC,
            INTERACTIVE_APP_TYPE_GINGA,
    })
    @interface InteractiveAppType {}

    /** HbbTV interactive app type */
    public static final String INTERACTIVE_APP_TYPE_HBBTV = "hbbtv";
    /** ATSC interactive app type */
    public static final String INTERACTIVE_APP_TYPE_ATSC = "atsc";
    /** Ginga interactive app type */
    public static final String INTERACTIVE_APP_TYPE_GINGA = "ginga";

    private final ResolveInfo mService;
    private final String mId;
    private List<String> mTypes = new ArrayList<>();
@@ -106,6 +124,13 @@ public final class TvIAppInfo implements Parcelable {
        return mService.serviceInfo;
    }

    /**
     * Gets supported interactive app types
     */
    public List<String> getSupportedTypes() {
        return new ArrayList<>(mTypes);
    }

    /**
     * A convenience builder for creating {@link TvIAppInfo} objects.
     */
@@ -186,7 +211,7 @@ public final class TvIAppInfo implements Parcelable {
                CharSequence[] types = sa.getTextArray(
                        com.android.internal.R.styleable.TvIAppService_supportedTypes);
                for (CharSequence cs : types) {
                    mTypes.add(cs.toString());
                    mTypes.add(cs.toString().toLowerCase());
                }

                sa.recycle();
+4 −0
Original line number Diff line number Diff line
@@ -113,6 +113,10 @@ public class TvIAppView extends ViewGroup {
        this(context, null, 0);
    }

    public TvIAppView(@NonNull Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TvIAppView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        int sourceResId = Resources.getAttributeSetSourceResId(attrs);