FileDocCategorySizeDatePackage
FgThread.javaAPI DocAndroid 5.1 API1948Thu Mar 12 22:22:42 GMT 2015com.android.server

FgThread

public final class FgThread extends ServiceThread
Shared singleton foreground thread for the system. This is a thread for regular foreground service operations, which shouldn't be blocked by anything running in the background. In particular, the shared background thread could be doing relatively long-running operations like saving state to disk (in addition to simply being a background priority), which can cause operations scheduled on it to be delayed for a user-noticeable amount of time.

Fields Summary
private static FgThread
sInstance
private static android.os.Handler
sHandler
Constructors Summary
private FgThread()

        super("android.fg", android.os.Process.THREAD_PRIORITY_DEFAULT, true /*allowIo*/);
    
Methods Summary
private static voidensureThreadLocked()

        if (sInstance == null) {
            sInstance = new FgThread();
            sInstance.start();
            sHandler = new Handler(sInstance.getLooper());
        }
    
public static com.android.server.FgThreadget()

        synchronized (UiThread.class) {
            ensureThreadLocked();
            return sInstance;
        }
    
public static android.os.HandlergetHandler()

        synchronized (UiThread.class) {
            ensureThreadLocked();
            return sHandler;
        }