Search in sources :

Example 76 with HandlerThread

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);
}
Also used : WifiManager(android.net.wifi.WifiManager) WifiListener(com.android.settingslib.wifi.WifiTracker.WifiListener) Scanner(com.android.settingslib.wifi.WifiTracker.Scanner) HandlerThread(android.os.HandlerThread)

Example 77 with HandlerThread

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);
}
Also used : HandlerThread(android.os.HandlerThread) LocalBluetoothManager(com.android.settingslib.bluetooth.LocalBluetoothManager)

Example 78 with HandlerThread

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);
}
Also used : HandlerThread(android.os.HandlerThread) Handler(android.os.Handler)

Example 79 with HandlerThread

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();
}
Also used : HandlerThread(android.os.HandlerThread) AccessPointPreference(com.android.settingslib.wifi.AccessPointPreference) Preference(android.support.v7.preference.Preference) AccessPointPreference(com.android.settingslib.wifi.AccessPointPreference)

Example 80 with HandlerThread

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);
        }
    }
}
Also used : HandlerThread(android.os.HandlerThread)

Aggregations

HandlerThread (android.os.HandlerThread)313 Handler (android.os.Handler)149 IntentFilter (android.content.IntentFilter)34 Message (android.os.Message)26 PowerManager (android.os.PowerManager)26 Intent (android.content.Intent)25 Context (android.content.Context)22 Test (org.junit.Test)20 Runnable (java.lang.Runnable)15 ComponentName (android.content.ComponentName)14 View (android.view.View)14 Looper (android.os.Looper)13 PendingIntent (android.app.PendingIntent)12 MediumTest (android.test.suitebuilder.annotation.MediumTest)12 RemoteException (android.os.RemoteException)11 MediaFormat (android.media.MediaFormat)10 Uri (android.net.Uri)10 Pair (android.util.Pair)10 SmallTest (android.test.suitebuilder.annotation.SmallTest)9 Bundle (android.os.Bundle)8