Commit 94fd177e authored by Torne (Richard Coles)'s avatar Torne (Richard Coles) Committed by Commit Bot

Reland "android: create cache dir if needed."

Remove the accidentally committed assert that caused test failures and
reland:

> When using a subdirectory of the Android cache dir (e.g. in WebView),
> explicitly create the directory in PathUtils instead of relying on any
> user of the directory creating it implicitly.

> Set the directory mode to 02700 which is what it currently gets set to
> when created implicitly.

This reverts commit fbdad03f.

Fixed: 963640
Fixed: 1132987
Change-Id: Ic94acaa1fd4dacb55839086699cc2974496e6bce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438469Reviewed-by: default avatarShimi Zhang <ctzsm@chromium.org>
Commit-Queue: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811785}
parent 517bbd8a
...@@ -108,8 +108,11 @@ public abstract class PathUtils { ...@@ -108,8 +108,11 @@ public abstract class PathUtils {
if (sCacheSubDirectory == null) { if (sCacheSubDirectory == null) {
paths[CACHE_DIRECTORY] = appContext.getCacheDir().getPath(); paths[CACHE_DIRECTORY] = appContext.getCacheDir().getPath();
} else { } else {
paths[CACHE_DIRECTORY] = File cacheDir = new File(appContext.getCacheDir(), sCacheSubDirectory);
new File(appContext.getCacheDir(), sCacheSubDirectory).getPath(); cacheDir.mkdir();
paths[CACHE_DIRECTORY] = cacheDir.getPath();
// Set to rwx--S--- as the Android cache dir has a distinct gid and is setgid.
chmod(paths[CACHE_DIRECTORY], 02700);
} }
} }
return paths; return paths;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment