use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class CallbackHandlerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mHandlerThread = new HandlerThread("TestThread");
mHandlerThread.start();
mHandler = new CallbackHandler(mHandlerThread.getLooper());
MockitoAnnotations.initMocks(this);
mHandler.setListening(mEmengencyListener, true);
mHandler.setListening(mSignalCallback, true);
}
use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class TileLifecycleManagerTests method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mThread = new HandlerThread("TestThread");
mThread.start();
mHandler = new Handler(mThread.getLooper());
ComponentName component = new ComponentName(mContext, FakeTileService.class);
mStateManager = new TileLifecycleManager(mHandler, getContext(), Mockito.mock(IQSService.class), new Tile(), new Intent().setComponent(component), new UserHandle(UserHandle.myUserId()));
mCallbacks.clear();
getContext().registerReceiver(mReceiver, new IntentFilter(TILE_UPDATE_BROADCAST));
}
use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class TileServiceManagerTests method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mThread = new HandlerThread("TestThread");
mThread.start();
mHandler = new Handler(mThread.getLooper());
mTileServices = Mockito.mock(TileServices.class);
Mockito.when(mTileServices.getContext()).thenReturn(mContext);
mTileLifecycle = Mockito.mock(TileLifecycleManager.class);
Mockito.when(mTileLifecycle.isActiveTile()).thenReturn(false);
ComponentName componentName = new ComponentName(mContext, TileServiceManagerTests.class);
Mockito.when(mTileLifecycle.getComponent()).thenReturn(componentName);
mTileServiceManager = new TileServiceManager(mTileServices, mHandler, mTileLifecycle);
}
use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class NetworkStatsObservers method getHandlerLooperLocked.
@VisibleForTesting
protected Looper getHandlerLooperLocked() {
HandlerThread handlerThread = new HandlerThread(TAG);
handlerThread.start();
return handlerThread.getLooper();
}
use of android.os.HandlerThread in project android_frameworks_base by ResurrectionRemix.
the class MediaPlayer method setSubtitleAnchor.
/**
* The private version of setSubtitleAnchor is used internally to set mSubtitleController if
* necessary when clients don't provide their own SubtitleControllers using the public version
* {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
*/
private synchronized void setSubtitleAnchor() {
if (mSubtitleController == null) {
final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
thread.start();
Handler handler = new Handler(thread.getLooper());
handler.post(new Runnable() {
@Override
public void run() {
Context context = ActivityThread.currentApplication();
mSubtitleController = new SubtitleController(context, mTimeProvider, MediaPlayer.this);
mSubtitleController.setAnchor(new Anchor() {
@Override
public void setSubtitleWidget(RenderingWidget subtitleWidget) {
}
@Override
public Looper getSubtitleLooper() {
return Looper.getMainLooper();
}
});
thread.getLooper().quitSafely();
}
});
try {
thread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
Log.w(TAG, "failed to join SetSubtitleAnchorThread");
}
}
}
Aggregations