FileDocCategorySizeDatePackage
HandlerThread_Delegate.javaAPI DocAndroid 5.1 API2515Thu Mar 12 22:22:44 GMT 2015android.os

HandlerThread_Delegate

public class HandlerThread_Delegate extends Object
Delegate overriding selected methods of android.os.HandlerThread Through the layoutlib_create tool, selected methods of Handler have been replaced by calls to methods of the same name in this delegate class.

Fields Summary
private static Map
sThreads
Constructors Summary
Methods Summary
public static voidcleanUp(com.android.layoutlib.bridge.android.BridgeContext context)


         
        List<HandlerThread> list = sThreads.get(context);
        if (list != null) {
            for (HandlerThread thread : list) {
                thread.quit();
            }

            list.clear();
            sThreads.remove(context);
        }
    
static voidrun(HandlerThread theThread)

        // record the thread so that it can be quit() on clean up.
        BridgeContext context = RenderAction.getCurrentContext();
        List<HandlerThread> list = sThreads.get(context);
        if (list == null) {
            list = new ArrayList<HandlerThread>();
            sThreads.put(context, list);
        }

        list.add(theThread);

        // ---- START DEFAULT IMPLEMENTATION.

        theThread.mTid = Process.myTid();
        Looper.prepare();
        synchronized (theThread) {
            theThread.mLooper = Looper.myLooper();
            theThread.notifyAll();
        }
        Process.setThreadPriority(theThread.mPriority);
        theThread.onLooperPrepared();
        Looper.loop();
        theThread.mTid = -1;