Add uncaught exception handler to message retrieval thread

Related #6644
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2017-06-02 09:49:44 -07:00
parent 711740d156
commit 5672701a60

View File

@ -182,10 +182,14 @@ public class MessageRetrievalService extends Service implements InjectableType,
return pipe;
}
private class MessageRetrievalThread extends Thread {
private class MessageRetrievalThread extends Thread implements Thread.UncaughtExceptionHandler {
private AtomicBoolean stopThread = new AtomicBoolean(false);
MessageRetrievalThread() {
setUncaughtExceptionHandler(this);
}
@Override
public void run() {
while (!stopThread.get()) {
@ -235,5 +239,11 @@ public class MessageRetrievalService extends Service implements InjectableType,
public void stopThread() {
stopThread.set(true);
}
@Override
public void uncaughtException(Thread t, Throwable e) {
Log.w(TAG, "*** Uncaught exception!");
Log.w(TAG, e);
}
}
}