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);
}
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);
}
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();
}
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();
}
}
}
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;
}
}
Aggregations