Start system audio initialization mode on new device discovery.
If a new device is avr and current tv setting is system audio mode, we should launch SystemAudioAutoInitiationAction. Bug: 15843140 Change-Id: I8db89e9be21572e304e6eebb5948a7981df14e90
This commit is contained in:
@@ -66,7 +66,7 @@ final class ActiveSourceHandler {
|
||||
}
|
||||
HdmiCecDeviceInfo device = mService.getDeviceInfo(activeAddress);
|
||||
if (device == null) {
|
||||
tv.addAndStartAction(new NewDeviceAction(tv, activeAddress, activePath));
|
||||
tv.startNewDeviceAction(activeAddress, activePath);
|
||||
}
|
||||
|
||||
int currentActive = tv.getActiveSource();
|
||||
|
||||
@@ -399,10 +399,28 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
if (!isInDeviceList(path, address)) {
|
||||
handleNewDeviceAtTheTailOfActivePath(path);
|
||||
}
|
||||
addAndStartAction(new NewDeviceAction(this, address, path));
|
||||
startNewDeviceAction(address, path);
|
||||
return true;
|
||||
}
|
||||
|
||||
void startNewDeviceAction(int address, int path) {
|
||||
for (NewDeviceAction action : getActions(NewDeviceAction.class)) {
|
||||
// If there is new device action which has the same logical address and path
|
||||
// ignore new request.
|
||||
// NewDeviceAction is created whenever it receives <Report Physical Address>.
|
||||
// And there is a chance starting NewDeviceAction for the same source.
|
||||
// Usually, new device sends <Report Physical Address> when it's plugged
|
||||
// in. However, TV can detect a new device from HotPlugDetectionAction,
|
||||
// which sends <Give Physical Address> to the source for newly detected
|
||||
// device.
|
||||
if (action.isActionOf(address, path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
addAndStartAction(new NewDeviceAction(this, address, path));
|
||||
}
|
||||
|
||||
private void handleNewDeviceAtTheTailOfActivePath(int path) {
|
||||
// Seq #22
|
||||
if (isTailOfActivePath(path, getActivePath())) {
|
||||
|
||||
@@ -56,7 +56,6 @@ final class NewDeviceAction extends FeatureAction {
|
||||
* @param source {@link HdmiCecLocalDevice} instance
|
||||
* @param deviceLogicalAddress logical address of the device in interest
|
||||
* @param devicePhysicalAddress physical address of the device in interest
|
||||
* @param requireRoutingChange whether to initiate routing change or not
|
||||
*/
|
||||
NewDeviceAction(HdmiCecLocalDevice source, int deviceLogicalAddress,
|
||||
int devicePhysicalAddress) {
|
||||
@@ -68,18 +67,6 @@ final class NewDeviceAction extends FeatureAction {
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
if (HdmiUtils.getTypeFromAddress(getSourceAddress())
|
||||
== HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
if (tv().getAvrDeviceInfo() == null) {
|
||||
// TODO: Start system audio initiation action
|
||||
}
|
||||
|
||||
if (shouldTryArcInitiation()) {
|
||||
addAndStartAction(new RequestArcInitiationAction(localDevice(),
|
||||
mDeviceLogicalAddress));
|
||||
}
|
||||
}
|
||||
|
||||
mState = STATE_WAITING_FOR_SET_OSD_NAME;
|
||||
if (mayProcessCommandIfCached(mDeviceLogicalAddress, Constants.MESSAGE_SET_OSD_NAME)) {
|
||||
return true;
|
||||
@@ -91,10 +78,6 @@ final class NewDeviceAction extends FeatureAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean shouldTryArcInitiation() {
|
||||
return tv().isConnectedToArcPort(mDevicePhysicalAddress) && tv().isArcFeatureEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processCommand(HdmiCecMessage cmd) {
|
||||
// For the logical device in interest, we want two more pieces of information -
|
||||
@@ -172,6 +155,23 @@ final class NewDeviceAction extends FeatureAction {
|
||||
mDeviceLogicalAddress, mDevicePhysicalAddress,
|
||||
HdmiUtils.getTypeFromAddress(mDeviceLogicalAddress),
|
||||
mVendorId, mDisplayName));
|
||||
|
||||
if (HdmiUtils.getTypeFromAddress(mDeviceLogicalAddress)
|
||||
== HdmiCecDeviceInfo.DEVICE_AUDIO_SYSTEM) {
|
||||
if (tv().getSystemAudioMode()) {
|
||||
addAndStartAction(new SystemAudioAutoInitiationAction(localDevice(),
|
||||
mDeviceLogicalAddress));
|
||||
}
|
||||
|
||||
if (shouldTryArcInitiation()) {
|
||||
addAndStartAction(new RequestArcInitiationAction(localDevice(),
|
||||
mDeviceLogicalAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldTryArcInitiation() {
|
||||
return tv().isConnectedToArcPort(mDevicePhysicalAddress) && tv().isArcFeatureEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,4 +188,8 @@ final class NewDeviceAction extends FeatureAction {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isActionOf(int address, int path) {
|
||||
return (mDeviceLogicalAddress == address) && (mDevicePhysicalAddress == path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user