From 781041239f2931ca16c902fb371cd041b057c918 Mon Sep 17 00:00:00 2001 From: Jinsuk Kim Date: Tue, 26 Aug 2014 19:32:34 +0900 Subject: [PATCH] CEC: Stub MHL Controller Replace MHL Controller with a stub impl Bug: 17259897 Change-Id: Id57bac363441f72b3da3f30d31c68c6d3b502237 --- .../server/hdmi/HdmiControlService.java | 4 +- .../server/hdmi/HdmiMhlControllerStub.java | 149 ++++++++++++++++++ services/core/jni/Android.mk | 1 - services/core/jni/onload.cpp | 2 - 4 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 services/core/java/com/android/server/hdmi/HdmiMhlControllerStub.java diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 9314cf86a84ef..6ba3fd18f3b8b 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -258,7 +258,7 @@ public final class HdmiControlService extends SystemService { private List mMhlDevices; @Nullable - private HdmiMhlController mMhlController; + private HdmiMhlControllerStub mMhlController; // Last input port before switching to the MHL port. Should switch back to this port // when the mobile device sends the request one touch play with off. @@ -307,7 +307,7 @@ public final class HdmiControlService extends SystemService { Slog.i(TAG, "Device does not support HDMI-CEC."); } - mMhlController = HdmiMhlController.create(this); + mMhlController = HdmiMhlControllerStub.create(this); if (!mMhlController.isReady()) { Slog.i(TAG, "Device does not support MHL-control."); } diff --git a/services/core/java/com/android/server/hdmi/HdmiMhlControllerStub.java b/services/core/java/com/android/server/hdmi/HdmiMhlControllerStub.java new file mode 100644 index 0000000000000..c27cf18034c82 --- /dev/null +++ b/services/core/java/com/android/server/hdmi/HdmiMhlControllerStub.java @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.hdmi; + +import android.hardware.hdmi.HdmiPortInfo; +import android.util.SparseArray; + +import com.android.server.hdmi.HdmiControlService.SendMessageCallback; + +/** + * A handler class for MHL control command. It converts user's command into MHL command and pass it + * to MHL HAL layer. + *

+ * It can be created only by {@link HdmiMhlControllerStub#create}. + */ +final class HdmiMhlControllerStub { + + private static final SparseArray mLocalDevices = new SparseArray<>(); + private static final HdmiPortInfo[] EMPTY_PORT_INFO = new HdmiPortInfo[0]; + private static final int INVALID_MHL_VERSION = 0; + private static final int NO_SUPPORTED_FEATURES = 0; + private static final int INVALID_DEVICE_ROLES = 0; + + // Private constructor. Use HdmiMhlControllerStub.create(). + private HdmiMhlControllerStub(HdmiControlService service) { + } + + // Returns true if MHL controller is initialized and ready to use. + boolean isReady() { + return false; + } + + static HdmiMhlControllerStub create(HdmiControlService service) { + return new HdmiMhlControllerStub(service); + } + + HdmiPortInfo[] getPortInfos() { + return EMPTY_PORT_INFO; + } + + /** + * Return {@link HdmiMhlLocalDevice} matched with the given port id. + * + * @return null if has no matched port id + */ + HdmiMhlLocalDevice getLocalDevice(int portId) { + return null; + } + + /** + * Return {@link HdmiMhlLocalDevice} matched with the given device id. + * + * @return null if has no matched id + */ + HdmiMhlLocalDevice getLocalDeviceById(int deviceId) { + return null; + } + + SparseArray getAllLocalDevices() { + return mLocalDevices; + } + + /** + * Remove a {@link HdmiMhlLocalDevice} matched with the given port id. + * + * @return removed {@link HdmiMhlLocalDevice}. Return null if no matched port id. + */ + HdmiMhlLocalDevice removeLocalDevice(int portId) { + return null; + } + + /** + * Add a new {@link HdmiMhlLocalDevice}. + * + * @return old {@link HdmiMhlLocalDevice} having same port id + */ + HdmiMhlLocalDevice addLocalDevice(HdmiMhlLocalDevice device) { + return null; + } + + void clearAllLocalDevices() { + } + + /** + * Send MHL MSC-Subcommand to the device connected to the given port. + */ + void sendSubcommand(int portId, HdmiMhlSubcommand command) { + } + + void sendSubcommand(final int portId, final HdmiMhlSubcommand command, + SendMessageCallback callback) { + } + + + void sendScratchpadCommand(int portId, int offset, int length, byte[] data) { + } + + void setOption(int flag, int value) { + } + + /** + * Get the MHL version supported by underlying hardware port of the given {@code portId}. + * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively. + * The return value is stored in 'version'. Return INVALID_VERSION if MHL hardware layer + * is not ready. + */ + int getMhlVersion(int portId) { + return INVALID_MHL_VERSION; + } + + /** + * Get MHL version of a device which is connected to a port of the given {@code portId}. + * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively. + * The return value is stored in 'version'. + */ + int getPeerMhlVersion(int portId) { + return INVALID_MHL_VERSION; + } + + /** + * Get the bit flags describing the features supported by the system. Refer to feature support + * flag register info in MHL specification. + */ + int getSupportedFeatures(int portId) { + return NO_SUPPORTED_FEATURES; + } + + /** + * Get the bit flags describing the roles which ECBUS device can play. Refer to the + * ECBUS_DEV_ROLES Register info MHL3.0 specification + */ + int getEcbusDeviceRoles(int portId) { + return INVALID_DEVICE_ROLES; + } +} diff --git a/services/core/jni/Android.mk b/services/core/jni/Android.mk index 1f377c717b397..d81cdd94b1c8f 100644 --- a/services/core/jni/Android.mk +++ b/services/core/jni/Android.mk @@ -11,7 +11,6 @@ LOCAL_SRC_FILES += \ $(LOCAL_REL_DIR)/com_android_server_connectivity_Vpn.cpp \ $(LOCAL_REL_DIR)/com_android_server_ConsumerIrService.cpp \ $(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiCecController.cpp \ - $(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiMhlController.cpp \ $(LOCAL_REL_DIR)/com_android_server_input_InputApplicationHandle.cpp \ $(LOCAL_REL_DIR)/com_android_server_input_InputManagerService.cpp \ $(LOCAL_REL_DIR)/com_android_server_input_InputWindowHandle.cpp \ diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp index 39b70a86c03e7..7b2e40809195e 100644 --- a/services/core/jni/onload.cpp +++ b/services/core/jni/onload.cpp @@ -38,7 +38,6 @@ int register_android_server_location_GpsLocationProvider(JNIEnv* env); int register_android_server_location_FlpHardwareProvider(JNIEnv* env); int register_android_server_connectivity_Vpn(JNIEnv* env); int register_android_server_hdmi_HdmiCecController(JNIEnv* env); -int register_android_server_hdmi_HdmiMhlController(JNIEnv* env); int register_android_server_tv_TvInputHal(JNIEnv* env); int register_android_server_PersistentDataBlockService(JNIEnv* env); int register_android_server_fingerprint_FingerprintService(JNIEnv* env); @@ -76,7 +75,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) register_android_server_ConsumerIrService(env); register_android_server_BatteryStatsService(env); register_android_server_hdmi_HdmiCecController(env); - register_android_server_hdmi_HdmiMhlController(env); register_android_server_tv_TvInputHal(env); register_android_server_PersistentDataBlockService(env); register_android_server_fingerprint_FingerprintService(env);