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

Commit 26ba7fdd authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

Make it pass CECT 11.1.3 System standby

- Accept the broadcast <Standby> message.
- Fix the bug that onStandyCompleted() is called mutliple times.
- Fix the issue that <Standby> message is not sent when going to
  the standby state, since the local device was cleared already.

Bug: 16497304
Change-Id: Ib04ad2386621929814a801edd6b6c0e1a3902a7c
parent 14149ee2
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.hardware.hdmi.HdmiCecDeviceInfo;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemProperties;
import android.util.Slog;

import com.android.internal.annotations.GuardedBy;
@@ -552,7 +551,10 @@ abstract class HdmiCecLocalDevice {

    protected void checkIfPendingActionsCleared() {
        if (mActions.isEmpty() && mPendingActionClearedCallback != null) {
            mPendingActionClearedCallback.onCleared(this);
            PendingActionClearedCallback callback = mPendingActionClearedCallback;
            // To prevent from calling the callback again during handling the callback itself.
            mPendingActionClearedCallback = null;
            callback.onCleared(this);
        }
    }

+0 −12
Original line number Diff line number Diff line
@@ -1249,18 +1249,6 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        }
    }

    @Override
    @ServiceThreadOnly
    protected boolean handleStandby(HdmiCecMessage message) {
        assertRunOnServiceThread();
        // Seq #12
        // Tv accepts directly addressed <Standby> only.
        if (message.getDestination() == mAddress) {
            super.handleStandby(message);
        }
        return false;
    }

    boolean isProhibitMode() {
        return mService.isProhibitMode();
    }
+3 −3
Original line number Diff line number Diff line
@@ -200,10 +200,10 @@ public final class HdmiControlService extends SystemService {
    private List<HdmiPortInfo> mPortInfo;

    // Map from path(physical address) to port ID.
    private SparseIntArray mPortIdMap = new SparseIntArray();
    private final SparseIntArray mPortIdMap = new SparseIntArray();

    // Map from port ID to HdmiPortInfo.
    private SparseArray<HdmiPortInfo> mPortInfoMap = new SparseArray<>();
    private final SparseArray<HdmiPortInfo> mPortInfoMap = new SparseArray<>();

    private HdmiCecMessageValidator mMessageValidator;

@@ -1414,8 +1414,8 @@ public final class HdmiControlService extends SystemService {
                Slog.v(TAG, "On standby-action cleared:" + device.mDeviceType);
                devices.remove(device);
                if (devices.isEmpty()) {
                    clearLocalDevices();
                    onStandbyCompleted();
                    clearLocalDevices();
                }
            }
        });