|
105 | 105 | import android.os.Process; |
106 | 106 | import android.os.RemoteCallbackList; |
107 | 107 | import android.os.RemoteException; |
| 108 | +import android.os.SELinux; |
108 | 109 | import android.os.ServiceManager; |
109 | 110 | import android.os.StrictMode; |
110 | 111 | import android.os.SystemClock; |
@@ -3040,7 +3041,12 @@ public static File dumpStackTraces(boolean clearTraces, ArrayList<Integer> first |
3040 | 3041 | File tracesFile = new File(tracesPath); |
3041 | 3042 | try { |
3042 | 3043 | File tracesDir = tracesFile.getParentFile(); |
3043 | | - if (!tracesDir.exists()) tracesFile.mkdirs(); |
| 3044 | + if (!tracesDir.exists()) { |
| 3045 | + tracesFile.mkdirs(); |
| 3046 | + if (!SELinux.restorecon(tracesDir)) { |
| 3047 | + return null; |
| 3048 | + } |
| 3049 | + } |
3044 | 3050 | FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1); // drwxrwxr-x |
3045 | 3051 |
|
3046 | 3052 | if (clearTraces && tracesFile.exists()) tracesFile.delete(); |
@@ -3144,7 +3150,12 @@ final void logAppTooSlow(ProcessRecord app, long startTime, String msg) { |
3144 | 3150 | final File tracesDir = tracesFile.getParentFile(); |
3145 | 3151 | final File tracesTmp = new File(tracesDir, "__tmp__"); |
3146 | 3152 | try { |
3147 | | - if (!tracesDir.exists()) tracesFile.mkdirs(); |
| 3153 | + if (!tracesDir.exists()) { |
| 3154 | + tracesFile.mkdirs(); |
| 3155 | + if (!SELinux.restorecon(tracesDir.getPath())) { |
| 3156 | + return; |
| 3157 | + } |
| 3158 | + } |
3148 | 3159 | FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1); // drwxrwxr-x |
3149 | 3160 |
|
3150 | 3161 | if (tracesFile.exists()) { |
|
0 commit comments