Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 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.hardware.hdmi.HdmiPortInfo; |
| 20 | import android.util.SparseArray; |
| 21 | |
Jinsuk Kim | 61c94d1 | 2015-01-15 07:00:28 +0900 | [diff] [blame] | 22 | import com.android.internal.util.IndentingPrintWriter; |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 23 | |
| 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 | */ |
| 30 | final class HdmiMhlControllerStub { |
| 31 | |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 32 | private static final SparseArray<HdmiMhlLocalDeviceStub> mLocalDevices = new SparseArray<>(); |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 33 | 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 Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 56 | * Return {@link HdmiMhlLocalDeviceStub} matched with the given port id. |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 57 | * |
| 58 | * @return null if has no matched port id |
| 59 | */ |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 60 | HdmiMhlLocalDeviceStub getLocalDevice(int portId) { |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 61 | return null; |
| 62 | } |
| 63 | |
| 64 | /** |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 65 | * Return {@link HdmiMhlLocalDeviceStub} matched with the given device id. |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 66 | * |
| 67 | * @return null if has no matched id |
| 68 | */ |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 69 | HdmiMhlLocalDeviceStub getLocalDeviceById(int deviceId) { |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 70 | return null; |
| 71 | } |
| 72 | |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 73 | SparseArray<HdmiMhlLocalDeviceStub> getAllLocalDevices() { |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 74 | return mLocalDevices; |
| 75 | } |
| 76 | |
| 77 | /** |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 78 | * Remove a {@link HdmiMhlLocalDeviceStub} matched with the given port id. |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 79 | * |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 80 | * @return removed {@link HdmiMhlLocalDeviceStub}. Return null if no matched port id. |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 81 | */ |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 82 | HdmiMhlLocalDeviceStub removeLocalDevice(int portId) { |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 83 | return null; |
| 84 | } |
| 85 | |
| 86 | /** |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 87 | * Add a new {@link HdmiMhlLocalDeviceStub}. |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 88 | * |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 89 | * @return old {@link HdmiMhlLocalDeviceStub} having same port id |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 90 | */ |
Jinsuk Kim | 3b9309a | 2014-09-12 15:10:33 +0900 | [diff] [blame] | 91 | HdmiMhlLocalDeviceStub addLocalDevice(HdmiMhlLocalDeviceStub device) { |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 92 | return null; |
| 93 | } |
| 94 | |
| 95 | void clearAllLocalDevices() { |
| 96 | } |
| 97 | |
Jinsuk Kim | b3fbf9d | 2014-09-12 10:41:40 +0900 | [diff] [blame] | 98 | void sendVendorCommand(int portId, int offset, int length, byte[] data) { |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 99 | } |
| 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 Kim | 61c94d1 | 2015-01-15 07:00:28 +0900 | [diff] [blame] | 138 | |
| 139 | void dump(IndentingPrintWriter pw) { |
| 140 | } |
Jinsuk Kim | 7810412 | 2014-08-26 19:32:34 +0900 | [diff] [blame] | 141 | } |