CEC: Make TV try to allocate logical address 0 first

HDMI Spec says TV shall try to allocate TV() logical address, unlike
other kinds of devices that are recommended to use the previously
allocated one.

Also included are small changes:

- reply with 'can not provide source' if TV has no source to provide
- return the present device info if we have one at the given path

Bug: 19045081
Change-Id: Icf17cb581f0ef2274e252ec5665f80bb1c08b494
This commit is contained in:
Jinsuk Kim
2015-01-17 07:38:24 +09:00
parent ac70b2d172
commit d47abefc82
2 changed files with 5 additions and 9 deletions

View File

@@ -222,18 +222,13 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
}
@Override
@ServiceThreadOnly
protected int getPreferredAddress() {
assertRunOnServiceThread();
return SystemProperties.getInt(Constants.PROPERTY_PREFERRED_ADDRESS_TV,
Constants.ADDR_UNREGISTERED);
return Constants.ADDR_TV;
}
@Override
@ServiceThreadOnly
protected void setPreferredAddress(int addr) {
assertRunOnServiceThread();
SystemProperties.set(Constants.PROPERTY_PREFERRED_ADDRESS_TV, String.valueOf(addr));
Slog.w(TAG, "Preferred addres will not be stored for TV");
}
@Override
@@ -1631,7 +1626,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
Slog.w(TAG, "Invalid record source." + Arrays.toString(recordSource));
announceOneTouchRecordResult(recorderAddress,
ONE_TOUCH_RECORD_FAIL_TO_RECORD_DISPLAYED_SCREEN);
return Constants.ABORT_UNABLE_TO_DETERMINE;
return Constants.ABORT_CANNOT_PROVIDE_SOURCE;
}
addAndStartAction(new OneTouchRecordAction(this, recorderAddress, recordSource));

View File

@@ -1192,7 +1192,8 @@ public final class HdmiControlService extends SystemService {
}
int activePath = tv.getActivePath();
if (activePath != HdmiDeviceInfo.PATH_INVALID) {
return new HdmiDeviceInfo(activePath, tv.getActivePortId());
HdmiDeviceInfo info = tv.getDeviceInfoByPath(activePath);
return (info != null) ? info : new HdmiDeviceInfo(activePath, tv.getActivePortId());
}
return null;
}