From b50f51e604d11afcf287c9980f8b087290a80124 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 27 Feb 2019 13:55:38 -0700 Subject: [PATCH] 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 --- core/java/android/app/ActivityThread.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 92302c501cafd..b18c4de93b403 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -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); }