use of android.content.IntentFilter in project platform_frameworks_base by android.
the class VibratorService method systemReady.
public void systemReady() {
mIm = mContext.getSystemService(InputManager.class);
mSettingObserver = new SettingsObserver(mH);
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
mPowerManagerInternal.registerLowPowerModeObserver(new PowerManagerInternal.LowPowerModeListener() {
@Override
public void onLowPowerModeChanged(boolean enabled) {
updateInputDeviceVibrators();
}
});
mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.VIBRATE_INPUT_DEVICES), true, mSettingObserver, UserHandle.USER_ALL);
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
updateInputDeviceVibrators();
}
}, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mH);
updateInputDeviceVibrators();
}
use of android.content.IntentFilter in project platform_frameworks_base by android.
the class TelephonyRegistry method systemRunning.
public void systemRunning() {
// Watch for interesting updates
final IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_USER_SWITCHED);
filter.addAction(Intent.ACTION_USER_REMOVED);
filter.addAction(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED);
log("systemRunning register for intents");
mContext.registerReceiver(mBroadcastReceiver, filter);
}
use of android.content.IntentFilter in project platform_frameworks_base by android.
the class NetworkTimeUpdateService method registerForConnectivityIntents.
private void registerForConnectivityIntents() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
mContext.registerReceiver(mConnectivityReceiver, intentFilter);
}
use of android.content.IntentFilter in project platform_frameworks_base by android.
the class NetworkTimeUpdateService method registerForTelephonyIntents.
private void registerForTelephonyIntents() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(TelephonyIntents.ACTION_NETWORK_SET_TIME);
intentFilter.addAction(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
mContext.registerReceiver(mNitzReceiver, intentFilter);
}
use of android.content.IntentFilter in project AsmackService by rtreffer.
the class SyncAdapter method onPerformSync.
/**
* Perform a roster sync on a given account and a given content provider.
* @param account The xmpp account to be synced.
* @param extras SyncAdapter-specific parameters
* @param authority The authority of this sync request.
* @param provider A authority based ContentProvider for this sync.
* @param syncResult Sync error and result counters.
*/
@Override
public void onPerformSync(final Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
Log.d(TAG, "Start Roster Sync");
final ArrayBlockingQueue<Node> rosterQueue = new ArrayBlockingQueue<Node>(1);
BroadcastReceiver receiver = new RosterResultReceiver(account, rosterQueue);
applicationContext.registerReceiver(receiver, new IntentFilter(XmppTransportService.XMPP_STANZA_INTENT));
try {
bindService();
if (!waitForService()) {
return;
}
if (!waitForServiceBind(account.name)) {
return;
}
Stanza stanza = getRosterRequest(account);
if (!sendWithRetry(stanza)) {
syncResult.stats.numIoExceptions++;
return;
}
Node roster = rosterQueue.poll(300, TimeUnit.SECONDS);
if (roster == null) {
return;
}
handleRosterResult(account, roster, provider);
} catch (InterruptedException e) {
Log.e(TAG, "Sync interrupted", e);
} finally {
applicationContext.unregisterReceiver(receiver);
unbindService();
}
}
Aggregations