am a8c43b25: Merge "CEC: Stub MHL Controller" into lmp-dev

* commit 'a8c43b254104ead2c465544efb88ec8de6f9f462':
  CEC: Stub MHL Controller
This commit is contained in:
Jinsuk Kim
2014-09-10 00:24:48 +00:00
committed by Android Git Automerger
4 changed files with 151 additions and 5 deletions

View File

@@ -256,7 +256,7 @@ public final class HdmiControlService extends SystemService {
private List<HdmiDeviceInfo> 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.
@@ -305,7 +305,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.");
}

View File

@@ -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.
* <p>
* It can be created only by {@link HdmiMhlControllerStub#create}.
*/
final class HdmiMhlControllerStub {
private static final SparseArray<HdmiMhlLocalDevice> 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<HdmiMhlLocalDevice> 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;
}
}

View File

@@ -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 \

View File

@@ -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);