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

Commit b50f51e6 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Translate SecurityException into EACCES.

Gives more consistent experience for code expecting errno values.

Bug: 122092631
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: I74f27ae33adca69a563d9d8cfc4cf9bb186e1750
parent ab864c6d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6954,6 +6954,8 @@ public final class ActivityThread extends ClientTransactionHandler {
                fd.setInt$(cr.openFileDescriptor(uri,
                        FileUtils.translateModePosixToString(mode)).detachFd());
                return fd;
            } catch (SecurityException e) {
                throw new ErrnoException(e.getMessage(), OsConstants.EACCES);
            } catch (FileNotFoundException e) {
                throw new ErrnoException(e.getMessage(), OsConstants.ENOENT);
            }