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

Commit 99029548 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Temporarily enable ANR debug log to track down b/113252928

Bug: 113252928
Test: Manual tested with the debug code enabled w/ debug.trigger.watchdog
Change-Id: I15bbf01f0a239d04be465a097cfec02b2c0414b9
parent 0886e909
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -17,34 +17,33 @@
package com.android.server;

import android.app.IActivityController;
import android.os.Binder;
import android.os.Build;
import android.os.RemoteException;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructRlimit;
import com.android.internal.os.ZygoteConnectionConstants;
import com.android.server.am.ActivityManagerService;

import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hidl.manager.V1_0.IServiceManager;
import android.os.Binder;
import android.os.Build;
import android.os.Debug;
import android.os.Handler;
import android.os.IPowerManager;
import android.os.Looper;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructRlimit;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;

import com.android.internal.os.ZygoteConnectionConstants;
import com.android.server.am.ActivityManagerService;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -62,6 +61,8 @@ import java.util.List;
public class Watchdog extends Thread {
    static final String TAG = "Watchdog";

    private static final boolean DEBUG = true; // STOPSHIP disable it (b/113252928)

    // Set this to true to use debug default values.
    static final boolean DB = false;

@@ -478,6 +479,7 @@ public class Watchdog extends Thread {
                        continue;
                    } else if (waitState == WAITED_HALF) {
                        if (!waitedHalf) {
                            if (DEBUG) Slog.d(TAG, "WAITED_HALF");
                            // We've waited half the deadlock-detection interval.  Pull a stack
                            // trace and wait another half.
                            ArrayList<Integer> pids = new ArrayList<Integer>();
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class ActivityManagerDebugConfig {

    // Available log categories in the activity manager package.
    static final boolean DEBUG_ADD_REMOVE = DEBUG_ALL_ACTIVITIES || false;
    static final boolean DEBUG_ANR = false;
    static final boolean DEBUG_ANR = true;  // STOPSHIP disable it (b/113252928)
    static final boolean DEBUG_APP = DEBUG_ALL_ACTIVITIES || false;
    static final boolean DEBUG_BACKGROUND_CHECK = DEBUG_ALL || false;
    static final boolean DEBUG_BACKUP = DEBUG_ALL || false;
+19 −0
Original line number Diff line number Diff line
@@ -1618,6 +1618,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                break;
            }
            case DISPATCH_UIDS_CHANGED_UI_MSG: {
                if (false) { // DO NOT SUBMIT WITH TRUE
                    maybeTriggerWatchdog();
                }
                dispatchUidsChanged();
            } break;
            case DISPATCH_OOM_ADJ_OBSERVER_MSG: {
@@ -21551,4 +21554,20 @@ public class ActivityManagerService extends IActivityManager.Stub
            return superImpl.apply(permName, uid);
        }
    }
    /**
     * If debug.trigger.watchdog is set to 1, sleep 10 minutes with the AM lock held, which would
     * cause a watchdog kill.
     */
    void maybeTriggerWatchdog() {
        if (SystemProperties.getInt("debug.trigger.watchdog", 0) == 1) {
            Slog.w(TAG, "TRIGGERING WATCHDOG");
            synchronized (ActivityManagerService.this) {
                try {
                    Thread.sleep(600 * 1000);
                } catch (InterruptedException e) {
                }
            }
        }
    }
}