Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13c030e8 authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

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
parent 19bb5705
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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.
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }