Loading services/core/java/com/android/server/ExtconUEventObserver.java +7 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,13 @@ public abstract class ExtconUEventObserver extends UEventObserver { } } /** Does the {@link /sys/class/extcon} directory exist */ /** Does the {@code /sys/class/extcon/<name>} directory exist */ public static boolean namedExtconDirExists(String name) { File extconDir = new File("/sys/class/extcon/" + name); return extconDir.exists() && extconDir.isDirectory(); } /** Does the {@code /sys/class/extcon} directory exist */ public static boolean extconExists() { File extconDir = new File("/sys/class/extcon"); return extconDir.exists() && extconDir.isDirectory(); Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -3556,11 +3556,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } } } else if (ExtconUEventObserver.extconExists()) { } else if (ExtconUEventObserver.extconExists() && ExtconUEventObserver.namedExtconDirExists(HdmiVideoExtconUEventObserver.NAME)) { HdmiVideoExtconUEventObserver observer = new HdmiVideoExtconUEventObserver(); plugged = observer.init(); mHDMIObserver = observer; } else if (localLOGV) { Slog.v(TAG, "Not observing HDMI plug state because HDMI was not found."); } // This dance forces the code in setHdmiPlugged to run. // Always do this so the sticky intent is stuck (to false) if there is no hdmi. mDefaultDisplayPolicy.setHdmiPlugged(plugged, true /* force */); Loading Loading @@ -5616,7 +5620,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private class HdmiVideoExtconUEventObserver extends ExtconStateObserver<Boolean> { private static final String HDMI_EXIST = "HDMI=1"; private final ExtconInfo mHdmi = new ExtconInfo("hdmi"); private static final String NAME = "hdmi"; private final ExtconInfo mHdmi = new ExtconInfo(NAME); private boolean init() { boolean plugged = false; Loading Loading
services/core/java/com/android/server/ExtconUEventObserver.java +7 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,13 @@ public abstract class ExtconUEventObserver extends UEventObserver { } } /** Does the {@link /sys/class/extcon} directory exist */ /** Does the {@code /sys/class/extcon/<name>} directory exist */ public static boolean namedExtconDirExists(String name) { File extconDir = new File("/sys/class/extcon/" + name); return extconDir.exists() && extconDir.isDirectory(); } /** Does the {@code /sys/class/extcon} directory exist */ public static boolean extconExists() { File extconDir = new File("/sys/class/extcon"); return extconDir.exists() && extconDir.isDirectory(); Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -3556,11 +3556,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } } } else if (ExtconUEventObserver.extconExists()) { } else if (ExtconUEventObserver.extconExists() && ExtconUEventObserver.namedExtconDirExists(HdmiVideoExtconUEventObserver.NAME)) { HdmiVideoExtconUEventObserver observer = new HdmiVideoExtconUEventObserver(); plugged = observer.init(); mHDMIObserver = observer; } else if (localLOGV) { Slog.v(TAG, "Not observing HDMI plug state because HDMI was not found."); } // This dance forces the code in setHdmiPlugged to run. // Always do this so the sticky intent is stuck (to false) if there is no hdmi. mDefaultDisplayPolicy.setHdmiPlugged(plugged, true /* force */); Loading Loading @@ -5616,7 +5620,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private class HdmiVideoExtconUEventObserver extends ExtconStateObserver<Boolean> { private static final String HDMI_EXIST = "HDMI=1"; private final ExtconInfo mHdmi = new ExtconInfo("hdmi"); private static final String NAME = "hdmi"; private final ExtconInfo mHdmi = new ExtconInfo(NAME); private boolean init() { boolean plugged = false; Loading