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 TV app. 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 allocated. 88 */ 89 public static final String FAILED_REASON_RESOURCE_BUSY = "FAILED_REASON_RESOURCE_BUSY"; 90 91 /** The recording failed because the input was not available */ 92 public static final String FAILED_REASON_INPUT_UNAVAILABLE = 93 "FAILED_REASON_INPUT_UNAVAILABLE"; 94 95 /** The recording failed because the input doesn't support recording */ 96 public static final String FAILED_REASON_INPUT_DVR_UNSUPPORTED = 97 "FAILED_REASON_INPUT_DVR_UNSUPPORTED"; 98 99 /** The recording failed because the space was not sufficient */ 100 public static final String FAILED_REASON_INSUFFICIENT_SPACE = 101 "FAILED_REASON_INSUFFICIENT_SPACE"; 102 103 /** 104 * The priority of this recording. 105 * 106 * <p>The lowest number is recorded first. If there is a tie in priority then the lower id 107 * wins. Defaults to {@value Long#MAX_VALUE} 108 * 109 * <p>Type: INTEGER (long) 110 */ 111 public static final String COLUMN_PRIORITY = "priority"; 112 113 /** 114 * The type of this recording. 115 * 116 * <p>This value should be one of the followings: {@link #TYPE_PROGRAM} and {@link 117 * #TYPE_TIMED}. 118 * 119 * <p>This is a required field. 120 * 121 * <p>Type: TEXT 122 */ 123 public static final String COLUMN_TYPE = "type"; 124 125 /** 126 * The input id of recording. 127 * 128 * <p>This is a required field. 129 * 130 * <p>Type: TEXT 131 */ 132 public static final String COLUMN_INPUT_ID = "input_id"; 133 134 /** 135 * The ID of the channel for recording. 136 * 137 * <p>This is a required field. 138 * 139 * <p>Type: INTEGER (long) 140 */ 141 public static final String COLUMN_CHANNEL_ID = "channel_id"; 142 143 /** 144 * The ID of the associated program for recording. 145 * 146 * <p>This is an optional field. 147 * 148 * <p>Type: INTEGER (long) 149 */ 150 public static final String COLUMN_PROGRAM_ID = "program_id"; 151 152 /** 153 * The title of the associated program for recording. 154 * 155 * <p>This is an optional field. 156 * 157 * <p>Type: TEXT 158 */ 159 public static final String COLUMN_PROGRAM_TITLE = "program_title"; 160 161 /** 162 * The start time of this recording, in milliseconds since the epoch. 163 * 164 * <p>This is a required field. 165 * 166 * <p>Type: INTEGER (long) 167 */ 168 public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis"; 169 170 /** 171 * The end time of this recording, in milliseconds since the epoch. 172 * 173 * <p>This is a required field. 174 * 175 * <p>Type: INTEGER (long) 176 */ 177 public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis"; 178 179 /** 180 * The season number of this program for episodic TV shows. 181 * 182 * <p>Type: TEXT 183 */ 184 public static final String COLUMN_SEASON_NUMBER = "season_number"; 185 186 /** 187 * The episode number of this program for episodic TV shows. 188 * 189 * <p>Type: TEXT 190 */ 191 public static final String COLUMN_EPISODE_NUMBER = "episode_number"; 192 193 /** 194 * The episode title of this program for episodic TV shows. 195 * 196 * <p>Type: TEXT 197 */ 198 public static final String COLUMN_EPISODE_TITLE = "episode_title"; 199 200 /** 201 * The description of program. 202 * 203 * <p>Type: TEXT 204 */ 205 public static final String COLUMN_PROGRAM_DESCRIPTION = "program_description"; 206 207 /** 208 * The long description of program. 209 * 210 * <p>Type: TEXT 211 */ 212 public static final String COLUMN_PROGRAM_LONG_DESCRIPTION = "program_long_description"; 213 214 /** 215 * The poster art uri of program. 216 * 217 * <p>Type: TEXT 218 */ 219 public static final String COLUMN_PROGRAM_POST_ART_URI = "program_poster_art_uri"; 220 221 /** 222 * The thumbnail uri of program. 223 * 224 * <p>Type: TEXT 225 */ 226 public static final String COLUMN_PROGRAM_THUMBNAIL_URI = "program_thumbnail_uri"; 227 228 /** 229 * The state of this recording. 230 * 231 * <p>This value should be one of the followings: {@link #STATE_RECORDING_NOT_STARTED}, 232 * {@link #STATE_RECORDING_IN_PROGRESS}, {@link #STATE_RECORDING_FINISHED}, {@link 233 * #STATE_RECORDING_FAILED}, {@link #STATE_RECORDING_CLIPPED} and {@link 234 * #STATE_RECORDING_DELETED}. 235 * 236 * <p>This is a required field. 237 * 238 * <p>Type: TEXT 239 */ 240 public static final String COLUMN_STATE = "state"; 241 242 /** 243 * The reason of failure of this recording if it's failed. 244 * 245 * <p>Type: TEXT 246 */ 247 public static final String COLUMN_FAILED_REASON = "failed_reason"; 248 249 /** 250 * The ID of the parent series recording. 251 * 252 * <p>Type: INTEGER (long) 253 */ 254 public static final String COLUMN_SERIES_RECORDING_ID = "series_recording_id"; 255 256 /** 257 * The extra time in milliseconds to start recording before the program starts. 258 * 259 * <p>Type: INTEGER (long) 260 */ 261 public static final String COLUMN_START_OFFSET_MILLIS = "start_offset_millis"; 262 263 /** 264 * The extra time in milliseconds to end recording after the program ends. 265 * 266 * <p>Type: INTEGER (long) 267 */ 268 public static final String COLUMN_END_OFFSET_MILLIS = "end_offset_millis"; 269 Schedules()270 private Schedules() {} 271 } 272 273 /** Column definition for Recording table. */ 274 public static final class SeriesRecordings implements BaseColumns { 275 /** The table name. */ 276 public static final String TABLE_NAME = "series_recording"; 277 278 /** 279 * This value is used for {@link #COLUMN_START_FROM_SEASON} and {@link 280 * #COLUMN_START_FROM_EPISODE} to mean record all seasons or episodes. 281 */ 282 public static final int THE_BEGINNING = -1; 283 284 /** 285 * The series recording option which indicates that the episodes in one channel are 286 * recorded. 287 */ 288 public static final String OPTION_CHANNEL_ONE = "OPTION_CHANNEL_ONE"; 289 290 /** 291 * The series recording option which indicates that the episodes in all the channels are 292 * recorded. 293 */ 294 public static final String OPTION_CHANNEL_ALL = "OPTION_CHANNEL_ALL"; 295 296 /** The state indicates that it is a normal one. */ 297 public static final String STATE_SERIES_NORMAL = "STATE_SERIES_NORMAL"; 298 299 /** The state indicates that it is stopped. */ 300 public static final String STATE_SERIES_STOPPED = "STATE_SERIES_STOPPED"; 301 302 /** 303 * The priority of this recording. 304 * 305 * <p>The lowest number is recorded first. If there is a tie in priority then the lower id 306 * wins. Defaults to {@value Long#MAX_VALUE} 307 * 308 * <p>Type: INTEGER (long) 309 */ 310 public static final String COLUMN_PRIORITY = "priority"; 311 312 /** 313 * The input id of recording. 314 * 315 * <p>This is a required field. 316 * 317 * <p>Type: TEXT 318 */ 319 public static final String COLUMN_INPUT_ID = "input_id"; 320 321 /** 322 * The ID of the channel for recording. 323 * 324 * <p>This is a required field. 325 * 326 * <p>Type: INTEGER (long) 327 */ 328 public static final String COLUMN_CHANNEL_ID = "channel_id"; 329 330 /** 331 * The ID of the associated series to record. 332 * 333 * <p>The id is an opaque but stable string. 334 * 335 * <p>This is an optional field. 336 * 337 * <p>Type: TEXT 338 */ 339 public static final String COLUMN_SERIES_ID = "series_id"; 340 341 /** 342 * The title of the series. 343 * 344 * <p>This is a required field. 345 * 346 * <p>Type: TEXT 347 */ 348 public static final String COLUMN_TITLE = "title"; 349 350 /** 351 * The short description of the series. 352 * 353 * <p>Type: TEXT 354 */ 355 public static final String COLUMN_SHORT_DESCRIPTION = "short_description"; 356 357 /** 358 * The long description of the series. 359 * 360 * <p>Type: TEXT 361 */ 362 public static final String COLUMN_LONG_DESCRIPTION = "long_description"; 363 364 /** 365 * The number of the earliest season to record. The value {@link #THE_BEGINNING} means 366 * record all seasons. 367 * 368 * <p>Default value is {@value #THE_BEGINNING} {@link #THE_BEGINNING}. 369 * 370 * <p>Type: INTEGER (int) 371 */ 372 public static final String COLUMN_START_FROM_SEASON = "start_from_season"; 373 374 /** 375 * The number of the earliest episode to record in {@link #COLUMN_START_FROM_SEASON}. The 376 * value {@link #THE_BEGINNING} means record all episodes. 377 * 378 * <p>Default value is {@value #THE_BEGINNING} {@link #THE_BEGINNING}. 379 * 380 * <p>Type: INTEGER (int) 381 */ 382 public static final String COLUMN_START_FROM_EPISODE = "start_from_episode"; 383 384 /** 385 * The series recording option which indicates the channels to record. 386 * 387 * <p>This value should be one of the followings: {@link #OPTION_CHANNEL_ONE} and {@link 388 * #OPTION_CHANNEL_ALL}. The default value is OPTION_CHANNEL_ONE. 389 * 390 * <p>Type: TEXT 391 */ 392 public static final String COLUMN_CHANNEL_OPTION = "channel_option"; 393 394 /** 395 * The comma-separated canonical genre string of this series. 396 * 397 * <p>Canonical genres are defined in {@link android.media.tv.TvContract.Programs.Genres}. 398 * Use {@link android.media.tv.TvContract.Programs.Genres#encode} to create a text that can 399 * be stored in this column. Use {@link android.media.tv.TvContract.Programs.Genres#decode} 400 * to get the canonical genre strings from the text stored in the column. 401 * 402 * <p>Type: TEXT 403 * 404 * @see android.media.tv.TvContract.Programs.Genres 405 * @see android.media.tv.TvContract.Programs.Genres#encode 406 * @see android.media.tv.TvContract.Programs.Genres#decode 407 */ 408 public static final String COLUMN_CANONICAL_GENRE = "canonical_genre"; 409 410 /** 411 * The URI for the poster of this TV series. 412 * 413 * <p>The data in the column must be a URL, or a URI in one of the following formats: 414 * 415 * <ul> 416 * <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT}) 417 * <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE}) 418 * <li>file ({@link android.content.ContentResolver#SCHEME_FILE}) 419 * </ul> 420 * 421 * <p>Type: TEXT 422 */ 423 public static final String COLUMN_POSTER_URI = "poster_uri"; 424 425 /** 426 * The URI for the photo of this TV program. 427 * 428 * <p>The data in the column must be a URL, or a URI in one of the following formats: 429 * 430 * <ul> 431 * <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT}) 432 * <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE}) 433 * <li>file ({@link android.content.ContentResolver#SCHEME_FILE}) 434 * </ul> 435 * 436 * <p>Type: TEXT 437 */ 438 public static final String COLUMN_PHOTO_URI = "photo_uri"; 439 440 /** 441 * The state of whether the series recording be canceled or not. 442 * 443 * <p>This value should be one of the followings: {@link #STATE_SERIES_NORMAL} and {@link 444 * #STATE_SERIES_STOPPED}. The default value is STATE_SERIES_NORMAL. 445 * 446 * <p>Type: TEXT 447 */ 448 public static final String COLUMN_STATE = "state"; 449 SeriesRecordings()450 private SeriesRecordings() {} 451 } 452 DvrContract()453 private DvrContract() {} 454 } 455