Commit Graph

807 Commits

Author SHA1 Message Date
Soonil Nagarkar
d9df33d1c0 DO NOT MERGE: Always return non null from getGpsStatus
Even though getGpsStatus is marked Nullable, some applications expect it
to always return non-null.

Bug: 161311411
Test: presubmits
Change-Id: I8d58621588253af1dc917711e230cfd176afec37
2020-07-15 13:12:54 -07:00
Kevin Hufnagle
4bef972b77 Merge "docs: Fix link to loc. Google Play services API" into rvc-dev 2020-07-13 22:24:25 +00:00
Soonil Nagarkar
7b6e6089af DO NOT MERGE: Keep old callback thread
Discrepency between documented and delivered thread in prior versions
got confused. Switching back to the main thread for delivery when not
specified.

Bug: 160565229
Test: presubmit only
Change-Id: I6deaf08e2045771c120aa2eb35c64b392208bd58
2020-07-06 16:31:35 -07:00
Kevin Hufnagle
98bcf11078 docs: Fix link to loc. Google Play services API
The API reference is now on developers.google.com.

Bug: 158305546
Change-Id: Ib116ae2e83fa9282a58b528773d52c5a048538d8
Test: none
2020-07-01 23:18:23 +00:00
Soonil Nagarkar
e007303822 DO NOT MERGE: Fix array casting bug
Bug: 159701638
Test: presubmits
Change-Id: Ib11f899d9b612b6325fda53b61e165613c881972
2020-06-23 14:32:12 -07:00
Soonil Nagarkar
8bd4db2620 Fix deadlock for system location clients
Bug: 158637743
Test: manual
Change-Id: I0fd2f2ac8cc4c81014e67d1115a2343b95b7cecf
2020-06-11 11:58:23 -07:00
TreeHugger Robot
e93814953c Merge "Remove unused intent in NiNotification" into rvc-dev 2020-06-09 22:26:42 +00:00
Yu-Han Yang
50bf07e963 Remove unused intent in NiNotification
Bug: 154319182
Test: manual
Change-Id: I5958a8fb442cf4506e1824243493f91aea34a7cc
2020-06-08 14:59:23 -07:00
Ruchir Rastogi
ef0904eac0 Move GnssStats puller to binder thread
Pass direct executor to setPullAtomCallback. This causes the puller to
run directly on the binder thread, as opposed to the Background thread,
which could be busy with other work.

This change means that the puller can be executed concurrently. To
properly handle that, the Statistics class is made thread-safe.

Test: adb shell cmd stats pull-source 10074
Bug: 157186182
Change-Id: I6c0940fd4ed231f9d962981cc1f9e8c983c48f7f
2020-06-05 14:08:37 -07:00
Ruchir Rastogi
5ea18c9036 Partial CP of ag/10846962
CP to rvc-dev to avoid automerger conflicts for ag/11727208.

Test: m
Bug: 157186182
Change-Id: I1b2dc636b90e6a643a2d5722022671563955f96a
Merged-In: I1eb1dfb68190c68e896e87c5bea1f2ec44065e80
2020-06-05 14:05:01 -07:00
Soonil Nagarkar
07c129cb1a DO NOT MERGE Don't crash if already unregistered
Bug: 155284432
Test: manual
Change-Id: Id04ab9093b9cd4c837058442a8d0e04ff4dde051
2020-05-05 13:18:24 -07:00
Yu-Han Yang
deecba6a54 Invoke GnssStatus listeners on caller's thread
Bug: 155440682

Test: tests passing
Change-Id: Ic1655b17f17ce58540c651c0f4ffad1e7878e2c1
Merged-In: I7aaa2b8258204a11016756ffd733dcb986e8d862
2020-05-01 16:29:27 +00:00
Yu-Han Yang
8c7011ad8f Update javadoc of getCodeType to add BDS B1C
Bug: 154267746

Test: javadoc only
Change-Id: I2a4391645c8c1315cfb9526ea796562422b3c03c
2020-04-17 02:48:38 +00:00
Soonil Nagarkar
4523f96ff1 DO NOT MERGE Add utilities for creating AppOps listenerIds
Use utilities to support location listenerIds.

Bug: 153687899
Test: presubmits
Change-Id: Ie138c98a5f864490c6560166b652ea9509fa8728
2020-04-14 19:04:41 -07:00
Soonil Nagarkar
9d11b38184 Fix initialization bug in LocationRequest
Bug: 153516795
Test: atest BatterySavingLocationTest && manual
Change-Id: I32f7813b16ed747f1da8066714803e7f85ffb5b4
2020-04-08 14:01:17 -07:00
Soonil Nagarkar
45e623c63a DO NOT MERGE Add listener ids for location listening operations
Bug: 153257294
Test: presubmits
Change-Id: I12654a3afac5362383caba3cea1c5e0a2b8ce1d9
2020-04-07 17:48:48 -07:00
Soonil Nagarkar
c4f8716720 Fix up LocationRequest and ProviderRequest
-Use more idiomatic and efficient parceling
-Cleanup LocationRequest a bit

Bug: 151026407
Test: presubmits
Change-Id: I3865421a128417a5096e39ee110139a13ab9ab3b
2020-04-01 11:06:12 -07:00
Soonil Nagarkar
39766392a7 DO NOT MERGE Refactor appops across location
-Add a new app ops helper to make testing easier.
-Consolidate app identity within CallerIdentity class.
-Remove location age restriction for coarse locations, was a bit
arbitrary.
-Remove listener identifiers from LM. These were not being properly
propagated and add a lot of binder overhead with what appears to be
little benefit since we have featureIds, which contain much better
information.
-Remove appops checks from some GNSS APIs that shouldn't require it.
-Move location fudger into location providers and reset them after mock
providers are used so that offset information cannot be leaked.

Bug: 149375028
Test: presubmits + manual
(cherry picked from commit 6033344baa)
Change-Id: I18e2cf3c39836f31d28180e1a4613df4ad675ab7
2020-03-28 13:59:26 -07:00
Soonil Nagarkar
8aea09fecd DO NOT MERGE Don't lock listener delivery
Previous versions of GNSS listeners commited to not holding locks even
when running directly unfortunately. We do some extra work to avoid
holding locks while running listeners.

Bug: 151291181
Test: manual
Change-Id: I0b7f46c30df2f97ce11db45b69443a9994885309
2020-03-18 19:17:52 -07:00
Yu-Han Yang
b4f806f07f Update inter-signal bias (framework)
- Rename recieverInterSignalBiasNs into interSignalBiasNs, which refers
to the sum of receiver ISB and satellite ISB.

Bug: 150724332

Test: atest GnssMeasurementTest
Change-Id: I322cbe42d24d1f0fe60351c47579323a8715d4d7
2020-03-17 20:42:53 +00:00
Philip P. Moltmann
12ac3f406f Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 19:26:10 +00:00
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
Tej Singh
72a70a8a3c Address Puller API Feedback
1. Rename registerPullAtomCallback to setPullAtomCallback
2. Rename unregisterPullAtomCallback to clearPullAtomCallback
3. Add getters to PullAtomMetadata
4. Change Ns to Millis (when I tried to make it Nanos, I received a
built time error saying to prefer millis unless we need the precision.
We do not need the precision, so I changed it).
5. Fix out of order params.

I did not change usePooledBuffer to setPooledBuffer because I think use
is more appropriate for our use case.

Test: make
Test: atest PullAtomMetadataTest
Test: atest GtsStatsdHostTestCases
Bug: 149475498

Change-Id: Ib07aa57a6e02c77917fe0e65a3d4a77c00ce8565
2020-03-05 16:43:02 -08: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
Blake Kragten
e4383d8999 Merge "GnssMetrics" 2020-02-21 22:15:29 +00: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
Blake Kragten
6ce382a372 GnssMetrics
These metrics will pull different metrics that tell the performance of the gnss subsystem.

Metrics include:
Location reports
% of location failure
Num times GPS had to first fix
Mean time to first fix on signal
Num position accuracy logs
Mean position accuracy in meters
Num top 4 Cn0 messages
Mean top 4 average Cn0 (signal quality)
Num L5 top 4 Cn0 messages
Mean L5 top 4 average Cn0 (signal quality)
Num Satellite status messages received
Num of Satellites used in fix
L5 Satellite status messages received
L5 of Satellites used in fix

metric_id: 1111
gauge_metrics {
  data {
    bucket_info {
      atom {
        gnss_stats {
          location_reports: 12
          location_failure_reports: 3
          time_to_first_fix_reports: 2
          time_to_first_fix_milli_s: 43588
          position_accuracy_reports: 9
          position_accuracy_meters: 112
          top_four_average_cn0_reports: 31
          top_four_average_cn0_db_mhz: 734711
          l5_top_four_average_cn0_reports: 1
          l5_top_four_average_cn0_db_mhz: 21500
          sv_status_reports: 1015
          sv_status_reports_used_in_fix: 100
          l5_sv_status_reports: 7
          l5_sv_status_reports_used_in_fix: 0
        }
      }
      elapsed_timestamp_nanos: 537249375445
      start_bucket_elapsed_millis: 522186
      end_bucket_elapsed_millis: 549283
    }
  }
}
time_base_elapsed_nano_seconds: 9283624934
bucket_size_nano_seconds: 60000000000
is_active: true

Bug: 147910698
Test: On Device using test script and gnsslogger.apk
>  make statsd_testdrive
>  ./out/host/linux-x86/bin/statsd_testdrive <ATOM_ID>

Change-Id: I92461eb8533ec810bb67d76a25931295cfa1efbd
2020-02-19 17:07:11 -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