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

Commit 988b38bc authored by Elliott Hughes's avatar Elliott Hughes Committed by Android Git Automerger
Browse files

am 5b7dccc4: am 90e2301e: am d2a11d97: Merge "Add explicit close of Scanner input"

* commit '5b7dccc4':
  Add explicit close of Scanner input
parents dec50073 5b7dccc4
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -590,14 +590,19 @@ public class UsbDeviceManager {
                intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                intent.putExtra("state", (enabled ? 1 : 0));
                intent.putExtra("state", (enabled ? 1 : 0));
                if (enabled) {
                if (enabled) {
                    Scanner scanner = null;
                    try {
                    try {
                        Scanner scanner = new Scanner(new File(AUDIO_SOURCE_PCM_PATH));
                        scanner = new Scanner(new File(AUDIO_SOURCE_PCM_PATH));
                        int card = scanner.nextInt();
                        int card = scanner.nextInt();
                        int device = scanner.nextInt();
                        int device = scanner.nextInt();
                        intent.putExtra("card", card);
                        intent.putExtra("card", card);
                        intent.putExtra("device", device);
                        intent.putExtra("device", device);
                    } catch (FileNotFoundException e) {
                    } catch (FileNotFoundException e) {
                        Slog.e(TAG, "could not open audio source PCM file", e);
                        Slog.e(TAG, "could not open audio source PCM file", e);
                    } finally {
                        if (scanner != null) {
                            scanner.close();
                        }
                    }
                    }
                }
                }
                mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
                mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);