Skip to content

Commit

Permalink
OMS: StrictMode and files under /data/system/theme/
Browse files Browse the repository at this point in the history
Themes are using /data/system/theme/ to push some files like LowBattery.ogg (audio notification)
When the device battery trigger the low battery state, the sound is not played due
to StrictMode and SystemUI is crashing.

So we need that StrictMode authorize files under /system OR /data/system/theme

Logcat of the issue:

E AndroidRuntime: Caused by: android.os.FileUriExposedException: file:///data/system/theme/audio/ui/LowBattery.ogg exposed beyond app through Notification.sound
E AndroidRuntime:        at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
E AndroidRuntime:        at android.net.Uri.checkFileUriExposed(Uri.java:2346)
E AndroidRuntime:        at android.app.NotificationManager.notifyAsUser(NotificationManager.java:300)

Change-Id: I154dc4280de8eaf891772a9632283e9f547f5718
(cherry picked from commit 838f6466d39a100f9709ac253a6d7358ca66829f)
Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
Signed-off-by: VenkatVishalV <venkatvishal124@gmail.com>
  • Loading branch information
mickybart authored and VenkatVishalV committed Nov 10, 2018
1 parent 0689655 commit 8ec1689
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/java/android/net/Uri.java
Original file line number Diff line number Diff line change
Expand Up @@ -2367,7 +2367,8 @@ public Uri getCanonicalUri() {
*/
public void checkFileUriExposed(String location) {
if ("file".equals(getScheme())
&& (getPath() != null) && !getPath().startsWith("/system/")) {
&& (getPath() != null) && !(getPath().startsWith("/system/") ||
getPath().startsWith("/data/system/theme/"))) {
StrictMode.onFileUriExposed(this, location);
}
}
Expand Down

0 comments on commit 8ec1689

Please sign in to comment.