am 75e181dd: Merge "Lock when obtaining the current monitor name." into jb-mr2-dev
* commit '75e181ddfec2166026a0ce553eca2a339e21b968': Lock when obtaining the current monitor name.
This commit is contained in:
@@ -88,7 +88,6 @@ public class Watchdog extends Thread {
|
|||||||
AlarmManagerService mAlarm;
|
AlarmManagerService mAlarm;
|
||||||
ActivityManagerService mActivity;
|
ActivityManagerService mActivity;
|
||||||
boolean mCompleted;
|
boolean mCompleted;
|
||||||
boolean mForceKillSystem;
|
|
||||||
Monitor mCurrentMonitor;
|
Monitor mCurrentMonitor;
|
||||||
|
|
||||||
int mPhonePid;
|
int mPhonePid;
|
||||||
@@ -135,7 +134,9 @@ public class Watchdog extends Thread {
|
|||||||
|
|
||||||
final int size = mMonitors.size();
|
final int size = mMonitors.size();
|
||||||
for (int i = 0 ; i < size ; i++) {
|
for (int i = 0 ; i < size ; i++) {
|
||||||
mCurrentMonitor = mMonitors.get(i);
|
synchronized (Watchdog.this) {
|
||||||
|
mCurrentMonitor = mMonitors.get(i);
|
||||||
|
}
|
||||||
mCurrentMonitor.monitor();
|
mCurrentMonitor.monitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +389,8 @@ public class Watchdog extends Thread {
|
|||||||
mCompleted = false;
|
mCompleted = false;
|
||||||
mHandler.sendEmptyMessage(MONITOR);
|
mHandler.sendEmptyMessage(MONITOR);
|
||||||
|
|
||||||
|
|
||||||
|
final String name;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
long timeout = TIME_TO_WAIT;
|
long timeout = TIME_TO_WAIT;
|
||||||
|
|
||||||
@@ -396,16 +399,16 @@ public class Watchdog extends Thread {
|
|||||||
// to timeout on is asleep as well and won't have a chance to run, causing a false
|
// to timeout on is asleep as well and won't have a chance to run, causing a false
|
||||||
// positive on when to kill things.
|
// positive on when to kill things.
|
||||||
long start = SystemClock.uptimeMillis();
|
long start = SystemClock.uptimeMillis();
|
||||||
while (timeout > 0 && !mForceKillSystem) {
|
while (timeout > 0) {
|
||||||
try {
|
try {
|
||||||
wait(timeout); // notifyAll() is called when mForceKillSystem is set
|
wait(timeout);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.wtf(TAG, e);
|
Log.wtf(TAG, e);
|
||||||
}
|
}
|
||||||
timeout = TIME_TO_WAIT - (SystemClock.uptimeMillis() - start);
|
timeout = TIME_TO_WAIT - (SystemClock.uptimeMillis() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCompleted && !mForceKillSystem) {
|
if (mCompleted) {
|
||||||
// The monitors have returned.
|
// The monitors have returned.
|
||||||
waitedHalf = false;
|
waitedHalf = false;
|
||||||
continue;
|
continue;
|
||||||
@@ -421,14 +424,14 @@ public class Watchdog extends Thread {
|
|||||||
waitedHalf = true;
|
waitedHalf = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name = (mCurrentMonitor != null) ?
|
||||||
|
mCurrentMonitor.getClass().getName() : "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we got here, that means that the system is most likely hung.
|
// If we got here, that means that the system is most likely hung.
|
||||||
// First collect stack traces from all threads of the system process.
|
// First collect stack traces from all threads of the system process.
|
||||||
// Then kill this process so that the system will restart.
|
// Then kill this process so that the system will restart.
|
||||||
|
|
||||||
final String name = (mCurrentMonitor != null) ?
|
|
||||||
mCurrentMonitor.getClass().getName() : "null";
|
|
||||||
EventLog.writeEvent(EventLogTags.WATCHDOG, name);
|
EventLog.writeEvent(EventLogTags.WATCHDOG, name);
|
||||||
|
|
||||||
ArrayList<Integer> pids = new ArrayList<Integer>();
|
ArrayList<Integer> pids = new ArrayList<Integer>();
|
||||||
|
|||||||
Reference in New Issue
Block a user