Switch LocationTimeZoneEvent to elapsedRealtimeMillis from nanos. This
makes it more consistent with other usages of the elapsed realtime clock
in time zone detection. This information is currently only used for
debug so there will be no functional change.
Also change LocationTimeZoneEvent toString() to additionally report
mElapsedRealtimeMillis value using Duration.toString(); this is done
elsewhere in debug output for time zone detection so makes understanding
log output easier.
Bug: 169304499
Test: build only
Change-Id: If307c9b27d64ca49a4fcc0d9bb6e36f362990b3e
LocationTimeZoneEvent was originally supposed to fulfil the same role as
Location does in the LocationProvider. Since Location is public SDK, it
was in android.location. LocationTimeZoneEvent is not public SDK (or any
form of API), so it can be moved to com.android instead.
LocationTimeZoneEventUnbundled is in the API in its place.
Bug: 169304499
Test: treehugger only
Change-Id: I5d382362383000b16852928895a18ac4e4269a8f
Adds additional logic for location requests coming from the system
server, such that those requests may allowed so long as location is on
for the current user, even if the system user has location disabled.
Even though the system server runs under the system user, it may need
to service requests from or on behalf of other users.
Test: presubmits + manual
Change-Id: Ic9d7762e75fc930b7d26f1d1bf20b272d562939c
This should always have been SystemApi, as most fused providers are
implemented outside system server. There is a strong argument this
should actually be public API, but I'm punting on that for now until we
can give it more consideration.
Bug: 173030969
Test: none
Change-Id: If5ba10accbe2f6ce47d749536d053e1bd8e297f8
-Moves batching APIs from SystemApi to Public, and makes them
multi-client safe.
-Adds equals/hashcode to Location.
Bug: 171512333
Test: manual + presubmit
Change-Id: I6ee28f8229fdf49386cd370ea785de63b97e7cde
It causes problems with permissions in testing and isn't strictly
required so it can be removed.
Bug: 152744911
Bug: 149014708
Test: atest services/tests/servicestests/src/android/location/timezone/LocationTimeZoneEventTest.java
Change-Id: Iba9c07780e3cc9f94f2c77144c48916236f31e60
Geocoder APIs are a mess, but this will at least validate the caller
properly, and pass the relevant information along to clients.
Bug: 158318462
Test: presubmits
Change-Id: I47b09962598a2346bd79caa643ba1d83069c0c19
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.
This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.
APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I
Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.
Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
Previously ListenerMultiplexer attempted to be perscriptive about when
individual listener invocations should be allowed, but this is not
proving flexible enough. So, we allow registrations to invoke listeners
at any time without being perscriptive about it instead.
Test: manual + presubmit
Change-Id: I6ff8c6bd4f3e3af15d6ebc4b484b971df5a8c0e2
* changes:
Apply fixes for EfficientStrings.
Apply fixes for EfficientStrings.
Apply fixes for EfficientStringsChecker.
Apply fixes for EfficientCollections.
Trivial refactor for consistent naming.
Expand formatSimple() to support widths.
Refinement of EfficientStringsChecker.
The recently-built Error Prone checker has found many instances where
we're always paying the cost of StringBuilder concatenation, even in
the typical cases where preconditions are successfully met.
Benchmarks have shown that even when replacing these with varargs
formatter strings, the default case is 20x faster.
Bug: 170978902
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: If8c00bc73467bfb91ec16c162969c9d26ca53646
Expose quality APIs publically after refactoring them to match external
usage of quality constants. Removes list of location requests from
provider request, as there is no client that really uses this, and it
feels like too much information to give to providers.
Bug: 168624248
Test: presubmits
Change-Id: Icf8a9f6096da0071d97190d3f7196948492e52a1
This API is no longer necessary for testing, and inappropriately exposes
internals. Also updates battery saver TEST_MAPPING to include location
tests.
Bug: 170224294
Test: presubmits
Change-Id: I1322f21ced86d3622650ecf02dfa959a484660d0
-Prevent PendingIntents from using LocationRequest SystemApis. We don't
track permission removal, so we don't current reset the request if the
permission is lost.
-Make LocationRequest.getWorkSource() NonNull. Small quality of life
change to reduce null checks all over.
-Don't spend CPU coarsening location until we actually need to. The vast
majority of locations will never need to be coarsened. Don't bother
doing so until we actually need to.
Bug: 169887240
Test: manual + presubmit
Change-Id: I7ad6fe886eaede3ed9f46cebe4246d29d6b6e187
Log a much wider variety of important events in memory for bugreports
and dumpsys. This will make debugging much easier, hopefully at a
minimal memory cost. Memory cost could be improved in the future as
well.
Test: manual + presubmits
Change-Id: Iab867575f783f1c5f41a405da66f72d5f52691bf
This is a breaking change so that providers are no longer disabled for
non-current (ie background users). Instead, location requests from
background users are now considered inactive. This brings provider
behavior more in line with other APIs (such as GNSS and geofencing),
and allows us to special case requests from the system UID.
Without this change, the system UID would see incorrect provider
enabled/disabled notifications. Impact on clients is expected to be
minimal, as by far the vast majority of android applications run on
single user devices. For multiuser devices, applications will no longer
see enabled/disabled notifications in response to current user changes.
Bug: 157682495
Test: manual + presubmit
Change-Id: I0edb15f0792bf1426855baefcda8477ba3a32b28
Prevent applications from bypassing background location throttling by
adding/removing requests. This allows provider managers to delay
requests in the event the interval has decreased so that power can be
saved. Clients that target S and above may now receive historical
locations in exchange, so that they are not losing locations overall.
Locationp providers can optionally implement delays themselves in the
event of an interval increase.
Also updates jitter calculation to be a capped percentage of the
request interval, rather than a flat cap.
Bug: 73144566
Test: manual + presubmits
Change-Id: I243e813f0c0c504850e2a3e777787f49fc6f7a57
This commit introduces a LocationTimeZoneEventUnbundled, as
LocationTimeZoneEvent will not be on another API surface so cannot be
reused. (The equivalent from LocationProvider is Location, which is
public API so there is no LocationUnbundled.)
Add an initialization timeout to LocationTimeZoneProviderRequest so that
providers can make intelligent choices about (for example) how long to
spend waiting for geolocation to happen passively.
Test: atest services/tests/servicestests/src/com/android/internal/location/timezone/
Test: atest services/tests/servicestests/src/com/android/server/location/timezone/
Bug: 152744911
Change-Id: Id3e9e6916e8c3a132d8fc892338578ab9d2ff574
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
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
-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
-Encapsulate various fields
-Bring naming in line with API guidelines
-Minor refactoring
Bug: 168621146
Test: manual
Change-Id: I55681a3d84d7833c98569a13a57e6c4f0b728a67
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
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
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