blob: 8c12060abc06ac9d038672ce4da15d46384dcc1d [file] [log] [blame]
Jinsuk Kimc0c20d02014-07-04 14:34:31 +09001/*
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
17package com.android.server.hdmi;
18
Jungshik Jang61f4fbd2014-08-06 19:21:12 +090019import android.hardware.hdmi.HdmiDeviceInfo;
Jinsuk Kim29a5d262014-07-21 17:25:32 +090020
Jinsuk Kimc0c20d02014-07-04 14:34:31 +090021/**
22 * Defines constants related to HDMI-CEC protocol internal implementation.
23 * If a constant will be used in the public api, it should be located in
Jungshik Jang8e93c842014-08-06 15:48:33 +090024 * {@link android.hardware.hdmi.HdmiControlManager}.
Jinsuk Kimc0c20d02014-07-04 14:34:31 +090025 */
26final class Constants {
27
28 /** Logical address for TV */
29 public static final int ADDR_TV = 0;
30
31 /** Logical address for recorder 1 */
32 public static final int ADDR_RECORDER_1 = 1;
33
34 /** Logical address for recorder 2 */
35 public static final int ADDR_RECORDER_2 = 2;
36
37 /** Logical address for tuner 1 */
38 public static final int ADDR_TUNER_1 = 3;
39
40 /** Logical address for playback 1 */
41 public static final int ADDR_PLAYBACK_1 = 4;
42
43 /** Logical address for audio system */
44 public static final int ADDR_AUDIO_SYSTEM = 5;
45
46 /** Logical address for tuner 2 */
47 public static final int ADDR_TUNER_2 = 6;
48
49 /** Logical address for tuner 3 */
50 public static final int ADDR_TUNER_3 = 7;
51
52 /** Logical address for playback 2 */
53 public static final int ADDR_PLAYBACK_2 = 8;
54
55 /** Logical address for recorder 3 */
56 public static final int ADDR_RECORDER_3 = 9;
57
58 /** Logical address for tuner 4 */
59 public static final int ADDR_TUNER_4 = 10;
60
61 /** Logical address for playback 3 */
62 public static final int ADDR_PLAYBACK_3 = 11;
63
64 /** Logical address reserved for future usage */
65 public static final int ADDR_RESERVED_1 = 12;
66
67 /** Logical address reserved for future usage */
68 public static final int ADDR_RESERVED_2 = 13;
69
70 /** Logical address for TV other than the one assigned with {@link #ADDR_TV} */
71 public static final int ADDR_SPECIFIC_USE = 14;
72
73 /** Logical address for devices to which address cannot be allocated */
74 public static final int ADDR_UNREGISTERED = 15;
75
76 /** Logical address used in the destination address field for broadcast messages */
77 public static final int ADDR_BROADCAST = 15;
78
79 /** Logical address used to indicate it is not initialized or invalid. */
80 public static final int ADDR_INVALID = -1;
81
82 /** Logical address used to indicate the source comes from internal device. */
Jungshik Jang61f4fbd2014-08-06 19:21:12 +090083 public static final int ADDR_INTERNAL = HdmiDeviceInfo.ADDR_INTERNAL;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +090084
85 static final int MESSAGE_FEATURE_ABORT = 0x00;
86 static final int MESSAGE_IMAGE_VIEW_ON = 0x04;
87 static final int MESSAGE_TUNER_STEP_INCREMENT = 0x05;
88 static final int MESSAGE_TUNER_STEP_DECREMENT = 0x06;
89 static final int MESSAGE_TUNER_DEVICE_STATUS = 0x07;
90 static final int MESSAGE_GIVE_TUNER_DEVICE_STATUS = 0x08;
91 static final int MESSAGE_RECORD_ON = 0x09;
92 static final int MESSAGE_RECORD_STATUS = 0x0A;
93 static final int MESSAGE_RECORD_OFF = 0x0B;
94 static final int MESSAGE_TEXT_VIEW_ON = 0x0D;
95 static final int MESSAGE_RECORD_TV_SCREEN = 0x0F;
96 static final int MESSAGE_GIVE_DECK_STATUS = 0x1A;
97 static final int MESSAGE_DECK_STATUS = 0x1B;
98 static final int MESSAGE_SET_MENU_LANGUAGE = 0x32;
99 static final int MESSAGE_CLEAR_ANALOG_TIMER = 0x33;
100 static final int MESSAGE_SET_ANALOG_TIMER = 0x34;
101 static final int MESSAGE_TIMER_STATUS = 0x35;
102 static final int MESSAGE_STANDBY = 0x36;
103 static final int MESSAGE_PLAY = 0x41;
104 static final int MESSAGE_DECK_CONTROL = 0x42;
105 static final int MESSAGE_TIMER_CLEARED_STATUS = 0x043;
106 static final int MESSAGE_USER_CONTROL_PRESSED = 0x44;
107 static final int MESSAGE_USER_CONTROL_RELEASED = 0x45;
108 static final int MESSAGE_GIVE_OSD_NAME = 0x46;
109 static final int MESSAGE_SET_OSD_NAME = 0x47;
110 static final int MESSAGE_SET_OSD_STRING = 0x64;
111 static final int MESSAGE_SET_TIMER_PROGRAM_TITLE = 0x67;
112 static final int MESSAGE_SYSTEM_AUDIO_MODE_REQUEST = 0x70;
113 static final int MESSAGE_GIVE_AUDIO_STATUS = 0x71;
114 static final int MESSAGE_SET_SYSTEM_AUDIO_MODE = 0x72;
115 static final int MESSAGE_REPORT_AUDIO_STATUS = 0x7A;
116 static final int MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D;
117 static final int MESSAGE_SYSTEM_AUDIO_MODE_STATUS = 0x7E;
118 static final int MESSAGE_ROUTING_CHANGE = 0x80;
119 static final int MESSAGE_ROUTING_INFORMATION = 0x81;
120 static final int MESSAGE_ACTIVE_SOURCE = 0x82;
121 static final int MESSAGE_GIVE_PHYSICAL_ADDRESS = 0x83;
122 static final int MESSAGE_REPORT_PHYSICAL_ADDRESS = 0x84;
123 static final int MESSAGE_REQUEST_ACTIVE_SOURCE = 0x85;
124 static final int MESSAGE_SET_STREAM_PATH = 0x86;
125 static final int MESSAGE_DEVICE_VENDOR_ID = 0x87;
126 static final int MESSAGE_VENDOR_COMMAND = 0x89;
127 static final int MESSAGE_VENDOR_REMOTE_BUTTON_DOWN = 0x8A;
128 static final int MESSAGE_VENDOR_REMOTE_BUTTON_UP = 0x8B;
129 static final int MESSAGE_GIVE_DEVICE_VENDOR_ID = 0x8C;
130 static final int MESSAGE_MENU_REQUEST = 0x8D;
131 static final int MESSAGE_MENU_STATUS = 0x8E;
132 static final int MESSAGE_GIVE_DEVICE_POWER_STATUS = 0x8F;
133 static final int MESSAGE_REPORT_POWER_STATUS = 0x90;
134 static final int MESSAGE_GET_MENU_LANGUAGE = 0x91;
135 static final int MESSAGE_SELECT_ANALOG_SERVICE = 0x92;
136 static final int MESSAGE_SELECT_DIGITAL_SERVICE = 0x93;
137 static final int MESSAGE_SET_DIGITAL_TIMER = 0x97;
138 static final int MESSAGE_CLEAR_DIGITAL_TIMER = 0x99;
139 static final int MESSAGE_SET_AUDIO_RATE = 0x9A;
140 static final int MESSAGE_INACTIVE_SOURCE = 0x9D;
141 static final int MESSAGE_CEC_VERSION = 0x9E;
142 static final int MESSAGE_GET_CEC_VERSION = 0x9F;
143 static final int MESSAGE_VENDOR_COMMAND_WITH_ID = 0xA0;
144 static final int MESSAGE_CLEAR_EXTERNAL_TIMER = 0xA1;
145 static final int MESSAGE_SET_EXTERNAL_TIMER = 0xA2;
Yuncheol Heo75a77e72014-07-09 18:27:53 +0900146 static final int MESSAGE_REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3;
147 static final int MESSAGE_REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900148 static final int MESSAGE_INITIATE_ARC = 0xC0;
149 static final int MESSAGE_REPORT_ARC_INITIATED = 0xC1;
150 static final int MESSAGE_REPORT_ARC_TERMINATED = 0xC2;
151 static final int MESSAGE_REQUEST_ARC_INITIATION = 0xC3;
152 static final int MESSAGE_REQUEST_ARC_TERMINATION = 0xC4;
153 static final int MESSAGE_TERMINATE_ARC = 0xC5;
Yuncheol Heo75a77e72014-07-09 18:27:53 +0900154 static final int MESSAGE_CDC_MESSAGE = 0xF8;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900155 static final int MESSAGE_ABORT = 0xFF;
156
157 static final int UNKNOWN_VENDOR_ID = 0xFFFFFF;
158
Jinsuk Kim7ecfbae2014-07-11 14:16:29 +0900159 static final int TRUE = 1;
160 static final int FALSE = 0;
161
Jungshik Jang4480efa2014-09-04 17:08:34 +0900162 // Internal abort error code. It's the same as success.
163 static final int ABORT_NO_ERROR = -1;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900164 // Constants related to operands of HDMI CEC commands.
165 // Refer to CEC Table 29 in HDMI Spec v1.4b.
166 // [Abort Reason]
Yuncheol Heo25c20292014-07-31 17:59:39 +0900167 static final int ABORT_UNRECOGNIZED_OPCODE = 0;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900168 static final int ABORT_NOT_IN_CORRECT_MODE = 1;
169 static final int ABORT_CANNOT_PROVIDE_SOURCE = 2;
170 static final int ABORT_INVALID_OPERAND = 3;
171 static final int ABORT_REFUSED = 4;
172 static final int ABORT_UNABLE_TO_DETERMINE = 5;
173
174 // [Audio Status]
175 static final int SYSTEM_AUDIO_STATUS_OFF = 0;
176 static final int SYSTEM_AUDIO_STATUS_ON = 1;
177
Terry Heo3e1564e2014-08-12 14:41:00 +0900178 // [Menu State]
179 static final int MENU_STATE_ACTIVATED = 0;
180 static final int MENU_STATE_DEACTIVATED = 1;
181
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900182 // Bit mask used to get the routing path of the top level device.
183 // When &'d with the path 1.2.2.0 (0x1220), for instance, gives 1.0.0.0.
184 static final int ROUTING_PATH_TOP_MASK = 0xF000;
Yuncheol Heo75a77e72014-07-09 18:27:53 +0900185 static final int ROUTING_PATH_TOP_SHIFT = 12;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900186
Jungshik Jang61f4fbd2014-08-06 19:21:12 +0900187 static final int INVALID_PORT_ID = HdmiDeviceInfo.PORT_INVALID;
188 static final int INVALID_PHYSICAL_ADDRESS = HdmiDeviceInfo.PATH_INVALID;
Jinsuk Kime6536022014-12-02 13:40:02 +0900189 static final int PATH_INTERNAL = HdmiDeviceInfo.PATH_INTERNAL;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900190
Jungshik Jang30a356a2014-07-21 17:55:25 +0900191 // Send result codes. It should be consistent with hdmi_cec.h's send_message error code.
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900192 static final int SEND_RESULT_SUCCESS = 0;
Jungshik Jang30a356a2014-07-21 17:55:25 +0900193 static final int SEND_RESULT_NAK = 1;
194 static final int SEND_RESULT_BUSY = 2;
195 static final int SEND_RESULT_FAILURE = 3;
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900196
197 // Strategy for device polling.
198 // Should use "OR(|) operation of POLL_STRATEGY_XXX and POLL_ITERATION_XXX.
199 static final int POLL_STRATEGY_MASK = 0x3; // first and second bit.
200 static final int POLL_STRATEGY_REMOTES_DEVICES = 0x1;
201 static final int POLL_STRATEGY_SYSTEM_AUDIO = 0x2;
202
203 static final int POLL_ITERATION_STRATEGY_MASK = 0x30000; // first and second bit.
204 static final int POLL_ITERATION_IN_ORDER = 0x10000;
205 static final int POLL_ITERATION_REVERSE_ORDER = 0x20000;
206
207 static final int UNKNOWN_VOLUME = -1;
208
Yuncheol Heo4b5c2d32014-09-13 11:21:46 +0900209 static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
210 static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";
211
212 // Property name for the local device configurations.
213 // TODO(OEM): OEM should provide this property, and the value is the comma separated integer
214 // values which denotes the device type in HDMI Spec 1.4.
215 static final String PROPERTY_DEVICE_TYPE = "ro.hdmi.device_type";
Jinsuk Kimaf2acf02014-07-11 18:43:04 +0900216
Jinsuk Kim659c4862015-05-07 12:12:55 +0900217 // TODO(OEM): Set this to false to keep the playback device in sleep upon hotplug event.
218 // True by default.
219 static final String PROPERTY_WAKE_ON_HOTPLUG = "ro.hdmi.wake_on_hotplug";
220
Jinsuk Kimbad83932015-02-10 07:10:40 +0900221 // Set to false to allow playback device to go to suspend mode even
222 // when it's an active source. True by default.
223 static final String PROPERTY_KEEP_AWAKE = "persist.sys.hdmi.keep_awake";
224
Jungshik Janga6b2a7a2014-07-16 18:04:49 +0900225 static final int RECORDING_TYPE_DIGITAL_RF = 1;
226 static final int RECORDING_TYPE_ANALOGUE_RF = 2;
227 static final int RECORDING_TYPE_EXTERNAL_PHYSICAL_ADDRESS = 3;
228 static final int RECORDING_TYPE_OWN_SOURCE = 4;
229
Jinsuk Kim50084862014-08-07 13:11:40 +0900230 // Definitions used for setOption(). These should be in sync with the definition
231 // in hardware/libhardware/include/hardware/{hdmi_cec.h,mhl.h}.
232
233 // TV gets turned on by incoming <Text/Image View On>. enabled by default.
234 // If set to disabled, TV won't turn on automatically.
235 static final int OPTION_CEC_AUTO_WAKEUP = 1;
236
237 // If set to disabled, all CEC commands are discarded.
238 static final int OPTION_CEC_ENABLE = 2;
239
240 // If set to disabled, system service yields control of CEC to sub-microcontroller.
Jinsuk Kim5b8cb002015-01-19 07:30:12 +0900241 // If enabled, it takes the control back.
Jinsuk Kim50084862014-08-07 13:11:40 +0900242 static final int OPTION_CEC_SERVICE_CONTROL = 3;
243
244 // Put other devices to standby when TV goes to standby. enabled by default.
245 // If set to disabled, TV doesn't send <Standby> to other devices.
246 static final int OPTION_CEC_AUTO_DEVICE_OFF = 4;
247
Jinsuk Kim5b8cb002015-01-19 07:30:12 +0900248 // Passes the language used in the system when updated. The value to use is the 3 byte
249 // code as defined in ISO/FDIS 639-2.
250 static final int OPTION_CEC_SET_LANGUAGE = 5;
251
Jinsuk Kim50084862014-08-07 13:11:40 +0900252 // If set to disabled, TV does not switch ports when mobile device is connected.
253 static final int OPTION_MHL_INPUT_SWITCHING = 101;
254
255 // If set to enabled, TV disables power charging for mobile device.
256 static final int OPTION_MHL_POWER_CHARGE = 102;
257
258 // If set to disabled, all MHL commands are discarded.
259 static final int OPTION_MHL_ENABLE = 103;
260
Jinsuk Kim5b8cb002015-01-19 07:30:12 +0900261 // If set to disabled, system service yields control of MHL to sub-microcontroller.
262 // If enabled, it takes the control back.
263 static final int OPTION_MHL_SERVICE_CONTROL = 104;
264
Jinsuk Kim50084862014-08-07 13:11:40 +0900265 static final int DISABLED = 0;
266 static final int ENABLED = 1;
267
Jinsuk Kimc0c20d02014-07-04 14:34:31 +0900268 private Constants() { /* cannot be instantiated */ }
269}