use of android.os.Handler in project platform_frameworks_base by android.
the class AttachInfo_Accessor method setAttachInfo.
public static void setAttachInfo(View view) {
Context context = view.getContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
ViewRootImpl root = new ViewRootImpl(context, display);
AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(), display, root, new Handler(), null);
info.mHasWindowFocus = true;
info.mWindowVisibility = View.VISIBLE;
// this is so that we can display selections.
info.mInTouchMode = false;
info.mHardwareAccelerated = false;
view.dispatchAttachedToWindow(info, 0);
}
use of android.os.Handler in project platform_frameworks_base by android.
the class WifiNetworkScoreCacheTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mockContext.getApplicationContext()).thenReturn(mockApplicationContext);
mValidScoredNetwork = buildScoredNetwork(VALID_KEY, mockRssiCurve);
mScoreCache = new WifiNetworkScoreCache(mockContext);
initializeCacheWithValidScoredNetwork();
HandlerThread thread = new HandlerThread("WifiNetworkScoreCacheTest Handler Thread");
thread.start();
mHandler = new Handler(thread.getLooper());
mLatch = new CountDownLatch(1);
mCacheListener = new CacheListener(mHandler) {
@Override
public void networkCacheUpdated(List<ScoredNetwork> updatedNetworks) {
mUpdatedNetworksCaptor = updatedNetworks;
mLatch.countDown();
}
};
}
use of android.os.Handler in project platform_frameworks_base by android.
the class WifiManager method getChannel.
private synchronized AsyncChannel getChannel() {
if (mAsyncChannel == null) {
Messenger messenger = getWifiServiceMessenger();
if (messenger == null) {
throw new IllegalStateException("getWifiServiceMessenger() returned null! This is invalid.");
}
mAsyncChannel = new AsyncChannel();
mConnected = new CountDownLatch(1);
Handler handler = new ServiceHandler(mLooper);
mAsyncChannel.connect(mContext, handler, messenger);
try {
mConnected.await();
} catch (InterruptedException e) {
Log.e(TAG, "interrupted wait at init");
}
}
return mAsyncChannel;
}
use of android.os.Handler in project platform_frameworks_base by android.
the class HdmiCecController method init.
private void init(long nativePtr) {
mIoHandler = new Handler(mService.getIoLooper());
mControlHandler = new Handler(mService.getServiceLooper());
mNativePtr = nativePtr;
}
use of android.os.Handler in project storio by pushtorefresh.
the class RxChangesObserverTest method contentObserverShouldReturnFalseOnDeliverSelfNotificationsOnAllSdkVersions.
@Test
public void contentObserverShouldReturnFalseOnDeliverSelfNotificationsOnAllSdkVersions() {
for (int sdkVersion = MIN_SDK_VERSION; sdkVersion < MAX_SDK_VERSION; sdkVersion++) {
ContentResolver contentResolver = mock(ContentResolver.class);
Uri uri = mock(Uri.class);
final AtomicReference<ContentObserver> contentObserver = new AtomicReference<ContentObserver>();
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
contentObserver.set((ContentObserver) invocation.getArguments()[2]);
return null;
}
}).when(contentResolver).registerContentObserver(same(uri), eq(true), any(ContentObserver.class));
Handler handler = mock(Handler.class);
Observable<Changes> observable = RxChangesObserver.observeChanges(contentResolver, singleton(uri), handler, sdkVersion);
Subscription subscription = observable.subscribe();
assertThat(contentObserver.get().deliverSelfNotifications()).isFalse();
subscription.unsubscribe();
}
}
Aggregations