From 46ed6f4bd6d28a1319a90eb7c58dca5c20b36670 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Mon, 15 Feb 2016 14:16:08 -0700 Subject: [PATCH] Explicitly chmod() for compatibility. Apps typically have a umask() that prevents the mkdir() from setting the requested permissions. Bug: 27116987 Change-Id: Ia14e7e31531328ab36e902a864b3d2891feec544 --- core/java/android/app/ContextImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 282707152e6ac..7f86600338534 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -492,6 +492,7 @@ class ContextImpl extends Context { if (!file.exists()) { try { Os.mkdir(file.getAbsolutePath(), 0771); + Os.chmod(file.getAbsolutePath(), 0771); } catch (ErrnoException e) { if (e.errno == OsConstants.EEXIST) { // We must have raced with someone; that's okay