Commit Graph

499 Commits

Author SHA1 Message Date
Soonil Nagarkar
bf016bb7ea Restore legacy SecurityException behavior
For apps that do not target R+, throw SecurityExceptions within
getProvider().

Bug: 150935354
Test: na
Change-Id: I37e9fc1cbcc1cb6ed941c3905ff253d798fc0ac8
2020-03-09 03:15:51 +00:00
Soonil Nagarkar
5df43c11e5 Quick fix for possible deadlock in LMS
LMS dispatches in-process location events while holding locks, which
can lead to deadlock if combined with another lock. This went from a
possibility to a definitive deadlock with the introduction of the
getCurrentLocation cancel() API. This fix prevents that deadlock by
not holding a lock while canceling. It is still technically possible
for other components to introduce deadlock by using their own locks
within the system process, but as there are very few location clients
inside the system server, and none of them appear to be at risk right
now, a complete fix is delayed until S.

Bug: 149780283
Test: presubmits
Change-Id: I9d202adc65380881969d276c470ef1bf52828e82
2020-03-02 16:42:20 -08:00
Yu-Han Yang
c0fe2bac01 Add comments to messageId, subMessageId and data
Bug: 147768625

Test: doc only and builds
Change-Id: I4a75d0cb015c47caaeaf93acffbca34d9eaea523
2020-02-28 11:39:47 -08:00
Tim Murray
a2668e55dc Merge "LocationManager: cache isLocationEnabledForUser" 2020-02-21 05:04:14 +00:00
Tim Murray
b5e1153d03 LocationManager: cache isLocationEnabledForUser
This method is in the hot path for all location tasks but whether
location is enabled for a particular user doesn't change that
often. Cache the result and invalidate from system_server in order to
reduce CPU consumption.

Test: boots, works, gets location
Bug: 140788621

Change-Id: I84ad2c570e7024187a728071dcbb6f72b177e17a
2020-02-20 17:11:04 -08:00
Soonil Nagarkar
3819f972df Revert requestSetProviderEnabled API
Bug: 144955780
Test: presubmits
Change-Id: Iec8520acfd98b9d9d92a4876ebfa899ac2a0731e
2020-02-19 14:39:58 -08:00
TreeHugger Robot
fe446f7f24 Merge "Fixes to GnssAntennaInfo API" 2020-02-19 20:34:29 +00:00
Sasha Kuznetsov
213bb7097a Fixes to GnssAntennaInfo API
Bug: 148284818
Test: End to end test: run "atest GnssAntennaInfoRegistrationTest" on cuttlefish and watch "adb logcat | grep -i GnssAntennaInfo". Other tests:  atest GnssAntennaInfoTest, atest GnssAntennaInfoProviderTest, atest GnssManagerServiceTest, atest VtsHalGnssV2_1TargetTest, atest LocationManagerFineTest.
Change-Id: I3714ccaed632634c52b882479563593b0bde16fd
2020-02-18 20:03:17 -08:00
Sasha Kuznetsov
e179484c7c Merge "Clarify environment bearing docs in framework API" 2020-02-14 23:53:03 +00:00
Sasha Kuznetsov
20ba50645c Clarify environment bearing docs in framework API
Bug: 149299473
Test: build cuttlefish
Change-Id: Iab7ce87fb872ba4a356633cde3835aa41b29443c
2020-02-13 15:11:41 -08:00
Soonil Nagarkar
a598462fb2 Reduce allocations in hot paths
Prevent lambda allocations in common paths in location.

Test: presubmits
Change-Id: Ia4fc7680e8e4304fcd6164a9aded56ed32492cbc
2020-02-13 09:25:27 -08:00
Soonil Nagarkar
23fcf56454 Add equals/hashcode for GnssStatus
Will help substantially with testing.

Test: presubmits
Change-Id: If1e5a3214c17b75a4cd47de85cfc0af5e62f9866
2020-02-11 19:53:44 -08:00
Sasha Kuznetsov
db44f628cd Merge "Revert^2 "Add GnssAntennaInfo framework APIs" + added fixes" 2020-02-11 22:29:33 +00:00
Soonil Nagarkar
77a9227b19 Fix work profile handling across location
There were a couple problems with work profile state in location. First,
we assumed that notifications sent to parent users would also be sent to
profiles but this is not true. Second we had assumed location status in
profiles was always identical to the parent user, but work profiles may
have user restrictions applied which are not present on the parent user.
The easiest way to handle these issues seems to be to expand LMS user
handling to deal with all users, rather than making various assumptions
which may or may not be true.

This also means we need to store last locations on a per profile basis.
Since we're refactoring how last location works completely, we also
removed the special NO_GPS handling for last locations. With the new
permission strings we now no longer have to exclude gnss based location
from coarsening. This lets us:

1) deprecate and remove various constants and methods use for storing
coarse locations tied to fine locations
2) substantially simplify code that calculated coarse location

This also exposed numerous bugs in the location service where we were
using the current user's state instead of the calling user's state,
which could have exposed the current user's location to other users
inappropriately.

Bug: 148798374
Bug: 146071833
Test: presubmits + manual
Change-Id: I2d3216a9fb58b73d0124d563b05de8870b70b716
2020-02-11 14:04:39 -08:00
TreeHugger Robot
e8759cc707 Merge "Deprecate Gps* APIs" 2020-02-11 21:31:50 +00:00
Sasha Kuznetsov
a68a7a3d23 Revert^2 "Add GnssAntennaInfo framework APIs" + added fixes
fef9247572

Test: End to end test: run "atest GnssAntennaInfoRegistrationTest" on cuttlefish and watch "adb logcat | grep -i GnssAntennaInfo". Other tests:  atest GnssAntennaInfoTest, atest GnssAntennaInfoProviderTest, atest GnssManagerServiceTest, atest VtsHalGnssV2_1TargetTest, atest LocationManagerFineTest.
Bug: 124556515
Change-Id: Ie1a8a60b9d7b9b95335bc84118639e33e0784ca1
2020-02-11 07:52:56 +00:00
Yu-Han Yang
eb1ae5b6bc Merge "Revert "Add GnssAntennaInfo framework APIs"" 2020-02-11 04:16:46 +00:00
Yu-Han Yang
fef9247572 Revert "Add GnssAntennaInfo framework APIs"
Revert "Add GnssAntennaInfo tests"

Revert submission 10111057-pco_pcv

Reason for revert: Build breakage
Reverted Changes:
I70e4014dd:Add GnssAntennaInfo framework APIs
I072958ecb:Add GnssAntennaInfo tests
Ia63a1f502:Add GnssAntennaInfo to HAL

Change-Id: I1934b1061737b417bb903f592c8f51cc65523747
2020-02-11 04:02:18 +00:00
Sasha Kuznetsov
1f11233375 Merge "Add GnssAntennaInfo framework APIs" 2020-02-11 02:54:40 +00:00
TreeHugger Robot
6757132332 Merge "LocationManager: move impl of setLocationEnabledForUser to server" 2020-02-11 00:06:26 +00:00
Sasha Kuznetsov
dcbeb75fc1 Add GnssAntennaInfo framework APIs
Test: End to end test: run "atest GnssAntennaInfoRegistrationTest" on cuttlefish and watch "adb logcat | grep -i GnssAntennaInfo". Other tests:  atest GnssAntennaInfoTest, atest GnssAntennaInfoProviderTest, atest GnssManagerServiceTest, atest VtsHalGnssV2_1TargetTest, atest LocationManagerFineTest.
Bug:124556515
Change-Id: I70e4014dd3959b0570c35bd2aa8bb839ef167d70
2020-02-10 12:29:19 -08:00
Yu-Han Yang
519694b50a Add fullTracking to registerGnssMeasurementsCallback (implementation)
- Currently enableFullTracking has a toggle in Developer Option.
This change adds a system API for the same functionality.
- If at least one of <enableFullTracking in Developer Option> and
<enableFullTracking from the system API> is true, full tracking is
enabled when registering a GnssMeasurement callback.
- For multiple GnssMeasurement callbacks, full tracking is enabled
if *at least* one callback has fullTracking enabled. Removing a callback
might trigger restarting the measurement collection if the aggregated
requirement has changed.

Bug: 147387008

Test: atest GnssMeasurementsProviderTest
      atest GnssManagerServiceTest
      atest GnssMeasurementRegistrationTest

Change-Id: Iedf03edd7053aa0089cfea0d5c0357322f68d9c4
2020-02-10 11:44:20 -08:00
TreeHugger Robot
b146099bc5 Merge "Add enableFullTracking to registerGnssMeasurementsCallback" 2020-02-08 00:44:36 +00:00
Yu-Han Yang
19e74855bb Deprecate Gps* APIs
- should use Gnss* APIs instead

Bug: 149111893

Test: annotation only and builds.
Change-Id: Ida2c61a746731cf0aae84fb69718943fd82e4d51
2020-02-07 14:39:33 -08:00
Yu-Han Yang
f5365989ff Add enableFullTracking to registerGnssMeasurementsCallback
- Internal implementation is in ag/10109000.

Bug: 148284818
Bug: 147387008

Test: builds and existing tests pass.
Change-Id: Ic276dcc8170a24d132770703b33bfc9762bf6b4f
2020-02-07 10:28:49 -08:00
Soonil Nagarkar
41a3654b00 Use compat framework for API behavior
Check compat API behavior using new compat APIs, also use
ActivityManager APIs to properly support user paramters on
APIs.

Bug: 145742912
Test: none
Change-Id: Ic86052b59764ad79404b78ba148aaf3220b3c1e5
2020-02-06 10:19:37 -08:00
Tim Murray
270296da83 LocationManager: move impl of setLocationEnabledForUser to server
Makes caching significantly easier.

Test: boots, works, gets location
Bug: 140788621

Change-Id: Ief39b3a985deea93e0e5f126863a3df383be5fd4
2020-02-05 16:12:17 -08:00
TreeHugger Robot
98bfaaf496 Merge "Remove setLocationExtra per API feedback" 2020-02-01 09:37:01 +00:00
Soonil Nagarkar
b6375a4f7f Create AppForegroundHelper
Create a new helper to deal with application foreground state changes.

1) Rename various Helpers.
2) Move GnssManagerService into location dir.
3) Use new AppForegroundHelper everywhere.
4) Move sendNiRequest to internal API
5) Some refactoring of NetInitiatedActivity

Test: atest AppForegroundHelperTest
Change-Id: Ifffe0e6a34452a18d017c6b190547b904d77b430
2020-01-29 15:23:06 -08:00
Sasha Kuznetsov
424ad90712 Merge "Update jni with measurement_corrections 1.1" 2020-01-25 23:31:42 +00:00
Soonil Nagarkar
56a2a44537 Remove setLocationExtra per API feedback
Bug: 142828735
Test: atest LocationManagerFineTest
Change-Id: I73193dc2484a2b8051c5cff42cd3fcec9a44a015
2020-01-24 13:32:26 -08:00
Soonil Nagarkar
980ce6a741 Add DPM API to request location provider enable
DPM can currently control the master location toggle, but cannot
influence the behavior of individual providers. This adds an API for
DPM (or other privileged entities) to request a provider to turn itself
on.

Practically, this is necessary to allow DPM to control network location,
which may be gated by additional consents. This change also renames some
internal location code to make clearer the distinction between provider
enabled and provider allowed: enabled = location on && allowed

Bug: 136219903
Test: CTS tests to be added
Change-Id: I05f03c976428f0f5a8a2cf627a84dc9e2baf3e67
2020-01-23 18:06:31 -08:00
Yu-Han Yang
c622cdf66c Merge "Add inter-signal bias fields to GnssMeasurement and GnssClock" 2020-01-23 20:35:28 +00:00
TreeHugger Robot
2b13f4e55f Merge "Add IRNSS svid range" 2020-01-23 18:41:40 +00:00
Sasha Kuznetsov
1ebf6158cf Update jni with measurement_corrections 1.1
Test: manually injected dummy measurement corrections in
GnssLocationProvider and verified that cuttlefish implementation
properly recieved them below the HAL
Bug: 145963440
Change-Id: Id659b0fdddd7852012da1bab07d0f26a3abb29af
2020-01-22 21:27:40 -08:00
Yu-Han Yang
ad03c47369 Add inter-signal bias fields to GnssMeasurement and GnssClock
Bug: 147500886

Test: atest GnssMeasurementTest
      atest GnssClockTest

Change-Id: I8adaf1c1b0f6478695ca9b4768568af0ebfb11d4
2020-01-22 16:42:19 -08:00
TreeHugger Robot
c9282b35de Merge "Support SBAS, QZSS and NAVIC navigation messages" 2020-01-22 21:31:08 +00:00
Yu-Han Yang
f81885b06a Support SBAS, QZSS and NAVIC navigation messages
Bug: 147768625

Test: atest GnssNavigationMessageTest
Change-Id: Icc788bd6762d3d8d75d7f92d3b233c05f329a104
2020-01-22 11:43:08 -08:00
TreeHugger Robot
1992ebada9 Merge "Make cN0Db and basebandCn0Db ranges consistent with HAL" 2020-01-22 18:04:30 +00:00
Yu-Han Yang
489465a687 Add IRNSS svid range
Bug: 147675678

Test: doc only and it builds.
Change-Id: I1c88475fd1673e173b3c62524b51ba566c08e85a
2020-01-14 10:55:01 -08:00
Soonil Nagarkar
8df02f452c Refactor providers/managers
Refactor how providers/managers are implemented in LMS, substantially
simplifying code, and opening up further simplification around
permissions in the next change.

Also, limit the number of additional packages providers can have, and
merge WorkSource into ProviderRequest so that providers can pass just
ProviderRequests around, not both.

Test: presubmits
Change-Id: Ic6fab46883cf53eb26368b54a824feac39c57a32
2020-01-09 14:52:50 -08:00
Yu-Han Yang
cb162534b6 Make cN0Db and basebandCn0Db ranges consistent with HAL
Bug: 136136192
Test: existing tests passing
Change-Id: I7ffc40f7f00e3d5e141d10025de6fe7886c61ba7
2020-01-08 12:19:34 -08:00
TreeHugger Robot
8cb0e1cfb7 Merge "Provide defaults and annotations for LocationListener" 2019-12-19 22:15:02 +00:00
Artur Satayev
53fe96661b Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I4bc8c9482e4bb1af21363f951affff7ee3fefeab
2019-12-18 15:42:06 +00:00
Soonil Nagarkar
13cde9694d Provide defaults and annotations for LocationListener
Providing defaults allows lambdas to be used with LocationListener.

Bug: 146355527
Test: presubmits
Change-Id: Ic7b9575c2788b7fcfef91293aa2371a32621f761
2019-12-16 11:47:59 -08:00
Soonil Nagarkar
45cc8691a6 Merge "Remove logspam" 2019-12-10 23:28:33 +00:00
Soonil Nagarkar
76b1d81bfe Remove logspam
Remove upgrade message for getGpsStatus() which is called at a much
greater frequency than register/unregister.

Bug: 146003205
Test: n/a
Change-Id: I32adde8a8cffa649d373fb394b06ef294481c6cf
2019-12-10 13:42:18 -08:00
Wei Wang
c3fabdcad3 Merge "Expose FUSED_PROVIDER to test API." 2019-12-10 21:03:03 +00:00
Soonil Nagarkar
06e37f67de Update location broadcast behavior
Updates location broadcast behavior in preparation for future changes
that will remove writes to LOCATION_PROVIDERS_ALLOWED. These changes
ensure that clients can properly listen for changes to provider enabled
status without being reliant on the deprecated
LOCATION_PROVIDERS_ALLOWED.

Bug: 145752928
Test: presubmits
Change-Id: I073749a895a6a206023290d83ea815a361353460
2019-12-05 12:22:57 -08:00
TreeHugger Robot
2e955bcb7d Merge "Add basebandCn0Dbhz to GnssMeasurement" 2019-12-04 00:54:05 +00:00