summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jinsuk Kim <jinsukkim@google.com> 2014-08-12 15:39:53 +0900
committer Jinsuk Kim <jinsukkim@google.com> 2014-08-12 15:47:19 +0900
commit1f8d1c576f06ed63c21d175fb0c86db596f59353 (patch)
tree61042e689d9072af228b09cfdcb5b3f7c969bf06
parent3afd00e9f2b55a21ca378d6e520d24283dbb62e0 (diff)
CEC: Fix two bugs
- <Routing Change> goes out with invalid parameter (F.F.F.F) for old path if the active source/path is not set. Should have been set to internal path (0.0.0.0) - <User Control Pressed> was still sent when active source was not set. Fixed to discard it. Bug: 16966486 Bug: 16965446 Change-Id: I5abb062be42c17514b3ed7ac930d7a3535fc9132
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 4810650e3599..334107ee3bfd 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -309,7 +309,8 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
// TODO: Return immediately if the operation is triggered by <Text/Image View On>
// and this is the first notification about the active input after power-on
// (switch to HDMI didn't happen so far but is expected to happen soon).
- int oldPath = mService.portIdToPath(getActivePortId());
+ int oldPath = getActivePortId() != Constants.INVALID_PORT_ID
+ ? mService.portIdToPath(getActivePortId()) : getDeviceInfo().getPhysicalAddress();
int newPath = mService.portIdToPath(portId);
HdmiCecMessage routingChange =
HdmiCecMessageBuilder.buildRoutingChange(mAddress, oldPath, newPath);
@@ -336,11 +337,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
if (!action.isEmpty()) {
action.get(0).processKeyEvent(keyCode, isPressed);
} else {
- if (isPressed) {
+ if (isPressed && getActiveSource().isValid()) {
int logicalAddress = getActiveSource().logicalAddress;
addAndStartAction(new SendKeyAction(this, logicalAddress, keyCode));
} else {
- Slog.w(TAG, "Discard key release event");
+ Slog.w(TAG, "Discard key event: " + keyCode + " pressed:" + isPressed);
}
}
}