blob: ec573f947a5055ab2ea29c12162115f5a88223a7 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server;
18
Dianne Hackborn5b88a2f2013-05-03 16:25:11 -070019import android.app.IActivityController;
20import android.os.Binder;
21import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import com.android.server.am.ActivityManagerService;
Jeff Brown4f8ecd82012-06-18 18:29:13 -070023import com.android.server.power.PowerManagerService;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024
25import android.app.AlarmManager;
26import android.app.PendingIntent;
27import android.content.BroadcastReceiver;
28import android.content.ContentResolver;
29import android.content.Context;
30import android.content.Intent;
31import android.content.IntentFilter;
Jeff Browna4d82042012-10-02 19:11:19 -070032import android.os.BatteryManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.os.Debug;
34import android.os.Handler;
John Michelau11641522013-03-18 18:28:23 -050035import android.os.Looper;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.os.Process;
Suchi Amalapurapu6ffce2e2010-03-08 14:48:40 -080037import android.os.ServiceManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.os.SystemClock;
39import android.os.SystemProperties;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.util.EventLog;
Dan Egnor9bdc94b2010-03-04 14:20:31 -080041import android.util.Log;
Joe Onorato8a9b2202010-02-26 18:56:32 -080042import android.util.Slog;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043
Dan Egnor9bdc94b2010-03-04 14:20:31 -080044import java.io.File;
Colin Cross5df1d872012-11-29 11:42:11 -080045import java.io.FileWriter;
46import java.io.IOException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.Calendar;
49
50/** This class calls its monitor every minute. Killing this process if they don't return **/
51public class Watchdog extends Thread {
52 static final String TAG = "Watchdog";
Joe Onorato43a17652011-04-06 19:22:23 -070053 static final boolean localLOGV = false || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
55 // Set this to true to use debug default values.
56 static final boolean DB = false;
57
Christopher Tateecaa7b42010-06-04 14:55:02 -070058 // Set this to true to have the watchdog record kernel thread stacks when it fires
59 static final boolean RECORD_KERNEL_THREADS = true;
60
Dianne Hackbornf6438b12013-05-09 18:53:48 -070061 static final int TIME_TO_WAIT = DB ? 5*1000 : 30*1000;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062
Dianne Hackbornf72467a2012-06-08 17:23:59 -070063 static final String[] NATIVE_STACKS_OF_INTEREST = new String[] {
64 "/system/bin/mediaserver",
65 "/system/bin/sdcard",
66 "/system/bin/surfaceflinger"
67 };
68
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 static Watchdog sWatchdog;
70
71 /* This handler will be used to post message back onto the main thread */
Dianne Hackborn8d044e82013-04-30 17:24:15 -070072 final ArrayList<HandlerChecker> mHandlerCheckers = new ArrayList<HandlerChecker>();
73 final HandlerChecker mMonitorChecker;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 ContentResolver mResolver;
75 BatteryService mBattery;
76 PowerManagerService mPower;
77 AlarmManagerService mAlarm;
78 ActivityManagerService mActivity;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 int mPhonePid;
Dianne Hackborn5b88a2f2013-05-03 16:25:11 -070081 IActivityController mController;
Dianne Hackborn8bd64df2013-05-06 16:07:26 -070082 boolean mAllowRestart = true;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 /**
Dianne Hackborn8d044e82013-04-30 17:24:15 -070085 * Used for checking status of handle threads and scheduling monitor callbacks.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 */
Dianne Hackborn8d044e82013-04-30 17:24:15 -070087 public final class HandlerChecker implements Runnable {
88 private final Handler mHandler;
89 private final String mName;
90 private final ArrayList<Monitor> mMonitors = new ArrayList<Monitor>();
Dianne Hackborn8d044e82013-04-30 17:24:15 -070091 private boolean mCompleted;
92 private Monitor mCurrentMonitor;
93
Dianne Hackbornf6438b12013-05-09 18:53:48 -070094 HandlerChecker(Handler handler, String name) {
Dianne Hackborn8d044e82013-04-30 17:24:15 -070095 mHandler = handler;
96 mName = name;
Dianne Hackborn8d044e82013-04-30 17:24:15 -070097 }
98
99 public void addMonitor(Monitor monitor) {
100 mMonitors.add(monitor);
101 }
102
103 public void scheduleCheckLocked() {
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700104 if (mMonitors.size() == 0 && mHandler.getLooper().isIdling()) {
Dianne Hackbornefa92b22013-05-03 14:11:43 -0700105 // If the target looper is or just recently was idling, then
106 // there is no reason to enqueue our checker on it since that
107 // is as good as it not being deadlocked. This avoid having
108 // to do a context switch to check the thread. Note that we
109 // only do this if mCheckReboot is false and we have no
110 // monitors, since those would need to be executed at this point.
111 mCompleted = true;
112 return;
113 }
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700114 mCompleted = false;
115 mCurrentMonitor = null;
116 mHandler.postAtFrontOfQueue(this);
117 }
118
119 public boolean isCompletedLocked() {
120 return mCompleted;
121 }
122
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700123 public Thread getThread() {
124 return mHandler.getLooper().getThread();
125 }
126
127 public String getName() {
128 return mName;
129 }
130
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700131 public String describeBlockedStateLocked() {
132 return mCurrentMonitor == null ? mName : mCurrentMonitor.getClass().getName();
John Michelau11641522013-03-18 18:28:23 -0500133 }
134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 @Override
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700136 public void run() {
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700137 final int size = mMonitors.size();
138 for (int i = 0 ; i < size ; i++) {
139 synchronized (Watchdog.this) {
140 mCurrentMonitor = mMonitors.get(i);
141 }
142 mCurrentMonitor.monitor();
143 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700145 synchronized (Watchdog.this) {
146 mCompleted = true;
147 mCurrentMonitor = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 }
149 }
150 }
151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 final class RebootRequestReceiver extends BroadcastReceiver {
153 @Override
154 public void onReceive(Context c, Intent intent) {
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700155 if (intent.getIntExtra("nowait", 0) != 0) {
156 rebootSystem("Received ACTION_REBOOT broadcast");
157 return;
158 }
159 Slog.w(TAG, "Unsupported ACTION_REBOOT broadcast: " + intent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160 }
161 }
162
163 public interface Monitor {
164 void monitor();
165 }
166
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 public static Watchdog getInstance() {
168 if (sWatchdog == null) {
169 sWatchdog = new Watchdog();
170 }
171
172 return sWatchdog;
173 }
174
175 private Watchdog() {
176 super("watchdog");
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700177 // Initialize handler checkers for each common thread we want to check. Note
178 // that we are not currently checking the background thread, since it can
179 // potentially hold longer running operations with no guarantees about the timeliness
180 // of operations there.
181
182 // The shared foreground thread is the main checker. It is where we
183 // will also dispatch monitor checks and do other work.
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700184 mMonitorChecker = new HandlerChecker(FgThread.getHandler(), "foreground thread");
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700185 mHandlerCheckers.add(mMonitorChecker);
186 // Add checker for main thread. We only do a quick check since there
187 // can be UI running on the thread.
188 mHandlerCheckers.add(new HandlerChecker(new Handler(Looper.getMainLooper()),
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700189 "main thread"));
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700190 // Add checker for shared UI thread.
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700191 mHandlerCheckers.add(new HandlerChecker(UiThread.getHandler(), "ui thread"));
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700192 // And also check IO thread.
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700193 mHandlerCheckers.add(new HandlerChecker(IoThread.getHandler(), "i/o thread"));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 }
195
196 public void init(Context context, BatteryService battery,
197 PowerManagerService power, AlarmManagerService alarm,
198 ActivityManagerService activity) {
199 mResolver = context.getContentResolver();
200 mBattery = battery;
201 mPower = power;
202 mAlarm = alarm;
203 mActivity = activity;
204
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800205 context.registerReceiver(new RebootRequestReceiver(),
206 new IntentFilter(Intent.ACTION_REBOOT),
207 android.Manifest.permission.REBOOT, null);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 }
209
Christopher Tatec27181c2010-06-30 14:41:09 -0700210 public void processStarted(String name, int pid) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800211 synchronized (this) {
212 if ("com.android.phone".equals(name)) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800213 mPhonePid = pid;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800214 }
215 }
216 }
217
Dianne Hackborn5b88a2f2013-05-03 16:25:11 -0700218 public void setActivityController(IActivityController controller) {
219 synchronized (this) {
220 mController = controller;
221 }
222 }
223
Dianne Hackborn8bd64df2013-05-06 16:07:26 -0700224 public void setAllowRestart(boolean allowRestart) {
225 synchronized (this) {
226 mAllowRestart = allowRestart;
227 }
228 }
229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800230 public void addMonitor(Monitor monitor) {
231 synchronized (this) {
232 if (isAlive()) {
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700233 throw new RuntimeException("Monitors can't be added once the Watchdog is running");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 }
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700235 mMonitorChecker.addMonitor(monitor);
236 }
237 }
238
239 public void addThread(Handler thread, String name) {
240 synchronized (this) {
241 if (isAlive()) {
242 throw new RuntimeException("Threads can't be added once the Watchdog is running");
243 }
Dianne Hackbornf6438b12013-05-09 18:53:48 -0700244 mHandlerCheckers.add(new HandlerChecker(thread, name));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 }
246 }
247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 /**
249 * Perform a full reboot of the system.
250 */
251 void rebootSystem(String reason) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800252 Slog.i(TAG, "Rebooting system because: " + reason);
Suchi Amalapurapu6ffce2e2010-03-08 14:48:40 -0800253 PowerManagerService pms = (PowerManagerService) ServiceManager.getService("power");
Dianne Hackbornc428aae2012-10-03 16:38:22 -0700254 pms.reboot(false, reason, false);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 }
256
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700257 private boolean haveAllCheckersCompletedLocked() {
258 for (int i=0; i<mHandlerCheckers.size(); i++) {
259 HandlerChecker hc = mHandlerCheckers.get(i);
260 if (!hc.isCompletedLocked()) {
261 return false;
262 }
263 }
264 return true;
265 }
266
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700267 private ArrayList<HandlerChecker> getBlockedCheckersLocked() {
268 ArrayList<HandlerChecker> checkers = new ArrayList<HandlerChecker>();
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700269 for (int i=0; i<mHandlerCheckers.size(); i++) {
270 HandlerChecker hc = mHandlerCheckers.get(i);
271 if (!hc.isCompletedLocked()) {
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700272 checkers.add(hc);
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700273 }
274 }
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700275 return checkers;
276 }
277
278 private String describeCheckersLocked(ArrayList<HandlerChecker> checkers) {
279 StringBuilder builder = new StringBuilder(128);
280 for (int i=0; i<checkers.size(); i++) {
281 if (builder.length() > 0) {
282 builder.append(", ");
283 }
284 builder.append(checkers.get(i).describeBlockedStateLocked());
285 }
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700286 return builder.toString();
287 }
288
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 @Override
290 public void run() {
Christopher Tate6ee412d2010-05-28 12:01:56 -0700291 boolean waitedHalf = false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 while (true) {
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700293 final ArrayList<HandlerChecker> blockedCheckers;
Michael Wright8fa56f62013-04-01 16:36:05 -0700294 final String name;
Dianne Hackborn8bd64df2013-05-06 16:07:26 -0700295 final boolean allowRestart;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296 synchronized (this) {
297 long timeout = TIME_TO_WAIT;
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700298 if (!waitedHalf) {
299 // If we are not at the half-point of waiting, perform a
300 // new set of checks. Otherwise we are still waiting for a previous set.
301 for (int i=0; i<mHandlerCheckers.size(); i++) {
302 HandlerChecker hc = mHandlerCheckers.get(i);
303 hc.scheduleCheckLocked();
304 }
305 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306
307 // NOTE: We use uptimeMillis() here because we do not want to increment the time we
308 // wait while asleep. If the device is asleep then the thing that we are waiting
Christopher Tate6ee412d2010-05-28 12:01:56 -0700309 // to timeout on is asleep as well and won't have a chance to run, causing a false
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310 // positive on when to kill things.
311 long start = SystemClock.uptimeMillis();
Michael Wright8fa56f62013-04-01 16:36:05 -0700312 while (timeout > 0) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800313 try {
Michael Wright8fa56f62013-04-01 16:36:05 -0700314 wait(timeout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800315 } catch (InterruptedException e) {
Dan Egnor9bdc94b2010-03-04 14:20:31 -0800316 Log.wtf(TAG, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 }
318 timeout = TIME_TO_WAIT - (SystemClock.uptimeMillis() - start);
Dan Egnor9bdc94b2010-03-04 14:20:31 -0800319 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320
Dianne Hackborn8d044e82013-04-30 17:24:15 -0700321 if (haveAllCheckersCompletedLocked()) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800322 // The monitors have returned.
Christopher Tate6ee412d2010-05-28 12:01:56 -0700323 waitedHalf = false;
324 continue;
325 }
326
327 if (!waitedHalf) {
328 // We've waited half the deadlock-detection interval. Pull a stack
329 // trace and wait another half.
Dianne Hackborn6b1afeb2010-08-31 15:40:21 -0700330 ArrayList<Integer> pids = new ArrayList<Integer>();
Christopher Tate6ee412d2010-05-28 12:01:56 -0700331 pids.add(Process.myPid());
Dianne Hackbornf72467a2012-06-08 17:23:59 -0700332 ActivityManagerService.dumpStackTraces(true, pids, null, null,
333 NATIVE_STACKS_OF_INTEREST);
Christopher Tate6ee412d2010-05-28 12:01:56 -0700334 waitedHalf = true;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 continue;
336 }
Michael Wright8fa56f62013-04-01 16:36:05 -0700337
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700338 blockedCheckers = getBlockedCheckersLocked();
339 name = describeCheckersLocked(blockedCheckers);
Dianne Hackborn8bd64df2013-05-06 16:07:26 -0700340 allowRestart = mAllowRestart;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341 }
342
343 // If we got here, that means that the system is most likely hung.
Jean-Baptiste Queru784827b2012-09-04 13:35:12 -0700344 // First collect stack traces from all threads of the system process.
345 // Then kill this process so that the system will restart.
Doug Zongkerab5c49c2009-12-04 10:31:43 -0800346 EventLog.writeEvent(EventLogTags.WATCHDOG, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347
Dianne Hackborn6b1afeb2010-08-31 15:40:21 -0700348 ArrayList<Integer> pids = new ArrayList<Integer>();
Dan Egnor9bdc94b2010-03-04 14:20:31 -0800349 pids.add(Process.myPid());
Dan Egnor4bded072010-03-11 22:00:47 -0800350 if (mPhonePid > 0) pids.add(mPhonePid);
Christopher Tate6ee412d2010-05-28 12:01:56 -0700351 // Pass !waitedHalf so that just in case we somehow wind up here without having
352 // dumped the halfway stacks, we properly re-initialize the trace file.
Brad Fitzpatrick9765c722011-01-14 11:28:22 -0800353 final File stack = ActivityManagerService.dumpStackTraces(
Dianne Hackbornf72467a2012-06-08 17:23:59 -0700354 !waitedHalf, pids, null, null, NATIVE_STACKS_OF_INTEREST);
Dan Egnor4bded072010-03-11 22:00:47 -0800355
356 // Give some extra time to make sure the stack traces get written.
357 // The system's been hanging for a minute, another second or two won't hurt much.
358 SystemClock.sleep(2000);
359
Christopher Tateecaa7b42010-06-04 14:55:02 -0700360 // Pull our own kernel thread stacks as well if we're configured for that
361 if (RECORD_KERNEL_THREADS) {
362 dumpKernelStackTraces();
363 }
364
Colin Cross5df1d872012-11-29 11:42:11 -0800365 // Trigger the kernel to dump all blocked threads to the kernel log
366 try {
367 FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
368 sysrq_trigger.write("w");
369 sysrq_trigger.close();
370 } catch (IOException e) {
371 Slog.e(TAG, "Failed to write to /proc/sysrq-trigger");
372 Slog.e(TAG, e.getMessage());
373 }
374
Brad Fitzpatrick9765c722011-01-14 11:28:22 -0800375 // Try to add the error to the dropbox, but assuming that the ActivityManager
376 // itself may be deadlocked. (which has happened, causing this statement to
377 // deadlock and the watchdog as a whole to be ineffective)
378 Thread dropboxThread = new Thread("watchdogWriteToDropbox") {
379 public void run() {
380 mActivity.addErrorToDropBox(
Jeff Sharkeya353d262011-10-28 11:12:06 -0700381 "watchdog", null, "system_server", null, null,
382 name, null, stack, null);
Brad Fitzpatrick9765c722011-01-14 11:28:22 -0800383 }
384 };
385 dropboxThread.start();
386 try {
387 dropboxThread.join(2000); // wait up to 2 seconds for it to return.
388 } catch (InterruptedException ignored) {}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389
Dianne Hackborn5b88a2f2013-05-03 16:25:11 -0700390 IActivityController controller;
391 synchronized (this) {
392 controller = mController;
393 }
394 if (controller != null) {
395 Slog.i(TAG, "Reporting stuck state to activity controller");
396 try {
397 Binder.setDumpDisabled("Service dumps disabled due to hung system process.");
398 // 1 = keep waiting, -1 = kill system
399 int res = controller.systemNotResponding(name);
400 if (res >= 0) {
401 Slog.i(TAG, "Activity controller requested to coninue to wait");
402 waitedHalf = false;
403 continue;
404 }
405 } catch (RemoteException e) {
406 }
407 }
408
Jean-Baptiste Queru784827b2012-09-04 13:35:12 -0700409 // Only kill the process if the debugger is not attached.
Dianne Hackborn8bd64df2013-05-06 16:07:26 -0700410 if (Debug.isDebuggerConnected()) {
411 Slog.w(TAG, "Debugger connected: Watchdog is *not* killing the system process");
412 } else if (!allowRestart) {
413 Slog.w(TAG, "Restart not allowed: Watchdog is *not* killing the system process");
414 } else {
Dan Egnor9bdc94b2010-03-04 14:20:31 -0800415 Slog.w(TAG, "*** WATCHDOG KILLING SYSTEM PROCESS: " + name);
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700416 for (int i=0; i<blockedCheckers.size(); i++) {
417 Slog.w(TAG, blockedCheckers.get(i).getName() + " stack trace:");
418 StackTraceElement[] stackTrace
419 = blockedCheckers.get(i).getThread().getStackTrace();
420 for (StackTraceElement element: stackTrace) {
421 Slog.w(TAG, " at " + element);
422 }
Michael Wright56a6c662013-04-30 20:13:07 -0700423 }
Dianne Hackbornfa012b32013-05-10 15:23:28 -0700424 Slog.w(TAG, "*** GOODBYE!");
Jean-Baptiste Queru784827b2012-09-04 13:35:12 -0700425 Process.killProcess(Process.myPid());
426 System.exit(10);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 }
Christopher Tate6ee412d2010-05-28 12:01:56 -0700428
429 waitedHalf = false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 }
431 }
Christopher Tateecaa7b42010-06-04 14:55:02 -0700432
433 private File dumpKernelStackTraces() {
434 String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
435 if (tracesPath == null || tracesPath.length() == 0) {
436 return null;
437 }
438
439 native_dumpKernelStacks(tracesPath);
440 return new File(tracesPath);
441 }
442
443 private native void native_dumpKernelStacks(String tracesPath);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444}