Search in sources :

Example 51 with UncaughtExceptionHandler

use of java.lang.Thread.UncaughtExceptionHandler in project android_frameworks_base by crdroidandroid.

the class UiAutomatorTestRunner method run.

public void run(List<String> testClasses, Bundle params, boolean debug, boolean monkey) {
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {

        @Override
        public void uncaughtException(Thread thread, Throwable ex) {
            Log.e(LOGTAG, "uncaught exception", ex);
            Bundle results = new Bundle();
            results.putString("shortMsg", ex.getClass().getName());
            results.putString("longMsg", ex.getMessage());
            mWatcher.instrumentationFinished(null, 0, results);
            // bailing on uncaught exception
            System.exit(EXIT_EXCEPTION);
        }
    });
    mTestClasses = testClasses;
    mParams = params;
    mDebug = debug;
    mMonkey = monkey;
    start();
    System.exit(EXIT_OK);
}
Also used : Bundle(android.os.Bundle) UncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler) HandlerThread(android.os.HandlerThread)

Aggregations

UncaughtExceptionHandler (java.lang.Thread.UncaughtExceptionHandler)51 Bundle (android.os.Bundle)5 HandlerThread (android.os.HandlerThread)5 IOException (java.io.IOException)5 AtomicLong (java.util.concurrent.atomic.AtomicLong)5 AtomicReference (java.util.concurrent.atomic.AtomicReference)5 CountDownLatch (java.util.concurrent.CountDownLatch)4 ThreadFactory (java.util.concurrent.ThreadFactory)4 Test (org.junit.Test)4 LocalLoadingCache (com.google.common.cache.LocalCache.LocalLoadingCache)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 Intent (android.content.Intent)1 Message (android.os.Message)1 PowerManager (android.os.PowerManager)1 RemoteException (android.os.RemoteException)1 ConsoleMessage (android.webkit.ConsoleMessage)1 SmartThread (com.alibaba.jstorm.utils.SmartThread)1 JCommander (com.beust.jcommander.JCommander)1 Console (com.beust.jcommander.internal.Console)1 LowLevelHeartBeatEvent (com.carrotsearch.ant.tasks.junit4.events.LowLevelHeartBeatEvent)1