Skip to content

Commit

Permalink
Bug 1417 - Android: Context.MODE_WORLD_READABLE causes SecurityExcept…
Browse files Browse the repository at this point in the history
…ion on API >= 24, use Context.MODE_PRIVATE for temp cache
  • Loading branch information
sgothel committed Dec 26, 2019
1 parent 6e98be1 commit faa3733
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -145,7 +145,7 @@ private static void initTmpRoot(final Context ctx) throws IOException {
synchronized (System.out) {
// Get the name of the tmpbase directory.
{
final File tmpRoot = ctx.getDir("temp", Context.MODE_WORLD_READABLE);
final File tmpRoot = ctx.getDir("temp", Context.MODE_PRIVATE); // Context.MODE_WORLD_READABLE -> SecurityException API >= 24
tmpBaseDir = new File(new File(tmpRoot, tmpSubDir), tmpDirPrefix);
}
tmpRootPropValue = System.getProperty(tmpRootPropName);
Expand Down
2 changes: 1 addition & 1 deletion src/java/jogamp/common/os/android/AndroidUtilsImpl.java
Expand Up @@ -75,7 +75,7 @@ public static File getTempRoot()
{
final Context ctx = StaticContext.getContext();
if(null != ctx) {
final File tmpRoot = ctx.getDir("temp", Context.MODE_WORLD_READABLE);
final File tmpRoot = ctx.getDir("temp", Context.MODE_PRIVATE); // Context.MODE_WORLD_READABLE -> SecurityException API >= 24
if(null==tmpRoot|| !tmpRoot.isDirectory() || !tmpRoot.canWrite()) {
throw new RuntimeException("Not a writable directory: '"+tmpRoot+"', retrieved Android static context");
}
Expand Down

0 comments on commit faa3733

Please sign in to comment.