use of android.os.Handler in project platform_frameworks_base by android.
the class ForegroundThread method ensureThreadLocked.
private static void ensureThreadLocked() {
if (sInstance == null) {
sInstance = new ForegroundThread();
sInstance.start();
sHandler = new Handler(sInstance.getLooper());
}
}
use of android.os.Handler in project platform_frameworks_base by android.
the class StorageNotification method start.
@Override
public void start() {
mNotificationManager = mContext.getSystemService(NotificationManager.class);
mStorageManager = mContext.getSystemService(StorageManager.class);
mStorageManager.registerListener(mListener);
mContext.registerReceiver(mSnoozeReceiver, new IntentFilter(ACTION_SNOOZE_VOLUME), android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
mContext.registerReceiver(mFinishReceiver, new IntentFilter(ACTION_FINISH_WIZARD), android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
// Kick current state into place
final List<DiskInfo> disks = mStorageManager.getDisks();
for (DiskInfo disk : disks) {
onDiskScannedInternal(disk, disk.volumeCount);
}
final List<VolumeInfo> vols = mStorageManager.getVolumes();
for (VolumeInfo vol : vols) {
onVolumeStateChangedInternal(vol);
}
mContext.getPackageManager().registerMoveCallback(mMoveCallback, new Handler());
updateMissingPrivateVolumes();
}
use of android.os.Handler in project platform_frameworks_base by android.
the class ManageDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getCallingPackage() != null) {
Log.e(TAG, getCallingPackage() + " cannot start this activity");
finish();
return;
}
try {
mService = IConnectivityManager.Stub.asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
mConfig = mService.getVpnConfig(UserHandle.myUserId());
// mConfig can be null if we are a restricted user, in that case don't show this dialog
if (mConfig == null) {
finish();
return;
}
View view = View.inflate(this, R.layout.manage, null);
if (mConfig.session != null) {
((TextView) view.findViewById(R.id.session)).setText(mConfig.session);
}
mDuration = (TextView) view.findViewById(R.id.duration);
mDataTransmitted = (TextView) view.findViewById(R.id.data_transmitted);
mDataReceived = (TextView) view.findViewById(R.id.data_received);
mDataRowsHidden = true;
if (mConfig.legacy) {
mAlertParams.mTitle = getText(R.string.legacy_title);
} else {
mAlertParams.mTitle = VpnConfig.getVpnLabel(this, mConfig.user);
}
if (mConfig.configureIntent != null) {
mAlertParams.mPositiveButtonText = getText(R.string.configure);
mAlertParams.mPositiveButtonListener = this;
}
mAlertParams.mNeutralButtonText = getText(R.string.disconnect);
mAlertParams.mNeutralButtonListener = this;
mAlertParams.mNegativeButtonText = getText(android.R.string.cancel);
mAlertParams.mNegativeButtonListener = this;
mAlertParams.mView = view;
setupAlert();
if (mHandler == null) {
mHandler = new Handler(this);
}
mHandler.sendEmptyMessage(0);
} catch (Exception e) {
Log.e(TAG, "onResume", e);
finish();
}
}
use of android.os.Handler in project platform_frameworks_base by android.
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.Handler in project platform_frameworks_base by android.
the class UiThread method ensureThreadLocked.
private static void ensureThreadLocked() {
if (sInstance == null) {
sInstance = new UiThread();
sInstance.start();
sInstance.getLooper().setTraceTag(Trace.TRACE_TAG_ACTIVITY_MANAGER);
sHandler = new Handler(sInstance.getLooper());
}
}
Aggregations