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

Commit 5b0c30fa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Catch IO Exception in UsbDevicesParser and don't add failed devices."

parents aa4295d7 50f8bbb9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ public class AlsaDevicesParser {
        return line.charAt(kIndex_CardDeviceField) == '[';
    }

    public void scan() {
    public boolean scan() {
        mDeviceRecords.clear();

        File devicesFile = new File(kDevicesFilePath);
@@ -274,11 +274,13 @@ public class AlsaDevicesParser {
                }
            }
            reader.close();
            return true;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }

    //
+5 −1
Original line number Diff line number Diff line
@@ -314,7 +314,11 @@ public final class UsbAlsaManager {
            return null;
        }

        mDevicesParser.scan();
        if (!mDevicesParser.scan()) {
            Slog.e(TAG, "Error parsing ALSA devices file.");
            return null;
        }

        int device = mDevicesParser.getDefaultDeviceNum(card);

        boolean hasPlayback = mDevicesParser.hasPlaybackDevices(card);