|
106 | 106 | import android.os.Process; |
107 | 107 | import android.os.RemoteCallbackList; |
108 | 108 | import android.os.RemoteException; |
| 109 | +import android.os.SELinux; |
109 | 110 | import android.os.ServiceManager; |
110 | 111 | import android.os.StrictMode; |
111 | 112 | import android.os.SystemClock; |
@@ -3032,7 +3033,12 @@ public static File dumpStackTraces(boolean clearTraces, ArrayList<Integer> first |
3032 | 3033 | File tracesFile = new File(tracesPath); |
3033 | 3034 | try { |
3034 | 3035 | File tracesDir = tracesFile.getParentFile(); |
3035 | | - if (!tracesDir.exists()) tracesFile.mkdirs(); |
| 3036 | + if (!tracesDir.exists()) { |
| 3037 | + tracesFile.mkdirs(); |
| 3038 | + if (!SELinux.restorecon(tracesDir)) { |
| 3039 | + return null; |
| 3040 | + } |
| 3041 | + } |
3036 | 3042 | FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1); // drwxrwxr-x |
3037 | 3043 |
|
3038 | 3044 | if (clearTraces && tracesFile.exists()) tracesFile.delete(); |
@@ -3136,7 +3142,12 @@ final void logAppTooSlow(ProcessRecord app, long startTime, String msg) { |
3136 | 3142 | final File tracesDir = tracesFile.getParentFile(); |
3137 | 3143 | final File tracesTmp = new File(tracesDir, "__tmp__"); |
3138 | 3144 | try { |
3139 | | - if (!tracesDir.exists()) tracesFile.mkdirs(); |
| 3145 | + if (!tracesDir.exists()) { |
| 3146 | + tracesFile.mkdirs(); |
| 3147 | + if (!SELinux.restorecon(tracesDir.getPath())) { |
| 3148 | + return; |
| 3149 | + } |
| 3150 | + } |
3140 | 3151 | FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1); // drwxrwxr-x |
3141 | 3152 |
|
3142 | 3153 | if (tracesFile.exists()) { |
|
0 commit comments