Commit Graph

695 Commits

Author SHA1 Message Date
Soonil Nagarkar
39d614aa83 Allow listener garbage collection
Currently listeners that expire (either because of expireAt or
numUpdates) will never be removed from the client listener list. Fix
this by adding a new ILocationListener callback.

Also remove old status callback that isn't being used anymore.

Test: atest CtsLocationFineTestCases
Change-Id: I3f8a5058988c8257f25fe63a0c62e9d26ed2cf00
2019-10-31 14:05:03 -07:00
Soonil Nagarkar
c4a4833708 Prevent crash when invoking GNSS apis
GNSS APIs may crash when invoked on devices without GNSS, fix this
implementation.

Bug: 143591625
Test: manual
Change-Id: I6de563df96bc4605852989243c38e5d5278cbda0
2019-10-30 17:04:26 -07:00
Soonil Nagarkar
5a1049564a Merge "Add expireIn implementation to LocationRequest" 2019-10-30 18:09:26 +00:00
Soonil Nagarkar
b81c30db9e Fix remaining Handler mismatch
Use direct executor for backwards compatibility when
addGpsStatusListener is invoked not on a handler.

Bug: 143544726
Test: manual
Change-Id: I594e302962737154e29d8226d0c19dbdebd18cbb
2019-10-29 12:12:08 -07:00
Soonil Nagarkar
7630c828b8 Minor fixes for CTS tests
-Ensure deprecated GNSS APIs run on binder threads for backcompat.
-Normalize exception thrown on null criteria to
IllegalArgumentException.

Bug: 143110531
Test: atest LocationManagerTest
Change-Id: I962234913857cb0c5bfdf46653986ab2a55bd5ee
2019-10-23 17:09:51 -07:00
Philip P. Moltmann
6c7377c888 Add featureId to LocationManager app-op notes
This pipes through the calling context's featureId for the
AppOpsManager#noteOp calls in the LocationManagerService.

Test: atest CtsAppOpsTestCases
Bug: 136595429
Change-Id: I754378b2c9e1740103e3441212ff11622b29a9d7
2019-10-22 09:26:05 -07:00
Soonil Nagarkar
e347ea1bd3 Add expireIn implementation to LocationRequest
Clients should no longer need to reset expireIn every time they make a
location request. Also allow clients of getCurrentLocation() to set
their own timeout if desired, and enforce a timeout for
requestSingleUpdate().

Bug: 133356925
Bug: 142956404
Test: atest LocationManagerTest
Change-Id: I1b3a4d8d6ef249a2395b0d30bf7b92a8d4cfe933
2019-10-18 17:22:31 -07:00
Soonil Nagarkar
905e7227dc Add getCurrentLocation API to LocationManager
Add new API to replace requestSingleUpdate() which is safer and more
convenient for clients to use.

Bug: 133356925
Test: manual (CTS tests coming in separate patch)
Change-Id: Ib7f76bcbff0cd010a479bb7a02e2f7e51e65525c
2019-10-17 16:17:34 -07:00
Soonil Nagarkar
4eaa2ecb7f Fix typo
Test: n/a
Change-Id: I1023daa59fbee38af8d7b8f9636fff6136894582
2019-10-16 17:50:04 -07:00
Soonil Nagarkar
f5306d433a Move registerGnssMeasurementsCallback onto direct executor
Preserves behavior from previous releases for legacy clients.

Bug: 141887245
Test: CTS
Change-Id: I75bb38b2ed65cca13068d7727343c6f0782ef9d8
2019-10-16 17:33:17 -07:00
TreeHugger Robot
99347aa691 Merge "Update javadocs as per API council feedback" 2019-10-16 21:31:21 +00:00
TreeHugger Robot
acb8ee8122 Merge "Normalize null argument behavior for GNSS APIs" 2019-10-16 06:08:08 +00:00
Soonil Nagarkar
88be6bf15c Update javadocs as per API council feedback
Bug: 142715945
Test: n/a
Change-Id: I0a7149c144a2f660bb135efe0d32ed625b40d90b
2019-10-15 15:15:58 -07:00
Soonil Nagarkar
f4a93276a1 Normalize null argument behavior for GNSS APIs
Previously some GNSS APIs would fail with NPE instead of
IllegalArgumentException. Also update JavaDocs to make behavior clear.

Bug: 142736900
Test: coming soon
Change-Id: If3228ff4f00629dd9eb099b8da8d8eea5d8852ad
2019-10-15 13:23:03 -07:00
Philip P. Moltmann
aad41eb667 Merge "Add useful app-op-note message to async Location deliveries" 2019-10-15 18:11:31 +00:00
Philip P. Moltmann
bc8b48a97b Add useful app-op-note message to async Location deliveries
Test: atest CtsAppOpsTestCases
Bug: 136505050
Change-Id: I1a34cd993132cc4fdf87c92625595240bb8ec4a7
2019-10-14 10:55:52 -07:00
TreeHugger Robot
b7d4e8ccf6 Merge "Add a Test API to verify if gmscore is the network location provider." 2019-10-12 04:24:39 +00:00
Soonil Nagarkar
597703c518 Merge "Expose NO_GPS_LOCATION APIs to system and test" 2019-10-11 20:32:45 +00:00
Wei Wang
9f52d55eb2 Add a Test API to verify if gmscore is the network location provider.
Bug:136079152
Test: adb shell am instrument -w -e class com.google.android.location.gts.LocationManagerTest com.google.android.location.gts/androidx.test.runner.AndroidJUnitRunner
Change-Id: Ibe8ffc6148ea22bef279f75275719075d26f346c
2019-10-11 13:18:53 -07:00
Soonil Nagarkar
79c47e27fe Expose NO_GPS_LOCATION APIs to system and test
These APIs are required for use by CTS tests and location providers.

Bug: 142481153
Test: manual
Change-Id: I09815477c2ac822a310b360145c8297170d24150
2019-10-11 11:30:45 -07:00
Soonil Nagarkar
0000e8acea LocationManager cleanups to make CTS tests easier
addTestProvider and removeTestProvider will now always succeed.

Test: n/a
Bug: 141887245
Change-Id: Ifcc687ffad0a803e5126285ba88bb8c97305b8a9
2019-10-08 18:58:02 -07:00
Soonil Nagarkar
f72128d49d Reuse transports if possible in LocationManager
Allow LocationManagerService to reuse the same listener transports, and
fix memory leak in event of RemoteException during registration.

Bug: 142024887
Test: manual
Change-Id: Ida25fe08c30e5936680c95c23cd03fbaf09ff574
2019-10-03 11:39:56 -07:00
Soonil Nagarkar
d4bbee27e7 Normalize JavaDocs and deprecate requestSingleUpdate
-Go through major javadocs for location APIs and update and normalize
them, inserting additional information where necessary.
-Deprecated requestSingleUpdate APIs as they are dangerous (may be
adding a more direct replacement getCurrentLocation() later in R).
-Drop support for GpsStatusListener APIs (deprecated many years ago) for
apps targeting R and above.
-Drop permissions check from location provider properties APIs, there
doesn't seem to be any reason for these to be secured.

Bug: 141774342
Test: manual
Change-Id: I847f395e1e869eec991613b9b1b7e94a655446cc
2019-10-01 10:29:01 -07:00
Soonil Nagarkar
958e8235dc Reorder LocationManager methods
Group LocationManager methods by function. No other changes beyond
copy/pasting methods (and fixing lint error).

Bug: 141644661
Test: builds
Change-Id: I95e1297e37aa862cb9ff8fad9052079f056a2973
2019-09-25 23:09:19 +00:00
Soonil Nagarkar
4551405b93 Add Executor APIs to LocationManager
Add executor support for all LM APIs and consolidate various GNSS
listeners. Also fixes some edge cases around multithreaded listener
callback delivery.

Bug: 136212299
Test: Manual
Change-Id: I2e863e41de846e739654362e859b58a5ed45c673
2019-09-25 20:56:48 +00:00
Blake Kragten
b0a6968f9d Merge "L5 Metrics Addition:" into qt-qpr1-dev
am: 9c16632a24

Change-Id: If50095321517893b805b6ca02150c2c2fd210aab
2019-09-16 11:34:04 -07:00
Soonil Nagarkar
fc9c7f8532 Remove all code dealing with obsolete location status
Test: manual
Change-Id: I0fde3dd9bdd418ab63c61c5afc093d8eef72e600
2019-09-13 13:03:14 -07:00
Blake Kragten
025aabe693 L5 Metrics Addition:
Added L5 metrics to determine if L5 should be enabled or not.

Test: On device

adb shell dumpsys location

Output:
  Number of CN0 reports: 149
  Top 4 Avg CN0 mean (dB-Hz): 26.100838872410307
  Top 4 Avg CN0 standard deviation (dB-Hz): 1.7702387090734562
  Total number of sv status messages processed: 4202
  Total number of L5 sv status messages processed: 703
  Total number of sv status messages processed, where sv is used in fix: 1979
  Total number of L5 sv status messages processed, where sv is used in fix: 46
  Number of L5 CN0 reports: 97
  L5 Top 4 Avg CN0 mean (dB-Hz): 20.273711379041377
  L5 Top 4 Avg CN0 standard deviation (dB-Hz): 2.632911219511556
  Used-in-fix constellation types: GPS GLONASS GALILEO

Output Logs: https://drive.google.com/drive/folders/1tGEolHWtF92UkJ8lxgFihIzfWLl8ChZK?usp=sharing
Bug: 137575988
Change-Id: Id306d7cc27c9410a5ad73f5a0940c25f8d795686
Merged-In: Id306d7cc27c9410a5ad73f5a0940c25f8d795686
2019-09-13 16:36:17 +00:00
Blake Kragten
bb613600fc L5 Metrics Addition:
Added L5 metrics to determine if L5 should be enabled or not.

Test: On device

adb shell dumpsys location

Output:
  Number of CN0 reports: 149
  Top 4 Avg CN0 mean (dB-Hz): 26.100838872410307
  Top 4 Avg CN0 standard deviation (dB-Hz): 1.7702387090734562
  Total number of sv status messages processed: 4202
  Total number of L5 sv status messages processed: 703
  Total number of sv status messages processed, where sv is used in fix: 1979
  Total number of L5 sv status messages processed, where sv is used in fix: 46
  Number of L5 CN0 reports: 97
  L5 Top 4 Avg CN0 mean (dB-Hz): 20.273711379041377
  L5 Top 4 Avg CN0 standard deviation (dB-Hz): 2.632911219511556
  Used-in-fix constellation types: GPS GLONASS GALILEO

Output Logs: https://drive.google.com/drive/folders/1tGEolHWtF92UkJ8lxgFihIzfWLl8ChZK?usp=sharing
Bug: 137575988
Change-Id: Id306d7cc27c9410a5ad73f5a0940c25f8d795686
2019-09-12 11:02:38 -07:00
Aurimas Liutikas
4d1699da48 Add missing nullability annotations.
To prepare for enabling MissingNullability Metalava check this CL
works on adding missing nullability issues that metalava flags if
we tell it to flag new things since API 29.

This is not a complete CL, mostly addresses public api and
toString/equals for @SystemApi

Exempt-From-Owner-Approval: Large scale nullability clean up
Bug: 124515653
Test: make -j checkapi
Change-Id: I109260842cfc25f06e40694997fcbb4afa02c867
2019-08-29 17:15:44 -07:00
Aurimas Liutikas
00be951a08 Add missing nullability annotations.
To prepare for enabling MissingNullability Metalava check this CL
works on adding missing nullability issues that metalava flags if
we tell it to flag new things since API 29.

This is not a complete CL, mostly addresses public api and
toString/equals for @SystemApi

Exempt-From-Owner-Approval: Large scale nullability clean up
Bug: 124515653
Test: make -j checkapi
Merged-In: I109260842cfc25f06e40694997fcbb4afa02c867
Change-Id: I109260842cfc25f06e40694997fcbb4afa02c867
2019-08-30 00:14:44 +00:00
Artur Satayev
fa05ca260a Add @UnsupportedAppUsage annotations.
This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 137350495
Test: m
Change-Id: I55c7845cb7c22808a85dd5185eccfe93c2064b76
2019-08-01 13:44:37 +01:00
Soonil Nagarkar
fb6b187bfb Remove obsolete constants.
These constants are not in use anywhere.

Test: na
Bug: 137675020
Change-Id: I9f1b2101b75779ff2f9c5f9d945189eccff782ae
2019-07-19 02:09:11 +00:00
Soonil Nagarkar
1c572559c6 Improve dumpsys formatting
Make dumpsys readable.

Test: n/a
Change-Id: Ie1701227b8dddaee7636c37f97c9469729e499c3
2019-07-10 14:27:50 -07:00
Soonil Nagarkar
ad6b61875e Pass binder identity through sendExtraCommand
Allow providers to see the identity of the caller of sendExtraCommand
and update documentation.

Bug: 116799964
Test: Presubmits
Change-Id: Ibb63dc3ce223bc1e3ae89e65cf2973a3619c057f
2019-07-02 09:36:11 -07:00
Soonil Nagarkar
a172288449 Merge "Restore GpsStatus listeners" into qt-dev am: beff33a3bd am: 5a57ce5366
am: 654d4d1c6f

Change-Id: I6cbef0e437351ba55a1f4ce8d93efffae52222ae
2019-05-24 17:46:27 -07:00
Soonil Nagarkar
beff33a3bd Merge "Restore GpsStatus listeners" into qt-dev 2019-05-23 23:42:15 +00:00
Anil Admal
dae874bf30 Merge "Merge "Update non-framework emergency location request notification" into qt-dev am: d566984298 am: 6d8da46657" into qt-r1-dev-plus-aosp
am: 22c9978625

Change-Id: Ief2edb3b9005301d56efa1d52358b06680f00687
2019-05-22 16:03:09 -07:00
Soonil Nagarkar
fc7d3bc858 Restore GpsStatus listeners
BUG: 132249089
Test: CTS/manual
Change-Id: I5bd3356240aee07acced1c10e7c67fff35d67bbb
2019-05-22 15:22:20 -07:00
Anil Admal
61da5f06ad Update non-framework emergency location request notification
- Incorporate notification text feedback in b/116328114 so that
  it translates well in different locales.
- Implement PWG recommendation to always notify user of non-framework
  location requests and not make it configurable. Remove es_notify_int
  configuration parameter.

Bug: 116328114
Bug: 130892418
Test: Manual plus existing tests pass.
Change-Id: Iad972eb1a6fe6c6ed5646edb00c1ea483a077553
2019-05-20 16:33:09 -07:00
TreeHugger Robot
4d346b743c Merge "Guard isProviderPackage with permission" 2019-05-15 20:40:31 +00:00
Anil Admal
8a246a2bce User notification of NFW emergency requests similar to IGnssNi.hal
Fixes: 130892418
Test: Manual
Change-Id: Ie505f4c08ffbabfaba3a072c5e14cf8a732c6860
2019-05-07 17:51:21 -07:00
Soonil Nagarkar
514dff4f9b Guard isProviderPackage with permission
Add READ_DEVICE_CONFIG permission requirement for using
isProviderPackage(). Now with more correctness.

Bug: 126614252
Test: manual
Change-Id: I38108a971e0f1dadc8fca8373c80d5d38099f161
2019-04-30 12:04:28 -07:00
David Christie
3fcb6dfae8 Revert "Guard isProviderPackage with permission"
This reverts commit 24136098c0.

Reason for revert: b/131637158. For some reason the Android system doesn't seem to have this permission.

Bug: 131637158

Change-Id: I7fd1e25a1bbb57f98a6ee0d07b8954c1cbcf08c2
2019-04-30 01:19:55 +00:00
Soonil Nagarkar
24136098c0 Guard isProviderPackage with permission
Add READ_DEVICE_CONFIG permission requirement for using
isProviderPackage().

Bug: 126614252
Test: manual
Change-Id: Iba68994e0faecda075ad37db6e1b9fe457bbaaef
2019-04-25 15:32:43 -07:00
Anil Admal
d4203ddebf Merge "Add separate hasCapabilityName() methods in GnssCapabilities" into qt-dev 2019-04-23 15:32:05 +00:00
Anil Admal
3ba0fa9999 Add separate hasCapabilityName() methods in GnssCapabilities
Fixes: 130802613
Test: Verified on a Pixel device.
Change-Id: I00418f12004b28de666ec2a73203611f73af3e18
2019-04-19 18:26:46 -07:00
Anil Admal
ec6ec82ef5 Change getGnssCapabilites() return type to @NonNull
Fixes: 130802725
Test: Manual
Change-Id: I01c3f2aa593c3b5f08b57b77960afc21bb155da7
2019-04-19 15:24:16 -07:00
Yu-Han Yang
284234ea8c Log constellation types in GnssMetrics
Bug: 121157068
Test: on device
Change-Id: I9e2c1238e46422f9c11b748567c2741ed95aeaa0
2019-04-12 18:22:05 +00:00
TreeHugger Robot
433bb84545 Merge "Adding documentation to getElapsedRealtimeUncertaintyNanos following api council guidance." into qt-dev 2019-04-08 17:13:58 +00:00