Store active source/active port in HdmiControlService when disabled
This lets the service keep track of the latest change made by TV app or TIF regarding active source/port. Bug: 16222083 Change-Id: I0f1a4520eb3e52ca5024567b0f1fbe4fd59e8cbf
This commit is contained in:
@@ -162,6 +162,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
handleSelectInternalSource(callback);
|
||||
return;
|
||||
}
|
||||
if (!mService.isControlEnabled()) {
|
||||
setActiveSource(targetAddress);
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
|
||||
return;
|
||||
}
|
||||
HdmiCecDeviceInfo targetDevice = getDeviceInfo(targetAddress);
|
||||
if (targetDevice == null) {
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_TARGET_NOT_AVAILABLE);
|
||||
@@ -240,18 +245,23 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
void doManualPortSwitching(int portId, IHdmiControlCallback callback) {
|
||||
assertRunOnServiceThread();
|
||||
// Seq #20
|
||||
if (!mService.isControlEnabled() || portId == getActivePortId()) {
|
||||
if (!mService.isValidPortId(portId)) {
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
|
||||
return;
|
||||
}
|
||||
// TODO: Make sure this call does not stem from <Active Source> message reception.
|
||||
|
||||
if (!mService.isControlEnabled()) {
|
||||
setActivePortId(portId);
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
|
||||
return;
|
||||
}
|
||||
if (portId == getActivePortId()) {
|
||||
invokeCallback(callback, HdmiControlManager.RESULT_SUCCESS);
|
||||
return;
|
||||
}
|
||||
setActivePortId(portId);
|
||||
// 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.
|
||||
// TODO: Handle invalid port id / active input which should be treated as an
|
||||
// internal tuner.
|
||||
|
||||
// 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).
|
||||
removeAction(RoutingControlAction.class);
|
||||
|
||||
int oldPath = mService.portIdToPath(mService.portIdToPath(getActivePortId()));
|
||||
|
||||
@@ -398,6 +398,15 @@ public final class HdmiControlService extends SystemService {
|
||||
return Constants.INVALID_PORT_ID;
|
||||
}
|
||||
|
||||
boolean isValidPortId(int portId) {
|
||||
for (HdmiPortInfo info : mPortInfo) {
|
||||
if (portId == info.getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Looper} for IO operation.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user