Search in sources :

Example 66 with IntentFilter

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();
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) PowerManagerInternal(android.os.PowerManagerInternal) Intent(android.content.Intent) InputManager(android.hardware.input.InputManager) BroadcastReceiver(android.content.BroadcastReceiver)

Example 67 with IntentFilter

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

Example 68 with IntentFilter

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

Example 69 with 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);
}
Also used : IntentFilter(android.content.IntentFilter)

Example 70 with 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();
    }
}
Also used : IntentFilter(android.content.IntentFilter) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) Node(org.w3c.dom.Node) Stanza(com.googlecode.asmack.Stanza) BroadcastReceiver(android.content.BroadcastReceiver)

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