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: Aleksej Makarov <aleksej.makarov@sony.com>
Change-Id: I410122aad09a5414a736cac51647e75fcfa61055
This commit is contained in:
Aleksej Makarov
2023-06-09 11:54:22 +02:00
committed by Hongguang Chen
parent ee4446c09e
commit 097f6504d5

View File

@@ -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);
}
}