use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class WifiTrackerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mWifiManager = Mockito.mock(WifiManager.class);
mWifiListener = Mockito.mock(WifiListener.class);
mWorkerThread = new HandlerThread("TestHandlerThread");
mWorkerThread.start();
mLooper = mWorkerThread.getLooper();
mMainThread = new HandlerThread("TestHandlerThread");
mMainThread.start();
mMainLooper = mMainThread.getLooper();
mWifiTracker = new WifiTracker(mContext, mWifiListener, mLooper, true, true, true, mWifiManager, mMainLooper);
mWifiTracker.mScanner = mWifiTracker.new Scanner();
Mockito.when(mWifiManager.isWifiEnabled()).thenReturn(true);
}
use of android.os.HandlerThread in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DockService method onCreate.
@Override
public void onCreate() {
if (DEBUG)
Log.d(TAG, "onCreate");
LocalBluetoothManager manager = Utils.getLocalBtManager(this);
if (manager == null) {
Log.e(TAG, "Can't get LocalBluetoothManager: exiting");
return;
}
mLocalAdapter = manager.getBluetoothAdapter();
mDeviceManager = manager.getCachedDeviceManager();
mProfileManager = manager.getProfileManager();
if (mProfileManager == null) {
Log.e(TAG, "Can't get LocalBluetoothProfileManager: exiting");
return;
}
HandlerThread thread = new HandlerThread("DockService");
thread.start();
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
use of android.os.HandlerThread in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class IncreasingRingVolumePreference method initHandler.
private void initHandler() {
if (mHandler != null)
return;
HandlerThread thread = new HandlerThread(TAG + ".CallbackHandler");
thread.start();
mHandler = new Handler(thread.getLooper(), this);
mHandler.sendEmptyMessage(MSG_INIT_SAMPLE);
}
use of android.os.HandlerThread in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.wifi_settings);
mAddPreference = new Preference(getContext());
mAddPreference.setIcon(R.drawable.ic_menu_add_inset);
mAddPreference.setTitle(R.string.wifi_add_network);
mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
mBgThread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
mBgThread.start();
}
use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class ConnectivityManager method incCallbackHandlerRefCount.
private void incCallbackHandlerRefCount() {
synchronized (sCallbackRefCount) {
if (sCallbackRefCount.incrementAndGet() == 1) {
// TODO: switch this to ConnectivityThread
HandlerThread callbackThread = new HandlerThread("ConnectivityManager");
callbackThread.start();
sCallbackHandler = new CallbackHandler(callbackThread.getLooper(), sNetworkCallback, sCallbackRefCount, this);
}
}
}
Aggregations