summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJinsuk Kim <jinsukkim@google.com>2015-01-19 12:39:06 +0900
committerJinsuk Kim <jinsukkim@google.com>2015-01-22 16:58:26 +0900
commitcb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b (patch)
tree1a2d299342ee1e8ad3101ba9e544f447d956ff7b /services
parentb74155cf01f959fc9b7909de5a22806ad519f7c9 (diff)
downloadframeworks_base-cb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b.zip
frameworks_base-cb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b.tar.gz
frameworks_base-cb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b.tar.bz2
CEC: Add logic to return to internal source
This CL introduces a logic that, upon receiving <Inactive Source> from the active source or a corresponding MHL subcommand, lets the service return to one of internal inputs. Introduced to handle it is a new type for HdmiDevice (INACTIVE) that will be passed to input change listeners. The callback is expected to transform to other mechanism such as intent, to let TV app to decide which input to switch to, which will be one of non-HDMI input that was viewed previously. Bug: 19008579 Change-Id: I1922f4cd20e9220411061bb9d9fbe5fbc5676d48
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java9
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiControlService.java24
2 files changed, 21 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 4673b8c..43ef457 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -476,7 +476,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
HdmiDeviceInfo info = getCecDeviceInfo(logicalAddress);
if (info == null) {
if (!handleNewDeviceAtTheTailOfActivePath(physicalAddress)) {
- HdmiLogger.debug("Device info not found: %X; buffering the command", logicalAddress);
+ HdmiLogger.debug("Device info %X not found; buffering the command", logicalAddress);
mDelayedMessageBuffer.add(message);
}
} else if (!isInputReady(info.getId())) {
@@ -517,6 +517,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
doManualPortSwitching(portId, null);
setPrevPortId(Constants.INVALID_PORT_ID);
+ } else {
+ // No HDMI port to switch to was found. Notify the input change listers to
+ // switch to the lastly shown internal input.
+ mActiveSource.invalidate();
+ setActivePath(Constants.INVALID_PHYSICAL_ADDRESS);
+ mService.invokeInputChangeListener(HdmiDeviceInfo.INACTIVE_DEVICE);
}
return true;
}
@@ -1826,6 +1832,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
pw.println("mAutoDeviceOff: " + mAutoDeviceOff);
pw.println("mAutoWakeup: " + mAutoWakeup);
pw.println("mSkipRoutingControl: " + mSkipRoutingControl);
+ pw.println("mPrevPortId: " + mPrevPortId);
pw.println("CEC devices:");
pw.increaseIndent();
for (HdmiDeviceInfo info : mSafeAllDeviceInfos) {
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index fa8ab59..9f78c61 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -2252,16 +2252,17 @@ public final class HdmiControlService extends SystemService {
assertRunOnServiceThread();
if (tv() == null) return;
final int lastInput = contentOn ? tv().getActivePortId() : Constants.INVALID_PORT_ID;
- tv().doManualPortSwitching(portId, new IHdmiControlCallback.Stub() {
- @Override
- public void onComplete(int result) throws RemoteException {
- // Keep the last input to switch back later when RAP[ContentOff] is received.
- // This effectively sets the port to invalid one if the switching is for
- // RAP[ContentOff].
- setLastInputForMhl(lastInput);
- }
- });
-
+ if (portId != Constants.INVALID_PORT_ID) {
+ tv().doManualPortSwitching(portId, new IHdmiControlCallback.Stub() {
+ @Override
+ public void onComplete(int result) throws RemoteException {
+ // Keep the last input to switch back later when RAP[ContentOff] is received.
+ // This effectively sets the port to invalid one if the switching is for
+ // RAP[ContentOff].
+ setLastInputForMhl(lastInput);
+ }
+ });
+ }
// MHL device is always directly connected to the port. Update the active port ID to avoid
// unnecessary post-routing control task.
tv().setActivePortId(portId);
@@ -2271,7 +2272,8 @@ public final class HdmiControlService extends SystemService {
// may not be the MHL-enabled one. In this case the device info to be passed to
// input change listener should be the one describing the corresponding HDMI port.
HdmiMhlLocalDeviceStub device = mMhlController.getLocalDevice(portId);
- HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId);
+ HdmiDeviceInfo info = (device != null) ? device.getInfo()
+ : mPortDeviceMap.get(portId, HdmiDeviceInfo.INACTIVE_DEVICE);
invokeInputChangeListener(info);
}