/** * Stops the background thread that processes updates and cancels any pending requests to start * it. */ public synchronized void stopRequestProcessing() { // Remove any pending requests to start the processing thread. mHandler.removeMessages(START_THREAD); if (mCallerIdThread != null) { // Stop the thread; we are finished with it. mCallerIdThread.stopProcessing(); mCallerIdThread.interrupt(); mCallerIdThread = null; } }
/** * Starts a background thread to process contact-lookup requests, unless one has already been * started. */ private synchronized void startRequestProcessing() { // For unit-testing. if (mRequestProcessingDisabled) return; // Idempotence... if a thread is already started, don't start another. if (mCallerIdThread != null) return; mCallerIdThread = new QueryThread(); mCallerIdThread.setPriority(Thread.MIN_PRIORITY); mCallerIdThread.start(); }