File paths to system partition are okay-ish.
Unless SELinux blocks it, all apps have identical access to files
included on the system partition. Since there are a handful of
useful files stored there, like ringtones and license files, carve
out an exception to allow file:///system/ style paths.
Note that StrictMode isn't a security mechanism, which is why we're
not concerned about resolving canonical paths.
Bug: 26895798
Change-Id: If0b659d30c4e51377edcf01445392759d1e4962e
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
index 53b027b..67378bd 100644
--- a/core/java/android/net/Uri.java
+++ b/core/java/android/net/Uri.java
@@ -2342,7 +2342,7 @@
* @hide
*/
public void checkFileUriExposed(String location) {
- if ("file".equals(getScheme())) {
+ if ("file".equals(getScheme()) && !getPath().startsWith("/system/")) {
StrictMode.onFileUriExposed(this, location);
}
}