Search in sources :

Example 36 with IntentFilter

use of android.content.IntentFilter in project platform_frameworks_base by android.

the class BroadcastTest method testClearSticky.

public void testClearSticky() throws Exception {
    Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
    intent.putExtra("test", LaunchpadActivity.DATA_1);
    ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
    ActivityManagerNative.getDefault().unbroadcastIntent(null, new Intent(LaunchpadActivity.BROADCAST_STICKY1, null), UserHandle.myUserId());
    addIntermediate("finished-unbroadcast");
    IntentFilter filter = new IntentFilter(LaunchpadActivity.BROADCAST_STICKY1);
    Intent sticky = getContext().registerReceiver(null, filter);
    assertNull("Sticky not found", sticky);
}
Also used : IntentFilter(android.content.IntentFilter) Intent(android.content.Intent)

Example 37 with IntentFilter

use of android.content.IntentFilter in project platform_frameworks_base by android.

the class BroadcastTest method testRegisteredBroadcastPermissionGranted.

public void testRegisteredBroadcastPermissionGranted() throws Exception {
    setExpectedReceivers(new String[] { RECEIVER_REG });
    registerMyReceiver(new IntentFilter(BROADCAST_REGISTERED), null);
    addIntermediate("after-register");
    getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_REGISTERED), PERMISSION_GRANTED);
    waitForResultOrThrow(BROADCAST_TIMEOUT);
}
Also used : IntentFilter(android.content.IntentFilter)

Example 38 with IntentFilter

use of android.content.IntentFilter in project platform_frameworks_base by android.

the class IntentSenderTest method testRegisteredReceivePermissionGranted.

public void testRegisteredReceivePermissionGranted() throws Exception {
    setExpectedReceivers(new String[] { RECEIVER_REG });
    registerMyReceiver(new IntentFilter(BROADCAST_REGISTERED), PERMISSION_GRANTED);
    addIntermediate("after-register");
    PendingIntent is = PendingIntent.getBroadcast(getContext(), 0, makeBroadcastIntent(BROADCAST_REGISTERED), 0);
    is.send();
    waitForResultOrThrow(BROADCAST_TIMEOUT);
    is.cancel();
}
Also used : IntentFilter(android.content.IntentFilter) PendingIntent(android.app.PendingIntent)

Example 39 with IntentFilter

use of android.content.IntentFilter in project platform_frameworks_base by android.

the class SettingsDrawerActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    if (mDrawerLayout != null) {
        final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
        filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
        filter.addDataScheme("package");
        registerReceiver(mPackageReceiver, filter);
        new CategoriesUpdater().execute();
    }
    final Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra(EXTRA_SHOW_MENU)) {
            if (intent.getBooleanExtra(EXTRA_SHOW_MENU, false)) {
                // Intent explicitly set to show menu.
                showMenuIcon();
            }
        } else if (isTopLevelTile(intent)) {
            showMenuIcon();
        }
    }
}
Also used : IntentFilter(android.content.IntentFilter) Intent(android.content.Intent)

Example 40 with IntentFilter

use of android.content.IntentFilter in project platform_frameworks_base by android.

the class AuthenticatorHelper method listenToAccountUpdates.

public void listenToAccountUpdates() {
    if (!mListeningToAccountUpdates) {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
        // At disk full, certain actions are blocked (such as writing the accounts to storage).
        // It is useful to also listen for recovery from disk full to avoid bugs.
        intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
        mContext.registerReceiverAsUser(this, mUserHandle, intentFilter, null, null);
        mListeningToAccountUpdates = true;
    }
}
Also used : IntentFilter(android.content.IntentFilter)

Aggregations

IntentFilter (android.content.IntentFilter)1505 Intent (android.content.Intent)516 Context (android.content.Context)305 BroadcastReceiver (android.content.BroadcastReceiver)285 PendingIntent (android.app.PendingIntent)155 RemoteException (android.os.RemoteException)80 Handler (android.os.Handler)65 ComponentName (android.content.ComponentName)55 PowerManager (android.os.PowerManager)50 View (android.view.View)50 Uri (android.net.Uri)42 Test (org.junit.Test)42 ArrayList (java.util.ArrayList)39 TextView (android.widget.TextView)37 HandlerThread (android.os.HandlerThread)34 ResolveInfo (android.content.pm.ResolveInfo)30 File (java.io.File)30 PackageManager (android.content.pm.PackageManager)28 Point (android.graphics.Point)28 IOException (java.io.IOException)28