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

Commit 7640d989 authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

CEC: Fix a regression bug

The HdmiControlService.getActiveSource() has a regression (exception)
when calling getDeviceInfoByPath since method should be called on
a service thread. Introduced a method that can be invoked safely
from the main thread.

Bug: 19170884
Change-Id: I393161e08c916270faf46147a97076bc573b808f
parent 43b2746b
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1455,6 +1455,25 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        return null;
    }

    /**
     * Returns the {@link HdmiDeviceInfo} instance whose physical address matches
     * the given routing path. This is the version accessible safely from threads
     * other than service thread.
     *
     * @param path routing path or physical address
     * @return {@link HdmiDeviceInfo} if the matched info is found; otherwise null
     */
    HdmiDeviceInfo getSafeDeviceInfoByPath(int path) {
        synchronized (mLock) {
            for (HdmiDeviceInfo info : mSafeAllDeviceInfos) {
                if (info.getPhysicalAddress() == path) {
                    return info;
                }
            }
            return null;
        }
    }

    /**
     * Whether a device of the specified physical address and logical address exists
     * in a device info list. However, both are minimal condition and it could
+1 −1
Original line number Diff line number Diff line
@@ -1196,7 +1196,7 @@ public final class HdmiControlService extends SystemService {
            }
            int activePath = tv.getActivePath();
            if (activePath != HdmiDeviceInfo.PATH_INVALID) {
                HdmiDeviceInfo info = tv.getDeviceInfoByPath(activePath);
                HdmiDeviceInfo info = tv.getSafeDeviceInfoByPath(activePath);
                return (info != null) ? info : new HdmiDeviceInfo(activePath, tv.getActivePortId());
            }
            return null;