Loading api/current.txt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -708,7 +708,6 @@ package android { field public static final int l_resource_pad24 = 16843769; // 0x10103f9 field public static final int l_resource_pad24 = 16843769; // 0x10103f9 field public static final int l_resource_pad25 = 16843768; // 0x10103f8 field public static final int l_resource_pad25 = 16843768; // 0x10103f8 field public static final int l_resource_pad26 = 16843767; // 0x10103f7 field public static final int l_resource_pad26 = 16843767; // 0x10103f7 field public static final int l_resource_pad27 = 16843766; // 0x10103f6 field public static final int l_resource_pad3 = 16843790; // 0x101040e field public static final int l_resource_pad3 = 16843790; // 0x101040e field public static final int l_resource_pad4 = 16843789; // 0x101040d field public static final int l_resource_pad4 = 16843789; // 0x101040d field public static final int l_resource_pad5 = 16843788; // 0x101040c field public static final int l_resource_pad5 = 16843788; // 0x101040c Loading Loading @@ -1020,6 +1019,7 @@ package android { field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342 field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342 field public static final int sessionService = 16843841; // 0x1010441 field public static final int sessionService = 16843841; // 0x1010441 field public static final int settingsActivity = 16843301; // 0x1010225 field public static final int settingsActivity = 16843301; // 0x1010225 field public static final int setupActivity = 16843766; // 0x10103f6 field public static final int shadowColor = 16843105; // 0x1010161 field public static final int shadowColor = 16843105; // 0x1010161 field public static final int shadowDx = 16843106; // 0x1010162 field public static final int shadowDx = 16843106; // 0x1010162 field public static final int shadowDy = 16843107; // 0x1010163 field public static final int shadowDy = 16843107; // 0x1010163 Loading Loading @@ -15929,10 +15929,13 @@ package android.media.tv { method public int describeContents(); method public int describeContents(); method public android.content.ComponentName getComponent(); method public android.content.ComponentName getComponent(); method public java.lang.String getId(); method public java.lang.String getId(); method public android.content.Intent getIntentForSettingsActivity(); method public android.content.Intent getIntentForSetupActivity(); method public java.lang.String getPackageName(); method public java.lang.String getPackageName(); method public java.lang.String getServiceName(); method public java.lang.String getServiceName(); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int); field public static final java.lang.String EXTRA_SERVICE_NAME = "serviceName"; } } public final class TvInputManager { public final class TvInputManager { Loading Loading @@ -15966,6 +15969,7 @@ package android.media.tv { method public abstract android.media.tv.TvInputService.TvInputSessionImpl onCreateSession(); method public abstract android.media.tv.TvInputService.TvInputSessionImpl onCreateSession(); method public final void setAvailable(boolean); method public final void setAvailable(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; } } public abstract class TvInputService.TvInputSessionImpl implements android.view.KeyEvent.Callback { public abstract class TvInputService.TvInputSessionImpl implements android.view.KeyEvent.Callback { core/res/res/values/attrs.xml +13 −0 Original line number Original line Diff line number Diff line Loading @@ -6694,4 +6694,17 @@ <declare-styleable name="EdgeEffect"> <declare-styleable name="EdgeEffect"> <attr name="colorPrimaryLight" /> <attr name="colorPrimaryLight" /> </declare-styleable> </declare-styleable> <!-- Use <code>tv-input</code> as the root tag of the XML resource that describes an {@link android.media.tv.TvInputService}, which is referenced from its {@link android.media.tv.TvInputService#SERVICE_META_DATA} meta-data entry. Described here are the attributes that can be included in that tag. --> <declare-styleable name="TvInputService"> <!-- Component name of an activity for setup of this service. The setup includes scanning channels and registering EPG data. --> <attr name="setupActivity" format="string" /> <!-- Component name of an activity that allows the user to modify the settings for this service. --> <attr name="settingsActivity" /> </declare-styleable> </resources> </resources> core/res/res/values/public.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -2096,6 +2096,7 @@ <public type="attr" name="windowSwipeToDismiss" id="0x10103f3" /> <public type="attr" name="windowSwipeToDismiss" id="0x10103f3" /> <public type="attr" name="isGame" id="0x10103f4" /> <public type="attr" name="isGame" id="0x10103f4" /> <public type="attr" name="allowEmbedded" id="0x10103f5" /> <public type="attr" name="allowEmbedded" id="0x10103f5" /> <public type="attr" name="setupActivity" id="0x10103f6"/> <!-- =============================================================== <!-- =============================================================== Resources added in version 21 of the platform Resources added in version 21 of the platform Loading media/java/android/media/tv/TvInputInfo.java +118 −1 Original line number Original line Diff line number Diff line Loading @@ -17,26 +17,113 @@ package android.media.tv; package android.media.tv; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; /** /** * This class is used to specify meta information of a TV input. * This class is used to specify meta information of a TV input. */ */ public final class TvInputInfo implements Parcelable { public final class TvInputInfo implements Parcelable { private static final boolean DEBUG = false; private static final String TAG = "TvInputInfo"; /** * The name of the TV input service to provide to the setup activity and settings activity. */ public static final String EXTRA_SERVICE_NAME = "serviceName"; private static final String XML_START_TAG_NAME = "tv-input"; private final ResolveInfo mService; private final ResolveInfo mService; private final String mId; private final String mId; // Attributes from XML meta data. private String mSetupActivity; private String mSettingsActivity; /** * Create a new instance of the TvInputInfo class, * instantiating it from the given Context and ResolveInfo. * * @param service The ResolveInfo returned from the package manager about this TV input service. * @hide */ public static TvInputInfo createTvInputInfo(Context context, ResolveInfo service) throws XmlPullParserException, IOException { ServiceInfo si = service.serviceInfo; PackageManager pm = context.getPackageManager(); XmlResourceParser parser = null; try { parser = si.loadXmlMetaData(pm, TvInputService.SERVICE_META_DATA); if (parser == null) { throw new XmlPullParserException("No " + TvInputService.SERVICE_META_DATA + " meta-data for " + si.name); } Resources res = pm.getResourcesForApplication(si.applicationInfo); AttributeSet attrs = Xml.asAttributeSet(parser); int type; while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) { } String nodeName = parser.getName(); if (!XML_START_TAG_NAME.equals(nodeName)) { throw new XmlPullParserException( "Meta-data does not start with tv-input-service tag in " + si.name); } TvInputInfo input = new TvInputInfo(context, service); TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.TvInputService); input.mSetupActivity = sa.getString( com.android.internal.R.styleable.TvInputService_setupActivity); if (DEBUG) { Log.d(TAG, "Setup activity loaded. [" + input.mSetupActivity + "] for " + si.name); } input.mSettingsActivity = sa.getString( com.android.internal.R.styleable.TvInputService_settingsActivity); if (DEBUG) { Log.d(TAG, "Settings activity loaded. [" + input.mSettingsActivity + "] for " + si.name); } sa.recycle(); return input; } catch (NameNotFoundException e) { throw new XmlPullParserException("Unable to create context for: " + si.packageName); } finally { if (parser != null) { parser.close(); } } } /** /** * Constructor. * Constructor. * * * @param service The ResolveInfo returned from the package manager about this TV input service. * @param service The ResolveInfo returned from the package manager about this TV input service. * @hide * @hide */ */ public TvInputInfo(ResolveInfo service) { private TvInputInfo(Context context, ResolveInfo service) { mService = service; mService = service; ServiceInfo si = service.serviceInfo; ServiceInfo si = service.serviceInfo; mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name)); mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name)); Loading Loading @@ -71,6 +158,32 @@ public final class TvInputInfo implements Parcelable { return new ComponentName(mService.serviceInfo.packageName, mService.serviceInfo.name); return new ComponentName(mService.serviceInfo.packageName, mService.serviceInfo.name); } } /** * Returns an intent to start the setup activity for this TV input service. */ public Intent getIntentForSetupActivity() { if (!TextUtils.isEmpty(mSetupActivity)) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(getPackageName(), mSetupActivity); intent.putExtra(EXTRA_SERVICE_NAME, getServiceName()); return intent; } return null; } /** * Returns an intent to start the settings activity for this TV input service. */ public Intent getIntentForSettingsActivity() { if (!TextUtils.isEmpty(mSettingsActivity)) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(getPackageName(), mSettingsActivity); intent.putExtra(EXTRA_SERVICE_NAME, getServiceName()); return intent; } return null; } /** /** * Loads the user-displayed label for this TV input service. * Loads the user-displayed label for this TV input service. * * Loading Loading @@ -125,6 +238,8 @@ public final class TvInputInfo implements Parcelable { public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) { dest.writeString(mId); dest.writeString(mId); mService.writeToParcel(dest, flags); mService.writeToParcel(dest, flags); dest.writeString(mSetupActivity); dest.writeString(mSettingsActivity); } } /** /** Loading Loading @@ -159,5 +274,7 @@ public final class TvInputInfo implements Parcelable { private TvInputInfo(Parcel in) { private TvInputInfo(Parcel in) { mId = in.readString(); mId = in.readString(); mService = ResolveInfo.CREATOR.createFromParcel(in); mService = ResolveInfo.CREATOR.createFromParcel(in); mSetupActivity = in.readString(); mSettingsActivity = in.readString(); } } } } media/java/android/media/tv/TvInputService.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -62,6 +62,14 @@ public abstract class TvInputService extends Service { */ */ public static final String SERVICE_INTERFACE = "android.media.tv.TvInputService"; public static final String SERVICE_INTERFACE = "android.media.tv.TvInputService"; /** * Name under which a TvInputService component publishes information about itself. * This meta-data must reference an XML resource containing an * <code><{@link android.R.styleable#TvInputService tv-input}></code> * tag. */ public static final String SERVICE_META_DATA = "android.media.tv.input"; private String mId; private String mId; private final Handler mHandler = new ServiceHandler(); private final Handler mHandler = new ServiceHandler(); private final RemoteCallbackList<ITvInputServiceCallback> mCallbacks = private final RemoteCallbackList<ITvInputServiceCallback> mCallbacks = Loading Loading
api/current.txt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -708,7 +708,6 @@ package android { field public static final int l_resource_pad24 = 16843769; // 0x10103f9 field public static final int l_resource_pad24 = 16843769; // 0x10103f9 field public static final int l_resource_pad25 = 16843768; // 0x10103f8 field public static final int l_resource_pad25 = 16843768; // 0x10103f8 field public static final int l_resource_pad26 = 16843767; // 0x10103f7 field public static final int l_resource_pad26 = 16843767; // 0x10103f7 field public static final int l_resource_pad27 = 16843766; // 0x10103f6 field public static final int l_resource_pad3 = 16843790; // 0x101040e field public static final int l_resource_pad3 = 16843790; // 0x101040e field public static final int l_resource_pad4 = 16843789; // 0x101040d field public static final int l_resource_pad4 = 16843789; // 0x101040d field public static final int l_resource_pad5 = 16843788; // 0x101040c field public static final int l_resource_pad5 = 16843788; // 0x101040c Loading Loading @@ -1020,6 +1019,7 @@ package android { field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342 field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342 field public static final int sessionService = 16843841; // 0x1010441 field public static final int sessionService = 16843841; // 0x1010441 field public static final int settingsActivity = 16843301; // 0x1010225 field public static final int settingsActivity = 16843301; // 0x1010225 field public static final int setupActivity = 16843766; // 0x10103f6 field public static final int shadowColor = 16843105; // 0x1010161 field public static final int shadowColor = 16843105; // 0x1010161 field public static final int shadowDx = 16843106; // 0x1010162 field public static final int shadowDx = 16843106; // 0x1010162 field public static final int shadowDy = 16843107; // 0x1010163 field public static final int shadowDy = 16843107; // 0x1010163 Loading Loading @@ -15929,10 +15929,13 @@ package android.media.tv { method public int describeContents(); method public int describeContents(); method public android.content.ComponentName getComponent(); method public android.content.ComponentName getComponent(); method public java.lang.String getId(); method public java.lang.String getId(); method public android.content.Intent getIntentForSettingsActivity(); method public android.content.Intent getIntentForSetupActivity(); method public java.lang.String getPackageName(); method public java.lang.String getPackageName(); method public java.lang.String getServiceName(); method public java.lang.String getServiceName(); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int); field public static final java.lang.String EXTRA_SERVICE_NAME = "serviceName"; } } public final class TvInputManager { public final class TvInputManager { Loading Loading @@ -15966,6 +15969,7 @@ package android.media.tv { method public abstract android.media.tv.TvInputService.TvInputSessionImpl onCreateSession(); method public abstract android.media.tv.TvInputService.TvInputSessionImpl onCreateSession(); method public final void setAvailable(boolean); method public final void setAvailable(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; } } public abstract class TvInputService.TvInputSessionImpl implements android.view.KeyEvent.Callback { public abstract class TvInputService.TvInputSessionImpl implements android.view.KeyEvent.Callback {
core/res/res/values/attrs.xml +13 −0 Original line number Original line Diff line number Diff line Loading @@ -6694,4 +6694,17 @@ <declare-styleable name="EdgeEffect"> <declare-styleable name="EdgeEffect"> <attr name="colorPrimaryLight" /> <attr name="colorPrimaryLight" /> </declare-styleable> </declare-styleable> <!-- Use <code>tv-input</code> as the root tag of the XML resource that describes an {@link android.media.tv.TvInputService}, which is referenced from its {@link android.media.tv.TvInputService#SERVICE_META_DATA} meta-data entry. Described here are the attributes that can be included in that tag. --> <declare-styleable name="TvInputService"> <!-- Component name of an activity for setup of this service. The setup includes scanning channels and registering EPG data. --> <attr name="setupActivity" format="string" /> <!-- Component name of an activity that allows the user to modify the settings for this service. --> <attr name="settingsActivity" /> </declare-styleable> </resources> </resources>
core/res/res/values/public.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -2096,6 +2096,7 @@ <public type="attr" name="windowSwipeToDismiss" id="0x10103f3" /> <public type="attr" name="windowSwipeToDismiss" id="0x10103f3" /> <public type="attr" name="isGame" id="0x10103f4" /> <public type="attr" name="isGame" id="0x10103f4" /> <public type="attr" name="allowEmbedded" id="0x10103f5" /> <public type="attr" name="allowEmbedded" id="0x10103f5" /> <public type="attr" name="setupActivity" id="0x10103f6"/> <!-- =============================================================== <!-- =============================================================== Resources added in version 21 of the platform Resources added in version 21 of the platform Loading
media/java/android/media/tv/TvInputInfo.java +118 −1 Original line number Original line Diff line number Diff line Loading @@ -17,26 +17,113 @@ package android.media.tv; package android.media.tv; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; /** /** * This class is used to specify meta information of a TV input. * This class is used to specify meta information of a TV input. */ */ public final class TvInputInfo implements Parcelable { public final class TvInputInfo implements Parcelable { private static final boolean DEBUG = false; private static final String TAG = "TvInputInfo"; /** * The name of the TV input service to provide to the setup activity and settings activity. */ public static final String EXTRA_SERVICE_NAME = "serviceName"; private static final String XML_START_TAG_NAME = "tv-input"; private final ResolveInfo mService; private final ResolveInfo mService; private final String mId; private final String mId; // Attributes from XML meta data. private String mSetupActivity; private String mSettingsActivity; /** * Create a new instance of the TvInputInfo class, * instantiating it from the given Context and ResolveInfo. * * @param service The ResolveInfo returned from the package manager about this TV input service. * @hide */ public static TvInputInfo createTvInputInfo(Context context, ResolveInfo service) throws XmlPullParserException, IOException { ServiceInfo si = service.serviceInfo; PackageManager pm = context.getPackageManager(); XmlResourceParser parser = null; try { parser = si.loadXmlMetaData(pm, TvInputService.SERVICE_META_DATA); if (parser == null) { throw new XmlPullParserException("No " + TvInputService.SERVICE_META_DATA + " meta-data for " + si.name); } Resources res = pm.getResourcesForApplication(si.applicationInfo); AttributeSet attrs = Xml.asAttributeSet(parser); int type; while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) { } String nodeName = parser.getName(); if (!XML_START_TAG_NAME.equals(nodeName)) { throw new XmlPullParserException( "Meta-data does not start with tv-input-service tag in " + si.name); } TvInputInfo input = new TvInputInfo(context, service); TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.TvInputService); input.mSetupActivity = sa.getString( com.android.internal.R.styleable.TvInputService_setupActivity); if (DEBUG) { Log.d(TAG, "Setup activity loaded. [" + input.mSetupActivity + "] for " + si.name); } input.mSettingsActivity = sa.getString( com.android.internal.R.styleable.TvInputService_settingsActivity); if (DEBUG) { Log.d(TAG, "Settings activity loaded. [" + input.mSettingsActivity + "] for " + si.name); } sa.recycle(); return input; } catch (NameNotFoundException e) { throw new XmlPullParserException("Unable to create context for: " + si.packageName); } finally { if (parser != null) { parser.close(); } } } /** /** * Constructor. * Constructor. * * * @param service The ResolveInfo returned from the package manager about this TV input service. * @param service The ResolveInfo returned from the package manager about this TV input service. * @hide * @hide */ */ public TvInputInfo(ResolveInfo service) { private TvInputInfo(Context context, ResolveInfo service) { mService = service; mService = service; ServiceInfo si = service.serviceInfo; ServiceInfo si = service.serviceInfo; mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name)); mId = generateInputIdForComponentName(new ComponentName(si.packageName, si.name)); Loading Loading @@ -71,6 +158,32 @@ public final class TvInputInfo implements Parcelable { return new ComponentName(mService.serviceInfo.packageName, mService.serviceInfo.name); return new ComponentName(mService.serviceInfo.packageName, mService.serviceInfo.name); } } /** * Returns an intent to start the setup activity for this TV input service. */ public Intent getIntentForSetupActivity() { if (!TextUtils.isEmpty(mSetupActivity)) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(getPackageName(), mSetupActivity); intent.putExtra(EXTRA_SERVICE_NAME, getServiceName()); return intent; } return null; } /** * Returns an intent to start the settings activity for this TV input service. */ public Intent getIntentForSettingsActivity() { if (!TextUtils.isEmpty(mSettingsActivity)) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(getPackageName(), mSettingsActivity); intent.putExtra(EXTRA_SERVICE_NAME, getServiceName()); return intent; } return null; } /** /** * Loads the user-displayed label for this TV input service. * Loads the user-displayed label for this TV input service. * * Loading Loading @@ -125,6 +238,8 @@ public final class TvInputInfo implements Parcelable { public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) { dest.writeString(mId); dest.writeString(mId); mService.writeToParcel(dest, flags); mService.writeToParcel(dest, flags); dest.writeString(mSetupActivity); dest.writeString(mSettingsActivity); } } /** /** Loading Loading @@ -159,5 +274,7 @@ public final class TvInputInfo implements Parcelable { private TvInputInfo(Parcel in) { private TvInputInfo(Parcel in) { mId = in.readString(); mId = in.readString(); mService = ResolveInfo.CREATOR.createFromParcel(in); mService = ResolveInfo.CREATOR.createFromParcel(in); mSetupActivity = in.readString(); mSettingsActivity = in.readString(); } } } }
media/java/android/media/tv/TvInputService.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -62,6 +62,14 @@ public abstract class TvInputService extends Service { */ */ public static final String SERVICE_INTERFACE = "android.media.tv.TvInputService"; public static final String SERVICE_INTERFACE = "android.media.tv.TvInputService"; /** * Name under which a TvInputService component publishes information about itself. * This meta-data must reference an XML resource containing an * <code><{@link android.R.styleable#TvInputService tv-input}></code> * tag. */ public static final String SERVICE_META_DATA = "android.media.tv.input"; private String mId; private String mId; private final Handler mHandler = new ServiceHandler(); private final Handler mHandler = new ServiceHandler(); private final RemoteCallbackList<ITvInputServiceCallback> mCallbacks = private final RemoteCallbackList<ITvInputServiceCallback> mCallbacks = Loading