CEC: Revamp volume control action.
Here is a list of changes
1. Change volume control into event base not level base
2. Hide volume ui if volume change is triggered by CEC
3. Report volume change triggered by CEC in OSD message
4. Revamp HdmiLogger so that normal class uses static method only.
5. Apply format message to HdmiLogger's helper methods.
Bug: 17367215
Change-Id: I9f3cd41f7c66f76919059b463df956ed5176b054
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index bb22b4d..c5a6dbd 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -31,8 +31,6 @@
import libcore.util.EmptyArray;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -102,11 +100,6 @@
// Stores the local CEC devices in the system. Device type is used for key.
private final SparseArray<HdmiCecLocalDevice> mLocalDevices = new SparseArray<>();
- @IoThreadOnly
- private final HdmiLogger mIoThreadLogger = new HdmiLogger(TAG);
- @ServiceThreadOnly
- private final HdmiLogger mServiceThreadLogger = new HdmiLogger(TAG);
-
// Private constructor. Use HdmiCecController.create().
private HdmiCecController(HdmiControlService service) {
mService = service;
@@ -210,9 +203,8 @@
}
final int assignedAddress = logicalAddress;
- mIoThreadLogger.debug(
- String.format("New logical address for device [%d]: [preferred:%d, assigned:%d]",
- deviceType, preferredAddress, assignedAddress));
+ HdmiLogger.debug("New logical address for device [%d]: [preferred:%d, assigned:%d]",
+ deviceType, preferredAddress, assignedAddress);
if (callback != null) {
runOnServiceThread(new Runnable() {
@Override
@@ -449,7 +441,7 @@
allocated.add(address);
}
}
- mIoThreadLogger.debug("[P]:Allocated Address=" + allocated);
+ HdmiLogger.debug("[P]:Allocated Address=" + allocated);
if (callback != null) {
runOnServiceThread(new Runnable() {
@Override
@@ -551,7 +543,7 @@
runOnIoThread(new Runnable() {
@Override
public void run() {
- mIoThreadLogger.debug("[S]:" + cecMessage);
+ HdmiLogger.debug("[S]:" + cecMessage);
byte[] body = buildBody(cecMessage.getOpcode(), cecMessage.getParams());
int i = 0;
int errorCode = Constants.SEND_RESULT_SUCCESS;
@@ -586,7 +578,7 @@
private void handleIncomingCecCommand(int srcAddress, int dstAddress, byte[] body) {
assertRunOnServiceThread();
HdmiCecMessage command = HdmiCecMessageBuilder.of(srcAddress, dstAddress, body);
- mServiceThreadLogger.debug("[R]:" + command);
+ HdmiLogger.debug("[R]:" + command);
onReceiveCommand(command);
}
@@ -596,8 +588,7 @@
@ServiceThreadOnly
private void handleHotplug(int port, boolean connected) {
assertRunOnServiceThread();
- mServiceThreadLogger.debug(
- "Hotplug event:[port:" + port + " , connected:" + connected + "]");
+ HdmiLogger.debug("Hotplug event:[port:%d, connected:%b]", port, connected);
mService.onHotplug(port, connected);
}