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

Commit 6b902abf authored by Nick Chalko's avatar Nick Chalko Committed by Android (Google) Code Review
Browse files

Merge "Check if the extcon dir exists when constructing WiredAccessoryExtconObserver"

parents 6877b1cc 7b5f4369
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();