Example usage for android.os Process THREAD_PRIORITY_LESS_FAVORABLE

List of usage examples for android.os Process THREAD_PRIORITY_LESS_FAVORABLE

Introduction

In this page you can find the example usage for android.os Process THREAD_PRIORITY_LESS_FAVORABLE.

Prototype

int THREAD_PRIORITY_LESS_FAVORABLE

To view the source code for android.os Process THREAD_PRIORITY_LESS_FAVORABLE.

Click Source Link

Document

Minimum increment to make a priority less favorable.

Usage

From source file:io.github.mkjung.ivi.media.MediaLibrary.java

public void scanMediaItems() {
    if (mLoadingThread == null || mLoadingThread.getState() == State.TERMINATED) {
        isStopping = false;/*from   ww w .  j  av  a  2s.  c o m*/
        MediaUtils.actionScanStart();
        mLoadingThread = new Thread(new GetMediaItemsRunnable());
        mLoadingThread.setPriority(Process.THREAD_PRIORITY_DEFAULT + Process.THREAD_PRIORITY_LESS_FAVORABLE);
        mLoadingThread.start();
    }
}

From source file:com.android.launcher2.AsyncTaskCallback.java

/**
 * Return the appropriate thread priority for loading for a given page (we give the current
 * page much higher priority)/*from w  ww .j a  va  2s.com*/
 */
private int getThreadPriorityForPage(int page) {
    // TODO-APPS_CUSTOMIZE: detect number of cores and set thread priorities accordingly below
    int pageDiff = getWidgetPageLoadPriority(page);
    if (pageDiff <= 0) {
        return Process.THREAD_PRIORITY_LESS_FAVORABLE;
    } else if (pageDiff <= 1) {
        return Process.THREAD_PRIORITY_LOWEST;
    } else {
        return Process.THREAD_PRIORITY_LOWEST;
    }
}

From source file:com.phonemetra.turbo.launcher.AsyncTaskCallback.java

/**
 * Return the appropriate thread priority for loading for a given page (we give the current
 * page much higher priority)//from  w  w w .  ja  v a 2s  .com
 */
private int getThreadPriorityForPage(int page) {

    int pageDiff = getWidgetPageLoadPriority(page);
    if (pageDiff <= 0) {
        return Process.THREAD_PRIORITY_LESS_FAVORABLE;
    } else if (pageDiff <= 1) {
        return Process.THREAD_PRIORITY_LOWEST;
    } else {
        return Process.THREAD_PRIORITY_LOWEST;
    }
}