1 /* 2 * Copyright (C) 2014 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.server.hdmi; 18 19 import android.annotation.IntDef; 20 import android.annotation.StringDef; 21 import android.hardware.hdmi.HdmiDeviceInfo; 22 23 import java.lang.annotation.Retention; 24 import java.lang.annotation.RetentionPolicy; 25 26 /** 27 * Defines constants related to HDMI-CEC protocol internal implementation. If a constant will be 28 * used in the public api, it should be located in {@link android.hardware.hdmi.HdmiControlManager}. 29 */ 30 final class Constants { 31 32 /** Logical address for TV */ 33 public static final int ADDR_TV = 0; 34 35 /** Logical address for recorder 1 */ 36 public static final int ADDR_RECORDER_1 = 1; 37 38 /** Logical address for recorder 2 */ 39 public static final int ADDR_RECORDER_2 = 2; 40 41 /** Logical address for tuner 1 */ 42 public static final int ADDR_TUNER_1 = 3; 43 44 /** Logical address for playback 1 */ 45 public static final int ADDR_PLAYBACK_1 = 4; 46 47 /** Logical address for audio system */ 48 public static final int ADDR_AUDIO_SYSTEM = 5; 49 50 /** Logical address for tuner 2 */ 51 public static final int ADDR_TUNER_2 = 6; 52 53 /** Logical address for tuner 3 */ 54 public static final int ADDR_TUNER_3 = 7; 55 56 /** Logical address for playback 2 */ 57 public static final int ADDR_PLAYBACK_2 = 8; 58 59 /** Logical address for recorder 3 */ 60 public static final int ADDR_RECORDER_3 = 9; 61 62 /** Logical address for tuner 4 */ 63 public static final int ADDR_TUNER_4 = 10; 64 65 /** Logical address for playback 3 */ 66 public static final int ADDR_PLAYBACK_3 = 11; 67 68 /** Logical address reserved for future usage */ 69 public static final int ADDR_BACKUP_1 = 12; 70 71 /** Logical address reserved for future usage */ 72 public static final int ADDR_BACKUP_2 = 13; 73 74 /** Logical address for TV other than the one assigned with {@link #ADDR_TV} */ 75 public static final int ADDR_SPECIFIC_USE = 14; 76 77 /** Logical address for devices to which address cannot be allocated */ 78 public static final int ADDR_UNREGISTERED = 15; 79 80 /** Logical address used in the destination address field for broadcast messages */ 81 public static final int ADDR_BROADCAST = 15; 82 83 /** Logical address used to indicate it is not initialized or invalid. */ 84 public static final int ADDR_INVALID = -1; 85 86 /** Logical address used to indicate the source comes from internal device. */ 87 public static final int ADDR_INTERNAL = HdmiDeviceInfo.ADDR_INTERNAL; 88 89 @Retention(RetentionPolicy.SOURCE) 90 @IntDef({ 91 MESSAGE_FEATURE_ABORT, 92 MESSAGE_IMAGE_VIEW_ON, 93 MESSAGE_TUNER_STEP_INCREMENT, 94 MESSAGE_TUNER_STEP_DECREMENT, 95 MESSAGE_TUNER_DEVICE_STATUS, 96 MESSAGE_GIVE_TUNER_DEVICE_STATUS, 97 MESSAGE_RECORD_ON, 98 MESSAGE_RECORD_STATUS, 99 MESSAGE_RECORD_OFF, 100 MESSAGE_TEXT_VIEW_ON, 101 MESSAGE_RECORD_TV_SCREEN, 102 MESSAGE_GIVE_DECK_STATUS, 103 MESSAGE_DECK_STATUS, 104 MESSAGE_SET_MENU_LANGUAGE, 105 MESSAGE_CLEAR_ANALOG_TIMER, 106 MESSAGE_SET_ANALOG_TIMER, 107 MESSAGE_TIMER_STATUS, 108 MESSAGE_STANDBY, 109 MESSAGE_PLAY, 110 MESSAGE_DECK_CONTROL, 111 MESSAGE_TIMER_CLEARED_STATUS, 112 MESSAGE_USER_CONTROL_PRESSED, 113 MESSAGE_USER_CONTROL_RELEASED, 114 MESSAGE_GIVE_OSD_NAME, 115 MESSAGE_SET_OSD_NAME, 116 MESSAGE_SET_OSD_STRING, 117 MESSAGE_SET_TIMER_PROGRAM_TITLE, 118 MESSAGE_SYSTEM_AUDIO_MODE_REQUEST, 119 MESSAGE_GIVE_AUDIO_STATUS, 120 MESSAGE_SET_SYSTEM_AUDIO_MODE, 121 MESSAGE_REPORT_AUDIO_STATUS, 122 MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS, 123 MESSAGE_SYSTEM_AUDIO_MODE_STATUS, 124 MESSAGE_ROUTING_CHANGE, 125 MESSAGE_ROUTING_INFORMATION, 126 MESSAGE_ACTIVE_SOURCE, 127 MESSAGE_GIVE_PHYSICAL_ADDRESS, 128 MESSAGE_REPORT_PHYSICAL_ADDRESS, 129 MESSAGE_REQUEST_ACTIVE_SOURCE, 130 MESSAGE_SET_STREAM_PATH, 131 MESSAGE_DEVICE_VENDOR_ID, 132 MESSAGE_VENDOR_COMMAND, 133 MESSAGE_VENDOR_REMOTE_BUTTON_DOWN, 134 MESSAGE_VENDOR_REMOTE_BUTTON_UP, 135 MESSAGE_GIVE_DEVICE_VENDOR_ID, 136 MESSAGE_MENU_REQUEST, 137 MESSAGE_MENU_STATUS, 138 MESSAGE_GIVE_DEVICE_POWER_STATUS, 139 MESSAGE_REPORT_POWER_STATUS, 140 MESSAGE_GET_MENU_LANGUAGE, 141 MESSAGE_SELECT_ANALOG_SERVICE, 142 MESSAGE_SELECT_DIGITAL_SERVICE, 143 MESSAGE_SET_DIGITAL_TIMER, 144 MESSAGE_CLEAR_DIGITAL_TIMER, 145 MESSAGE_SET_AUDIO_RATE, 146 MESSAGE_INACTIVE_SOURCE, 147 MESSAGE_CEC_VERSION, 148 MESSAGE_GET_CEC_VERSION, 149 MESSAGE_VENDOR_COMMAND_WITH_ID, 150 MESSAGE_CLEAR_EXTERNAL_TIMER, 151 MESSAGE_SET_EXTERNAL_TIMER, 152 MESSAGE_REPORT_SHORT_AUDIO_DESCRIPTOR, 153 MESSAGE_REQUEST_SHORT_AUDIO_DESCRIPTOR, 154 MESSAGE_GIVE_FEATURES, 155 MESSAGE_REPORT_FEATURES, 156 MESSAGE_REQUEST_CURRENT_LATENCY, 157 MESSAGE_REPORT_CURRENT_LATENCY, 158 MESSAGE_INITIATE_ARC, 159 MESSAGE_REPORT_ARC_INITIATED, 160 MESSAGE_REPORT_ARC_TERMINATED, 161 MESSAGE_REQUEST_ARC_INITIATION, 162 MESSAGE_REQUEST_ARC_TERMINATION, 163 MESSAGE_TERMINATE_ARC, 164 MESSAGE_CDC_MESSAGE, 165 MESSAGE_ABORT, 166 }) 167 public @interface FeatureOpcode { 168 } 169 170 static final int MESSAGE_FEATURE_ABORT = 0x00; 171 static final int MESSAGE_IMAGE_VIEW_ON = 0x04; 172 static final int MESSAGE_TUNER_STEP_INCREMENT = 0x05; 173 static final int MESSAGE_TUNER_STEP_DECREMENT = 0x06; 174 static final int MESSAGE_TUNER_DEVICE_STATUS = 0x07; 175 static final int MESSAGE_GIVE_TUNER_DEVICE_STATUS = 0x08; 176 static final int MESSAGE_RECORD_ON = 0x09; 177 static final int MESSAGE_RECORD_STATUS = 0x0A; 178 static final int MESSAGE_RECORD_OFF = 0x0B; 179 static final int MESSAGE_TEXT_VIEW_ON = 0x0D; 180 static final int MESSAGE_RECORD_TV_SCREEN = 0x0F; 181 static final int MESSAGE_GIVE_DECK_STATUS = 0x1A; 182 static final int MESSAGE_DECK_STATUS = 0x1B; 183 static final int MESSAGE_SET_MENU_LANGUAGE = 0x32; 184 static final int MESSAGE_CLEAR_ANALOG_TIMER = 0x33; 185 static final int MESSAGE_SET_ANALOG_TIMER = 0x34; 186 static final int MESSAGE_TIMER_STATUS = 0x35; 187 static final int MESSAGE_STANDBY = 0x36; 188 static final int MESSAGE_PLAY = 0x41; 189 static final int MESSAGE_DECK_CONTROL = 0x42; 190 static final int MESSAGE_TIMER_CLEARED_STATUS = 0x043; 191 static final int MESSAGE_USER_CONTROL_PRESSED = 0x44; 192 static final int MESSAGE_USER_CONTROL_RELEASED = 0x45; 193 static final int MESSAGE_GIVE_OSD_NAME = 0x46; 194 static final int MESSAGE_SET_OSD_NAME = 0x47; 195 static final int MESSAGE_SET_OSD_STRING = 0x64; 196 static final int MESSAGE_SET_TIMER_PROGRAM_TITLE = 0x67; 197 static final int MESSAGE_SYSTEM_AUDIO_MODE_REQUEST = 0x70; 198 static final int MESSAGE_GIVE_AUDIO_STATUS = 0x71; 199 static final int MESSAGE_SET_SYSTEM_AUDIO_MODE = 0x72; 200 static final int MESSAGE_REPORT_AUDIO_STATUS = 0x7A; 201 static final int MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D; 202 static final int MESSAGE_SYSTEM_AUDIO_MODE_STATUS = 0x7E; 203 static final int MESSAGE_ROUTING_CHANGE = 0x80; 204 static final int MESSAGE_ROUTING_INFORMATION = 0x81; 205 static final int MESSAGE_ACTIVE_SOURCE = 0x82; 206 static final int MESSAGE_GIVE_PHYSICAL_ADDRESS = 0x83; 207 static final int MESSAGE_REPORT_PHYSICAL_ADDRESS = 0x84; 208 static final int MESSAGE_REQUEST_ACTIVE_SOURCE = 0x85; 209 static final int MESSAGE_SET_STREAM_PATH = 0x86; 210 static final int MESSAGE_DEVICE_VENDOR_ID = 0x87; 211 static final int MESSAGE_VENDOR_COMMAND = 0x89; 212 static final int MESSAGE_VENDOR_REMOTE_BUTTON_DOWN = 0x8A; 213 static final int MESSAGE_VENDOR_REMOTE_BUTTON_UP = 0x8B; 214 static final int MESSAGE_GIVE_DEVICE_VENDOR_ID = 0x8C; 215 static final int MESSAGE_MENU_REQUEST = 0x8D; 216 static final int MESSAGE_MENU_STATUS = 0x8E; 217 static final int MESSAGE_GIVE_DEVICE_POWER_STATUS = 0x8F; 218 static final int MESSAGE_REPORT_POWER_STATUS = 0x90; 219 static final int MESSAGE_GET_MENU_LANGUAGE = 0x91; 220 static final int MESSAGE_SELECT_ANALOG_SERVICE = 0x92; 221 static final int MESSAGE_SELECT_DIGITAL_SERVICE = 0x93; 222 static final int MESSAGE_SET_DIGITAL_TIMER = 0x97; 223 static final int MESSAGE_CLEAR_DIGITAL_TIMER = 0x99; 224 static final int MESSAGE_SET_AUDIO_RATE = 0x9A; 225 static final int MESSAGE_INACTIVE_SOURCE = 0x9D; 226 static final int MESSAGE_CEC_VERSION = 0x9E; 227 static final int MESSAGE_GET_CEC_VERSION = 0x9F; 228 static final int MESSAGE_VENDOR_COMMAND_WITH_ID = 0xA0; 229 static final int MESSAGE_CLEAR_EXTERNAL_TIMER = 0xA1; 230 static final int MESSAGE_SET_EXTERNAL_TIMER = 0xA2; 231 static final int MESSAGE_REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3; 232 static final int MESSAGE_REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4; 233 static final int MESSAGE_GIVE_FEATURES = 0xA5; 234 static final int MESSAGE_REPORT_FEATURES = 0xA6; 235 static final int MESSAGE_REQUEST_CURRENT_LATENCY = 0xA7; 236 static final int MESSAGE_REPORT_CURRENT_LATENCY = 0xA8; 237 static final int MESSAGE_INITIATE_ARC = 0xC0; 238 static final int MESSAGE_REPORT_ARC_INITIATED = 0xC1; 239 static final int MESSAGE_REPORT_ARC_TERMINATED = 0xC2; 240 static final int MESSAGE_REQUEST_ARC_INITIATION = 0xC3; 241 static final int MESSAGE_REQUEST_ARC_TERMINATION = 0xC4; 242 static final int MESSAGE_TERMINATE_ARC = 0xC5; 243 static final int MESSAGE_CDC_MESSAGE = 0xF8; 244 static final int MESSAGE_ABORT = 0xFF; 245 246 static final int UNKNOWN_VENDOR_ID = 0xFFFFFF; 247 248 static final int TRUE = 1; 249 static final int FALSE = 0; 250 251 @Retention(RetentionPolicy.SOURCE) 252 @IntDef({ 253 NOT_HANDLED, 254 HANDLED, 255 ABORT_UNRECOGNIZED_OPCODE, 256 ABORT_NOT_IN_CORRECT_MODE, 257 ABORT_CANNOT_PROVIDE_SOURCE, 258 ABORT_INVALID_OPERAND, 259 ABORT_REFUSED, 260 ABORT_UNABLE_TO_DETERMINE, 261 }) 262 public @interface HandleMessageResult {} 263 264 @Retention(RetentionPolicy.SOURCE) 265 @IntDef({ 266 ABORT_UNRECOGNIZED_OPCODE, 267 ABORT_NOT_IN_CORRECT_MODE, 268 ABORT_CANNOT_PROVIDE_SOURCE, 269 ABORT_INVALID_OPERAND, 270 ABORT_REFUSED, 271 ABORT_UNABLE_TO_DETERMINE, 272 }) 273 public @interface AbortReason {} 274 275 // Indicates that a message was not handled, but could be handled by another local device. 276 // If no local devices handle the message, we send <Feature Abort>[Unrecognized Opcode]. 277 static final int NOT_HANDLED = -2; 278 // Indicates that a message has been handled successfully; no feature abort needed. 279 static final int HANDLED = -1; 280 // Constants related to operands of HDMI CEC commands. 281 // Refer to CEC Table 29 in HDMI Spec v1.4b. 282 // [Abort Reason] 283 static final int ABORT_UNRECOGNIZED_OPCODE = 0; 284 static final int ABORT_NOT_IN_CORRECT_MODE = 1; 285 static final int ABORT_CANNOT_PROVIDE_SOURCE = 2; 286 static final int ABORT_INVALID_OPERAND = 3; 287 static final int ABORT_REFUSED = 4; 288 static final int ABORT_UNABLE_TO_DETERMINE = 5; 289 290 // [Audio Status] 291 static final int SYSTEM_AUDIO_STATUS_OFF = 0; 292 static final int SYSTEM_AUDIO_STATUS_ON = 1; 293 294 // [Menu State] 295 static final int MENU_STATE_ACTIVATED = 0; 296 static final int MENU_STATE_DEACTIVATED = 1; 297 298 // Audio Format Codes 299 // Refer to CEA Standard (CEA-861-D), Table 37 Audio Format Codes. 300 @Retention(RetentionPolicy.SOURCE) 301 @IntDef({ 302 AUDIO_CODEC_NONE, 303 AUDIO_CODEC_LPCM, 304 AUDIO_CODEC_DD, 305 AUDIO_CODEC_MPEG1, 306 AUDIO_CODEC_MP3, 307 AUDIO_CODEC_MPEG2, 308 AUDIO_CODEC_AAC, 309 AUDIO_CODEC_DTS, 310 AUDIO_CODEC_ATRAC, 311 AUDIO_CODEC_ONEBITAUDIO, 312 AUDIO_CODEC_DDP, 313 AUDIO_CODEC_DTSHD, 314 AUDIO_CODEC_TRUEHD, 315 AUDIO_CODEC_DST, 316 AUDIO_CODEC_WMAPRO, 317 AUDIO_CODEC_MAX, 318 }) 319 public @interface AudioCodec {} 320 321 static final int AUDIO_CODEC_NONE = 0x0; 322 static final int AUDIO_CODEC_LPCM = 0x1; // Support LPCMs 323 static final int AUDIO_CODEC_DD = 0x2; // Support DD 324 static final int AUDIO_CODEC_MPEG1 = 0x3; // Support MPEG1 325 static final int AUDIO_CODEC_MP3 = 0x4; // Support MP3 326 static final int AUDIO_CODEC_MPEG2 = 0x5; // Support MPEG2 327 static final int AUDIO_CODEC_AAC = 0x6; // Support AAC 328 static final int AUDIO_CODEC_DTS = 0x7; // Support DTS 329 static final int AUDIO_CODEC_ATRAC = 0x8; // Support ATRAC 330 static final int AUDIO_CODEC_ONEBITAUDIO = 0x9; // Support One-Bit Audio 331 static final int AUDIO_CODEC_DDP = 0xA; // Support DDP 332 static final int AUDIO_CODEC_DTSHD = 0xB; // Support DTSHD 333 static final int AUDIO_CODEC_TRUEHD = 0xC; // Support MLP/TRUE-HD 334 static final int AUDIO_CODEC_DST = 0xD; // Support DST 335 static final int AUDIO_CODEC_WMAPRO = 0xE; // Support WMA-Pro 336 static final int AUDIO_CODEC_MAX = 0xF; 337 338 @StringDef({ 339 AUDIO_DEVICE_ARC_IN, 340 AUDIO_DEVICE_SPDIF, 341 }) 342 public @interface AudioDevice {} 343 344 static final String AUDIO_DEVICE_ARC_IN = "ARC_IN"; 345 static final String AUDIO_DEVICE_SPDIF = "SPDIF"; 346 347 // Bit mask used to get the routing path of the top level device. 348 // When &'d with the path 1.2.2.0 (0x1220), for instance, gives 1.0.0.0. 349 static final int ROUTING_PATH_TOP_MASK = 0xF000; 350 static final int ROUTING_PATH_TOP_SHIFT = 12; 351 352 static final int INVALID_PORT_ID = HdmiDeviceInfo.PORT_INVALID; 353 static final int INVALID_PHYSICAL_ADDRESS = HdmiDeviceInfo.PATH_INVALID; 354 static final int PATH_INTERNAL = HdmiDeviceInfo.PATH_INTERNAL; 355 356 // The relationship from one path (physical address) to another. 357 @IntDef({ 358 PATH_RELATIONSHIP_UNKNOWN, 359 PATH_RELATIONSHIP_DIFFERENT_BRANCH, 360 PATH_RELATIONSHIP_ANCESTOR, 361 PATH_RELATIONSHIP_DESCENDANT, 362 PATH_RELATIONSHIP_SIBLING, 363 PATH_RELATIONSHIP_SAME 364 }) 365 @interface PathRelationship {} 366 367 // One or both of the paths is invalid 368 static final int PATH_RELATIONSHIP_UNKNOWN = 0; 369 // None of the relationships below holds 370 static final int PATH_RELATIONSHIP_DIFFERENT_BRANCH = 1; 371 // A path is either the TV, or between the TV and another path 372 static final int PATH_RELATIONSHIP_ANCESTOR = 2; 373 // A path is located somewhere below another path 374 static final int PATH_RELATIONSHIP_DESCENDANT = 3; 375 // A path has the same parent as another path 376 static final int PATH_RELATIONSHIP_SIBLING = 4; 377 // A path is equal to another path 378 static final int PATH_RELATIONSHIP_SAME = 5; 379 380 // Strategy for device polling. 381 // Should use "OR(|) operation of POLL_STRATEGY_XXX and POLL_ITERATION_XXX. 382 static final int POLL_STRATEGY_MASK = 0x3; // first and second bit. 383 static final int POLL_STRATEGY_REMOTES_DEVICES = 0x1; 384 static final int POLL_STRATEGY_SYSTEM_AUDIO = 0x2; 385 386 static final int POLL_ITERATION_STRATEGY_MASK = 0x30000; // first and second bit. 387 static final int POLL_ITERATION_IN_ORDER = 0x10000; 388 static final int POLL_ITERATION_REVERSE_ORDER = 0x20000; 389 390 static final int UNKNOWN_VOLUME = -1; 391 392 // States of property PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON 393 // to decide if turn on the system audio control when power on the device 394 @IntDef({ 395 ALWAYS_SYSTEM_AUDIO_CONTROL_ON_POWER_ON, 396 USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON, 397 NEVER_SYSTEM_AUDIO_CONTROL_ON_POWER_ON 398 }) 399 @interface SystemAudioControlOnPowerOn {} 400 401 static final int ALWAYS_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 0; 402 static final int USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 1; 403 static final int NEVER_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 2; 404 405 // Port id to record local active port for Routing Control features 406 // They are used to map to corresponding Inputs 407 // Current interface is only implemented for specific device. 408 // Developers can add more port number and map them to corresponding inputs on demand. 409 @IntDef({ 410 CEC_SWITCH_HOME, 411 CEC_SWITCH_HDMI1, 412 CEC_SWITCH_HDMI2, 413 CEC_SWITCH_HDMI3, 414 CEC_SWITCH_HDMI4, 415 CEC_SWITCH_HDMI5, 416 CEC_SWITCH_HDMI6, 417 CEC_SWITCH_HDMI7, 418 CEC_SWITCH_HDMI8, 419 CEC_SWITCH_ARC, 420 CEC_SWITCH_BLUETOOTH, 421 CEC_SWITCH_OPTICAL, 422 CEC_SWITCH_AUX 423 }) 424 @interface LocalActivePort {} 425 static final int CEC_SWITCH_HOME = 0; 426 static final int CEC_SWITCH_HDMI1 = 1; 427 static final int CEC_SWITCH_HDMI2 = 2; 428 static final int CEC_SWITCH_HDMI3 = 3; 429 static final int CEC_SWITCH_HDMI4 = 4; 430 static final int CEC_SWITCH_HDMI5 = 5; 431 static final int CEC_SWITCH_HDMI6 = 6; 432 static final int CEC_SWITCH_HDMI7 = 7; 433 static final int CEC_SWITCH_HDMI8 = 8; 434 static final int CEC_SWITCH_ARC = 17; 435 static final int CEC_SWITCH_BLUETOOTH = 18; 436 static final int CEC_SWITCH_OPTICAL = 19; 437 static final int CEC_SWITCH_AUX = 20; 438 static final int CEC_SWITCH_PORT_MAX = 21; 439 440 static final String PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM = 441 "persist.sys.hdmi.addr.audiosystem"; 442 static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback"; 443 static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv"; 444 445 // Set to false to allow playback device to go to suspend mode even 446 // when it's an active source. True by default. 447 static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake"; 448 449 // TODO(UI): Set this from UI to decide if turn on System Audio Mode when power on the device 450 /** 451 * Property to decide if turn on the system audio control when power on the device. 452 * 453 * <p>Default is always turn on. State must be a valid {@link SystemAudioControlOnPowerOn} int. 454 */ 455 static final String PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 456 "persist.sys.hdmi.system_audio_control_on_power_on"; 457 458 /** 459 * Property to record last state of system audio control before device powered off. 460 * <p>When {@link #PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON} is set to 461 * {@link #USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON}, restoring this state on power on. 462 * <p>State must be true or false. Default true. 463 */ 464 static final String PROPERTY_LAST_SYSTEM_AUDIO_CONTROL = 465 "persist.sys.hdmi.last_system_audio_control"; 466 467 /** 468 * Property to indicate if device supports ARC or not 469 * <p>Default is true. 470 */ 471 static final String PROPERTY_ARC_SUPPORT = 472 "persist.sys.hdmi.property_arc_support"; 473 474 /** 475 * Property to save the audio port to switch to when system audio control is on. 476 * <P>Audio system should switch to this port when cec active source is not its child in the tree 477 * or is not itself. 478 * 479 * <p>Default is ARC port. 480 */ 481 static final String PROPERTY_SYSTEM_AUDIO_MODE_AUDIO_PORT = 482 "persist.sys.hdmi.property_sytem_audio_mode_audio_port"; 483 484 /** 485 * Property to strip local audio of amplifier and use local speaker 486 * when TV does not support system audio mode. 487 * 488 * <p>This property applies to device with both audio system/playback types. 489 * <p>True means using local speaker when TV does not support system audio. 490 * <p>False means passing audio to TV. Default is true. 491 */ 492 static final String PROPERTY_STRIP_AUDIO_TV_NO_SYSTEM_AUDIO = 493 "persist.sys.hdmi.property_strip_audio_tv_no_system_audio"; 494 495 static final int RECORDING_TYPE_DIGITAL_RF = 1; 496 static final int RECORDING_TYPE_ANALOGUE_RF = 2; 497 static final int RECORDING_TYPE_EXTERNAL_PHYSICAL_ADDRESS = 3; 498 static final int RECORDING_TYPE_OWN_SOURCE = 4; 499 500 // Definitions used for setOption(). These should be in sync with the definition 501 // in hardware/libhardware/include/hardware/mhl.h. 502 503 // If set to disabled, TV does not switch ports when mobile device is connected. 504 static final int OPTION_MHL_INPUT_SWITCHING = 101; 505 506 // If set to enabled, TV disables power charging for mobile device. 507 static final int OPTION_MHL_POWER_CHARGE = 102; 508 509 // If set to disabled, all MHL commands are discarded. 510 static final int OPTION_MHL_ENABLE = 103; 511 512 // If set to disabled, system service yields control of MHL to sub-microcontroller. 513 // If enabled, it takes the control back. 514 static final int OPTION_MHL_SERVICE_CONTROL = 104; 515 516 static final int DISABLED = 0; 517 static final int ENABLED = 1; 518 519 static final int ALL_DEVICE_TYPES_TV = 7; 520 static final int ALL_DEVICE_TYPES_RECORDER = 6; 521 static final int ALL_DEVICE_TYPES_TUNER = 5; 522 static final int ALL_DEVICE_TYPES_PLAYBACK = 4; 523 static final int ALL_DEVICE_TYPES_AUDIO_SYSTEM = 3; 524 static final int ALL_DEVICE_TYPES_SWITCH = 2; 525 @IntDef({ 526 ALL_DEVICE_TYPES_TV, 527 ALL_DEVICE_TYPES_RECORDER, 528 ALL_DEVICE_TYPES_TUNER, 529 ALL_DEVICE_TYPES_PLAYBACK, 530 ALL_DEVICE_TYPES_AUDIO_SYSTEM, 531 ALL_DEVICE_TYPES_SWITCH 532 }) 533 @interface DeviceType {} 534 535 static final int DEVICE_FEATURE_TV_SUPPORTS_RECORD_TV_SCREEN = 6; 536 static final int DEVICE_FEATURE_TV_SUPPORTS_SET_OSD_STRING = 5; 537 static final int DEVICE_FEATURE_SUPPORTS_DECK_CONTROL = 4; 538 static final int DEVICE_FEATURE_SUPPORTS_SET_AUDIO_RATE = 3; 539 static final int DEVICE_FEATURE_SINK_SUPPORTS_ARC_TX = 2; 540 static final int DEVICE_FEATURE_SOURCE_SUPPORTS_ARC_RX = 1; 541 @IntDef({ 542 DEVICE_FEATURE_TV_SUPPORTS_RECORD_TV_SCREEN, 543 DEVICE_FEATURE_TV_SUPPORTS_SET_OSD_STRING, 544 DEVICE_FEATURE_SUPPORTS_DECK_CONTROL, 545 DEVICE_FEATURE_SUPPORTS_SET_AUDIO_RATE, 546 DEVICE_FEATURE_SINK_SUPPORTS_ARC_TX, 547 DEVICE_FEATURE_SOURCE_SUPPORTS_ARC_RX 548 }) 549 @interface DeviceFeature {} 550 551 static final int RC_PROFILE_TV = 0; 552 static final int RC_PROFILE_SOURCE = 1; 553 @IntDef({ 554 RC_PROFILE_TV, 555 RC_PROFILE_SOURCE 556 }) 557 @interface RcProfile {} 558 559 static final int RC_PROFILE_TV_NONE = 0x0; 560 static final int RC_PROFILE_TV_ONE = 0x2; 561 static final int RC_PROFILE_TV_TWO = 0x6; 562 static final int RC_PROFILE_TV_THREE = 0xA; 563 static final int RC_PROFILE_TV_FOUR = 0xE; 564 @IntDef({ 565 RC_PROFILE_TV_NONE, 566 RC_PROFILE_TV_ONE, 567 RC_PROFILE_TV_TWO, 568 RC_PROFILE_TV_THREE, 569 RC_PROFILE_TV_FOUR 570 }) 571 @interface RcProfileTv {} 572 573 static final int RC_PROFILE_SOURCE_HANDLES_ROOT_MENU = 4; 574 static final int RC_PROFILE_SOURCE_HANDLES_SETUP_MENU = 3; 575 static final int RC_PROFILE_SOURCE_HANDLES_CONTENTS_MENU = 2; 576 static final int RC_PROFILE_SOURCE_HANDLES_TOP_MENU = 1; 577 static final int RC_PROFILE_SOURCE_HANDLES_MEDIA_CONTEXT_SENSITIVE_MENU = 0; 578 @IntDef({ 579 RC_PROFILE_SOURCE_HANDLES_ROOT_MENU, 580 RC_PROFILE_SOURCE_HANDLES_SETUP_MENU, 581 RC_PROFILE_SOURCE_HANDLES_CONTENTS_MENU, 582 RC_PROFILE_SOURCE_HANDLES_TOP_MENU, 583 RC_PROFILE_SOURCE_HANDLES_MEDIA_CONTEXT_SENSITIVE_MENU 584 }) 585 @interface RcProfileSource {} 586 Constants()587 private Constants() { 588 /* cannot be instantiated */ 589 } 590 } 591