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_RESERVED_1 = 12;
70 
71     /** Logical address reserved for future usage */
72     public static final int ADDR_RESERVED_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_INITIATE_ARC,
155         MESSAGE_REPORT_ARC_INITIATED,
156         MESSAGE_REPORT_ARC_TERMINATED,
157         MESSAGE_REQUEST_ARC_INITIATION,
158         MESSAGE_REQUEST_ARC_TERMINATION,
159         MESSAGE_TERMINATE_ARC,
160         MESSAGE_CDC_MESSAGE,
161         MESSAGE_ABORT,
162     })
163     public @interface FeatureOpcode {}
164 
165     static final int MESSAGE_FEATURE_ABORT = 0x00;
166     static final int MESSAGE_IMAGE_VIEW_ON = 0x04;
167     static final int MESSAGE_TUNER_STEP_INCREMENT = 0x05;
168     static final int MESSAGE_TUNER_STEP_DECREMENT = 0x06;
169     static final int MESSAGE_TUNER_DEVICE_STATUS = 0x07;
170     static final int MESSAGE_GIVE_TUNER_DEVICE_STATUS = 0x08;
171     static final int MESSAGE_RECORD_ON = 0x09;
172     static final int MESSAGE_RECORD_STATUS = 0x0A;
173     static final int MESSAGE_RECORD_OFF = 0x0B;
174     static final int MESSAGE_TEXT_VIEW_ON = 0x0D;
175     static final int MESSAGE_RECORD_TV_SCREEN = 0x0F;
176     static final int MESSAGE_GIVE_DECK_STATUS = 0x1A;
177     static final int MESSAGE_DECK_STATUS = 0x1B;
178     static final int MESSAGE_SET_MENU_LANGUAGE = 0x32;
179     static final int MESSAGE_CLEAR_ANALOG_TIMER = 0x33;
180     static final int MESSAGE_SET_ANALOG_TIMER = 0x34;
181     static final int MESSAGE_TIMER_STATUS = 0x35;
182     static final int MESSAGE_STANDBY = 0x36;
183     static final int MESSAGE_PLAY = 0x41;
184     static final int MESSAGE_DECK_CONTROL = 0x42;
185     static final int MESSAGE_TIMER_CLEARED_STATUS = 0x043;
186     static final int MESSAGE_USER_CONTROL_PRESSED = 0x44;
187     static final int MESSAGE_USER_CONTROL_RELEASED = 0x45;
188     static final int MESSAGE_GIVE_OSD_NAME = 0x46;
189     static final int MESSAGE_SET_OSD_NAME = 0x47;
190     static final int MESSAGE_SET_OSD_STRING = 0x64;
191     static final int MESSAGE_SET_TIMER_PROGRAM_TITLE = 0x67;
192     static final int MESSAGE_SYSTEM_AUDIO_MODE_REQUEST = 0x70;
193     static final int MESSAGE_GIVE_AUDIO_STATUS = 0x71;
194     static final int MESSAGE_SET_SYSTEM_AUDIO_MODE = 0x72;
195     static final int MESSAGE_REPORT_AUDIO_STATUS = 0x7A;
196     static final int MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D;
197     static final int MESSAGE_SYSTEM_AUDIO_MODE_STATUS = 0x7E;
198     static final int MESSAGE_ROUTING_CHANGE = 0x80;
199     static final int MESSAGE_ROUTING_INFORMATION = 0x81;
200     static final int MESSAGE_ACTIVE_SOURCE = 0x82;
201     static final int MESSAGE_GIVE_PHYSICAL_ADDRESS = 0x83;
202     static final int MESSAGE_REPORT_PHYSICAL_ADDRESS = 0x84;
203     static final int MESSAGE_REQUEST_ACTIVE_SOURCE = 0x85;
204     static final int MESSAGE_SET_STREAM_PATH = 0x86;
205     static final int MESSAGE_DEVICE_VENDOR_ID = 0x87;
206     static final int MESSAGE_VENDOR_COMMAND = 0x89;
207     static final int MESSAGE_VENDOR_REMOTE_BUTTON_DOWN = 0x8A;
208     static final int MESSAGE_VENDOR_REMOTE_BUTTON_UP = 0x8B;
209     static final int MESSAGE_GIVE_DEVICE_VENDOR_ID = 0x8C;
210     static final int MESSAGE_MENU_REQUEST = 0x8D;
211     static final int MESSAGE_MENU_STATUS = 0x8E;
212     static final int MESSAGE_GIVE_DEVICE_POWER_STATUS = 0x8F;
213     static final int MESSAGE_REPORT_POWER_STATUS = 0x90;
214     static final int MESSAGE_GET_MENU_LANGUAGE = 0x91;
215     static final int MESSAGE_SELECT_ANALOG_SERVICE = 0x92;
216     static final int MESSAGE_SELECT_DIGITAL_SERVICE = 0x93;
217     static final int MESSAGE_SET_DIGITAL_TIMER = 0x97;
218     static final int MESSAGE_CLEAR_DIGITAL_TIMER = 0x99;
219     static final int MESSAGE_SET_AUDIO_RATE = 0x9A;
220     static final int MESSAGE_INACTIVE_SOURCE = 0x9D;
221     static final int MESSAGE_CEC_VERSION = 0x9E;
222     static final int MESSAGE_GET_CEC_VERSION = 0x9F;
223     static final int MESSAGE_VENDOR_COMMAND_WITH_ID = 0xA0;
224     static final int MESSAGE_CLEAR_EXTERNAL_TIMER = 0xA1;
225     static final int MESSAGE_SET_EXTERNAL_TIMER = 0xA2;
226     static final int MESSAGE_REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3;
227     static final int MESSAGE_REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4;
228     static final int MESSAGE_INITIATE_ARC = 0xC0;
229     static final int MESSAGE_REPORT_ARC_INITIATED = 0xC1;
230     static final int MESSAGE_REPORT_ARC_TERMINATED = 0xC2;
231     static final int MESSAGE_REQUEST_ARC_INITIATION = 0xC3;
232     static final int MESSAGE_REQUEST_ARC_TERMINATION = 0xC4;
233     static final int MESSAGE_TERMINATE_ARC = 0xC5;
234     static final int MESSAGE_CDC_MESSAGE = 0xF8;
235     static final int MESSAGE_ABORT = 0xFF;
236 
237     static final int UNKNOWN_VENDOR_ID = 0xFFFFFF;
238 
239     static final int TRUE = 1;
240     static final int FALSE = 0;
241 
242     @Retention(RetentionPolicy.SOURCE)
243     @IntDef({
244         ABORT_NO_ERROR,
245         ABORT_UNRECOGNIZED_OPCODE,
246         ABORT_NOT_IN_CORRECT_MODE,
247         ABORT_CANNOT_PROVIDE_SOURCE,
248         ABORT_INVALID_OPERAND,
249         ABORT_REFUSED,
250         ABORT_UNABLE_TO_DETERMINE,
251     })
252     public @interface AbortReason {}
253 
254     // Internal abort error code. It's the same as success.
255     static final int ABORT_NO_ERROR = -1;
256     // Constants related to operands of HDMI CEC commands.
257     // Refer to CEC Table 29 in HDMI Spec v1.4b.
258     // [Abort Reason]
259     static final int ABORT_UNRECOGNIZED_OPCODE = 0;
260     static final int ABORT_NOT_IN_CORRECT_MODE = 1;
261     static final int ABORT_CANNOT_PROVIDE_SOURCE = 2;
262     static final int ABORT_INVALID_OPERAND = 3;
263     static final int ABORT_REFUSED = 4;
264     static final int ABORT_UNABLE_TO_DETERMINE = 5;
265 
266     // [Audio Status]
267     static final int SYSTEM_AUDIO_STATUS_OFF = 0;
268     static final int SYSTEM_AUDIO_STATUS_ON = 1;
269 
270     // [Menu State]
271     static final int MENU_STATE_ACTIVATED = 0;
272     static final int MENU_STATE_DEACTIVATED = 1;
273 
274     // Audio Format Codes
275     // Refer to CEA Standard (CEA-861-D), Table 37 Audio Format Codes.
276     @Retention(RetentionPolicy.SOURCE)
277     @IntDef({
278         AUDIO_CODEC_NONE,
279         AUDIO_CODEC_LPCM,
280         AUDIO_CODEC_DD,
281         AUDIO_CODEC_MPEG1,
282         AUDIO_CODEC_MP3,
283         AUDIO_CODEC_MPEG2,
284         AUDIO_CODEC_AAC,
285         AUDIO_CODEC_DTS,
286         AUDIO_CODEC_ATRAC,
287         AUDIO_CODEC_ONEBITAUDIO,
288         AUDIO_CODEC_DDP,
289         AUDIO_CODEC_DTSHD,
290         AUDIO_CODEC_TRUEHD,
291         AUDIO_CODEC_DST,
292         AUDIO_CODEC_WMAPRO,
293         AUDIO_CODEC_MAX,
294     })
295     public @interface AudioCodec {}
296 
297     static final int AUDIO_CODEC_NONE = 0x0;
298     static final int AUDIO_CODEC_LPCM = 0x1; // Support LPCMs
299     static final int AUDIO_CODEC_DD = 0x2; // Support DD
300     static final int AUDIO_CODEC_MPEG1 = 0x3; // Support MPEG1
301     static final int AUDIO_CODEC_MP3 = 0x4; // Support MP3
302     static final int AUDIO_CODEC_MPEG2 = 0x5; // Support MPEG2
303     static final int AUDIO_CODEC_AAC = 0x6; // Support AAC
304     static final int AUDIO_CODEC_DTS = 0x7; // Support DTS
305     static final int AUDIO_CODEC_ATRAC = 0x8; // Support ATRAC
306     static final int AUDIO_CODEC_ONEBITAUDIO = 0x9; // Support One-Bit Audio
307     static final int AUDIO_CODEC_DDP = 0xA; // Support DDP
308     static final int AUDIO_CODEC_DTSHD = 0xB; // Support DTSHD
309     static final int AUDIO_CODEC_TRUEHD = 0xC; // Support MLP/TRUE-HD
310     static final int AUDIO_CODEC_DST = 0xD; // Support DST
311     static final int AUDIO_CODEC_WMAPRO = 0xE; // Support WMA-Pro
312     static final int AUDIO_CODEC_MAX = 0xF;
313 
314     @StringDef({
315         AUDIO_DEVICE_ARC_IN,
316         AUDIO_DEVICE_SPDIF,
317     })
318     public @interface AudioDevice {}
319 
320     static final String AUDIO_DEVICE_ARC_IN = "ARC_IN";
321     static final String AUDIO_DEVICE_SPDIF = "SPDIF";
322 
323     // Bit mask used to get the routing path of the top level device.
324     // When &'d with the path 1.2.2.0 (0x1220), for instance, gives 1.0.0.0.
325     static final int ROUTING_PATH_TOP_MASK = 0xF000;
326     static final int ROUTING_PATH_TOP_SHIFT = 12;
327 
328     static final int INVALID_PORT_ID = HdmiDeviceInfo.PORT_INVALID;
329     static final int INVALID_PHYSICAL_ADDRESS = HdmiDeviceInfo.PATH_INVALID;
330     static final int PATH_INTERNAL = HdmiDeviceInfo.PATH_INTERNAL;
331 
332     // Strategy for device polling.
333     // Should use "OR(|) operation of POLL_STRATEGY_XXX and POLL_ITERATION_XXX.
334     static final int POLL_STRATEGY_MASK = 0x3; // first and second bit.
335     static final int POLL_STRATEGY_REMOTES_DEVICES = 0x1;
336     static final int POLL_STRATEGY_SYSTEM_AUDIO = 0x2;
337 
338     static final int POLL_ITERATION_STRATEGY_MASK = 0x30000; // first and second bit.
339     static final int POLL_ITERATION_IN_ORDER = 0x10000;
340     static final int POLL_ITERATION_REVERSE_ORDER = 0x20000;
341 
342     static final int UNKNOWN_VOLUME = -1;
343 
344     // States of property PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON
345     // to decide if turn on the system audio control when power on the device
346     @IntDef({
347         ALWAYS_SYSTEM_AUDIO_CONTROL_ON_POWER_ON,
348         USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON,
349         NEVER_SYSTEM_AUDIO_CONTROL_ON_POWER_ON
350     })
351     @interface SystemAudioControlOnPowerOn {}
352 
353     static final int ALWAYS_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 0;
354     static final int USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 1;
355     static final int NEVER_SYSTEM_AUDIO_CONTROL_ON_POWER_ON = 2;
356 
357     // Port id to record local active port for Routing Control features
358     // They are used to map to corresponding Inputs
359     // Current interface is only implemented for specific device.
360     // Developers can add more port number and map them to corresponding inputs on demand.
361     @IntDef({
362         CEC_SWITCH_HOME,
363         CEC_SWITCH_HDMI1,
364         CEC_SWITCH_HDMI2,
365         CEC_SWITCH_HDMI3,
366         CEC_SWITCH_HDMI4,
367         CEC_SWITCH_HDMI5,
368         CEC_SWITCH_HDMI6,
369         CEC_SWITCH_HDMI7,
370         CEC_SWITCH_HDMI8,
371         CEC_SWITCH_ARC,
372         CEC_SWITCH_BLUETOOTH,
373         CEC_SWITCH_OPTICAL,
374         CEC_SWITCH_AUX
375     })
376     @interface LocalActivePort {}
377     static final int CEC_SWITCH_HOME = 0;
378     static final int CEC_SWITCH_HDMI1 = 1;
379     static final int CEC_SWITCH_HDMI2 = 2;
380     static final int CEC_SWITCH_HDMI3 = 3;
381     static final int CEC_SWITCH_HDMI4 = 4;
382     static final int CEC_SWITCH_HDMI5 = 5;
383     static final int CEC_SWITCH_HDMI6 = 6;
384     static final int CEC_SWITCH_HDMI7 = 7;
385     static final int CEC_SWITCH_HDMI8 = 8;
386     static final int CEC_SWITCH_ARC = 17;
387     static final int CEC_SWITCH_BLUETOOTH = 18;
388     static final int CEC_SWITCH_OPTICAL = 19;
389     static final int CEC_SWITCH_AUX = 20;
390     static final int CEC_SWITCH_PORT_MAX = 21;
391 
392     static final String PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM =
393             "persist.sys.hdmi.addr.audiosystem";
394     static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
395     static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";
396 
397     // TODO(OEM): Set this to false to keep the playback device in sleep upon hotplug event.
398     //            False by default.
399     static final String PROPERTY_WAKE_ON_HOTPLUG = "ro.hdmi.wake_on_hotplug";
400 
401     /**
402      * Property to save the ARC port id on system audio device.
403      * <p>When ARC is initiated, this port will be used to turn on ARC.
404      */
405     static final String PROPERTY_SYSTEM_AUDIO_DEVICE_ARC_PORT =
406             "ro.hdmi.property_sytem_audio_device_arc_port";
407 
408     /**
409      * Property to disable muting logic in System Audio Control handling. Default is true.
410      *
411      * <p>True means enabling muting logic.
412      * <p>False means never mute device.
413      */
414     static final String PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE =
415             "ro.hdmi.property_system_audio_mode_muting_enable";
416 
417     /**
418      * When set to true the HdmiControlService will never request a Logical Address for the
419      * playback device type. Default is false.
420      *
421      * <p> This is useful when HDMI CEC multiple device types is not supported by the cec driver
422      */
423     static final String PROPERTY_HDMI_CEC_NEVER_CLAIM_PLAYBACK_LOGICAL_ADDRESS =
424             "ro.hdmi.property_hdmi_cec_never_claim_playback_logical_address";
425 
426     /**
427      * A comma separated list of logical addresses that HdmiControlService
428      * will never assign local CEC devices to.
429      *
430      * <p> This is useful when HDMI CEC hardware module can't assign multiple logical addresses
431      * in the range same range of 0-7 or 8-15.
432      */
433     static final String PROPERTY_HDMI_CEC_NEVER_ASSIGN_LOGICAL_ADDRESSES =
434             "ro.hdmi.property_hdmi_cec_never_assign_logical_addresses";
435 
436     // Set to false to allow playback device to go to suspend mode even
437     // when it's an active source. True by default.
438     static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake";
439 
440     // TODO(UI): Set this from UI to decide if turn on System Audio Mode when power on the device
441     /**
442      * Property to decide if turn on the system audio control when power on the device.
443      *
444      * <p>Default is always turn on. State must be a valid {@link SystemAudioControlOnPowerOn} int.
445      */
446     static final String PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON =
447             "persist.sys.hdmi.system_audio_control_on_power_on";
448 
449     /**
450      * Property to record last state of system audio control before device powered off.
451      * <p>When {@link #PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON} is set to
452      * {@link #USE_LAST_STATE_SYSTEM_AUDIO_CONTROL_ON_POWER_ON}, restoring this state on power on.
453      * <p>State must be true or false. Default true.
454      */
455     static final String PROPERTY_LAST_SYSTEM_AUDIO_CONTROL =
456             "persist.sys.hdmi.last_system_audio_control";
457 
458     /**
459      * Property to indicate if device supports ARC or not
460      * <p>Default is true.
461      */
462     static final String PROPERTY_ARC_SUPPORT =
463             "persist.sys.hdmi.property_arc_support";
464 
465     /**
466      * Property to save the audio port to switch to when system audio control is on.
467      * <P>Audio system should switch to this port when cec active source is not its child in the tree
468      * or is not itself.
469      *
470      * <p>Default is ARC port.
471      */
472     static final String PROPERTY_SYSTEM_AUDIO_MODE_AUDIO_PORT =
473             "persist.sys.hdmi.property_sytem_audio_mode_audio_port";
474 
475     /**
476      * Property to strip local audio of amplifier and use local speaker
477      * when TV does not support system audio mode.
478      *
479      * <p>This property applies to device with both audio system/playback types.
480      * <p>True means using local speaker when TV does not support system audio.
481      * <p>False means passing audio to TV. Default is true.
482      */
483     static final String PROPERTY_STRIP_AUDIO_TV_NO_SYSTEM_AUDIO =
484         "persist.sys.hdmi.property_strip_audio_tv_no_system_audio";
485 
486     /**
487      * Determines playback device action upon receiving routing control messages.
488      * <ul>
489      * <li><b>none</b> No action taken.
490      * <li><b>wake_up_only</b> PowerManager.wakeUp() is called.
491      * <li><b>wake_up_and_send_active_source</b> Same as above and
492      *     additionally <Active Source> is sent.
493      * </ul>
494      */
495     static final String PLAYBACK_DEVICE_ACTION_ON_ROUTING_CONTROL =
496             "ro.hdmi.cec.source.playback_device_action_on_routing_control";
497 
498     static final String PLAYBACK_DEVICE_ACTION_ON_ROUTING_CONTROL_NONE = "none";
499     static final String PLAYBACK_DEVICE_ACTION_ON_ROUTING_CONTROL_WAKE_UP_ONLY = "wake_up_only";
500     static final String PLAYBACK_DEVICE_ACTION_ON_ROUTING_CONTROL_WAKE_UP_AND_SEND_ACTIVE_SOURCE =
501             "wake_up_and_send_active_source";
502 
503     /**
504      * Property to decide the device behaviour when <Active Source> is lost.
505      *
506      * <p>This property applies to playback devices.
507      * <p>Possible values are:
508      * <ul>
509      * <li><b>none</b> No power state change (default).
510      * <li><b>standby_now</b> PowerManager.goToSleep() is called.
511      * </ul>
512      */
513     static final String POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST =
514             "ro.hdmi.cec.source.power_state_change_on_active_source_lost";
515 
516     static final String POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST_NONE = "none";
517     static final String POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST_STANDBY_NOW = "standby_now";
518 
519     static final int RECORDING_TYPE_DIGITAL_RF = 1;
520     static final int RECORDING_TYPE_ANALOGUE_RF = 2;
521     static final int RECORDING_TYPE_EXTERNAL_PHYSICAL_ADDRESS = 3;
522     static final int RECORDING_TYPE_OWN_SOURCE = 4;
523 
524     // Definitions used for setOption(). These should be in sync with the definition
525     // in hardware/libhardware/include/hardware/mhl.h.
526 
527     // If set to disabled, TV does not switch ports when mobile device is connected.
528     static final int OPTION_MHL_INPUT_SWITCHING = 101;
529 
530     // If set to enabled, TV disables power charging for mobile device.
531     static final int OPTION_MHL_POWER_CHARGE = 102;
532 
533     // If set to disabled, all MHL commands are discarded.
534     static final int OPTION_MHL_ENABLE = 103;
535 
536     // If set to disabled, system service yields control of MHL to sub-microcontroller.
537     // If enabled, it takes the control back.
538     static final int OPTION_MHL_SERVICE_CONTROL = 104;
539 
540     static final int DISABLED = 0;
541     static final int ENABLED = 1;
542 
Constants()543     private Constants() {
544         /* cannot be instantiated */
545     }
546 }
547