Search in sources :

Example 71 with IntentFilter

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

the class TrackerService method initLocationListeners.

private synchronized void initLocationListeners() {
    mTrackerData = new TrackerDataHelper(this);
    LocationManager lm = getLocationManager();
    mTrackedProviders = getTrackedProviders();
    List<String> locationProviders = lm.getAllProviders();
    mListeners = new ArrayList<LocationTrackingListener>(locationProviders.size());
    long minUpdateTime = getLocationUpdateTime();
    float minDistance = getLocationMinDistance();
    for (String providerName : locationProviders) {
        if (mTrackedProviders.contains(providerName)) {
            Log.d(LOG_TAG, "Adding location listener for provider " + providerName);
            if (doDebugLogging()) {
                mTrackerData.writeEntry("init", String.format("start listening to %s : %d ms; %f meters", providerName, minUpdateTime, minDistance));
            }
            LocationTrackingListener listener = new LocationTrackingListener();
            lm.requestLocationUpdates(providerName, minUpdateTime, minDistance, listener);
            mListeners.add(listener);
        }
    }
    mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    if (doDebugLogging()) {
        // register for cell location updates
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION);
        // Register for Network (Wifi or Mobile) updates
        mNetwork = new NetworkStateBroadcastReceiver();
        IntentFilter mIntentFilter;
        mIntentFilter = new IntentFilter();
        mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
        mIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
        mIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        Log.d(LOG_TAG, "registering receiver");
        registerReceiver(mNetwork, mIntentFilter);
    }
    if (trackSignalStrength()) {
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
    }
    // register for preference changes, so we can restart listeners on
    // pref changes
    mPrefListener = new PreferenceListener();
    getPreferences().registerOnSharedPreferenceChangeListener(mPrefListener);
}
Also used : LocationManager(android.location.LocationManager) IntentFilter(android.content.IntentFilter) TrackerDataHelper(com.android.locationtracker.data.TrackerDataHelper)

Example 72 with IntentFilter

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

the class NotificationHelper method onStart.

/**
     * Posts the notification and starts tracking the session to keep it
     * updated. The notification will automatically be removed if the session is
     * destroyed before {@link #onStop} is called.
     */
public void onStart() {
    mController.registerCallback(mCb);
    IntentFilter filter = new IntentFilter();
    filter.addAction(RequestUtils.ACTION_FFWD);
    filter.addAction(RequestUtils.ACTION_NEXT);
    filter.addAction(RequestUtils.ACTION_PAUSE);
    filter.addAction(RequestUtils.ACTION_PLAY);
    filter.addAction(RequestUtils.ACTION_PREV);
    filter.addAction(RequestUtils.ACTION_REW);
    mService.registerReceiver(this, filter);
    mMetadata = mController.getMetadata();
    mPlaybackState = mController.getPlaybackState();
    mStarted = true;
    // The notification must be updated after setting started to true
    updateNotification();
}
Also used : IntentFilter(android.content.IntentFilter)

Example 73 with IntentFilter

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

the class SoundTriggerTestService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    IntentFilter filter = new IntentFilter();
    filter.addAction(INTENT_ACTION);
    registerReceiver(mBroadcastReceiver, filter);
    // Make sure the data directory exists, and we're the owner of it.
    try {
        getFilesDir().mkdir();
    } catch (Exception e) {
    // Don't care - we either made it, or it already exists.
    }
}
Also used : IntentFilter(android.content.IntentFilter) IOException(java.io.IOException)

Example 74 with IntentFilter

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

the class Launcher method registerIntentReceivers.

/**
     * Registers various intent receivers. The current implementation registers
     * only a wallpaper intent receiver to let other applications change the
     * wallpaper.
     */
private void registerIntentReceivers() {
    if (sWallpaperReceiver == null) {
        final Application application = getApplication();
        sWallpaperReceiver = new WallpaperIntentReceiver(application, this);
        IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
        application.registerReceiver(sWallpaperReceiver, filter);
    } else {
        sWallpaperReceiver.setLauncher(this);
    }
    IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
    filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
    filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
    filter.addDataScheme("package");
    registerReceiver(mApplicationsReceiver, filter);
}
Also used : IntentFilter(android.content.IntentFilter) Application(android.app.Application)

Example 75 with IntentFilter

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

the class InputManagerService method start.

public void start() {
    Slog.i(TAG, "Starting input manager");
    nativeStart(mPtr);
    // Add ourself to the Watchdog monitors.
    Watchdog.getInstance().addMonitor(this);
    registerPointerSpeedSettingObserver();
    registerShowTouchesSettingObserver();
    registerAccessibilityLargePointerSettingObserver();
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            updatePointerSpeedFromSettings();
            updateShowTouchesFromSettings();
            updateAccessibilityLargePointerFromSettings();
        }
    }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler);
    updatePointerSpeedFromSettings();
    updateShowTouchesFromSettings();
    updateAccessibilityLargePointerFromSettings();
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) 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