blob: f19b19b8451ce4a18b5a07b18eceea1e0d7def68 [file] [log] [blame]
Jinsuk Kim78104122014-08-26 19:32:34 +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
19import android.hardware.hdmi.HdmiPortInfo;
20import android.util.SparseArray;
21
Jinsuk Kim61c94d12015-01-15 07:00:28 +090022import com.android.internal.util.IndentingPrintWriter;
Jinsuk Kim78104122014-08-26 19:32:34 +090023
24/**
25 * A handler class for MHL control command. It converts user's command into MHL command and pass it
26 * to MHL HAL layer.
27 * <p>
28 * It can be created only by {@link HdmiMhlControllerStub#create}.
29 */
30final class HdmiMhlControllerStub {
31
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090032 private static final SparseArray<HdmiMhlLocalDeviceStub> mLocalDevices = new SparseArray<>();
Jinsuk Kim78104122014-08-26 19:32:34 +090033 private static final HdmiPortInfo[] EMPTY_PORT_INFO = new HdmiPortInfo[0];
34 private static final int INVALID_MHL_VERSION = 0;
35 private static final int NO_SUPPORTED_FEATURES = 0;
36 private static final int INVALID_DEVICE_ROLES = 0;
37
38 // Private constructor. Use HdmiMhlControllerStub.create().
39 private HdmiMhlControllerStub(HdmiControlService service) {
40 }
41
42 // Returns true if MHL controller is initialized and ready to use.
43 boolean isReady() {
44 return false;
45 }
46
47 static HdmiMhlControllerStub create(HdmiControlService service) {
48 return new HdmiMhlControllerStub(service);
49 }
50
51 HdmiPortInfo[] getPortInfos() {
52 return EMPTY_PORT_INFO;
53 }
54
55 /**
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090056 * Return {@link HdmiMhlLocalDeviceStub} matched with the given port id.
Jinsuk Kim78104122014-08-26 19:32:34 +090057 *
58 * @return null if has no matched port id
59 */
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090060 HdmiMhlLocalDeviceStub getLocalDevice(int portId) {
Jinsuk Kim78104122014-08-26 19:32:34 +090061 return null;
62 }
63
64 /**
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090065 * Return {@link HdmiMhlLocalDeviceStub} matched with the given device id.
Jinsuk Kim78104122014-08-26 19:32:34 +090066 *
67 * @return null if has no matched id
68 */
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090069 HdmiMhlLocalDeviceStub getLocalDeviceById(int deviceId) {
Jinsuk Kim78104122014-08-26 19:32:34 +090070 return null;
71 }
72
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090073 SparseArray<HdmiMhlLocalDeviceStub> getAllLocalDevices() {
Jinsuk Kim78104122014-08-26 19:32:34 +090074 return mLocalDevices;
75 }
76
77 /**
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090078 * Remove a {@link HdmiMhlLocalDeviceStub} matched with the given port id.
Jinsuk Kim78104122014-08-26 19:32:34 +090079 *
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090080 * @return removed {@link HdmiMhlLocalDeviceStub}. Return null if no matched port id.
Jinsuk Kim78104122014-08-26 19:32:34 +090081 */
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090082 HdmiMhlLocalDeviceStub removeLocalDevice(int portId) {
Jinsuk Kim78104122014-08-26 19:32:34 +090083 return null;
84 }
85
86 /**
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090087 * Add a new {@link HdmiMhlLocalDeviceStub}.
Jinsuk Kim78104122014-08-26 19:32:34 +090088 *
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090089 * @return old {@link HdmiMhlLocalDeviceStub} having same port id
Jinsuk Kim78104122014-08-26 19:32:34 +090090 */
Jinsuk Kim3b9309a2014-09-12 15:10:33 +090091 HdmiMhlLocalDeviceStub addLocalDevice(HdmiMhlLocalDeviceStub device) {
Jinsuk Kim78104122014-08-26 19:32:34 +090092 return null;
93 }
94
95 void clearAllLocalDevices() {
96 }
97
Jinsuk Kimb3fbf9d2014-09-12 10:41:40 +090098 void sendVendorCommand(int portId, int offset, int length, byte[] data) {
Jinsuk Kim78104122014-08-26 19:32:34 +090099 }
100
101 void setOption(int flag, int value) {
102 }
103
104 /**
105 * Get the MHL version supported by underlying hardware port of the given {@code portId}.
106 * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively.
107 * The return value is stored in 'version'. Return INVALID_VERSION if MHL hardware layer
108 * is not ready.
109 */
110 int getMhlVersion(int portId) {
111 return INVALID_MHL_VERSION;
112 }
113
114 /**
115 * Get MHL version of a device which is connected to a port of the given {@code portId}.
116 * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively.
117 * The return value is stored in 'version'.
118 */
119 int getPeerMhlVersion(int portId) {
120 return INVALID_MHL_VERSION;
121 }
122
123 /**
124 * Get the bit flags describing the features supported by the system. Refer to feature support
125 * flag register info in MHL specification.
126 */
127 int getSupportedFeatures(int portId) {
128 return NO_SUPPORTED_FEATURES;
129 }
130
131 /**
132 * Get the bit flags describing the roles which ECBUS device can play. Refer to the
133 * ECBUS_DEV_ROLES Register info MHL3.0 specification
134 */
135 int getEcbusDeviceRoles(int portId) {
136 return INVALID_DEVICE_ROLES;
137 }
Jinsuk Kim61c94d12015-01-15 07:00:28 +0900138
139 void dump(IndentingPrintWriter pw) {
140 }
Jinsuk Kim78104122014-08-26 19:32:34 +0900141}