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