• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.tv.dvr.provider;
18 
19 import android.provider.BaseColumns;
20 
21 /**
22  * The contract between the DVR provider and applications. Contains definitions for the supported
23  * columns. It's for the internal use in Live TV.
24  */
25 public final class DvrContract {
26     /** Column definition for Schedules table. */
27     public static final class Schedules implements BaseColumns {
28         /** The table name. */
29         public static final String TABLE_NAME = "schedules";
30 
31         /** The recording type for program recording. */
32         public static final String TYPE_PROGRAM = "TYPE_PROGRAM";
33 
34         /** The recording type for timed recording. */
35         public static final String TYPE_TIMED = "TYPE_TIMED";
36 
37         /** The recording has not been started yet. */
38         public static final String STATE_RECORDING_NOT_STARTED = "STATE_RECORDING_NOT_STARTED";
39 
40         /** The recording is in progress. */
41         public static final String STATE_RECORDING_IN_PROGRESS = "STATE_RECORDING_IN_PROGRESS";
42 
43         /** The recording is finished. */
44         public static final String STATE_RECORDING_FINISHED = "STATE_RECORDING_FINISHED";
45 
46         /** The recording failed. */
47         public static final String STATE_RECORDING_FAILED = "STATE_RECORDING_FAILED";
48 
49         /** The recording finished and clipping. */
50         public static final String STATE_RECORDING_CLIPPED = "STATE_RECORDING_CLIPPED";
51 
52         /** The recording marked as deleted. */
53         public static final String STATE_RECORDING_DELETED = "STATE_RECORDING_DELETED";
54 
55         /** The recording marked as canceled. */
56         public static final String STATE_RECORDING_CANCELED = "STATE_RECORDING_CANCELED";
57 
58         /** The recording failed reason for other reasons */
59         public static final String FAILED_REASON_OTHER = "FAILED_REASON_OTHER";
60 
61         /** The recording failed because the program ended before recording started. */
62         public static final String FAILED_REASON_PROGRAM_ENDED_BEFORE_RECORDING_STARTED =
63                 "FAILED_REASON_PROGRAM_ENDED_BEFORE_RECORDING_STARTED";
64 
65         /** The recording failed because it was not finished successfully */
66         public static final String FAILED_REASON_NOT_FINISHED = "FAILED_REASON_NOT_FINISHED";
67 
68         /** The recording failed because the channel ID was invalid */
69         public static final String FAILED_REASON_INVALID_CHANNEL = "FAILED_REASON_INVALID_CHANNEL";
70 
71         /** The recording failed because the scheduler was stopped */
72         public static final String FAILED_REASON_SCHEDULER_STOPPED
73                 = "FAILED_REASON_SCHEDULER_STOPPED";
74 
75         /** The recording failed because some messages were not sent to the message queue */
76         public static final String FAILED_REASON_MESSAGE_NOT_SENT =
77                 "FAILED_REASON_MESSAGE_NOT_SENT";
78 
79         /**
80          * The recording failed because it was failed to establish a connection to the recording
81          * session for the corresponding TV input.
82          */
83         public static final String FAILED_REASON_CONNECTION_FAILED =
84                 "FAILED_REASON_CONNECTION_FAILED";
85 
86         /**
87          * The recording failed because a required recording resource was not able to be
88          * allocated.
89          */
90         public static final String FAILED_REASON_RESOURCE_BUSY = "FAILED_REASON_RESOURCE_BUSY";
91 
92         /** The recording failed because the input was not available */
93         public static final String FAILED_REASON_INPUT_UNAVAILABLE =
94                 "FAILED_REASON_INPUT_UNAVAILABLE";
95 
96         /** The recording failed because the input doesn't support recording */
97         public static final String FAILED_REASON_INPUT_DVR_UNSUPPORTED =
98                 "FAILED_REASON_INPUT_DVR_UNSUPPORTED";
99 
100         /** The recording failed because the space was not sufficient */
101         public static final String FAILED_REASON_INSUFFICIENT_SPACE =
102                 "FAILED_REASON_INSUFFICIENT_SPACE";
103 
104         /**
105          * The priority of this recording.
106          *
107          * <p>The lowest number is recorded first. If there is a tie in priority then the lower id
108          * wins. Defaults to {@value Long#MAX_VALUE}
109          *
110          * <p>Type: INTEGER (long)
111          */
112         public static final String COLUMN_PRIORITY = "priority";
113 
114         /**
115          * The type of this recording.
116          *
117          * <p>This value should be one of the followings: {@link #TYPE_PROGRAM} and {@link
118          * #TYPE_TIMED}.
119          *
120          * <p>This is a required field.
121          *
122          * <p>Type: TEXT
123          */
124         public static final String COLUMN_TYPE = "type";
125 
126         /**
127          * The input id of recording.
128          *
129          * <p>This is a required field.
130          *
131          * <p>Type: TEXT
132          */
133         public static final String COLUMN_INPUT_ID = "input_id";
134 
135         /**
136          * The ID of the channel for recording.
137          *
138          * <p>This is a required field.
139          *
140          * <p>Type: INTEGER (long)
141          */
142         public static final String COLUMN_CHANNEL_ID = "channel_id";
143 
144         /**
145          * The ID of the associated program for recording.
146          *
147          * <p>This is an optional field.
148          *
149          * <p>Type: INTEGER (long)
150          */
151         public static final String COLUMN_PROGRAM_ID = "program_id";
152 
153         /**
154          * The title of the associated program for recording.
155          *
156          * <p>This is an optional field.
157          *
158          * <p>Type: TEXT
159          */
160         public static final String COLUMN_PROGRAM_TITLE = "program_title";
161 
162         /**
163          * The start time of this recording, in milliseconds since the epoch.
164          *
165          * <p>This is a required field.
166          *
167          * <p>Type: INTEGER (long)
168          */
169         public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
170 
171         /**
172          * The end time of this recording, in milliseconds since the epoch.
173          *
174          * <p>This is a required field.
175          *
176          * <p>Type: INTEGER (long)
177          */
178         public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
179 
180         /**
181          * The season number of this program for episodic TV shows.
182          *
183          * <p>Type: TEXT
184          */
185         public static final String COLUMN_SEASON_NUMBER = "season_number";
186 
187         /**
188          * The episode number of this program for episodic TV shows.
189          *
190          * <p>Type: TEXT
191          */
192         public static final String COLUMN_EPISODE_NUMBER = "episode_number";
193 
194         /**
195          * The episode title of this program for episodic TV shows.
196          *
197          * <p>Type: TEXT
198          */
199         public static final String COLUMN_EPISODE_TITLE = "episode_title";
200 
201         /**
202          * The description of program.
203          *
204          * <p>Type: TEXT
205          */
206         public static final String COLUMN_PROGRAM_DESCRIPTION = "program_description";
207 
208         /**
209          * The long description of program.
210          *
211          * <p>Type: TEXT
212          */
213         public static final String COLUMN_PROGRAM_LONG_DESCRIPTION = "program_long_description";
214 
215         /**
216          * The poster art uri of program.
217          *
218          * <p>Type: TEXT
219          */
220         public static final String COLUMN_PROGRAM_POST_ART_URI = "program_poster_art_uri";
221 
222         /**
223          * The thumbnail uri of program.
224          *
225          * <p>Type: TEXT
226          */
227         public static final String COLUMN_PROGRAM_THUMBNAIL_URI = "program_thumbnail_uri";
228 
229         /**
230          * The state of this recording.
231          *
232          * <p>This value should be one of the followings: {@link #STATE_RECORDING_NOT_STARTED},
233          * {@link #STATE_RECORDING_IN_PROGRESS}, {@link #STATE_RECORDING_FINISHED}, {@link
234          * #STATE_RECORDING_FAILED}, {@link #STATE_RECORDING_CLIPPED} and {@link
235          * #STATE_RECORDING_DELETED}.
236          *
237          * <p>This is a required field.
238          *
239          * <p>Type: TEXT
240          */
241         public static final String COLUMN_STATE = "state";
242 
243         /**
244          * The reason of failure of this recording if it's failed.
245          *
246          * <p>Type: TEXT
247          */
248         public static final String COLUMN_FAILED_REASON = "failed_reason";
249 
250         /**
251          * The ID of the parent series recording.
252          *
253          * <p>Type: INTEGER (long)
254          */
255         public static final String COLUMN_SERIES_RECORDING_ID = "series_recording_id";
256 
Schedules()257         private Schedules() {}
258     }
259 
260     /** Column definition for Recording table. */
261     public static final class SeriesRecordings implements BaseColumns {
262         /** The table name. */
263         public static final String TABLE_NAME = "series_recording";
264 
265         /**
266          * This value is used for {@link #COLUMN_START_FROM_SEASON} and {@link
267          * #COLUMN_START_FROM_EPISODE} to mean record all seasons or episodes.
268          */
269         public static final int THE_BEGINNING = -1;
270 
271         /**
272          * The series recording option which indicates that the episodes in one channel are
273          * recorded.
274          */
275         public static final String OPTION_CHANNEL_ONE = "OPTION_CHANNEL_ONE";
276 
277         /**
278          * The series recording option which indicates that the episodes in all the channels are
279          * recorded.
280          */
281         public static final String OPTION_CHANNEL_ALL = "OPTION_CHANNEL_ALL";
282 
283         /** The state indicates that it is a normal one. */
284         public static final String STATE_SERIES_NORMAL = "STATE_SERIES_NORMAL";
285 
286         /** The state indicates that it is stopped. */
287         public static final String STATE_SERIES_STOPPED = "STATE_SERIES_STOPPED";
288 
289         /**
290          * The priority of this recording.
291          *
292          * <p>The lowest number is recorded first. If there is a tie in priority then the lower id
293          * wins. Defaults to {@value Long#MAX_VALUE}
294          *
295          * <p>Type: INTEGER (long)
296          */
297         public static final String COLUMN_PRIORITY = "priority";
298 
299         /**
300          * The input id of recording.
301          *
302          * <p>This is a required field.
303          *
304          * <p>Type: TEXT
305          */
306         public static final String COLUMN_INPUT_ID = "input_id";
307 
308         /**
309          * The ID of the channel for recording.
310          *
311          * <p>This is a required field.
312          *
313          * <p>Type: INTEGER (long)
314          */
315         public static final String COLUMN_CHANNEL_ID = "channel_id";
316 
317         /**
318          * The ID of the associated series to record.
319          *
320          * <p>The id is an opaque but stable string.
321          *
322          * <p>This is an optional field.
323          *
324          * <p>Type: TEXT
325          */
326         public static final String COLUMN_SERIES_ID = "series_id";
327 
328         /**
329          * The title of the series.
330          *
331          * <p>This is a required field.
332          *
333          * <p>Type: TEXT
334          */
335         public static final String COLUMN_TITLE = "title";
336 
337         /**
338          * The short description of the series.
339          *
340          * <p>Type: TEXT
341          */
342         public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
343 
344         /**
345          * The long description of the series.
346          *
347          * <p>Type: TEXT
348          */
349         public static final String COLUMN_LONG_DESCRIPTION = "long_description";
350 
351         /**
352          * The number of the earliest season to record. The value {@link #THE_BEGINNING} means
353          * record all seasons.
354          *
355          * <p>Default value is {@value #THE_BEGINNING} {@link #THE_BEGINNING}.
356          *
357          * <p>Type: INTEGER (int)
358          */
359         public static final String COLUMN_START_FROM_SEASON = "start_from_season";
360 
361         /**
362          * The number of the earliest episode to record in {@link #COLUMN_START_FROM_SEASON}. The
363          * value {@link #THE_BEGINNING} means record all episodes.
364          *
365          * <p>Default value is {@value #THE_BEGINNING} {@link #THE_BEGINNING}.
366          *
367          * <p>Type: INTEGER (int)
368          */
369         public static final String COLUMN_START_FROM_EPISODE = "start_from_episode";
370 
371         /**
372          * The series recording option which indicates the channels to record.
373          *
374          * <p>This value should be one of the followings: {@link #OPTION_CHANNEL_ONE} and {@link
375          * #OPTION_CHANNEL_ALL}. The default value is OPTION_CHANNEL_ONE.
376          *
377          * <p>Type: TEXT
378          */
379         public static final String COLUMN_CHANNEL_OPTION = "channel_option";
380 
381         /**
382          * The comma-separated canonical genre string of this series.
383          *
384          * <p>Canonical genres are defined in {@link android.media.tv.TvContract.Programs.Genres}.
385          * Use {@link android.media.tv.TvContract.Programs.Genres#encode} to create a text that can
386          * be stored in this column. Use {@link android.media.tv.TvContract.Programs.Genres#decode}
387          * to get the canonical genre strings from the text stored in the column.
388          *
389          * <p>Type: TEXT
390          *
391          * @see android.media.tv.TvContract.Programs.Genres
392          * @see android.media.tv.TvContract.Programs.Genres#encode
393          * @see android.media.tv.TvContract.Programs.Genres#decode
394          */
395         public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
396 
397         /**
398          * The URI for the poster of this TV series.
399          *
400          * <p>The data in the column must be a URL, or a URI in one of the following formats:
401          *
402          * <ul>
403          *   <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT})
404          *   <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE})
405          *   <li>file ({@link android.content.ContentResolver#SCHEME_FILE})
406          * </ul>
407          *
408          * <p>Type: TEXT
409          */
410         public static final String COLUMN_POSTER_URI = "poster_uri";
411 
412         /**
413          * The URI for the photo of this TV program.
414          *
415          * <p>The data in the column must be a URL, or a URI in one of the following formats:
416          *
417          * <ul>
418          *   <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT})
419          *   <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE})
420          *   <li>file ({@link android.content.ContentResolver#SCHEME_FILE})
421          * </ul>
422          *
423          * <p>Type: TEXT
424          */
425         public static final String COLUMN_PHOTO_URI = "photo_uri";
426 
427         /**
428          * The state of whether the series recording be canceled or not.
429          *
430          * <p>This value should be one of the followings: {@link #STATE_SERIES_NORMAL} and {@link
431          * #STATE_SERIES_STOPPED}. The default value is STATE_SERIES_NORMAL.
432          *
433          * <p>Type: TEXT
434          */
435         public static final String COLUMN_STATE = "state";
436 
SeriesRecordings()437         private SeriesRecordings() {}
438     }
439 
DvrContract()440     private DvrContract() {}
441 }
442