Merge "Add an API to get TV input icon"

This commit is contained in:
Jae Seo
2014-06-12 21:22:11 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 0 deletions

View File

@@ -15885,6 +15885,7 @@ package android.media.tv {
method public android.content.Intent getIntentForSetupActivity();
method public android.content.pm.ServiceInfo getServiceInfo();
method public int getType();
method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager);
method public void writeToParcel(android.os.Parcel, int);
field public static final java.lang.String EXTRA_SERVICE_NAME = "serviceName";

View File

@@ -26,6 +26,7 @@ import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -223,6 +224,18 @@ public final class TvInputInfo implements Parcelable {
return mService.loadLabel(pm);
}
/**
* Loads the user-displayed icon for this TV input service.
*
* @param pm Supplies a PackageManager used to load the TV input's resources.
* @return a Drawable containing the TV input's icon. If the TV input does not have
* an icon, application icon is returned. If it's unavailable too, system default is
* returned.
*/
public Drawable loadIcon(PackageManager pm) {
return mService.serviceInfo.loadIcon(pm);
}
@Override
public int describeContents() {
return 0;