Commit Graph

930 Commits

Author SHA1 Message Date
TreeHugger Robot
a44e3df0c9 Merge "Fix bug in getCurrentLocation cancellation" 2020-09-22 01:25:10 +00:00
Soonil Nagarkar
43a368dc19 Fix bug in getCurrentLocation cancellation
Cancellation was not being propagated to the system server due to a
misunderstanding on how CancellationSignal functions. There is no
noticable impact for the user, as cancellation did properly prevent any
further locations, however this would have resulted in limited extra
power draw since the system server would not have canceled the
associated provider location request. Impact is limited since
getCurrentLocation() was limited to a 30s duration anyways.

Bug: 168666216
Test: manual + presubmits
Change-Id: I5c77db4cc56cce1b984587f65d2bcfb488436bb8
2020-09-21 14:15:47 -07:00
Soonil Nagarkar
69d87137be Improve LocationRequest appcompat
Fix a bug where we were overstrict in validating legacy location
requests, and didn't cover all possible legacy inputs. Specifically,
clients that pass in Long.MAX_VALUE as the interval - unclear why any
client would want to do this, but nevertheless, it was allowed.

Bug: 168927418
Test: presubmit
Change-Id: Iaa604da6dee9e860f13abe0a74853579f757e249
2020-09-21 09:22:57 -07:00
Soonil Nagarkar
87b8cc3866 Refactor ListenerMultiplexer with new capabilities
-Store tag string in multiplexer rather than duplicating in every
registration.
-Add support for failure callbacks at listener operation submission
time, in addition to within the listener operation itself.
-Extract request out of ListenerRegistration and into subclass, so that
the multiplexer does not need to have any knowledge of requests.
-New multiplexer specific execute and failure callbacks within
registrations objects, with strongly typed listener operation objects.
-Fixed resetService() to work properly even if the service is still
registered.
-Added registration info as an argument to registerWithService() so that
this doesn't need to be duplicated if a client wants access to this
information.
-Narrow exception handling so that only the proper exception
(RemoteException for binder calls for instance) results in registration
removal, and other unexpected checked exceptions should still crash the
process.
-Various other minor fixes.

Test: manual + presubmit
Change-Id: I6fdec313222ff1ef01a1aa4d27d8ee56b4be25d4
2020-09-18 10:08:11 -07:00
TreeHugger Robot
559bf65528 Merge "Additional API change after feedback" 2020-09-16 17:47:03 +00:00
Soonil Nagarkar
f2bc6ba3a0 Fix up provider internal/external APIs
-Encapsulate various fields
-Bring naming in line with API guidelines
-Minor refactoring

Bug: 168621146
Test: manual
Change-Id: I55681a3d84d7833c98569a13a57e6c4f0b728a67
2020-09-15 17:13:46 -07:00
Soonil Nagarkar
12c2c5c949 Additional API change after feedback
Bug: 168624248
Test: manual
Change-Id: I61a85b84af20f339d68541f45ad53fe09e8d176c
2020-09-15 13:24:40 -07:00
Soonil Nagarkar
7926062e1f Merge "Make LocationRequest a public API" 2020-09-14 16:20:23 +00:00
Soonil Nagarkar
757380517b Make LocationRequest a public API
LocationRequest and associated APIs have historically always been
SystemApi, for no real reason. In keeping with the Android-wide push to
clean up API surfaces like this, we make LocationRequest a public API.

Bug: 166692379
Test: manual + presubmits
Change-Id: I6a93fca1a5613c96bf35da158bc542e47864dbff
2020-09-11 12:29:50 -07:00
Neil Fuller
a32bde83cd Merge "Small docs fix" 2020-09-08 18:13:27 +00:00
Neil Fuller
076aaa5e81 Merge "Small fixes to basic classes and refactorings" 2020-09-04 15:57:03 +00:00
Neil Fuller
7c552b3786 Small fixes to basic classes and refactorings
Small fixes to basic classes and refactorings noticed while preparing a
later change. These changes are fairly "obvious" fixes and refactorings,
removed from the later change to make it smaller.

Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/
Bug: 149014708
Change-Id: If9bcb567778d82f49b3481c50a64c0d739ce2ace
2020-09-04 13:55:57 +01:00
Neil Fuller
05dc9327d3 Small docs fix
Fix for a typo in LocationManager docs.

Test: None
Change-Id: I6c91dda634054f181bb9e46ee8ba4fe438ec6f9f
2020-09-04 13:38:30 +01:00
Soonil Nagarkar
bb7c92cdca Add SdkConstant annotations to public API
Test: presubmits
Change-Id: I3a433a1ca086ba856055048c02ca4fb309c9f255
2020-08-25 10:22:19 -07:00
Soonil Nagarkar
6af009ab20 DO NOT MERGE: Fix NPE bug in LocationManager
Both null and non-null GnssRequest objects may be present in the list of
requests to merge.

Bug: 165375330
Test: presubmits
Change-Id: I13284b1c32f1ad1fce39ad1ca2e4298194197015
2020-08-20 09:11:37 -07:00
Neil Fuller
376a91befa Basic changes to the LocationTimeZoneProvider API
These changes have been broken out as they stand alone and should be
relatively uncontroversial.

The LocationTimeZoneEvent is having UserHandle added, mostly for
logging at this point so we can debug issues with multi-user providers.

Bug: 152744911
Bug: 149014708
Test: atest services/tests/servicestests/src/android/location/timezone/LocationTimeZoneEventTest.java
Change-Id: Iafbd5bc9778d68bc9c3046244e7dca6d9892519e
2020-08-20 08:52:41 +00:00
TreeHugger Robot
275fd7ede6 Merge "Extract LocationProviderManager" 2020-08-04 23:33:20 +00:00
Soonil Nagarkar
d6158258e6 Extract LocationProviderManager
This extracts LocationProviderManager as a completely stand-alone class,
substantially reducing the complexity in LMS, and in
LocationProviderManager. Core AOSP location code is now unit testable
for the first time, and we begin adding unit tests.

Test: extensive manual tests + presubmits
Change-Id: I0fb17ddbf91bdd26ed7855110026b3dd09612a5c
2020-08-04 11:09:55 -07:00
Sasha Kuznetsov
8f0b3f2631 Update GnssAntennaInfo docs and formatting
Bug: 162611455
Test: n/a
Change-Id: I176adae52f0d776a8d2862f1cf3178ae1b919bab
2020-08-03 09:55:19 -07:00
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
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
Salud Lemus
3d655ad09e Replace manual creation of StatsEvent objects with their appropriate buildStatsEvent() method
Currently, Java clients are manually creating the StatsEvent objects
which can lead to errors. Now that there is support for pulled atoms for
stats-log-api-gen for Java clients, use the appropriate buildStatsEvent
method that was auto generated by stats-log-api-gen.

Bug: 160368804
Test: Ran `m` and completed successfully
Test: Ran `atest statsd_test` and all CTS tests passed
Test: Ran `atest UidAtomTests` and all CTS tests passed except for the CTS tests related to a SIM card because the device does not have a SIM card

Change-Id: Id229ba5ca94203135a8a5e2607de9844e0432ce1
2020-07-14 23:00:57 +00: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
00af9a3205 Ask location provider for its package name
The package name from the service watcher may be inconsistent with the
package name of the currently bound service.

Test: none
Change-Id: Iede437d2e61a0da0b853fdbb133a29add04f6bf3
2020-07-09 16:57:25 -07: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
TreeHugger Robot
5e72ff77d4 Merge "Remove unused intent in NiNotification" into rvc-dev am: e93814953c am: ebaf86bece am: c6e39e749d am: 6200c35d5b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11799318

Change-Id: I23e0430e37ab8714fb35389d269dc7c8a6c99986
2020-06-09 23:21:32 +00: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
80169f2f12 Merge changes I6c0940fd,I1b2dc636 into rvc-dev am: 01d150e539 am: fdd1c9d081 am: f40041df55 am: f1d8c17883
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11727208

Change-Id: I6623d52ca3265652dcafdf8c4a15ce2ccb2936b0
2020-06-08 20:52:51 +00: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
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