231 Commits

Author SHA1 Message Date
Tom O'Neill
184e75146c Warn that SettingInjectorService must be fast
- Move UPDATE_INTENT to SettingInjectorSErvice

Change-Id: I9c8f8dc0878647a051cb852721b3436e9d55b391
2013-08-19 13:13:21 -07:00
David Christie
3e32bdd418 Add comments to new hidden API in LocationRequest.
Document their purpose and permissions required in case
this is unhidden in a different code line.

Change-Id: I42f6f950157f488cf51b361e3411861ff98794e8
2013-08-16 16:16:27 -07:00
David Christie
d0d554579b Merge "Use default class loader when creating a LocationRequest from Parcel. This seems to be the standard usage, and there are rare reports of requestLocationUpdates giving NullPointerExceptions on the first call to requestLocationUpdates but not on subsequent calls (b/10207898)." into klp-dev 2013-08-16 22:55:21 +00:00
David Christie
6de1047278 Ensure LocationRequest's worksource defaults to null
Helps to make sure the service doesn't throw a
SecurityException for not having the UPDATE_DEVICE_STATS
permission.

Change-Id: I9be0302f1378d2c4441e6b7d5ce472ed0d5fbd80
2013-08-16 14:12:59 -07:00
David Christie
def20a3350 Use default class loader when creating a LocationRequest from Parcel.
This seems to be the standard usage, and there are rare reports of
requestLocationUpdates giving NullPointerExceptions on the first call
to requestLocationUpdates but not on subsequent calls (b/10207898).

Change-Id: If7a873fba5a2cd77b836ff3fda89105da20104ac
2013-08-15 16:01:42 -07:00
Tom O'Neill
95b2299dc4 Merge "API for location settings injection" into klp-dev 2013-08-14 00:22:18 +00:00
destradaa
0682809ad0 Add support in the platform for Flp Geofencing.
Change-Id: I0fb0e276d3a06322697bb5d46323779aca1f78c5
2013-08-13 16:00:04 -07:00
Tom O'Neill
fa2992c412 API for location settings injection
- Partial fix for b/10287745

Change-Id: Ie998ce0a7b350e4183fce5753bfac3eb51238ff4
2013-08-13 14:41:22 -07:00
destradaa
1af4b0280a Add FlpHal layer to support Location Batching.
Change-Id: Ia3a57d869dfb3f067a1b95fa66d54f311ddcfdc3
2013-08-08 15:27:38 -07:00
David Christie
c750c1fb83 Update gps status icon to be a "high power" location icon.
Move icon to right side of the screen and synchronize status with
AppOpsManager.OP_MONITOR_HIGH_POWER_LOCATION.

Change-Id: Iea2570501cb18be0489669fd4ea240dc63f9567a
2013-08-08 14:06:25 -07:00
David Christie
40e5782f5c Allow a particular LocationRequest to be excluded from
AppOps monitoring as long as the client as the appropriate
permission (UPDATE_DEVICE_STATS).

Change-Id: I7223a53bc1551e6498302a22eb310c8c5b5684b0
2013-08-01 14:31:48 -07:00
David Christie
82edc9b348 Add WorkSource capability to LocationManager
Change-Id: I0fbbad0879b87ecc75a503bf7963356595bf4b96
2013-07-22 16:50:13 -07:00
Joe Malin
89cded957c am 39069b6e: am efb3726c: am 2b8f3734: am e3c549fc: am cd70c873: Merge "Android U: Making Apps Location-Aware" into jb-mr1.1-docs
* commit '39069b6e82fa848608d56b4efc8f28785816fe27':
  Android U: Making Apps Location-Aware
2013-05-13 23:36:58 -07:00
Joe Malin
39069b6e82 am efb3726c: am 2b8f3734: am e3c549fc: am cd70c873: Merge "Android U: Making Apps Location-Aware" into jb-mr1.1-docs
* commit 'efb3726c226001149c92d48fa50da7031c231490':
  Android U: Making Apps Location-Aware
2013-05-13 23:34:47 -07:00
Joe Malin
3ddba7ee37 Android U: Making Apps Location-Aware
Change-Id: I8f44c6ca6d797ceb8ada5b2c723a8cca0081cf0a
2013-05-13 20:50:22 -07:00
Jaikumar Ganesh
8ce470dd4b GPS Hardware geofencing.
Add support for doing geofencing in hardware.

Change-Id: I6d5015190e8d84e1f4beb1010ed977a71c1622d0
2013-04-10 15:25:07 -07:00
Victoria Lease
54ca7aef2e Annotate Locations coming from mock providers
LocationManagerService now annotates incoming Location objects that
have come from mock location providers. The new isFromMockProvider()
method can be called on any Location to determine whether the
provider that supplied the Location was a mock location provider.

Bug: 6813235
Change-Id: Ib5140e93ea427f2e0b0036151047f87a02b4d23a
2013-01-22 09:39:47 -08:00
Dianne Hackborn
a06de0f29b New "app ops" service.
Initial implementation, tracking use of the vibrator, GPS,
and location reports.

Also includes an update to battery stats to also keep track of
vibrator usage (since I had to be in the vibrator code anyway
to instrument it).

The service itself is only half-done.  Currently no API to
retrieve the data (which once there will allow us to show you
which apps are currently causing the GPS to run and who has
recently accessed your location), it doesn't persist its data
like it should, and no way to tell it to reject app requests
for various operations.

But hey, it's a start!

Change-Id: I05b8d76cc4a4f7f37bc758c1701f51f9e0550e15
2013-01-09 12:47:47 -08:00
Victoria Lease
a5fa049562 am 4b77660b: am 7023b3b0: Merge "clarify Geofence.createCircle() param ranges" into jb-mr1.1-dev
* commit '4b77660b38cfff2ffb67c15db4c9e20adaac41d7':
  clarify Geofence.createCircle() param ranges
2012-11-29 14:28:04 -08:00
Victoria Lease
3dffb8cb69 clarify Geofence.createCircle() param ranges
This commit adds the valid ranges to the latitude/longitude
parameters in Geofence.createCircle()'s javadoc.

Bug: 7172696
Change-Id: Iff6e3c3723d3fd9b6393bbc827ec5755c0d034af
2012-11-27 09:23:52 -08:00
Kenny Root
58ed5d748c am 768d9e1a: Merge "Correct executable bit for source files"
* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
  Correct executable bit for source files
2012-11-07 11:52:12 -08:00
Kenny Root
3a084af2e9 Correct executable bit for source files
Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
2012-11-07 10:27:31 -08:00
Laurent Tu
7ab7f53892 Hide new location APIs and undeprecate old ones
Hide all new location APIs related to LocationRequest/Geofence and
undeprecate all deprecated APIs consequently to the LocationRequest and
Geofence introduction. Also introduce LocationRequestUnbundled for
LocationProviders to use.

Change-Id: I5b116c7d342041f45b341c88a4b6813571118018
2012-11-01 15:22:22 -07:00
Victoria Lease
1e701979a0 Merge "fix NLP for COARSE applications, build FLP with SDK" into jb-mr1-dev 2012-11-01 15:07:56 -07:00
Victoria Lease
779b77455f fix NLP for COARSE applications, build FLP with SDK
In this commit, we provide a means for unbundled location providers
to attach an EXTRA_NO_GPS_LOCATION to the Locations that they report.

We also build FusedLocation against the SDK rather than the internal
tree.

Used in conjunction with I394ded497b8de40d1f85618bff282553cdf378cb
to fix NLP for applications with only ACCESS_COARSE_LOCATION
permission.

Bug: 7453355
Change-Id: Ie696f7abff9ef5237740ab87fe9f537a1c812c54
2012-11-01 13:55:36 -07:00
Scott Main
8761e143c9 docs: Clarify the callback mechanisms for LocationRequest
and clarify horizontal geofencing

Change-Id: I8ff264d7a12c8ec3c79854e008aeeb5f922ad459
2012-11-01 09:54:15 -07:00
Victoria Lease
b17223b6f5 revise android.location.Geofence documentation
Bug: 7172696
Change-Id: Ib1a104ee4a97c51996200b8d456face66178115f
2012-10-24 10:40:07 -07:00
Victoria Lease
2291ca47c7 LocationManager javadoc permission fixes
The javadoc mistakenly claimed that GPS and PASSIVE location
providers could be used with ACCESS_COARSE_LOCATION permissions.
That was incorrect, and the javadoc has been amended.

Bug: 7389249
Change-Id: I6f6489bb539679a962c67ae7263857700df33c82
2012-10-22 12:53:32 -07:00
Victoria Lease
37425c3475 LocationManager permissions cleanup
This commit is the result of a comprehensive permissions review for
MR1 release. It addresses a number of deviations from spec and from
MR0's behavior, bringing MR1 into sync with both.

It also cleans up the concept of "location resolution permission",
representing it internally as an enumerated access level to reduce
reliance on cumbersome string manipulation. There's a function to
convert the enum int into a permission string where needed, too.

Additionally, this confines caller-identity-sensitive calls to the
hopefully-obviously-named "getCallerAllowedResolutionLevel()". This
should make it much easier to prove correctness with respect to
accidentally calling functions that depend upon the caller's identity
after identity has already been shed by Binder.clearCallingIdentity().

Change-Id: I446169aee8fb2fde26ac6d04b479b40253782acb
2012-10-18 09:13:39 -07:00
Laurent Tu
e72fe16146 Prevent overflow in LocationRequest.setExpireIn()
Prevent overflow in LocationRequest.setExpireIn(), for example,
when we pass in Long.MAX_VALUE.

Bug: 7047435
Change-Id: Ie56928a59fb387173fbd3887c0ef9aede00f8152
2012-10-04 13:40:08 -07:00
Victoria Lease
38389b6cf7 Route GPS notifications to all users.
This takes the easy way around notifying the correct users
about GPS state transitions by notifying ALL the users(!).

I've also laid groundwork for proper multiuser support in
LocationManager and did a tiny bit of cleanup in
GpsNetInitiatedHandler while I was looking at notifications.

Bug: 7213552
Change-Id: I2d6dc65c459e55d110ac0f5f79ae7a87ad638ede
2012-10-01 09:09:25 -07:00
Philip Milne
4118012da9 Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()
Change-Id: Ie38952bbaace080e81e41e61350cda172951d548
2012-09-26 11:29:25 -07:00
Philip Milne
73577888ec Fix for bug: #7172778. Javadoc errors in LocationManager.
Change-Id: Iaebd4cf00c8a33bcf4fc74eaa1dfec9675032826
2012-09-25 12:58:26 -07:00
Philip Milne
bc391d58c8 Merge "Revert "Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()"" into jb-mr1-dev 2012-09-24 11:41:53 -07:00
Philip Milne
53fe756772 Revert "Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()"
This reverts commit 2f6d8829524dfca3a77e9a57c3b9c3862209877d

Change-Id: Id5af767a09fc319127c4ebef837c5b7a7f75cb01
2012-09-24 11:38:29 -07:00
Philip Milne
b00df8e929 Merge "Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()" into jb-mr1-dev 2012-09-24 11:02:31 -07:00
Victoria Lease
17e3e9e53c Merge "Do not use passive GPS data for COARSE only apps." into jb-mr1-dev 2012-09-23 15:06:59 -07:00
Philip Milne
2f6d882952 Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()
Change-Id: I71c24ea10093ece07a0780e97bc641ff548c1a44
2012-09-21 15:54:41 -07:00
Victoria Lease
09016ab4dd Do not use passive GPS data for COARSE only apps.
FusionEngine now attaches a secondary location that has never seen
GPS data to its result. LocationFudger uses the GPS-less location so
that COARSE apps never see data from the GPS provider.

When the previous location is updated, the previous GPS-less location
is carried over if the location update was GPS-only.

Additionally, apps without FINE permission are not notified when GPS
location changes, and any attempt to use GPS_PROVIDER without FINE
permission is met by a stern SecurityException.

Bug: 7153659
Change-Id: I12f26725782892038ce1133561e1908d91378a4a
2012-09-21 13:45:41 -07:00
Romain Guy
8a624ef0fe API REVIEW: Undeprecate Location.dump()
Bug #7173109

Change-Id: Ia2f4a5b6255dae7ace4702f7d66ec30a077c9c79
2012-09-21 11:20:00 -07:00
Victoria Lease
4fab68b532 Require ACCESS_FINE_LOCATION for Geofence use.
Bug: 7153226
Change-Id: I49236379e739fcda66bbc9a31cfdca9a87122aec
2012-09-13 14:17:41 -07:00
Nick Pelly
1332b53522 Fix some location issues exposed by CTS.
Change-Id: I5859ee2c9db5745b0a3bc8abfa8f08728fb25059
2012-08-21 16:26:26 -07:00
Nick Pelly
5584b497b7 Print timestamp (instead of age) in Location#toString()
Age was a bad idea, since it depends when toString() was called

Change-Id: Ica0b6bfa9a93b5a452ba3def5fbb2b0a0194c401
2012-08-21 13:52:20 -07:00
Nick Pelly
4035f5a7c1 Port location blacklist code to MR1.
I had to re-do this change for MR1 because LocationManagerService changed
so much. Here is the original change description:

Add package-name-prefix blacklist for location updates.

The Settings.Secure value locationPackagePrefixBlacklist and
locationPackagePrefixWhitelist contains comma seperated package-name
prefixes.

Location & geo-fence updates are silently dropped if the receiving
package name has a prefix on the blacklist. Status updates are
not affected. All other API's work as before.

A content observer is used so run-time updates to the blacklist
apply immediately. There is both a blacklist and a whitelist.
The blacklist applies first, and then exemptions are allowed
from the whitelist. In other words, if your package name prefix
matches both the black AND white list, then it is allowed.

Bug: 6986553
Change-Id: I1e151e08bd7143e47db005bc3fe9795076398df7
2012-08-17 15:25:16 -07:00
Nick Pelly
4e31c4fffb Add javadoc for new location API's.
Change-Id: If15024ee88421c07ba3a174747774fc451fd002e
2012-08-16 17:59:34 -07:00
Nick Pelly
74fa7eabda Improve coarse locations.
Fix a couple of bugs, and modify the behavior of the random offset.

The random offset now slowly changes over time, to mitigate against
applications averaging out the offset over time while at a
grid boundary.

Change-Id: Iecffff29145b8c2b30d1eca1662cf9d3e8cff756
2012-08-16 15:22:24 -07:00
Nick Pelly
08ca1046fe Fix a couple of bugs from the location overhaul.
Marshall LocationRequest array correctly.

Observe reportLocation from FusionEngine.

Actually deliver the setRequest message to fusion engine.

Change-Id: Iff64596fdd42f9fb06e563591dda9fbe0241533a
2012-08-10 17:17:32 -07:00
Nick Pelly
3914e4b7d1 Remove LocationManager#getLastKnownLocation(Criteria).
This was never a public API, so we don't need to follow
an orderly deprecation. And it breaks a CTS test:

cts/tests/tests/location/src/android/location/cts/LocationManagerTest.java:521: reference to getLastKnownLocation is ambiguous, both method getLastKnownLocation(java.lang.String) in android.location.LocationManager and method getLastKnownLocation(android.location.Criteria) in android.location.LocationManager match
            mManager.getLastKnownLocation(null);
                    ^

Change-Id: I503267e4fa577ce4bf684239da777f11b0e511f5
2012-08-10 15:27:38 -07:00
Nick Pelly
6fa9ad4afc Location overhaul, major commit.
Themes: Fused Location, Geofencing, LocationRequest.

API changes
o Fused location is always returned when asking for location by Criteria.
o Fused location is never returned as a LocationProvider object, nor returned
  as a provider String. This wouldn't make sense because the current API
  design assumes that LocationProvider's have fixed properties (accuracy, power
  etc).
o The fused location engine will tune itself based on the criteria passed
  by applications.
o Deprecate LocationProvider. Apps should use fused location (via Criteria
  class), instead of enumerating through LocationProvider objects. It is
  also over-engineered: designed for a world with a plethora of location
  providers that never materialized.
o The Criteria class is also over-engineered, with many methods that aren't
  currently used, but for now we won't deprecate them since they may have
  value in the future. It is now used to tune the fused location engine.
o Deprecate getBestProvider() and getProvider().
o Add getLastKnownLocation(Criteria), so we can return last known
  fused locations.
o Apps with only ACCESS_COARSE_LOCATION _can_ now use the GPS, but the location
  they receive will be fudged to a 1km radius. They can also use NETWORK
  and fused locatoins, which are fudged in the same way if necessary.
o Totally deprecate Criteria, in favor of LocationRequest.
  Criteria was designed to map QOS to a location provider. What we
  really need is to map QOS to _locations_.
  The death knell was the conflicting ACCURACY_ constants on
  Criteria, with values 1, 2, 3, 1, 2. Yes not a typo.
o Totally deprecate LocationProvider.
o Deprecate test/mock provider support. They require a named provider,
  which is a concept we are moving away from. We do not yet have a
  replacement, but I think its ok to deprecate since you also
  need to have 'allow mock locations' checked in developer settings.
  They will continue to work.
o Deprecate event codes associated with provider status. The fused
  provider is _always_ available.
o Introduce Geofence data object to provide an easier path fowards
  for polygons etc.

Implementation changes
o Fused implementation: incoming (GPS and NLP) location fixes are given
  a weight, that exponentially decays with respect to age and accuracy.
  The half-life of age is ~60 seconds, and the half-life of accuracy is
  ~20 meters. The fixes are weighted and combined to output a fused
  location.
o Move Fused Location impl into
  frameworks/base/packages/FusedLocation
o Refactor Fused Location behind the IProvider AIDL interface. This allow us
  to distribute newer versions of Fused Location in a new APK, at run-time.
o Introduce ServiceWatcher.java, to refactor code used for run-time upgrades of
  Fused Location, and the NLP.
o Fused Location is by default run in the system server (but can be moved to
  any process or pacakge, even at run-time).
o Plumb the Criteria requirements through to the Fused Location provider via
  ILocation.sendExtraCommand(). I re-used this interface to avoid modifying the
  ILocation interface, which would have broken run-time upgradability of the
  NLP.
o Switch the geofence manager to using fused location.
o Clean up 'adb shell dumpsys location' output.
o Introduce config_locationProviderPackageNames and
  config_overlay_locationProviderPackageNames to configure the default
  and overlay package names for Geocoder, NLP and FLP.
o Lots of misc cleanup.
o Improve location fudging. Apply random vector then quantize.
o Hide internal POJO's from clients of com.android.location.provider.jar
  (NLP and FLP). Introduce wrappers ProviderRequestUnbundled and
  ProviderPropertiesUnbundled.
o Introduce ProviderProperties to collapse all the provider accuracy/
  bearing/altitude/power plumbing (that is deprecated anyway).
o DELETE lots of code: DummyLocationProvider,
o Rename the (internal) LocationProvider to LocationProviderBase.
o Plumb pid, uid and packageName throughout
  LocationManagerService#Receiver to support future features.

TODO: The FLP and Geofencer have a lot of room to be more intelligent
TODO: Documentation
TODO: test test test

Change-Id: Iacefd2f176ed40ce1e23b090a164792aa8819c55
2012-08-10 14:57:09 -07:00
Nick Pelly
48c5eb018b DO NOT MERGE. Add package-name-prefix blacklist for location updates.
The Settings.Secure value locationPackagePrefixBlacklist and
locationPackagePrefixWhitelist contains comma seperated package-name
prefixes.

Location & geo-fence updates are silently dropped if the receiving
package name has a prefix on the blacklist. Status updates are
not affected. All other API's work as before.

A content observer is used so run-time updates to the blacklist
apply immediately. There is both a blacklist and a whitelist.
The blacklist applies first, and then exemptions are allowed
from the whitelist. In other words, if your package name prefix
matches both the black AND white list, then it is allowed.

Change-Id: I4ea2ad56fa6bd75d32151bc250ac25c26a5777c4
2012-07-30 13:17:30 -07:00