Commit Graph

557 Commits

Author SHA1 Message Date
Soonil Nagarkar
afec5ccf72 Assorted cleanup and refactoring
Will minimize future changes:
-Never return null GpsStatus to avoid breaking legacy clients
-Allow null location callback complete callbacks
-Return void from sendExtraCommand
-Combine appops and permissions checks into a single helper
-Allow passive provider to remember last locations even when there is
no active passive request.
-Add a couple new injectable helpers to support future changes along
with fakes for testing.

Test: presubmits + manual
Change-Id: If22bee787c5ab5c8c09d20e4742a8b5d1b7f0b59
2020-07-23 13:50:15 -07:00
Kevin Hufnagle
ab5d24346a Merge "docs: Fix link to loc. Google Play services API" into rvc-dev am: 4bef972b77 am: 9a16d1a934 am: aacf1ce9ac am: 941fb17fd4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12063133

Change-Id: If4bed43797bc1756ec575e7571e8d61594595cf1
2020-07-13 23:36:39 +00: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
f71511387c Deprecate high power location broadcast
This can be replaced by listening directly for appops changes.

Test: manual + presubmit
Change-Id: Ib84fbeebd7be25f4a1b097b65137777030805132
2020-07-09 11:13:51 -07:00
Soonil Nagarkar
cab87314a5 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: I3461f16278a38082f7101b83e9e23b1e30c949b0
2020-07-08 17:39:19 -07: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
1d7e0baad5 Remove onRemoved callbacks
Removes the necessity for LMS to call back into client code to inform
the client that a location listener has been removed. This is replaced
with weak references instead, which allows the garbage collector to
handle cleanup instead. This simplifies LMS implementation and makes it
less buggy.

Also includes some rewrites of getCurrentLocation to use a dedicated
AIDL interface now that the onRemoved channel is no longer available,
as well as various other minor refactors.

Test: manual + presubmits
Change-Id: Ic61ce278c44e23bc5da5b703f89f6e656e89dea2
2020-06-29 20:01:59 -07: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
c25f4f1d0e Various small fixes
Test: manual
Change-Id: Id9874dd034aae96d540fac7c580c6689e25f44e8
2020-06-22 13:55:45 -07:00
TreeHugger Robot
3ec36c460e Merge "Fix deadlock for system location clients" into rvc-dev am: b297119cdb am: 243af9e9cf am: 27ec4f69b8 am: aba492eb0e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11839901

Change-Id: I9a84e3a8219836513d70369c30c5390467d679d1
2020-06-11 22:35:18 +00: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
Soonil Nagarkar
6fb00bb22b Remove permission info from CallerIdentity
Location permission info is 1) location specific and 2) may change over
time, and thus shouldn't be in CallerIdentity. This CL moves the
information (temporarily) into LocationRequest. Follow up CLs will
include deeper refactors that eliminate the need for this information to
be in LocationRequest as well.

Test: manual + presubmits
Change-Id: I3b4b41941e386f644efce2effe6985b9c865586c
2020-06-03 19:17:32 -07:00
Soonil Nagarkar
7f78f206b7 Adopt new ListenerTransport framework
This makes all LM listeners static, saving memory across LM instances in
an application. In addition, listeners for rarely used APIs such as GNSS
APIs are now initialized on-demand to save memory. Finally, the new
transport framework is adopted for location listeners, which means a new
transport object will be used for every location request, eliminating
several edge case bugs around listener removal.

Test: manual + cts
Change-Id: I1f374248baf695323177f347873fed72841f85d0
2020-05-31 23:12:47 -07:00
Soonil Nagarkar
fb272095ad Refactor GeofenceManager
-Makes geofence manager work synchronously so that testing is not flaky
-Adopts ListenerMultiplexer for geofence listeners so that logic is
shared across location code
-Adds support for location blacklisting and background users
-Substantially reduces the CPU overhead of maintaining listeners
-Adds worksource support to geofencing so power blame is done correctly
-Adds new feature id for geofencing

Test: manual + presubmit
Change-Id: If55bc18f202debf7dd183f0120a24e8f75623ce8
2020-05-20 14:08:03 -07:00
TreeHugger Robot
828ffbe9ed Merge "Fix invalid null executor in registerGnssStatusCallback" 2020-05-20 17:34:53 +00:00
Neil Fuller
13d6ad7739 Merge "Remove LocationTimeZoneProviderRequest.workSource" 2020-05-20 11:48:46 +00:00
Yu-Han Yang
2c248c896f Fix invalid null executor in registerGnssStatusCallback
Bug: 157102461
Test: manual
Change-Id: Ie9e70003124ba40587348276b9f3689a6abdde5f
2020-05-19 22:19:39 -07:00
Neil Fuller
3575562606 Remove LocationTimeZoneProviderRequest.workSource
Remove LocationTimeZoneProviderRequest.workSource and correct some docs.

Bug: 152744911
Test: treehugger only
Change-Id: Ibd26886a1c4e66507bbcaafc5132b615e5af443e
2020-05-19 18:27:02 +01: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
Svetoslav Ganov
13308eb260 Merge changes from topic "RVC-SDK-Finalization-master"
* changes:
  Revert an API breaking changes
  Updating platform SDK version for R
2020-05-02 15:13:07 +00:00
Svet Ganov
ea8a2145c9 Revert an API breaking changes
bug:150281259

Test: N/A

Change-Id: Ie30286456af15dd7b81bceb0547ffe8bfac422d2
2020-05-01 15:25:51 -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
d0dfc78e11 Invoke GnssStatus listeners on caller's thread
Bug: 155440682

Test: tests passing
Change-Id: I7aaa2b8258204a11016756ffd733dcb986e8d862
2020-05-01 16:28:24 +00:00
TreeHugger Robot
fffa4e4d86 Merge "Update javadoc of getCodeType to add BDS B1C" into rvc-dev am: 6569339663 am: 957bbd35e4 am: 0bad77936a am: e5150b170e
Change-Id: I6ca43024225056efe9fa9964aa970d2f14ce1306
2020-04-17 23:39:05 +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
8ecc688a38 Add utilities for creating AppOps listenerIds
Use utilities to support location listenerIds.

Bug: 153687899
Test: presubmits
Change-Id: I269661556e48218fc76e5abc2099bed4c2d667cc
2020-04-15 17:13:02 -07: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
490c46ca8c Refactor and reorganize listener multiplexers
-Rename manager -> multiplexer where appropriate
-Split into client/server files/packages to minimize amount of code
going into client and keep complexity server side.
-Make GNSS listeners respect location blacklist.
-Add tests.

Test: presubmits + manual
Change-Id: I368e1c6aab1b9bcc1ff771a050431abc8e9c4c00
2020-04-13 11:13:49 -07:00
Neil Fuller
714fa9a76b Merge "Minimal skeleton for location time zone providers" 2020-04-09 11:00:41 +00:00
TreeHugger Robot
e1d4509084 Merge "Fix initialization bug in LocationRequest" into rvc-dev am: a23f461e1b am: 22d8e598c4 am: e6b437581a am: 8481c777c3
Change-Id: Ibc92e4c2bf325c908e37d7a7aa1e74c60b328473
2020-04-09 01:00:16 +00: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
Neil Fuller
0970a9bbb6 Minimal skeleton for location time zone providers
Minimal skeleton for location time zone providers. Most behavior has
been stripped and more detail will be added later.

Test: atest services/tests/servicestests/src/android/location/timezone/LocationTimeZoneEventTest.java
Test: services/tests/servicestests/src/com/android/internal/location/timezone/LocationTimeZoneProviderRequestTest.java
Change-Id: I64102df0970e6cfbcc07c9377b226c8663a29a74
2020-04-08 12:11:58 +01: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
a758407867 Add listener ids for location listening operations
Bug: 153257294
Test: presubmits
Change-Id: I077c6cbb25c79701c36052891a4b0959f7124dbe
2020-04-07 13:56:10 -07:00
Soonil Nagarkar
7fe47adb41 Merge "Fix up LocationRequest and ProviderRequest" into rvc-dev am: 240eaaaaab am: 293347f282 am: 14f734fbed am: d8f077de28
Change-Id: I49e0d5ec63fca56395fee5463633c21cff73f06d
2020-04-02 20:25:51 +00: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
99a2a72529 Make GnssStatus a Parcelable
This saves 24 bytes per serialization and makes code simpler. Also
includes some cleanup in GnssMetrics.

Bug: 152442920
Test: presubmits
Change-Id: I1eb1dfb68190c68e896e87c5bea1f2ec44065e80
2020-03-26 14:36:08 -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
9822fa4ff5 Merge "Update inter-signal bias (framework)" into rvc-dev am: f7fcee236e am: 644308c8bc am: 1a4be9a822 am: df40da0489
Change-Id: I8f5188fe3c9be87261233624563776a8d33ae8ea
2020-03-18 19:04:46 +00: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
Soonil Nagarkar
f29d776667 Rename featureId to attributionTag
Test: presubmits
Change-Id: I6643a2a32057d3a4e0b96b5fa785b68ec2b302b0
2020-03-16 09:55:06 -07: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
Philip P. Moltmann
8a06c2870e 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
2020-03-11 23:52:32 +00:00
Soonil Nagarkar
6cc3fce90a Remove remaining LOCATION_PROVIDERS_ALLOWED usages
Bug: 148963686
Test: presubmits
Change-Id: I8dbc8d4f20a63398348547dc3a6467367b9fc8d8
2020-03-11 12:11:37 -07:00
Automerger Merge Worker
5eb75138e1 Merge "Restore legacy SecurityException behavior" into rvc-dev am: 0ea91490c5 am: 9942a42bd6 am: 963cc1a02f am: d1b373fef8 am: b62baf2ea9
Change-Id: I95450ce350d170bf1997e6a3880cea4e0186e822
2020-03-09 22:00:44 +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
Soonil Nagarkar
1eb8014bd2 Merge "Give location providers a known identity" 2020-03-04 23:05:49 +00:00
Soonil Nagarkar
470c8f6a3f Give location providers a known identity
Providers no longer need the ability to specify additional packages,
this can be replaced with tracking the provider identity.

In addition, move CallerIdentity into the client space, and fix some
minor GNSS bugs.

Bug: 149839935
Test: atest LocationProviderTest
Change-Id: Ide107abc61531946b20d2ac50cd9555fc215ef03
2020-03-04 12:38:31 -08:00