From faa37334e2912e02cb58e738570a127cc6402b37 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 26 Dec 2019 04:19:36 +0100 Subject: Bug 1417 - Android: Context.MODE_WORLD_READABLE causes SecurityException on API >= 24, use Context.MODE_PRIVATE for temp cache --- src/java/jogamp/android/launcher/LauncherTempFileCache.java | 2 +- src/java/jogamp/common/os/android/AndroidUtilsImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/java/jogamp') diff --git a/src/java/jogamp/android/launcher/LauncherTempFileCache.java b/src/java/jogamp/android/launcher/LauncherTempFileCache.java index 6836dd9..7860bba 100644 --- a/src/java/jogamp/android/launcher/LauncherTempFileCache.java +++ b/src/java/jogamp/android/launcher/LauncherTempFileCache.java @@ -145,7 +145,7 @@ public class LauncherTempFileCache { 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); diff --git a/src/java/jogamp/common/os/android/AndroidUtilsImpl.java b/src/java/jogamp/common/os/android/AndroidUtilsImpl.java index 8dcdd6f..14c627d 100644 --- a/src/java/jogamp/common/os/android/AndroidUtilsImpl.java +++ b/src/java/jogamp/common/os/android/AndroidUtilsImpl.java @@ -75,7 +75,7 @@ public class AndroidUtilsImpl { { 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"); } -- cgit v1.2.3