diff options
| author | 2016-02-19 18:39:28 -0800 | |
|---|---|---|
| committer | 2016-02-23 16:52:16 -0800 | |
| commit | dee3cfe897b8cc49a3374807bd61647d429f706f (patch) | |
| tree | c0cb736330533862aaf7c92dd934a2b54ccafda9 | |
| parent | eefb17ac61698e1b1fe9ed9e6e4d3695d3100053 (diff) | |
Enable to set canRecord and tunerCount statically
Bug: 27276122
Change-Id: I61d07cfdbe13e4484ccaf5cdcf0796f08c78e2a8
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | api/system-current.txt | 2 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 15 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 2 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputInfo.java | 22 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputManager.java | 4 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputService.java | 6 |
8 files changed, 33 insertions, 22 deletions
diff --git a/api/current.txt b/api/current.txt index 9180dabdd392..775122d92285 100644 --- a/api/current.txt +++ b/api/current.txt @@ -338,6 +338,7 @@ package android { field public static final int calendarViewStyle = 16843613; // 0x101035d field public static final int canControlMagnification = 16844040; // 0x1010508 field public static final int canPerformGestures = 16844046; // 0x101050e + field public static final int canRecord = 16844061; // 0x101051d field public static final int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8 field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9 field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7 @@ -1359,6 +1360,7 @@ package android { field public static final int trimPathEnd = 16843785; // 0x1010409 field public static final int trimPathOffset = 16843786; // 0x101040a field public static final int trimPathStart = 16843784; // 0x1010408 + field public static final int tunerCount = 16844062; // 0x101051e field public static final int type = 16843169; // 0x10101a1 field public static final int typeface = 16842902; // 0x1010096 field public static final int uiOptions = 16843672; // 0x1010398 diff --git a/api/system-current.txt b/api/system-current.txt index dc08cd39bae8..8bd97df6253f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -433,6 +433,7 @@ package android { field public static final int calendarViewStyle = 16843613; // 0x101035d field public static final int canControlMagnification = 16844040; // 0x1010508 field public static final int canPerformGestures = 16844046; // 0x101050e + field public static final int canRecord = 16844061; // 0x101051d field public static final int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8 field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9 field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7 @@ -1458,6 +1459,7 @@ package android { field public static final int trimPathEnd = 16843785; // 0x1010409 field public static final int trimPathOffset = 16843786; // 0x101040a field public static final int trimPathStart = 16843784; // 0x1010408 + field public static final int tunerCount = 16844062; // 0x101051e field public static final int type = 16843169; // 0x10101a1 field public static final int typeface = 16842902; // 0x1010096 field public static final int uiOptions = 16843672; // 0x1010398 diff --git a/api/test-current.txt b/api/test-current.txt index bad08686bab3..545c718fa0d5 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -338,6 +338,7 @@ package android { field public static final int calendarViewStyle = 16843613; // 0x101035d field public static final int canControlMagnification = 16844040; // 0x1010508 field public static final int canPerformGestures = 16844046; // 0x101050e + field public static final int canRecord = 16844061; // 0x101051d field public static final int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8 field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9 field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7 @@ -1359,6 +1360,7 @@ package android { field public static final int trimPathEnd = 16843785; // 0x1010409 field public static final int trimPathOffset = 16843786; // 0x101040a field public static final int trimPathStart = 16843784; // 0x1010408 + field public static final int tunerCount = 16844062; // 0x101051e field public static final int type = 16843169; // 0x10101a1 field public static final int typeface = 16842902; // 0x1010096 field public static final int uiOptions = 16843672; // 0x1010398 diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 2ab95412ef62..3a45da9ba3ab 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -8048,12 +8048,19 @@ i {@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. --> + <!-- Component name of an activity that allows the user to set up this service. --> <attr name="setupActivity" format="string" /> - <!-- Component name of an activity that allows the user to modify - the settings for this service. --> + <!-- Component name of an activity that allows the user to modify the settings for this + service. --> <attr name="settingsActivity" /> + <!-- Attribute whether the TV input service can record programs. This value can be changed + at runtime by calling + {@link android.media.tv.TvInputService#updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo)}. --> + <attr name="canRecord" format="boolean" /> + <!-- The number of tuners that the TV input service is associated with. This value can be + changed at runtime by calling + {@link android.media.tv.TvInputService#updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo)}. --> + <attr name="tunerCount" format="integer" /> </declare-styleable> <!-- Attributes that can be used with <code>rating-system-definition</code> tags inside of the diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index dbaa73772bbe..06e2248bbb5a 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2703,6 +2703,8 @@ <public type="attr" name="version" /> <public type="attr" name="backupInForeground" /> <public type="attr" name="countDown" /> + <public type="attr" name="canRecord" /> + <public type="attr" name="tunerCount" /> <public type="style" name="Theme.Material.Light.DialogWhenLarge.DarkActionBar" /> <public type="style" name="Widget.Material.SeekBar.Discrete" /> diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java index f0a94268d533..b8a1374ff077 100644 --- a/media/java/android/media/tv/TvInputInfo.java +++ b/media/java/android/media/tv/TvInputInfo.java @@ -113,14 +113,14 @@ public final class TvInputInfo implements Parcelable { private final String mId; private final String mParentId; private final int mType; - private final int mTunerCount; - private final boolean mCanRecord; private final boolean mIsHardwareInput; private final Bundle mExtras; // Attributes from XML meta data. private String mSetupActivity; private String mSettingsActivity; + private boolean mCanRecord; + private int mTunerCount; private HdmiDeviceInfo mHdmiDeviceInfo; private int mLabelResId; @@ -250,21 +250,17 @@ public final class TvInputInfo implements Parcelable { * {@code false} otherwise. * @param isConnectedToHdmiSwitch Whether a CEC device for this TV input is connected to an HDMI * switch, i.e., the device isn't directly connected to a HDMI port. - * @param tunerCount The number of tuners this TV input has. - * @param canRecord Whether this TV input can record TV programs. */ private TvInputInfo(ResolveInfo service, String id, String parentId, int type, - boolean isHardwareInput, boolean isConnectedToHdmiSwitch, int tunerCount, - boolean canRecord, Bundle extras) { + boolean isHardwareInput, boolean isConnectedToHdmiSwitch, Bundle extras) { mService = service; mId = id; mParentId = parentId; mType = type; mIsHardwareInput = isHardwareInput; mIsConnectedToHdmiSwitch = isConnectedToHdmiSwitch; - mTunerCount = tunerCount; - mCanRecord = canRecord; mExtras = extras; + mTunerCount = type == TYPE_TUNER ? 1 : 0; } /** @@ -791,19 +787,17 @@ public final class TvInputInfo implements Parcelable { type = TYPE_HDMI; isHardwareInput = true; isConnectedToHdmiSwitch = (mHdmiDeviceInfo.getPhysicalAddress() & 0x0FFF) != 0; - mTunerCount = 0; } else if (mTvInputHardwareInfo != null) { id = generateInputId(componentName, mTvInputHardwareInfo); type = sHardwareTypeToTvInputType.get(mTvInputHardwareInfo.getType(), TYPE_TUNER); isHardwareInput = true; - mTunerCount = 0; } else { id = generateInputId(componentName); type = TYPE_TUNER; } TvInputInfo info = new TvInputInfo(mResolveInfo, id, mParentId, type, isHardwareInput, - isConnectedToHdmiSwitch, mTunerCount, mCanRecord, mExtras); + isConnectedToHdmiSwitch, mExtras); return parseServiceMetadata(type, info); } @@ -868,6 +862,12 @@ public final class TvInputInfo implements Parcelable { Log.d(TAG, "Settings activity loaded. [" + info.mSettingsActivity + "] for " + si.name); } + info.mCanRecord = sa.getBoolean( + com.android.internal.R.styleable.TvInputService_canRecord, false); + info.mTunerCount = sa.getInt( + com.android.internal.R.styleable.TvInputService_tunerCount, + info.mTunerCount); + sa.recycle(); } catch (NameNotFoundException e) { throw new XmlPullParserException("Unable to create context for: " + si.packageName); diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index 51aae9083fad..7089c0074c76 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -731,9 +731,7 @@ public final class TvInputManager { * * <p>Because the system automatically creates a <code>TvInputInfo</code> object for each TV * input based on the information collected from the <code>AndroidManifest.xml</code>, this - * method is only called back when such information has changed dynamically or when the TV - * input service implementation wants to pass additional information that is not specified - * by the manifest file, such as ability to record and tuner count. + * method is only called back when such information has changed dynamically. * * @param inputInfo The <code>TvInputInfo</code> object that contains new information. */ diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index da4a03832191..db851a31d363 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -262,10 +262,8 @@ public abstract class TvInputService extends Service { * * <p>The system automatically creates a <code>TvInputInfo</code> object for each TV input, * based on the information collected from the <code>AndroidManifest.xml</code>, thus it is not - * necessary to call this method unless such information has changed dynamically. This may be - * also used to pass additional information that is not specified by the manifest file, such as - * ability to record and tuner count. Use {@link TvInputInfo.Builder} to build a new - * <code>TvInputInfo</code> object. + * necessary to call this method unless such information has changed dynamically. + * Use {@link TvInputInfo.Builder} to build a new <code>TvInputInfo</code> object. * * <p>Attempting to change information about a TV input that the calling package does not own * does nothing. |