TIAF: add IApp types and the getter
Also add a constructor for TvIAppView Bug: 212363897 Bug: 212358870 Test: mmm Change-Id: Ic6d9e3ed7134041644a8a7ef71bf73175778e995
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user