1f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project// Copyright 2007 The Android Open Source Project 2f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project 3f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Projectimport java.lang.Thread.UncaughtExceptionHandler; 4f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project 5f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project/** 6f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project * Report death-by-uncaught-exception. 7f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project */ 8f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Projectpublic class ThreadDeathHandler implements Thread.UncaughtExceptionHandler { 9f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project private String mMyMessage; 10f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project 11f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project public ThreadDeathHandler(String msg) { 12f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project mMyMessage = msg; 13f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project } 14f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project 15f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project public void uncaughtException(Thread t, Throwable e) { 16f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project System.err.println("Uncaught exception " + mMyMessage + "!"); 17f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project e.printStackTrace(); 18f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project } 19f6c387128427e121477c1b32ad35cdcaa5101ba3The Android Open Source Project} 20