List of usage examples for android.os Process THREAD_PRIORITY_DEFAULT
int THREAD_PRIORITY_DEFAULT
To view the source code for android.os Process THREAD_PRIORITY_DEFAULT.
Click Source Link
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 a v 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
AppsCustomizeAsyncTask(int p, AsyncTaskPageData.Type ty) { page = p; threadPriority = Process.THREAD_PRIORITY_DEFAULT; dataType = ty; }
From source file:paulscode.android.mupen64plusae.jni.CoreService.java
@Override public void onCreate() { // Start up the thread running the service. Note that we create a // separate thread because the service normally runs in the process's // main thread, which we don't want to block. We also make it // background priority so CPU-intensive work will not disrupt our UI. HandlerThread thread = new HandlerThread("ServiceStartArguments", Process.THREAD_PRIORITY_DEFAULT); thread.start();//w w w . j a va 2 s .c o m // Get the HandlerThread's Looper and use it for our Handler Looper serviceLooper = thread.getLooper(); mServiceHandler = new ServiceHandler(serviceLooper); }
From source file:mp.teardrop.PlaybackService.java
@Override public void onCreate() { HandlerThread thread = new HandlerThread("PlaybackService", Process.THREAD_PRIORITY_DEFAULT); thread.start();// w w w .ja va 2 s . c o m mTimeline = new SongTimeline(this); mTimeline.setCallback(this); int state = loadState(); mPlayCounts = new PlayCountsHelper(this); mMediaPlayer = getNewMediaPlayer(); mBastpUtil = new BastpUtil(); mReadahead = new ReadaheadThread(); mReadahead.start(); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); SharedPreferences settings = getSettings(this); settings.registerOnSharedPreferenceChangeListener(this); mNotificationMode = Integer.parseInt(settings.getString(PrefKeys.NOTIFICATION_MODE, "1")); mScrobble = settings.getBoolean(PrefKeys.SCROBBLE, false); mIdleTimeout = settings.getBoolean(PrefKeys.USE_IDLE_TIMEOUT, false) ? settings.getInt(PrefKeys.IDLE_TIMEOUT, 3600) : 0; Song.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_ANDROID, true) ? Song.mCoverLoadMode | Song.COVER_MODE_ANDROID : Song.mCoverLoadMode & ~(Song.COVER_MODE_ANDROID); Song.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_VANILLA, true) ? Song.mCoverLoadMode | Song.COVER_MODE_VANILLA : Song.mCoverLoadMode & ~(Song.COVER_MODE_VANILLA); Song.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_SHADOW, true) ? Song.mCoverLoadMode | Song.COVER_MODE_SHADOW : Song.mCoverLoadMode & ~(Song.COVER_MODE_SHADOW); mHeadsetOnly = settings.getBoolean(PrefKeys.HEADSET_ONLY, false); mStockBroadcast = settings.getBoolean(PrefKeys.STOCK_BROADCAST, false); mInvertNotification = settings.getBoolean(PrefKeys.NOTIFICATION_INVERTED_COLOR, false); mNotificationAction = createNotificationAction(settings); mHeadsetPause = getSettings(this).getBoolean(PrefKeys.HEADSET_PAUSE, true); mShakeAction = settings.getBoolean(PrefKeys.ENABLE_SHAKE, false) ? Action.getAction(settings, PrefKeys.SHAKE_ACTION, Action.NextSong) : Action.Nothing; mShakeThreshold = settings.getInt(PrefKeys.SHAKE_THRESHOLD, 80) / 10.0f; mReplayGainTrackEnabled = settings.getBoolean(PrefKeys.ENABLE_TRACK_REPLAYGAIN, false); mReplayGainAlbumEnabled = settings.getBoolean(PrefKeys.ENABLE_ALBUM_REPLAYGAIN, false); mReplayGainBump = settings.getInt(PrefKeys.REPLAYGAIN_BUMP, 75); /* seek bar is 150 -> 75 == middle == 0 */ mReplayGainUntaggedDeBump = settings.getInt(PrefKeys.REPLAYGAIN_UNTAGGED_DEBUMP, 150); /* seek bar is 150 -> == 0 */ mReadaheadEnabled = settings.getBoolean(PrefKeys.ENABLE_READAHEAD, false); PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "TeardropMusicLock"); mReceiver = new Receiver(); IntentFilter filter = new IntentFilter(); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(Intent.ACTION_SCREEN_ON); registerReceiver(mReceiver, filter); getContentResolver().registerContentObserver(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, true, mObserver); CompatIcs.registerRemote(this, mAudioManager); mLooper = thread.getLooper(); mHandler = new Handler(mLooper, this); initWidgets(); updateState(state); setCurrentSong(0, false); sInstance = this; synchronized (sWait) { sWait.notifyAll(); } mAccelFiltered = 0.0f; mAccelLast = SensorManager.GRAVITY_EARTH; setupSensor(); }
From source file:com.realtek.simpleconfig.SCTest.java
/** */ @SuppressWarnings("deprecation") public void DiscoverDevPopUp(final int milliSeconds) { discovDialog.setTitle("Wi-Fi: " + SCLib.getConnectedWifiSSID()); discovDialog.setMessage(" ?......"); discovDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); discovDialog.setCancelable(false);/*from ww w . ja va 2 s . c o m*/ discovDialog.setButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DiscovEnable = false; dialog.cancel(); } }); discovDialog.show(); new Thread(new Runnable() { public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); byte[] DiscovCmdBuf = SCCtlOps.rtk_sc_gen_discover_packet(SCLib.rtk_sc_get_default_pin()); long startTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis(); while (DiscovEnable && (endTime - startTime) < milliSeconds) { SCLib.rtk_sc_send_discover_packet(DiscovCmdBuf, "255.255.255.255"); endTime = System.currentTimeMillis(); } Log.i(TAG, "Discover Time Elapsed: " + (endTime - startTime) + "ms"); // Update Status Message msg = Message.obtain(); msg.obj = null; msg.what = ~SCCtlOps.Flag.DiscoverACK; //timeout SCLib.TreadMsgHandler.sendMessage(msg); } }).start(); }
From source file:com.realtek.simpleconfig.SCTest.java
/** ?? */ public void SendCtlDevPacket(final int flag, final String pin, final String ip, final String new_name) { // Log.d(TAG, "ip: " + ip); // Log.d(TAG, "pin: " + pin); // Log.d(TAG, "name: " + new_name); new Thread(new Runnable() { int count = 0; public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); byte[] buf = SCCtlOps.rtk_sc_gen_control_packet(flag, SCLib.rtk_sc_get_default_pin(), pin, new_name); while (count < 15) { SCLib.rtk_sc_send_control_packet(buf, ip); count++;/* w w w . j a va 2s .c om*/ } } }).start(); }
From source file:com.facebook.react.ReactInstanceManager.java
private void setupReactContext(final ReactApplicationContext reactContext) { Log.d(ReactConstants.TAG, "ReactInstanceManager.setupReactContext()"); ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_END); ReactMarker.logMarker(SETUP_REACT_CONTEXT_START); Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "setupReactContext"); synchronized (mReactContextLock) { mCurrentReactContext = Assertions.assertNotNull(reactContext); }//from w w w . java2 s .co m CatalystInstance catalystInstance = Assertions.assertNotNull(reactContext.getCatalystInstance()); catalystInstance.initialize(); mDevSupportManager.onNewReactContextCreated(reactContext); mMemoryPressureRouter.addMemoryPressureListener(catalystInstance); moveReactContextToCurrentLifecycleState(); ReactMarker.logMarker(ATTACH_MEASURED_ROOT_VIEWS_START); synchronized (mAttachedRootViews) { for (ReactRootView rootView : mAttachedRootViews) { attachRootViewToInstance(rootView); } } ReactMarker.logMarker(ATTACH_MEASURED_ROOT_VIEWS_END); ReactInstanceEventListener[] listeners = new ReactInstanceEventListener[mReactInstanceEventListeners .size()]; final ReactInstanceEventListener[] finalListeners = mReactInstanceEventListeners.toArray(listeners); UiThreadUtil.runOnUiThread(new Runnable() { @Override public void run() { for (ReactInstanceEventListener listener : finalListeners) { listener.onReactContextInitialized(reactContext); } } }); Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); ReactMarker.logMarker(SETUP_REACT_CONTEXT_END); reactContext.runOnJSQueueThread(new Runnable() { @Override public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); } }); reactContext.runOnNativeModulesQueueThread(new Runnable() { @Override public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); } }); }
From source file:com.realtek.simpleconfig.SCTest.java
private void rtk_sc_send_confirm_packet(final int flag) { new Thread(new Runnable() { String pin;/*from w w w . ja v a 2 s. c om*/ int count = 0; public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); if (CurrentView == 0) { // pin = PINSet; pin = (PINSet != null && PINSet.length() > 0) ? PINSet : "none"; } else { if (pinArrayList.size() > 0) { pin = pinArrayList.get(CurrentItem).toString(); } else { // Log.e(TAG, "pinArrayList is null"); return; } } // Log.d(TAG, "Comfirm PIN: " + pin); // Log.d(TAG, "Comfirm IP: " + CurrentControlIP); byte[] buf = SCCtlOps.rtk_sc_gen_control_confirm_packet(flag, SCLib.rtk_sc_get_default_pin(), pin); while (count < 5) { SCLib.rtk_sc_send_control_packet(buf, CurrentControlIP); count++; } } }).start(); }