private void initHandler(){ HandlerThread temp = new HandlerThread(Debug.class.getCanonicalName()); //if you send a lot of data through the debug interface, you need this for avoid delay that //can trigger a timeout temp.setPriority(Thread.MAX_PRIORITY); temp.start(); mNotifyThread= new Handler(temp.getLooper()); }//initHandler
public HandlerExecutor() { HandlerThread thread = new HandlerThread(TAG); thread.setPriority(Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mCompressHandler = new CompressHandler(thread.getLooper()); }
public StackTraceCollector(long collectInterval) { mCollectInterval = collectInterval; HandlerThread thread = new HandlerThread(TAG); thread.setPriority(Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mLooper = thread.getLooper(); mCollectorHandler = new CollectorHandler(mLooper); int space = (int) (COLLECT_SPACE_TIME / mCollectInterval); mCollectCount = space <= MIN_COLLECT_COUNT ? MIN_COLLECT_COUNT : space; mStackQueue = new ArrayDeque<String>(mCollectCount); trigger(); }
public StackTraceCollector(long collectInterval) { mCollectInterval = collectInterval; HandlerThread thread = new HandlerThread(TAG); thread.setPriority(Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mLooper = thread.getLooper(); mCollectorHandler = new CollectorHandler(mLooper); int space = (int) (COLLECT_SPACE_TIME / mCollectInterval); mLimitLength = space <= MIN_COLLECT_COUNT ? MIN_COLLECT_COUNT : space; mStackQueue = new ArrayDeque<>(mLimitLength); trigger(); }
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); moveHandlerThread = new HandlerThread("goOnHandlerThread"); moveHandlerThread.setPriority(Thread.MIN_PRIORITY); moveHandlerThread.start(); moveHandler = new GoOnHandler(moveHandlerThread.getLooper()); }
iconWarnDelay2 = 500; myThread.start(); myThread.setPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); notifyHandler = new Handler(myThread.getLooper());
public void startLoader(boolean isLaunching, int synchronousBindPage, int loadFlags) { synchronized (mLock) { if (DEBUG_LOADERS) { Log.d(TAG, "startLoader isLaunching=" + isLaunching); } // Clear any deferred bind-runnables from the synchronized load process // We must do this before any loading/binding is scheduled below. synchronized (mDeferredBindRunnables) { mDeferredBindRunnables.clear(); } // Don't bother to start the thread if we know it's not going to do anything if (mCallbacks != null && mCallbacks.get() != null) { // If there is already one running, tell it to stop. // also, don't downgrade isLaunching if we're already running isLaunching = isLaunching || stopLoaderLocked(); mLoaderTask = new LoaderTask(LauncherAppState.getContext(), isLaunching, loadFlags); if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE && mAllAppsLoaded && mWorkspaceLoaded) { mLoaderTask.runBindSynchronousPage(synchronousBindPage); } else { sWorkerThread.setPriority(Thread.NORM_PRIORITY); sWorker.post(mLoaderTask); } } } }
public void startLoader(int synchronousBindPage, int loadFlags) { // Enable queue before starting loader. It will get disabled in Launcher#finishBindingItems InstallShortcutReceiver.enableInstallQueue(); synchronized (mLock) { // Clear any deferred bind-runnables from the synchronized load process // We must do this before any loading/binding is scheduled below. synchronized (mDeferredBindRunnables) { mDeferredBindRunnables.clear(); } // Don't bother to start the thread if we know it's not going to do anything if (mCallbacks != null && mCallbacks.get() != null) { // If there is already one running, tell it to stop. stopLoaderLocked(); mLoaderTask = new LoaderTask(mApp.getContext(), loadFlags); if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE && mAllAppsLoaded && mWorkspaceLoaded && !mIsLoaderTaskRunning) { mLoaderTask.runBindSynchronousPage(synchronousBindPage); } else { sWorkerThread.setPriority(Thread.NORM_PRIORITY); sWorker.post(mLoaderTask); } } } }
return true; } else { sWorkerThread.setPriority(Thread.NORM_PRIORITY); sWorker.post(mLoaderTask);
return true; } else { sWorkerThread.setPriority(Thread.NORM_PRIORITY); sWorker.post(mLoaderTask);
return true; } else { sWorkerThread.setPriority(Thread.NORM_PRIORITY); sWorker.post(mLoaderTask);