From a94417a51646a2560e44974c99435cb00bd96201 Mon Sep 17 00:00:00 2001 From: Jinsuk Kim Date: Fri, 12 Sep 2014 15:02:07 +0900 Subject: CEC: Refactoring for MHL This helps MHL code clean-up. - Factored MHL constants out to a new class - Renamed some methods Bug: 17479050 Change-Id: Ia39f8bb51ce552ac10f587e6ee0431951f2f494b --- .../java/com/android/server/hdmi/Constants.java | 32 ----------------- .../android/server/hdmi/HdmiControlService.java | 26 +++++++------- .../java/com/android/server/hdmi/MhlConstants.java | 40 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 services/core/java/com/android/server/hdmi/MhlConstants.java (limited to 'services') diff --git a/services/core/java/com/android/server/hdmi/Constants.java b/services/core/java/com/android/server/hdmi/Constants.java index 6ce235b..5823f47 100644 --- a/services/core/java/com/android/server/hdmi/Constants.java +++ b/services/core/java/com/android/server/hdmi/Constants.java @@ -255,37 +255,5 @@ final class Constants { // values which denotes the device type in HDMI Spec 1.4. static final String PROPERTY_DEVICE_TYPE = "ro.hdmi.device_type"; - // -------------------------------------------------- - // MHL sub command message types. - static final int MHL_MSG_MSGE = 0x02; - static final int MHL_MSG_RCP = 0x10; - static final int MHL_MSG_RCPK = 0x11; - static final int MHL_MSG_RCPE = 0x12; - static final int MHL_MSG_RAP = 0x20; - static final int MHL_MSG_RAPK = 0x21; - - // MHL RAP messages. - static final int MHL_RAP_ACTION_POLL = 0x00; - static final int MHL_RAP_ACTION_CONTENT_ON = 0x10; - static final int MHL_RAP_ACTION_CONTENT_OFF = 0x11; - - // MHL RAPK messages. - static final int MHL_RAPK_NO_ERROR = 0x00; - static final int MHL_RAPK_UNRECOGNIZED_ACTION = 0x01; - static final int MHL_RAPK_UNSUPPORTED_ACTION = 0x02; - static final int MHL_RAPK_RESPONDER_BUSY = 0x03; - - static final int MHL_INVALID_ADOPTER_ID = -1; - static final int MHL_INVALID_DEVICE_ID = -1; - - static final int MHL_CBUS_MODE_OCBUS = 1; - static final int MHL_CBUS_MODE_ECBUS_S = 2; - static final int MHL_CBUS_MODE_ECBUS_D = 3; - - // MHL RCPE messages - static final int MHL_RCPE_NO_ERROR = 0x00; - static final int MHL_RCPE_INEFFECTIVE_KEYCODE = 0x01; - static final int MHL_RCPE_RESPONDER_BUSY = 0x02; - private Constants() { /* cannot be instantiated */ } } diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 9a4000c..97da52b 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -856,8 +856,8 @@ public final class HdmiControlService extends SystemService { HdmiMhlLocalDevice device = mMhlController.removeLocalDevice(portId); if (device != null) { device.onDeviceRemoved(); - // There is no explicit event for device removal unlike capability register event - // used for device addition . Hence we remove the device on hotplug event. + // There is no explicit event for device removal. + // Hence we remove the device on hotplug event. HdmiDeviceInfo deviceInfo = device.getInfo(); if (deviceInfo != null) { invokeDeviceEventListeners(deviceInfo, DEVICE_EVENT_REMOVE_DEVICE); @@ -871,40 +871,40 @@ public final class HdmiControlService extends SystemService { } @ServiceThreadOnly - void handleMhlCbusModeChanged(int portId, int cbusmode) { + void handleMhlBusModeChanged(int portId, int busmode) { assertRunOnServiceThread(); HdmiMhlLocalDevice device = mMhlController.getLocalDevice(portId); if (device != null) { - device.setCbusMode(cbusmode); + device.setBusMode(busmode); } else { - Slog.w(TAG, "No mhl device exists for cbus mode change[portId:" + portId + - ", cbusmode:" + cbusmode + "]"); + Slog.w(TAG, "No mhl device exists for bus mode change[portId:" + portId + + ", busmode:" + busmode + "]"); } } @ServiceThreadOnly - void handleMhlVbusOvercurrent(int portId, boolean on) { + void handleMhlBusOvercurrent(int portId, boolean on) { assertRunOnServiceThread(); HdmiMhlLocalDevice device = mMhlController.getLocalDevice(portId); if (device != null) { - device.onVbusOvercurrentDetected(on); + device.onBusOvercurrentDetected(on); } else { - Slog.w(TAG, "No mhl device exists for vbus overcurrent event[portId:" + portId + "]"); + Slog.w(TAG, "No mhl device exists for bus overcurrent event[portId:" + portId + "]"); } } @ServiceThreadOnly - void handleMhlCapabilityRegisterChanged(int portId, int adopterId, int deviceId) { + void handleMhlDeviceStatusChanged(int portId, int adopterId, int deviceId) { assertRunOnServiceThread(); HdmiMhlLocalDevice device = mMhlController.getLocalDevice(portId); - // Hotplug event should already have been called before capability register change event. + // Hotplug event should already have been called before device status change event. if (device != null) { - device.setCapabilityRegister(adopterId, deviceId); + device.setDeviceStatusChange(adopterId, deviceId); invokeDeviceEventListeners(device.getInfo(), DEVICE_EVENT_ADD_DEVICE); updateSafeMhlInput(); } else { - Slog.w(TAG, "No mhl device exists for capability register change event[portId:" + Slog.w(TAG, "No mhl device exists for device status event[portId:" + portId + ", adopterId:" + adopterId + ", deviceId:" + deviceId + "]"); } } diff --git a/services/core/java/com/android/server/hdmi/MhlConstants.java b/services/core/java/com/android/server/hdmi/MhlConstants.java new file mode 100644 index 0000000..fe479f3 --- /dev/null +++ b/services/core/java/com/android/server/hdmi/MhlConstants.java @@ -0,0 +1,40 @@ +package com.android.server.hdmi; + +/** + * Defines constants related to MHL protocol internal implementation. + */ +final class MhlConstants { + // -------------------------------------------------- + // MHL sub command message types. + static final int MSG_MSGE = 0x02; + static final int MSG_RCP = 0x10; + static final int MSG_RCPK = 0x11; + static final int MSG_RCPE = 0x12; + static final int MSG_RAP = 0x20; + static final int MSG_RAPK = 0x21; + + // MHL RAP messages. + static final int RAP_ACTION_POLL = 0x00; + static final int RAP_ACTION_CONTENT_ON = 0x10; + static final int RAP_ACTION_CONTENT_OFF = 0x11; + + // MHL RAPK messages. + static final int RAPK_NO_ERROR = 0x00; + static final int RAPK_UNRECOGNIZED_ACTION = 0x01; + static final int RAPK_UNSUPPORTED_ACTION = 0x02; + static final int RAPK_RESPONDER_BUSY = 0x03; + + static final int INVALID_ADOPTER_ID = -1; + static final int INVALID_DEVICE_ID = -1; + + static final int CBUS_MODE_OCBUS = 1; + static final int CBUS_MODE_ECBUS_S = 2; + static final int CBUS_MODE_ECBUS_D = 3; + + // MHL RCPE messages + static final int RCPE_NO_ERROR = 0x00; + static final int RCPE_INEFFECTIVE_KEYCODE = 0x01; + static final int RCPE_RESPONDER_BUSY = 0x02; + + private MhlConstants() { /* cannot be instantiated */ } +} -- cgit v1.1