111 Commits

Author SHA1 Message Date
Jeff Sharkey
5e61331da5 Move away from deprecated NetworkInfo extra.
Because the NetworkInfo included in CONNECTIVITY_ACTION broadcast
extra does not reflect the state applicable to the calling UID, and
the last sticky broadcast may have stale state, transition to calling
ConnectivityManager.getActiveNetworkInfo() directly.

Change-Id: I86b316fbedd0273585ad5f1248b091bc3a3a5520
2012-01-30 11:21:35 -08:00
Dianne Hackborn
6c418d585e Fix issue #4902856: Don't let apps register non-explicit PendingIntents
Location manager now checks for such intents, and logs a warning when
they are given to it.  Nothing thrown yet, it needs to check the
targetSdkVersion of the caller somehow.

When sending the pending intent, we require that the recipient hold the
appropriate permission.  This should pretty much close the security hole.

Includes a bunch of infrastructure in the activity manager needed to
support all this.

Change-Id: I4dba7a98a7b8bbb9e347666451aa9cb1efad1848
2011-06-30 11:23:54 -07:00
Mike Lockwood
1ebe049acc am 1b571bd3: am 1d28a840: Merge "Location Manager: Fix LocationManager.getBestProvider filtering." into gingerbread 2010-10-26 08:38:51 -07:00
Mike Lockwood
9e3191d16c Location Manager: Fix LocationManager.getBestProvider filtering.
getBestProvider should only return location providers that the client
has permission to use.

BUG: 3124614

Change-Id: I065091d0445092563bc53fb4f7d93a1ab6bebb9a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-10-26 10:01:55 -04:00
Mike Lockwood
8fa50d4f2d am 6c8d8d89: am 8c32bddf: Merge "GPS: Disable verbose logging" into gingerbread
Merge commit '6c8d8d8927373fdb9ad1c853396b5dbc8295f996'

* commit '6c8d8d8927373fdb9ad1c853396b5dbc8295f996':
  GPS: Disable verbose logging
2010-10-25 14:00:38 -07:00
Mike Lockwood
4a7b65e0d5 GPS: Disable verbose logging
BUG: 3127049

Change-Id: I9efd9eb7ff69724b133f3b70c52e173f49ddfbc5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-10-25 16:35:55 -04:00
Mike Lockwood
dd074306e1 am 11eada78: am ba2ec2b4: Merge "Enable framework GPS and location manager logging" into gingerbread
Merge commit '11eada780dc82fcac2a1dad4e2dde1d310b4231c'

* commit '11eada780dc82fcac2a1dad4e2dde1d310b4231c':
  Enable framework GPS and location manager logging
2010-10-19 09:54:42 -07:00
Mike Lockwood
2d4d1bf14b Enable framework GPS and location manager logging
Change-Id: Id54fc01e7288e7d90d7b76824b708bcb2ee88333
Signed-off-by: Mike Lockwood <lockwood@google.com>
2010-10-18 17:06:26 -04:00
Mike Lockwood
ca936f1661 am 98e1f384: am aecab79b: Merge "Remove races in Geocoder/LocationProvider Proxy" into gingerbread
Merge commit '98e1f3840f06d3dfea987154da25d5351460d080'

* commit '98e1f3840f06d3dfea987154da25d5351460d080':
  Remove races in Geocoder/LocationProvider Proxy
2010-10-10 17:15:06 -07:00
Mark Vandevoorde
8863c43d9e Remove races in Geocoder/LocationProvider Proxy
The proxy must ensure that enable/disable calls are not reordered when
proxied; this change adds synchronization to prevent such reordering
that could happen following an onServiceConnected() callback, and to
ensure cross-thread visibility of writes.

Also, when the package is updated, the old service instance must be
unbound and the new one bound.  This changes uses a separate
Connection object per service instance (package version) to avoid
confusing the binder objects.

Change-Id: I0907f7eed211b97ccfffa395754f1eb8ea8d8fec
2010-10-05 11:12:48 -07:00
Mike Lockwood
5972e52e15 resolved conflicts for merge of 53b07027 to master
Change-Id: Ia5ce86d84454a4be76e71aeb77942ba8d88d2700
2010-09-30 18:43:52 -04:00
Mike Lockwood
e97ae40dff location: rebind to network location and geocoder services after package update
Change-Id: I2d7db3512b9edd7e0ba27d97442967fc2278e3b9
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-09-30 15:25:54 -04:00
Mike Lockwood
537ce32c71 am 24956d36: am 307aef01: Merge "LocationManager: Hide location provider and geocode provider APIs." into gingerbread
Merge commit '24956d36f46dd7be0b029a7b2b43c1020ae8a4c5'

* commit '24956d36f46dd7be0b029a7b2b43c1020ae8a4c5':
  LocationManager: Hide location provider and geocode provider APIs.
2010-09-20 19:33:58 -07:00
Mike Lockwood
e15735a9e0 LocationManager: Hide location provider and geocode provider APIs.
Also rename Geocoder.isImplemented() to Geocoder.isPresent()

BUG: 3000738
BUG: 3001413

Change-Id: I56bb4e9a9c59f8b79de585eeb168f74c3ff1a853
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-09-20 20:14:34 -04:00
Dianne Hackborn
e746f03c6c resolved conflicts for merge of 53686433 to master
Change-Id: I27004dc464f5771d3205ae5757c6eccc5b16854d
2010-09-13 16:56:10 -07:00
Dianne Hackborn
7e9f4eb260 Track client requests through location manager.
This fixes a problem where applications could ask the location
manager to do very heavy-weight things (like...  say... update
location every minute), which would get accounted against the
system instead of the application because ultimately it is the
system making the heavy calls (wake locks, etc).

To solve this, we introduce a new class WorkSource representing
the source of some work.  Wake locks and Wifi locks allow you
to set the source to use (but only if you are system code and thus
can get the permission to do so), which is what will be reported
to the battery stats until the actual caller.

For the initial implementation, the location manager keeps track
of all clients requesting periodic updates, and tells its providers
about them as a WorkSource param when setting their min update time.
The network location provider uses this to set the source on the
wake and wifi locks it acquires, when doing work because of the
update period.

This should also be used elsewhere, such as in the GPS provider,
but this is a good start.

Change-Id: I2b6ffafad9e90ecf15d7c502e2db675fd52ae3cf
2010-09-13 14:20:48 -07:00
Brad Fitzpatrick
59e6135480 am d71021cb: am 0c731f99: Merge "Send broadcast intent when configured location providers change." into gingerbread
Merge commit 'd71021cb30bd20dabd6783f4235d5f245a7bd1a3'

* commit 'd71021cb30bd20dabd6783f4235d5f245a7bd1a3':
  Send broadcast intent when configured location providers change.
2010-08-27 18:10:38 -07:00
Brad Fitzpatrick
0c5a04014d Send broadcast intent when configured location providers change.
See e.g. http://code.google.com/p/android/issues/detail?id=10042

This is also needed by the power control widget, which has no reliable
way otherwise of staying in-sync.

Change-Id: I8f2b6b79b1843329bae952a25ea56f15e3cf92aa
2010-08-27 14:01:23 -07:00
Adam Bliss
6181f39257 am 27ef0f73: am 9714d2c4: Merge "Don\'t throw an exception from isProviderEnabled and getLastKnownLocation" into gingerbread
Merge commit '27ef0f732c5a97ba88a699b7490045e5370cf51f'

* commit '27ef0f732c5a97ba88a699b7490045e5370cf51f':
  Don't throw an exception from isProviderEnabled and getLastKnownLocation
2010-07-19 09:07:53 -07:00
Mike Lockwood
f4d207b1c2 Don't throw an exception from isProviderEnabled and getLastKnownLocation
if the location provider does not exist.  Instead use the same behavior
as if the provider were disabled in settings
(return false for isProviderEnabled and null from getLastKnownLocation).
This eliminates for a lot of exception handling around some simple
queries to the location manager.

BUG: 2841014

Change-Id: I4fbe0c088e915c90969e13083201dd3e7f4029cb
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-07-17 08:21:33 -04:00
Mark Vandevoorde
2b4140ef1b am a5437f2d: am 88437284: Fix build error (Boolean -> boolean) 2010-05-24 13:47:47 -07:00
Mark Vandevoorde
884372842b Fix build error (Boolean -> boolean)
Change-Id: I2f337e23f4b092de41523f1195546e9d65851c84
2010-05-24 13:40:22 -07:00
Mike Lockwood
7df535b976 am 749afee8: am 1e11e95f: Merge "Add Geocorder.isImplemented()" into kraken 2010-05-24 13:03:22 -07:00
Mark Vandevoorde
01ac80b715 Add Geocorder.isImplemented()
The Geocorder interface is not part of the Android core.  It
requires a backend service which may or may not be available
on a device.  The new isImplemented static method allows
apps to discover whether the Geocorder is in fact available
on the device.

Change-Id: I2b5cf7bcc9cce4766bcbb156e91edf34b01f9296
2010-05-21 15:43:26 -07:00
Mike Lockwood
4d252c484c am dc0ca1d5: am 88262733: Merge "New Location Manager APIs for Criteria based requests and single shot mode." into kraken 2010-05-21 10:40:48 -07:00
Mike Lockwood
03ca216ac1 New Location Manager APIs for Criteria based requests and single shot mode.
Use MS-Assisted mode for single shot GPS fixes if it is supported.

Add finer grained control over accuracy to the android.location.Criteria class
and location criteria logic from LocationManager to LocationManagerService

Change-Id: I156b1f6c6a45d255c87ff917cf3e9726a6d7a75b
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-21 11:47:19 -04:00
Mike Lockwood
105384e360 am 4d0c3083: am c7c856fb: am d2084bb6: am e1d7dca6: Merge "LocationManagerService: Call updateNetworkState on providers that are disabled." into froyo 2010-05-12 09:24:43 -07:00
Mike Lockwood
c7c856fb85 am d2084bb6: am e1d7dca6: Merge "LocationManagerService: Call updateNetworkState on providers that are disabled." into froyo
Merge commit 'd2084bb689bb680eb886d5cfbd27adc6f2e9da1c' into kraken

* commit 'd2084bb689bb680eb886d5cfbd27adc6f2e9da1c':
  LocationManagerService: Call updateNetworkState on providers that are disabled.
2010-05-12 07:55:55 -07:00
Mike Lockwood
f19a785e15 LocationManagerService: Call updateNetworkState on providers that are disabled.
Fixes a problem with Network Location not working after SetupWizard until the
network state changes.

Change-Id: Ief81b76beb5cc90b2ca7d8aa2d4c99221898f01d
BUG: 2671347

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-11 15:35:09 -04:00
Mike Lockwood
00b74270c9 Move files internal to LocationManagerService from framework.jar to services.jar
Change-Id: Iebbfc49b8300ab59730733efdf489ec87ea45a25
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-04-04 18:44:05 -04:00
Mike Lockwood
a03b19272b Preflight before attempting to start network location and geocoder services
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-03-26 10:43:05 -04:00
Mike Lockwood
43e33f2872 Move files internal to LocationManagerService from framework.jar to services.jar
Change-Id: I3dbb40210d87708e0bff46729f707d4ab8e29e42
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-03-26 10:41:48 -04:00
Mike Lockwood
223e84d733 Fix LocationManager.getProvider() API breakage.
getProvider() needs to work for providers that are disabled.
It should only return null if the provider does not exist.

Change-Id: Ieb9fbd8965a10329377bc8ac9d8061cebe519ab5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-03-12 07:51:06 -05:00
Fred Fettinger
3c8fbdf5dd location: dump LocationProvider internal state
For each location provider, call getInternalState() to see if it has any
state information to include in a bugreport. If the returned string is not
null, then print a header with the provided name followed by the returned
string.

Change-Id: I0a388d7fba14ac8cadcb80eda0a0ceb95032410b
Signed-off-by: Fred Fettinger <fred.fettinger@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-03-07 09:29:15 -05:00
Sean Foy
8fff645147 Remove the ProximityAlerts update Receiver when the last ProximityAlert expires.
Fixes issue 6900.

Change-Id: Ifcd3fa9c34cfca02ed5e7a94aded33984ac81c60
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-03-04 21:05:51 -05:00
Mike Lockwood
3b9ef08bbb Don't eat IllegalArgumentExceptions in LocationManagerService.
The exeptions should be returned to the Binder client instead.

Change-Id: I8ab36880622bf8b4fdf28407dec50652c48b6712
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-03-02 10:33:55 -05:00
Joe Onorato
8a9b22056b Switch the services library to using the new Slog 2010-03-01 13:06:50 -08:00
Mike Lockwood
46db504de5 Don't start location providers until the system is ready.
Change-Id: Id545e95705e59ffbaaab8a679a1b7df488813101
BUG: 2461320

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-02-22 20:42:27 -05:00
Dianne Hackborn
21f1bd17b2 Fix issue #2438980: Implement package watcher for voice recognizer service setting
I am getting tired of writing package monitor code, realized this is missing in
a number of places, and at this point it has gotten complicated enough that I
don't think anyone actually does it 100% right so:

Introducing PackageMonitor.

Yes there are no Java docs.  I am still playing around with just what this
thing is to figure out what makes sense and how people will use it.  It is
being used to fix this bug for monitoring voice recognizers (integrating the
code from the settings provider for setting an initial value), to replace
the existing code for monitoring input methods (and fix the bug where we
wouldn't remove an input method from the enabled list when it got
uninstalled), to now monitor live wallpaper package changes (now allowing
us to avoid reverting back to the default live wallpaper when the current
one is updated!), and to monitor device admin changes.

Also includes a fix so you can't uninstall an .apk that is currently enabled
as a device admin.

Also includes a fix where the default time zone was not initialized early
enough which should fix issue #2455507 (Observed Google services frame work crash).

In addition, this finally introduces a mechanism to determine if the
"force stop" button should be enabled, with convenience in PackageMonitor
for system services to handle it.  All services have been updated to support
this.  There is also new infrastructure for reporting battery usage as an
applicatin error report.
2010-02-22 11:27:52 -08:00
Bryan Mawhinney
43cc4696bf Don't return passive location provider unless app has fine permissions. 2010-02-18 13:00:16 +00:00
Mike Lockwood
a4903f254b Add passive location provider.
The passive location provider allows receiving location updates without
actually triggering them.  This allows an application to receive location
updates that are being generated due to other clients of the location manager.

Change-Id: Ibf7a96b089c56875d4f62d3210252ae8d9f32768
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-02-17 18:36:40 -05:00
Mike Lockwood
d03ff94fe5 Clean up interface between LocationManagerService and the location providers:
LocationManagerService now uses new Java interface LocationProviderInterface
rather than LocationProviderProxy to refer to location providers internally.

LocationProviderProxy and the ILocationProvider binder interface are only
used for location providers implemented as services (NetworkLocationProvider)

Built-in location providers (GpsLocationProvider and mock providers) now just
implement LocationProviderInterface rather than using a Binder interface and proxy object.

Delete obsolete and unused TestLocationProvider class.

Change-Id: Id800e7c1864f7c666f8e37125c05896493b9c8c4
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-02-10 09:41:25 -05:00
Mike Lockwood
628fd6d9c1 Network Location unbundling:
The network location and geocode provider services are now started on demand
and their interfaces are now retrieved via bindService().

Remove obsolete LocationManager installLocationProvider() and installGeocodeProvider() methods.

Add abstract class android.location.provider.GeocodeProvider to provide a public wrapper to
the IGeocodeProvider Binder interface. Replaces the LocationManager.GeocodeProvider interface.

Rename LocationProviderImpl to android.location.provider.LocationProvider.

Move LocationManager.reportLocation() to android.location.provider.LocationProvider,
so all methods related to external location providers are now all in one class.

Avoid calling from the Location Manager Service into providers that are disabled so we
do not start the network location service unnecessarily.

Change-Id: If3ed2d5d62b83ba508006711d575cad09f4a0007
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-02-08 23:20:27 -05:00
Suchi Amalapurapu
b56ae20b22 Rename media resource broadcasts
Add checks for fwdlocked and updated system apps
add more tests
remove duplicate adds
2010-02-08 14:52:25 -08:00
Suchi Amalapurapu
08675a3376 Apps on sdcard: Add new broadcasts
Add new broadcasts ACTION_MEDIA_RESOURCES_AVAILABLE and
ACTION_MEDIA_RESOURCES_UNAVAILABLE that get broadcast by
PackageManagerService when sdcard gets mounted/unmounted
by MountService so that packages on sdcard get recognized by
various system services as being installed/available or
removed/unavailable by the system.
The broadcasts are sent before the actual package cleanup which includes
mounting/unmounting the packages and we force a gc right after so
that any lingering file references to resources on sdcard get
released.
2010-02-02 18:33:29 -08:00
Mike Lockwood
0dac8c0f7e LocationManagerService: Fix bug removing proximity alerts.
Alerts were not being removed from the mProximitiesEntered array.

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-01-19 14:00:48 -05:00
Mike Lockwood
34901409a4 Cleanup and add public wrapper for IGeocodeProvider interface to prepare for network location unbundling.
Change-Id: I6523d115b56dbf450121e73d48e151f200827eb4
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-01-05 23:39:29 -05:00
Brad Larson
8eb3ea6597 Use isLocationProviderEnabled to test for enabled providers
LocationManagerService was just checking if the string of (comma-separated)
Location Providers contained the provider we were interested in.  This works
fine in normal cases, but breaks if we add a provider such as test_network.
Enabling test_network causes LocationManagerService to think that the network
provider is also enabled.

The code in Settings.Secure.isLocationProviderEnabled() checks for the commas
in the string as well, to make sure that a provider name which is a substring
of another provider name won't cause problems.  It also centralizes the code
which reads the string.

Signed-off-by: Brad Larson <brad.larson@garmin.com>
2009-12-30 10:22:35 -05:00
Jean-Baptiste Queru
7e2b4f602a merge from open-source master 2009-11-11 08:26:31 -08:00
Alexey Tarasov
f2db9fb0f8 Typo fix in javadoc
@throw -> @throws
@Deprecated -> @deprecated
2009-11-09 16:07:14 -08:00