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 22 import com.android.internal.util.IndentingPrintWriter; 23 import com.android.server.hdmi.HdmiControlService.SendMessageCallback; 24 25 /** 26 * A handler class for MHL control command. It converts user's command into MHL command and pass it 27 * to MHL HAL layer. 28 * <p> 29 * It can be created only by {@link HdmiMhlControllerStub#create}. 30 */ 31 final class HdmiMhlControllerStub { 32 33 private static final SparseArray<HdmiMhlLocalDeviceStub> mLocalDevices = new SparseArray<>(); 34 private static final HdmiPortInfo[] EMPTY_PORT_INFO = new HdmiPortInfo[0]; 35 private static final int INVALID_MHL_VERSION = 0; 36 private static final int NO_SUPPORTED_FEATURES = 0; 37 private static final int INVALID_DEVICE_ROLES = 0; 38 39 // Private constructor. Use HdmiMhlControllerStub.create(). 40 private HdmiMhlControllerStub(HdmiControlService service) { 41 } 42 43 // Returns true if MHL controller is initialized and ready to use. 44 boolean isReady() { 45 return false; 46 } 47 48 static HdmiMhlControllerStub create(HdmiControlService service) { 49 return new HdmiMhlControllerStub(service); 50 } 51 52 HdmiPortInfo[] getPortInfos() { 53 return EMPTY_PORT_INFO; 54 } 55 56 /** 57 * Return {@link HdmiMhlLocalDeviceStub} matched with the given port id. 58 * 59 * @return null if has no matched port id 60 */ 61 HdmiMhlLocalDeviceStub getLocalDevice(int portId) { 62 return null; 63 } 64 65 /** 66 * Return {@link HdmiMhlLocalDeviceStub} matched with the given device id. 67 * 68 * @return null if has no matched id 69 */ 70 HdmiMhlLocalDeviceStub getLocalDeviceById(int deviceId) { 71 return null; 72 } 73 74 SparseArray<HdmiMhlLocalDeviceStub> getAllLocalDevices() { 75 return mLocalDevices; 76 } 77 78 /** 79 * Remove a {@link HdmiMhlLocalDeviceStub} matched with the given port id. 80 * 81 * @return removed {@link HdmiMhlLocalDeviceStub}. Return null if no matched port id. 82 */ 83 HdmiMhlLocalDeviceStub removeLocalDevice(int portId) { 84 return null; 85 } 86 87 /** 88 * Add a new {@link HdmiMhlLocalDeviceStub}. 89 * 90 * @return old {@link HdmiMhlLocalDeviceStub} having same port id 91 */ 92 HdmiMhlLocalDeviceStub addLocalDevice(HdmiMhlLocalDeviceStub device) { 93 return null; 94 } 95 96 void clearAllLocalDevices() { 97 } 98 99 void sendVendorCommand(int portId, int offset, int length, byte[] data) { 100 } 101 102 void setOption(int flag, int value) { 103 } 104 105 /** 106 * Get the MHL version supported by underlying hardware port of the given {@code portId}. 107 * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively. 108 * The return value is stored in 'version'. Return INVALID_VERSION if MHL hardware layer 109 * is not ready. 110 */ 111 int getMhlVersion(int portId) { 112 return INVALID_MHL_VERSION; 113 } 114 115 /** 116 * Get MHL version of a device which is connected to a port of the given {@code portId}. 117 * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively. 118 * The return value is stored in 'version'. 119 */ 120 int getPeerMhlVersion(int portId) { 121 return INVALID_MHL_VERSION; 122 } 123 124 /** 125 * Get the bit flags describing the features supported by the system. Refer to feature support 126 * flag register info in MHL specification. 127 */ 128 int getSupportedFeatures(int portId) { 129 return NO_SUPPORTED_FEATURES; 130 } 131 132 /** 133 * Get the bit flags describing the roles which ECBUS device can play. Refer to the 134 * ECBUS_DEV_ROLES Register info MHL3.0 specification 135 */ 136 int getEcbusDeviceRoles(int portId) { 137 return INVALID_DEVICE_ROLES; 138 } 139 140 void dump(IndentingPrintWriter pw) { 141 } 142 } 143