Do not have HdmiControlService report deviceEvent for TV itself
DeviceEvent should be used only for the other logical device, not the TV device itself. Also fixed a but not updating the logical address after the allocation. Change-Id: I80cec9d5bb4b95d003c9d1c7ea13f02d7e76b322
This commit is contained in:
@@ -78,7 +78,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
*/
|
||||
void deviceSelect(int targetAddress, IHdmiControlCallback callback) {
|
||||
assertRunOnServiceThread();
|
||||
HdmiCecDeviceInfo targetDevice = mService.getDeviceInfo(targetAddress);
|
||||
HdmiCecDeviceInfo targetDevice = getDeviceInfo(targetAddress);
|
||||
if (targetDevice == null) {
|
||||
invokeCallback(callback, HdmiCec.RESULT_TARGET_NOT_AVAILABLE);
|
||||
return;
|
||||
@@ -458,8 +458,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
|
||||
final void addCecDevice(HdmiCecDeviceInfo info) {
|
||||
assertRunOnServiceThread();
|
||||
addDeviceInfo(info);
|
||||
if (info.getLogicalAddress() == mAddress) {
|
||||
// The addition of TV device itself should not be notified.
|
||||
return;
|
||||
}
|
||||
mService.invokeDeviceEventListeners(info, true);
|
||||
// TODO: announce new device detection.
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -158,6 +158,7 @@ public final class HdmiControlService extends SystemService {
|
||||
// A container for [Logical Address, Local device info].
|
||||
final SparseArray<HdmiCecLocalDevice> devices = new SparseArray<>();
|
||||
final SparseIntArray finished = new SparseIntArray();
|
||||
mCecController.clearLogicalAddress();
|
||||
for (int type : deviceTypes) {
|
||||
final HdmiCecLocalDevice localDevice = HdmiCecLocalDevice.create(this, type);
|
||||
localDevice.init();
|
||||
@@ -189,7 +190,7 @@ public final class HdmiControlService extends SystemService {
|
||||
for (int i = 0; i < devices.size(); ++i) {
|
||||
int address = devices.keyAt(i);
|
||||
HdmiCecLocalDevice device = devices.valueAt(i);
|
||||
device.onAddressAllocated(address);
|
||||
device.handleAddressAllocated(address);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user