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

Commit 097f6504 authored by Aleksej Makarov's avatar Aleksej Makarov Committed by Hongguang Chen
Browse files

HdmiVideoExtconUEventObserver: handle "DP=1" state



HdmiVideoExtconUEventObserver handles only "HDMI=1" external
connection state while kernel generates uevent with "DP=1" state
when external hdmi display is connected via USB-C-to-HDMI converter.
This results in wrong DisplayPolicy.mHdmiPlugged value when
hdmi display is connected, so we need to handle "DP=1" state as well.

Bug: 288003290
Test: take bugreport while external hdmi display is connected
and grep for "mHdmiPlugged=true"
Signed-off-by: default avatarAleksej Makarov <aleksej.makarov@sony.com>
Change-Id: I410122aad09a5414a736cac51647e75fcfa61055
parent ee4446c0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -6070,6 +6070,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private class HdmiVideoExtconUEventObserver extends ExtconStateObserver<Boolean> {
        private static final String HDMI_EXIST = "HDMI=1";
        private static final String DP_EXIST = "DP=1";
        private static final String NAME = "hdmi";

        private boolean init(ExtconInfo hdmi) {
@@ -6100,7 +6101,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        public Boolean parseState(ExtconInfo extconIfno, String state) {
            // extcon event state changes from kernel4.9
            // new state will be like STATE=HDMI=1
            return state.contains(HDMI_EXIST);
            // or like STATE=DP=1 for newer kernel
            return state.contains(HDMI_EXIST) || state.contains(DP_EXIST);
        }
    }