Search in sources :

Example 61 with Handler

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

Example 62 with Handler

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();
}
Also used : IntentFilter(android.content.IntentFilter) NotificationManager(android.app.NotificationManager) StorageManager(android.os.storage.StorageManager) DiskInfo(android.os.storage.DiskInfo) Handler(android.os.Handler) VolumeInfo(android.os.storage.VolumeInfo)

Example 63 with Handler

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();
    }
}
Also used : Handler(android.os.Handler) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 64 with Handler

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

Example 65 with Handler

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

Aggregations

Handler (android.os.Handler)1906 Message (android.os.Message)254 View (android.view.View)207 Intent (android.content.Intent)174 HandlerThread (android.os.HandlerThread)156 TextView (android.widget.TextView)118 MediumTest (android.test.suitebuilder.annotation.MediumTest)116 ArrayList (java.util.ArrayList)97 Test (org.junit.Test)85 Context (android.content.Context)71 IntentFilter (android.content.IntentFilter)69 RemoteException (android.os.RemoteException)63 IOException (java.io.IOException)63 ComponentName (android.content.ComponentName)57 ImageView (android.widget.ImageView)57 Bundle (android.os.Bundle)56 RecyclerView (android.support.v7.widget.RecyclerView)54 Looper (android.os.Looper)53 File (java.io.File)46 ContentObserver (android.database.ContentObserver)44