Update OMS patches
[GitHub/Stricted/android_vendor_extra.git] / patches / frameworks / base / 0051-OMS-StrictMode-and-files-under-data-system-theme.patch
1 From 744d0ea3ce3115ed6f1ae32bcb98511cdd41cf74 Mon Sep 17 00:00:00 2001
2 From: mickybart <mickybart@pygoscelis.org>
3 Date: Sat, 19 Nov 2016 19:05:05 -0500
4 Subject: [PATCH 51/52] OMS: StrictMode and files under /data/system/theme/
5
6 Themes are using /data/system/theme/ to push some files like LowBattery.ogg (audio notification)
7 When the device battery trigger the low battery state, the sound is not played due
8 to StrictMode and SystemUI is crashing.
9
10 So we need that StrictMode authorize files under /system OR /data/system/theme
11
12 Logcat of the issue:
13
14 E AndroidRuntime: Caused by: android.os.FileUriExposedException: file:///data/system/theme/audio/ui/LowBattery.ogg exposed beyond app through Notification.sound
15 E AndroidRuntime: at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
16 E AndroidRuntime: at android.net.Uri.checkFileUriExposed(Uri.java:2346)
17 E AndroidRuntime: at android.app.NotificationManager.notifyAsUser(NotificationManager.java:300)
18
19 Change-Id: I154dc4280de8eaf891772a9632283e9f547f5718
20 (cherry picked from commit 838f6466d39a100f9709ac253a6d7358ca66829f)
21 ---
22 core/java/android/net/Uri.java | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25 diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
26 index 09af05c0dfb..3fd40428efb 100644
27 --- a/core/java/android/net/Uri.java
28 +++ b/core/java/android/net/Uri.java
29 @@ -2342,7 +2342,8 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
30 * @hide
31 */
32 public void checkFileUriExposed(String location) {
33 - if ("file".equals(getScheme()) && !getPath().startsWith("/system/")) {
34 + if ("file".equals(getScheme()) && !(getPath().startsWith("/system/")
35 + || getPath().startsWith("/data/system/theme/"))) {
36 StrictMode.onFileUriExposed(this, location);
37 }
38 }
39 --
40 2.11.1
41