Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60d0043d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "frameworks/base: creating sperate files for ANRs traces"

parents 43f0ac39 573f6394
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -260,6 +260,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.Date;
import java.text.SimpleDateFormat;
public final class ActivityManagerService extends ActivityManagerNative
        implements Watchdog.Monitor, BatteryStatsImpl.BatteryCallback {
@@ -481,6 +483,8 @@ public final class ActivityManagerService extends ActivityManagerNative
     */
    String mDeviceOwnerName;
    SimpleDateFormat mTraceDateFormat = new SimpleDateFormat("dd_MMM_HH_mm_ss.SSS");
    public class PendingAssistExtras extends Binder implements Runnable {
        public final ActivityRecord activity;
        public final Bundle extras;
@@ -5071,6 +5075,24 @@ public final class ActivityManagerService extends ActivityManagerNative
                    annotation != null ? "ANR " + annotation : "ANR",
                    info.toString());
            //Set the trace file name to app name + current date format to avoid overrinding trace file
            String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
            if (tracesPath != null && tracesPath.length() != 0) {
                File traceRenameFile = new File(tracesPath);
                String newTracesPath;
                int lpos = tracesPath.lastIndexOf (".");
                if (-1 != lpos)
                    newTracesPath = tracesPath.substring (0, lpos) + "_" + app.processName + "_" + mTraceDateFormat.format(new Date()) + tracesPath.substring (lpos);
                else
                    newTracesPath = tracesPath + "_" + app.processName;
                traceRenameFile.renameTo(new File(newTracesPath));
                Process.sendSignal(app.pid, 6);
                SystemClock.sleep(1000);
                Process.sendSignal(app.pid, 6);
                SystemClock.sleep(1000);
            }
            // Bring up the infamous App Not Responding dialog
            Message msg = Message.obtain();
            HashMap<String, Object> map = new HashMap<String, Object>();