AppOps stats are used to populate the "apps recently using location"
list in settings->location. There is no reason to show Android OS
in that list simply because of internal location requests supporting
other clients.
Change-Id: I6908aa63deb19d22733b8d9cdae6ea5dbbea55e0
- JNI exception accessing a geofence method with wrong signature
- FlpHardwareProvider exception when the monitoring status contains no location information
Bug: 10691492
Change-Id: I1959712912af712dc9dc344f20afd1112da46efc
This is an issue caused by multi-threading. If geofence provider service
is connected and disconnected immediately, the ServiceWatcher can return a
null service handle to the private thread used by GeofenceProxy, and
this can cause NPE and system crash.
This CL also fixed a hidden race conditions bug where mGeofenceHardware
is not synchronized between two threads.
Change-Id: I824642cd638fbb1e6799a5a1220b047ebc2556a1
We now keep track of all of the active start operations per
non-system process, so they can be cleaned up if the process
goes away.
Change-Id: I9d05f1e0281c47dbe1213de014f0491f1359685c
Re-arranged code to be more flexible, now track
state of services, dump ordered list of running
processes while memory was critical and low.
Also rename battery stats service from "batteryinfo" to "batterystats".
Change-Id: I0f4f0c8d443c49d255cb84d0fc917e8ec18b152e
Fixed b/8276827
Vendor might want to provide their own implementation of "network
location", "fused location" and "geocoder" service. Location manager now
allows those service to be replaced by packages that have the same
signature as one of the packages in config_locationProviderPackageNames.
Such behavior might not be desirable on some devices. This change
make this behavior configurable by 3 boolean flags.
Details:
- Added three boolean flags in core/res/res/values/config.xml to enable
or disable NLP/FLP/Geocoder overlay
- Added 3 package name for the stock NLP/FLP/Geocoder. They are needed
only when overlay is disabled because LocationManagerService need to
know which package is preferred when searching for
NLP/FLP/Geocoder service.
- Made ServiceWatcher able to handle non-overlayable services.
- Fixed an NPE isue in ServiceWatcher. mPm.queryIntentServicesAsUser
might return null.
- Fixed an bug: justCheckThisPackage in bindBestPackageLocked is always
ignored.
Change-Id: Id221961ac7c3aa8ad44b894f9523f04f770ae237
# By Arun Ravindran
# Via Android Git Automerger (2) and others
* commit 'd080bb07c88ca5ccf99f326789ed472448b50832':
Services: Adding HSPAP info in Android
This changelist revises LocationManager's previous multiuser system.
Location provider services that are not multiuser-aware continue to
run as before: ServiceWatcher binds to location provider services as
the current active user. When the device switches from one user to
another, ServiceWatcher unbinds from the old user's location provider
service and binds to the new user's instance.
Now, location provider services that are multiuser-aware or
user-agnostic can declare "serviceIsMultiuser" metadata in their
AndroidManifest.xml to prevent ServiceWatcher from performing this
switching. These services will run as singleton services and will be
expected to handle user switches on their own.
With this feature in, I was able to switch FusedLocationProvider to
run in multiuser mode, sharing the system_server process instead of
running in its own process. The NetworkLocationProvider is unchanged,
still running in singleuser mode, cheerfully oblivious to the
possibility that there might be any user on the device besides the
one it services.
Bug: 8028045
Change-Id: I1a5bd032918419bab6edb46c62ff8c6811170654
Also add new ops for calendar and wi-fi scans, finish
implementing rejection of content provider calls, fix
issues with rejecting location calls, fix bug in the
new pm call to retrieve apps with permissions.
Change-Id: I29d9f8600bfbbf6561abf6d491907e2bbf6af417
Fix the issue where GpsLocationProvider.isEnabled() returns true when it
is really false (and the other way around), when the handler hasn't
processed the enable/disable messages yet.
This can be systematically reproduced when the caller code is using the
same thread as the thread of the handler in GpsLocationProvider.
For example, this was happening in LocationManagerService.switchUser().
It would start by disabling all the providers (with
updateProviderListenersLocked()), then re-enable them in
updateProvidersLocked() only when isEnalbed()==false, which was in the
wrong state since the GpsLocationProvider.ENABLE message hadn't been
processed yet. As a result, the GpsLocationProvider was disabled upon
startup of the phone.
This is a slight problem for the enable() contract, which specifies that
getStatus() must be handled, getStatus() will be handled but might have
slighty not-up-to-date info in this case.
Bug: 8028017
Change-Id: Iff91a11cc150e9029a6db85b64a10a926e12b0ba
Use this to track the package name of applications
accessing GPS.
And now the app ops service can enforce that callers
must provide valid package names.
Change-Id: I842a0abe236ea85f77926d708547f0f95c24bd49
Initial implementation, tracking use of the vibrator, GPS,
and location reports.
Also includes an update to battery stats to also keep track of
vibrator usage (since I had to be in the vibrator code anyway
to instrument it).
The service itself is only half-done. Currently no API to
retrieve the data (which once there will allow us to show you
which apps are currently causing the GPS to run and who has
recently accessed your location), it doesn't persist its data
like it should, and no way to tell it to reject app requests
for various operations.
But hey, it's a start!
Change-Id: I05b8d76cc4a4f7f37bc758c1701f51f9e0550e15
systemReady() was returning before the LocationManagerService was
actually ready. Applications making LocationManager transactions
during their startup could possibly hit a race condition with the
yet-uninitialised LocationManagerService.
To guarantee that LocationManagerService is actually ready before
returning from systemReady(), we simply do the startup work on the
thread that called systemReady(), rather than spin up a secondary
thread to do the work asynchronously.
LocationWorkerHandler still needs a thread to do its work on, so
rather than have it run on the secondary thread that was
previously used for systemReady()'s work, we create a HandlerThread
for it.
Additionally, LocationManagerService.init() really needed to grab
lock for some of the things it was doing. I moved all of the code
that could benefit from mutex protection to a single section of
systemReady() and wrapped it up with a lock while I was at it.
Bug: 7723944
Change-Id: I51d480e2781622c3a14769c3a2019a2407dcfd8a
Many media files and source code files were marked as executable in Git.
Remove those.
Also a shell script and python script were not marked as executable.
Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
Process the location of the fence as soon as it is added.
Clarified how the distance to the fence was being used.
Added more debug logs (disabled by default).
Fixed a numerical overflow in the location request if the
distance to the border of the nearest fence was greater
than about 2000Km.
Removed a useless call to request location updates passively
when the geofence manager is initialized. We have no need
of location updates unless there are active geofences.
The effect of this call was undone the next time the location
request was updated anyhow.
Changed the location request to always request a fastest update
interval of 0 which accomplishes the goal of passively
monitoring all updates. This does not increase the power
consumption because we are conservative about choosing
a minimum location update interval. We're simply stating
that the geofence manager is willing to handle a higher
report rate which is very important.
Subject location to a "freshness test" - only use relatively
recent locations for geofence testing.
Run all geofence updates on the handler and avoid making
multiple redundant calls into the location manager when
updating the provider requirements.
Ensure that we update geofences correctly even if we don't
know the initial location of the device at the time the
geofence is created.
Pin update interval value to the range [1m..2hr].
Distance to fence is now distance to fence's border, not
distance to fence's centre.
Bug: 7466334
Change-Id: I28e571ecfc508d5ceb9bb2afcabaaf05abb26369
GpsLocationProvider emits a message on CDMA phones, warning about
lack of CDMA support. It also emits this message on every other
non-GSM device. I've pulled the conditions in a bit for this so that
it only happens on actual CDMA devices.
Change-Id: I1a122e2599c83c730be014c61385e60ef819b5a1
LocationManagerService now keeps track of the current user ID and
denies location requests made by all but the foreground user.
Additionally, location settings are now user-specific, rather than
global to the device. Location provider services now run as specific
users, and when the device's foreground user changes, we rebind to
appropriately-owned providers.
Bug: 6926385
Bug: 7247203
Change-Id: I346074959e96e52bcc77eeb188dffe322b690879
Use LocationManager.getLastPosition() in GeofenceManager instead of
keeping track of it manually. Keeping track of it in GeofenceManager
doesn't handle the case where we install a fence, and cross it just
after that based on the last position before we installed the fence.
Also shuffle around some code in LocationManagerService to remember the
last position even if there are no UpdateRecords. This is useful in the
GeofenceManager for example.
Bug: 7047435
Change-Id: Ia8acc32e357ecc2e1bd689432a5beb1ea7dcd1c7
This allows primary/secondary users to have different "Google
Location Services" preferences. It also reenables LocationBlacklist,
which is fixed elsewhere.
Bug: 7213502
Bug: 7248239
Change-Id: I94837682f95920c225c00b7da2de6dd1418a673e
Oops, looks like we were spinning up a secondary thread to run some
tasks that will just happen on the main thread regardless. Removed
the secondary thread and fixed up initialisation order regarding
mHandler and things that post to it. Also reordered GPS and
PASSIVE provider initialisation order since GPS depends on PASSIVE.
This should be both safer and easier to read.
Bug: 7248029
Change-Id: I8630caf0a7bd1b2c401603075676f13dda5be4fa
Fixed one setting that was migrated but not marked deprecated.
Removed a hidden setting that is no longer used by the new
power manager service.
Bug: 7231172
Change-Id: I332f020f876a18d519a1a20598a172f1c98036f7
FusionEngine now attaches a secondary location that has never seen
GPS data to its result. LocationFudger uses the GPS-less location so
that COARSE apps never see data from the GPS provider.
When the previous location is updated, the previous GPS-less location
is carried over if the location update was GPS-only.
Additionally, apps without FINE permission are not notified when GPS
location changes, and any attempt to use GPS_PROVIDER without FINE
permission is met by a stern SecurityException.
Bug: 7153659
Change-Id: I12f26725782892038ce1133561e1908d91378a4a
This replaces the ACCURACY_METERS constant and all derived values with
a secure setting. This value defaults to 2km and has a hardcoded floor
of 500m.
Bug: 6982024
Change-Id: Ibf97ab57145abf28c4a9747444f40250adddf23c
Quick Settings and global actions (aka longpress-Power) toggles are
included in this CL. The Settings app manipulations are updated in
a different CL because that's a different git package.
Bug 7132230
Change-Id: I50838f5e8d7b25a750d2bcae90bf384b09816dbb
You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.
Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.
New Context APIs for more kinds of sending broadcasts as users.
Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.
Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.
Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
The GpsLocationProvider typically acquires a wake lock
before sending a message to its handler then releases it
after the message has been handled.
There were two cases where messages might be removed from
the handler, resulting in the wake lock being released.
There were also two cases where background tasks were being
started while not holding a wake lock for the duration.
Fixed these issues and marked the GpsLocationProvider handler
as asynchronous too so that it doesn't accidentally get
blocked by traversals if it happens to share a thread with some UI.
Bug: 7057752
Change-Id: I8e12fc91ae943e84db068c08ec809879537503c6
Currently, the NTP and XTRA downloads block on the GPS provider thread.
This could potentially block the next tasks for over a minute of time.
If the upcoming task happens to be AGPS, AGPS will time out.
Placed the NTP and XTRA downloads in separate threads.
Bug: 6980618
Change-Id: I57a6aaf5348212bc1246813f6d941da7d5b19136
Bug: 7020678
The broadcast receiver in GpsLocationProvider now listens for
CONNECTIVITY_ACTION changes. Set the intent filter so that
it catches those actions and updates the network state.
Change-Id: I7efd393dfe2aa8b172dd6701d42ff9ed687648a2
I had to re-do this change for MR1 because LocationManagerService changed
so much. Here is the original change description:
Add package-name-prefix blacklist for location updates.
The Settings.Secure value locationPackagePrefixBlacklist and
locationPackagePrefixWhitelist contains comma seperated package-name
prefixes.
Location & geo-fence updates are silently dropped if the receiving
package name has a prefix on the blacklist. Status updates are
not affected. All other API's work as before.
A content observer is used so run-time updates to the blacklist
apply immediately. There is both a blacklist and a whitelist.
The blacklist applies first, and then exemptions are allowed
from the whitelist. In other words, if your package name prefix
matches both the black AND white list, then it is allowed.
Bug: 6986553
Change-Id: I1e151e08bd7143e47db005bc3fe9795076398df7