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

Commit 270dc7d7 authored by Sandeep Bandaru's avatar Sandeep Bandaru Committed by Android (Google) Code Review
Browse files

Merge "Add support to read from directories other the files dir" into main

parents 02b5090f c4eb87d5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -451,12 +451,16 @@ public abstract class OnDeviceIntelligenceService extends Service {
            Slog.v(TAG,
                    "onGetReadOnlyFileDescriptor: " + fileName + " under internal app storage.");
            File f = new File(getBaseContext().getFilesDir(), fileName);
            if (!f.exists()) {
                f = new File(fileName);
            }
            ParcelFileDescriptor pfd = null;
            try {
                pfd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
                Slog.d(TAG, "Successfully opened a file with ParcelFileDescriptor.");
            } catch (FileNotFoundException e) {
                Slog.e(TAG, "Cannot open file. No ParcelFileDescriptor returned.");
                future.completeExceptionally(e);
            } finally {
                future.complete(pfd);
                if (pfd != null) {