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

Commit 7b5f4369 authored by Nick Chalko's avatar Nick Chalko
Browse files

Check if the extcon dir exists when constructing WiredAccessoryExtconObserver

Bug: 124364409
Change-Id: I2ec4aa05314881f4e045aa0be3afae7f6ce239e7
Test: m -j services.core
parent c20de154
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@ public abstract class ExtconUEventObserver extends UEventObserver {

        /** Returns a new list of all external connections whose name matches {@code regex}. */
        public static List<ExtconInfo> getExtconInfos(@Nullable String regex) {
            if (!extconExists()) {
                return new ArrayList<>(0);  // Always return a new list.
            }
            Pattern p = regex == null ? null : Pattern.compile(regex);
            File file = new File("/sys/class/extcon");
            File[] files = file.listFiles();