am e59b3156: am 5fc018ad: am 41824e71: Merge "Make it not to go to sleep when changing TV\'s input to the others." into lmp-dev

* commit 'e59b3156a1470639a2514a8b4dd169266d3e0083':
  Make it not to go to sleep when changing TV's input to the others.
This commit is contained in:
Yuncheol Heo
2014-08-11 08:54:23 +00:00
committed by Android Git Automerger
2 changed files with 63 additions and 12 deletions

View File

@@ -210,6 +210,8 @@ abstract class HdmiCecLocalDevice {
return handleReportPhysicalAddress(message);
case Constants.MESSAGE_ROUTING_CHANGE:
return handleRoutingChange(message);
case Constants.MESSAGE_ROUTING_INFORMATION:
return handleRoutingInformation(message);
case Constants.MESSAGE_INITIATE_ARC:
return handleInitiateArc(message);
case Constants.MESSAGE_TERMINATE_ARC:
@@ -331,6 +333,10 @@ abstract class HdmiCecLocalDevice {
return false;
}
protected boolean handleRoutingInformation(HdmiCecMessage message) {
return false;
}
protected boolean handleReportPhysicalAddress(HdmiCecMessage message) {
return false;
}

View File

@@ -16,8 +16,8 @@
package com.android.server.hdmi;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.IHdmiControlCallback;
import android.os.RemoteException;
import android.os.SystemProperties;
@@ -137,14 +137,14 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
protected boolean handleActiveSource(HdmiCecMessage message) {
assertRunOnServiceThread();
int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
mayResetActiveSource(physicalAddress);
return true; // Broadcast message.
}
private void mayResetActiveSource(int physicalAddress) {
if (physicalAddress != mService.getPhysicalAddress()) {
mIsActiveSource = false;
if (mService.isPowerOnOrTransient()) {
mService.nap();
}
return true;
}
return false;
}
@Override
@@ -152,13 +152,58 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
protected boolean handleSetStreamPath(HdmiCecMessage message) {
assertRunOnServiceThread();
int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
maySetActiveSource(physicalAddress);
maySendActiveSource();
wakeUpIfActiveSource();
return true; // Broadcast message.
}
// Samsung model, we tested, sends <RoutingChange> and <RequestActiveSource> consecutively,
// Then if there is no <ActiveSource> response, it will change the input to
// the internal source. To handle this, we'll set ActiveSource aggressively.
@Override
@ServiceThreadOnly
protected boolean handleRoutingChange(HdmiCecMessage message) {
assertRunOnServiceThread();
int newPath = HdmiUtils.twoBytesToInt(message.getParams(), 2);
maySetActiveSource(newPath);
return true; // Broadcast message.
}
@Override
@ServiceThreadOnly
protected boolean handleRoutingInformation(HdmiCecMessage message) {
assertRunOnServiceThread();
int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
maySetActiveSource(physicalAddress);
return true; // Broadcast message.
}
private void maySetActiveSource(int physicalAddress) {
if (physicalAddress == mService.getPhysicalAddress()) {
if (mService.isPowerStandbyOrTransient()) {
mService.wakeUp();
}
return true;
mIsActiveSource = true;
}
return false;
}
private void wakeUpIfActiveSource() {
if (mIsActiveSource && mService.isPowerStandbyOrTransient()) {
mService.wakeUp();
}
}
private void maySendActiveSource() {
if (mIsActiveSource) {
mService.sendCecCommand(HdmiCecMessageBuilder.buildActiveSource(
mAddress, mService.getPhysicalAddress()));
}
}
@Override
@ServiceThreadOnly
protected boolean handleRequestActiveSource(HdmiCecMessage message) {
assertRunOnServiceThread();
maySendActiveSource();
return true; // Broadcast message.
}
@Override
@@ -174,4 +219,4 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
mIsActiveSource = false;
checkIfPendingActionsCleared();
}
}
}