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
..

This library (com.android.location.provider.jar) is a shared java library
containing classes required by unbundled location providers.

--- Rules of this library ---
o This library is effectively a PUBLIC API for unbundled location providers
  that may be distributed outside the system image. So it MUST BE API STABLE.
  You can add but not remove. The rules are the same as for the
  public platform SDK API.
o This library can see and instantiate internal platform classes (such as
  ProviderRequest.java), but it must not expose them in any public method
  (or by extending them via inheritance). This would break clients of the
  library because they cannot see the internal platform classes.

This library is distributed in the system image, and loaded as
a shared library. So you can change the implementation, but not
the interface. In this way it is like framework.jar.

--- Why does this library exists? ---

Unbundled location providers (such as the NetworkLocationProvider)
can not use internal platform classes.

So ideally all of these classes would be part of the public platform SDK API,
but that doesn't seem like a great idea when only applications with a special
signature can implement this API.

The compromise is this library.

It wraps internal platform classes (like ProviderRequest) with a stable
API that does not leak the internal classes.