273 Commits
udc ... bka

Author SHA1 Message Date
Joey Huab
89b32fa7db msm8953-common: Drop AntHalService 2025-09-17 23:08:57 +09:00
LuK1337
3ca13d0fe2 msm8953-common: Migrate to AIDL LiveDisplay HAL
Change-Id: I4e8be836e94d442b40c63a1ac7dade3c9d9c784c
2025-09-17 23:06:14 +09:00
genoxci
d8b162f68f msm8953-common: touch: Drop Lineage Touch 2025-09-17 22:56:21 +09:00
Al Mahmud
40db32a405 msm8953-common: switch to common AIDL IR service 2025-06-09 23:59:45 +09:00
Joey Huab
58d2b7873d msm8953-common: Initialize for Evolution X 10.x 2025-05-26 17:44:21 +09:00
Bruno Martins
c781ccf90e msm8935-common: Set vendor init lib via soong config
Change-Id: I8f7e6b987bee58dbf09ca9ad7cfd5a7e99e19c3b
2025-05-09 22:20:45 +02:00
Giovanni Ricca
e0f2c22435 msm8953-common: Temporarily downgrade kernel clang version
19.0.1 doesn't boot for us. Let's keep using the old one for now.

Change-Id: I6693b36674539c20870be49d564b652a93478de1
2025-04-19 22:14:02 +02:00
Giovanni Ricca
3e87f86b13 msm8953-common: Build device-specific light HAL
Change-Id: Ic87830bac5a757e530eb255d5e72ddd495cf00bf
2025-04-19 22:14:02 +02:00
Giovanni Ricca
e50ed064ca Revert "aidl: light: Add support for upstream LED timed mode"
Needs to be fixed kernel side as it causes some unwanted crashes.
Let's just revert the commit and hope for the best ...

Change-Id: I112f43b6224ec1fc9bf2564186c73a05238080ae
2025-04-19 22:13:57 +02:00
Giovanni Ricca
9363f3e0dc msm8953-common: light: Rename HAL
Change-Id: I812659cfe585c20bc26a9448b9f6401e8d94e5f9
2025-04-19 22:11:30 +02:00
Giovanni Ricca
1f1379e75b msm8953-common: Fork light HAL from hardware/lineage/interfaces
HEAD: android_hardware_lineage_interface @
sa7d52a839d32efc6c704d9b20a1ab269fc5bce38

Change-Id: Iab02caa5dd57b7b0e3a65c6921b3d0c865ffeb2b
2025-04-19 22:04:06 +02:00
Ivan Vecera
91815b026b msm8953-common: rro_overlays: Enable WPA3-SAE for SoftAP
Test: Create WPA3 enabled wifi hotspot and connect to it using another device
Change-Id: I081e3b6cb7e3ed019dab70f2b9736cf7546392c3
2025-03-22 14:21:17 +01:00
Yumi Yukimura
d89cfae03e msm8953-common: rro_overlays: WifiOverlay: Move to vendor
Change-Id: Iac1e29563145b3f9e2ffddbd604ed982a247a5b2
2025-03-22 14:21:17 +01:00
Alexander Koskovich
56631d4d9a msm8953-common: rro_overlays: Drop explicit 'sdk_version' declaration
* We don't need to manually set this anymore.

Change-Id: I1239ba541636e53f8ea4373d3815024f2cd60824
2025-03-22 14:21:17 +01:00
Alexander Martinz
3aa11a492a msm8953-common: audio: switch to open source sound trigger hal
The audio hal expects the version of the android and sound trigger
hal to match.

As the prebuilt sound trigger hal is built with a BSP based on
Android 10, the version is older than expected and sound trigger fails
to initialize.

11-11 11:37:55.774  4103  4107 I soundtrigger: audio_extn_sound_trigger_init: Enter
11-11 11:37:55.775  4103  4107 I soundtrigger: audio_extn_sound_trigger_init: DLOPEN successful for /vendor/lib/hw/sound_trigger.primary.sdm845.so
11-11 11:37:55.775  4103  4107 E soundtrigger: audio_extn_sound_trigger_init: Incompatible API versions ahal:0x200 != sthal:0x101

Test: atest CtsSoundTriggerTestCases
Test: atest VtsHalSoundtriggerV2_0TargetTest
Test: atest VtsHalSoundtriggerV2_1TargetTest
Test: atest VtsHalSoundtriggerV2_2TargetTest

Depends-On: https://review.lineageos.org/344863
Change-Id: I23b052149bf243f86ebfa13dbbc5053abe4b92e1
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2025-03-22 14:21:13 +01:00
Harshal Ahire
e9f2497ae2 msm8953-common: enable sound trigger hidl hal 2.3
Change-Id: Ieac067b937c06f1ce4f74abf0b884fc1bf92b5c9
2025-03-22 14:18:26 +01:00
Jaideep Sharma
6990f43a2d msm8953-common: Update sound trigger HIDL version to 2.2
Change-Id: Idb683714c52bfdf17ea709c6f47d312582042190
2025-03-22 14:18:26 +01:00
Bruno Martins
763f44cf9d msm8953-common: Use the common device compatibility matrix from QCOM
Change-Id: I0c0f3ecddbe6d7b232cc0d13c78ca58094e4e720
2025-03-22 14:18:26 +01:00
Wang Han
7abd1ec13b msm8953-common: Remove libaacwrapper from PRODUCT_PACKAGES
* It does not exist at all and is replaced by libwfdaac.

Change-Id: I3b2684b9980d6856f1817e5a40e42861ea86ae24
2025-03-22 14:18:26 +01:00
Giovanni Ricca
cdc3adb624 msm8953-common: Update poweroff stack from FP3
Inline with oneplus msm8998-common

Change-Id: I39be086fdc2d6405b47d6b914469117e13097fcd
2025-03-20 09:26:45 +01:00
Giovanni Ricca
2f9dd94887 msm8953-common: Drop TARGET_RECOVERY_DEVICE_MODULES
Dead as of QPR2, and we only use it to set dalvik
props anyway.

Change-Id: I185ce300cf67e5855d86e2ea29ac982175c8e442
2025-03-10 21:08:25 +01:00
Michael Bestas
0b0283eb65 msm8953-common: Enable ELF checks for libwpa_client dependent libs
Change-Id: I490df02b68da4b9a7088a239672a1dcace66d270
2025-03-10 16:23:16 +01:00
Tyler Wear
7e7750fe72 msm8953-common: tetheroffload: Version 1.1
Update tetheroffload to version 1.1.

Change-Id: I004e44e416a88a1b39a4c80366df9008722f096b
2025-03-04 09:07:16 +01:00
Suren Baghdasaryan
9bcb7d9b10 msm8953-common: Switch lmkd to use minfree levels for kill decisions
Enable ro.lmk.use_minfree_levels flag to use minfree levels to decide
when lmkd should kill. This makes lmkd work the same way lowmemorykiller
kernel driver used to work.

Bug: 77299493
Bug: 75322373
Test: lmkd_unit_test
Change-Id: Ic29d7fd21af1cb6af3a7d2a175d210775a09987e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2025-02-14 16:54:00 +01:00
Suren Baghdasaryan
3b0aaa3b58 msm8953-common: Increase ro.lmk.medium to prevent kills at medium vmpressure
Setting ro.lmk.medium to 800 to prevent important processes from being
killed at medium vmpressure levels.

Bug: 77299493
Test: lmkd_unit_test
Merged-In: I37e1651a0a2b148a852e5bde86501024d4f87bbf
Change-Id: I37e1651a0a2b148a852e5bde86501024d4f87bbf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit c954ec2eb318518cfa5c6f64a688fd8c809e91c5)
2025-02-14 16:53:56 +01:00
Suren Baghdasaryan
6a8e50b920 msm8953-common: Set lmkd configuration properties
Bug: 63631020

Change-Id: I16a183e8e4625e8b98cefdc9c8a7b650556a2b55
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2025-02-14 16:53:52 +01:00
Pullakavi Srinivas
57a64dacdf msm8953-common: Disable SF composition prediction model.
CRs-Fixed: 3243885
Change-Id: I64f82a25768b561bb343fdb7686b7d6c020d024a
2025-02-14 10:52:29 +01:00
Alex Sarraf
9713502ef7 msm8953-common: Disable SF client composition cache
Disable SF client composition cache. Helps with framework
client target fence management.

Change-Id: I73e03e76f51d00fafad38479be00f4005be50665
2025-02-14 10:52:22 +01:00
David Sehr
398193f4d7 msm8953-common: Enable usage of dex2oat64
Use 64-bit dex2oat for better dexopt time.

Bug: 153380900
Test: boot and install an application
Change-Id: I3e7a6e6e9385ff6564d1a2e6dda004ebb061f095
(cherry picked from commit 126f03be80f57a8a0411842011152d9381589b78)
Merged-In: I3e7a6e6e9385ff6564d1a2e6dda004ebb061f095
2025-02-14 10:44:32 +01:00
Jan Altensen
b3a794833e msm8953-common: move to new fm vendor jni variable
Change-Id: I48a4c0005a0761ca4c6ff574fca0153d2dbf54c9
2025-02-10 12:22:41 +01:00
Nolen Johnson
f0d617c3c1 msm8953-common: Adapt to new no FM firmware download flag
Change-Id: Ifae8243501a25c4bdbccdcddebd42a2118995805
2025-02-07 20:13:48 +01:00
feiyuchen
e4e0676ba6 msm8953-common: rootdir: Add "system" group to Audio HAL
needed for using EdgeTpu.
Due to this code goes to AOSP, please see CL details and test result in
b/289097511#comment24.

Bug: 289097511
Change-Id: Ie0969309346cd85b4bb8ac71860a529710c73345
2025-01-31 08:51:55 +01:00
Andy Hung
814aa44b41 msm8953-common: rootdir: Enable RT priority inheritance
Test: instrumented
Bug: 181148259
Bug: 260918856
Merged-In: If56e449a9c6f1a49e372591893d8714534574e3a
Change-Id: If56e449a9c6f1a49e372591893d8714534574e3a
2025-01-31 08:51:07 +01:00
emilchung
5c23a83493 msm8953-common: rootdir: add context_hub into audio hal group
While implementing the capo nanoapp for audio configuration, we met
some chre socket connected error due to the access group denied.

Add context_hub group for audio hal to connect chre socket.

go/capo-algo

Bug: 141128522
Bug: 149069556
Test: FULL build with audio hal part and local prebuilts nanoapp.
Test: Audio HAL communicates normally with CHRE socket.
Change-Id: Iea84411682f4c3e08f8b37a5b21818b0e9b04983
2025-01-31 08:50:17 +01:00
Giovanni Ricca
a32dafe437 msm8953-common: Simplify FMRadio section
* `libfmjni` is now built by default

Change-Id: I875d69ad37535d9e9dc3b661084e58b06d56e4a6
2025-01-30 19:10:24 +01:00
Giovanni Ricca
816150e7f7 fixup! msm8953-common: Remove vendor RenderScript implementation
Change-Id: I4b81e67be511e64c50ae053eba86a30ae3294191
2025-01-25 15:00:41 +01:00
LuK1337
9326e51bb9 msm8953-common: Switch to common lights HAL
Change-Id: If515e7c3f6e5b6895076f1d8381fb2c22bd1b3de
2025-01-25 12:25:18 +01:00
Michael Bestas
18e20d4d44 msm8953-common: Migrate mount point creation out of Android.mk
Change-Id: Id5986b8a740e45f864eecdd2bd82d9455f128d6b
2025-01-25 12:25:18 +01:00
Michael Bestas
bcd9eaa6fb msm8953-common: Update display flags & packages
Required after display HAL blueprint conversion

Change-Id: Idb002fc81fca3321f70fb3bba83f4af44354ce81
2025-01-25 12:25:18 +01:00
Michael Bestas
847a369884 msm8953-common: Remove OMX audio codecs
* OMX HW audio codecs won't work without QCOM A/V enhancements, which
   we don't have on Lineage.
 * OMX SW audio codecs no longer exist.

Change-Id: I940be6716b603e848c44839bb87ad690eb55e86f
2025-01-25 12:25:17 +01:00
Giovanni Ricca
44b82fe705 msm8953-common: Drop libmmosal_proprietary
* Seems to be unused.

Change-Id: Idd45fcdc4b25f7ae585aeddd115d0bdde91bbc06
2025-01-17 15:22:34 +01:00
Nolen Johnson
f5f2d3a22a msm8953-common: Drop libmm-color-convertor
* Follow up to prior commit.

Change-Id: Ic0e2e953f1f32256b61f8fb262f6fec1f83b109c
2025-01-17 15:22:34 +01:00
Giovanni Ricca
19890fdd2d msm8953-common: Drop libsensor_user_cal
* Nothing depends on it

Change-Id: Id2a24318808105f23d0b72b5a1312a7496f6fb1f
2025-01-17 15:22:34 +01:00
Jeferson
7fd3667fdd msm8953-common: Remove activity_recognition libs
* E ActivityRecognitionHardware: activity_recognition HAL is deprecated.
   is_supported is effectively a no-op

Change-Id: I2ea52288799e52424e984af25a8477e204b0df88
2025-01-17 15:22:34 +01:00
Bruno Martins
3edbce2dc3 msm8953-common: Mark CNE symlink target as required package
Change-Id: I0bfe65ba61b6aa9916fe6459be2a84d772939a2f
2025-01-17 15:22:34 +01:00
Giovanni Ricca
f6eef4a460 msm8953-common: rootdir: Android.mk -> Android.bp
* Also decommonize fstab as it would become a mess to maintain :D.

Change-Id: I1f1885af7d84c1be01dd257d99b43a84f4be49f6
2025-01-17 15:22:34 +01:00
Michael Bestas
c8904b898f msm8953-common: gps: Convert remaining Android.mk to bp
Change-Id: I75e6af92795fe755a48557aa06106406b14c6750
2025-01-17 15:22:33 +01:00
Michael Bestas
7ee57398ee msm8953-common: gps: Remove unused implementations
Change-Id: I079edea073f3ae43eaebbf04712e99ec1a931b10
2025-01-17 15:22:33 +01:00
Nolen Johnson
50ab32852a msm8953-common: Nuke update-sha1sums.py
* We have py extract to do this now.

Change-Id: I031938ddb78e8f343864da521dc577cfcb67ee45
2025-01-17 15:22:33 +01:00
Beverly
d80acf00d4 msm8953-common: Update lock icon padding
It should not change based on density changes.

Test: visual inspection
Bug: 264738021
Change-Id: I98f948b4a1bd7e6cc560f14e2e1b14a0bde76f01
2025-01-17 15:22:33 +01:00
Demon Singur
a6f9c193cd msm8953-common: Remove energy awareness daemon
All this does is to disable msm_core and set the
polling_interval to 0, which makes the driver useless.
We can achieve the same result by disabling the driver.

Change-Id: Ic19c505ed74811a3d1b76703255af3aa5cb37bf9
2025-01-17 15:22:33 +01:00
Giovanni Ricca
75f15fed3b msm8953-common: sepolicy: Allow poweroffalarm_app access to /persist
* There might be a case where `/persist/alarm` may have the wrong
  SELinux context applied. Allow access to `/persist` as a whole as
  fallback.

Change-Id: I72dbce4018db23f46d03f5389f0eec07e479632c
2025-01-17 15:22:33 +01:00
Giovanni Ricca
05cbe9a3d5 msm8953-common: Drop embms
Change-Id: Iaef95f45053690502018d7da7f9df999a5bc0c9b
2025-01-17 15:22:33 +01:00
Giovanni Ricca
2d7f0afc4c msm8953-common: Drop vendor.qti.hardware.qdutils_disp
Change-Id: Ic891ef77fce641d51fde0014b172709596f3b2b4
2025-01-17 15:22:32 +01:00
Giovanni Ricca
121125e712 msm8953-common: Drop cdsprpcd stack
Change-Id: Id29ad49334791ba1a1086481d21729736e7920de
2025-01-17 15:22:32 +01:00
Roberto Sartori
2862c64019 msm8953-common: Switch from time_daemon to TimeKeep
* time_daemon just refuses to work properly on mata.
    Sony's TimeKeep, instead, does the job flawlessly,
    so just ditch the former in favor of the latter.

Signed-off-by: Roberto Sartori <roberto.sartori.android@gmail.com>
Change-Id: I54f50ed3d49efc2834d478781b15e6ee428a3062
2025-01-17 15:22:31 +01:00
Giovanni Ricca
6e43c17714 msm8953-common: Decommonize screen density
Change-Id: I0c2c2723c0e9826c549e86dd591bc64893ce98cf
2024-12-10 09:46:21 +01:00
Giovanni Ricca
36aa01d84f msm8953-common: Document the disabled ELF check libs
Change-Id: I1a484ca2620131c36fca4a45112a53317021d24f
2024-12-10 09:46:21 +01:00
Giovanni Ricca
36a8a74baa msm8953-common: sepolicy: Guard debugfs rules
Change-Id: I194d54e207de56fa8df92f198f1e983b5ca6b213
2024-12-10 09:46:20 +01:00
basamaryan
c671d5bbc1 msm8953-common: Move to Xiaomi fingerprint AIDL
Change-Id: I68dba7184034fd37454c7d32a065f041cb611625
2024-12-10 09:46:18 +01:00
Devin Moore
46a15430f3 msm8953-common: Switch to new AIDL IR service
Test: atest VtsHalIrTargetTest hal_implementation_test
Bug: 205000342
Change-Id: I70c54aa8e8962939cc8f4b42fbbe828e9dad7f0d
2024-12-01 13:42:44 +01:00
ayongyuth
4eb952e68b msm8953-common: Fix Image size for Razor and RazorG by reduce Jounal size to zero
Bug: 21016403
Change-Id: Iaadd805dd5326b810e6dd83c1e509cab48995d9d
2024-12-01 13:42:44 +01:00
Giovanni Ricca
e4ae66498a msm8953-common: Use soong to copy gps configs
Change-Id: Ia1188567d250f228585e0e52f096112ac3233200
2024-12-01 13:42:43 +01:00
Giovanni Ricca
b6cfd8554f msm8953-common: Rename wcnss_service target
Change-Id: I638e8e40ea95b914ee3c36035704a4d55780d41f
2024-12-01 13:42:43 +01:00
Cosmin Tanislav
7616863d9f msm8953-common: do not manually build dependencies
Change-Id: I4046d8eeabfc70842898b7034f75cdd6bcfc441b
2024-12-01 13:42:43 +01:00
Aaron Kling
add9cc458e msm8953-common: Remove elf files in copy files check
New extract files uses packages instead of copy files

Change-Id: I337c07d13bd350958d4808e1693cc6e03753a96c
2024-12-01 13:42:43 +01:00
Giovanni Ricca
1e79be9012 msm8953-common: Import missing 32bit libs
Change-Id: Ic1fbd94452488e3ee318a59e9b9e9c4c7c0b94ee
2024-12-01 13:42:43 +01:00
Michael Bestas
d6b4318402 msm8953-common: Disable ELF checks for certain libraries
Change-Id: I61dbc3559b43becc22f69ae2c1c3e8edf95e2483
2024-12-01 13:42:43 +01:00
Michael Bestas
5b3bfd56c8 msm8953-common: gps: Remove all Wno-error flags
Almost all warnings/errors have been fixed.
Ignore undefined bool conversion error on purpose.

Change-Id: I00cb5f38711fa9f873da030fc6a0ebc6cde3ceeb
2024-12-01 13:42:43 +01:00
Kevin Tang
ba6de7e36f msm8953-common: gps: fixing LE build breakage and a warning
util/Log.h is not available for LE

Change-Id: I4cd654bb2a832a19dd4b78db61bd2a55484382c0
CRs-Fixed: 2679131
2024-12-01 13:42:43 +01:00
Michael Bestas
a8534c0c78 msm8953-common: gps: Resolve unused parameter warnings
Change-Id: I0acef3da2c3567a28edd0a71dac89a5828f7725d
2024-12-01 13:42:42 +01:00
Saurabh Srivastava
9359f5d80c msm8953-common: gps: Android mk to bp conversion
Change-Id: I206b4a5a2b7e88a6a20522611e7b2684594ef6f4
CRs-Fixed: 2559087
2024-12-01 13:42:42 +01:00
Dante Russo
3eabe8e480 msm8953-common: gps: Bringup changes for Lahaina
CRs-fixed: 2568895
Change-Id: Iec61f47c05009bdadb67bb236b9772cdeda99ec7
2024-12-01 13:42:42 +01:00
haohuang
2b62b05f33 msm8953-common: gps: Logging buffer implemented by skip list
Use skip list to implement a log buffer,
log sentences will be inserted into this buffer
once the log print function is called. the
buffer will be dumped when GNSS process
crash/killed or send SIGUSR1 signal manually.

Change-Id: I5e23cdf30c263fa59108070c9dbfd95c49c2e9b6
CRs-Fixed: 2571326
2024-12-01 13:42:42 +01:00
Dante Russo
6a3cb70cbe msm8953-common: gps: Remove libhidltransport & libhwbinder references
These libraries are no longer required and
references are removed for optimization.

Change-Id: I186befda34a7d53a3c8f1e80449639dd230b1e1b
CRs-fixed: 2559079
2024-12-01 13:42:42 +01:00
Giovanni Ricca
68e630e13b msm8953-common: Fix lib-imscamera ELF checks
Change-Id: I83c6ec68af801b17a1dd6e4aba74145cea355e8f
2024-12-01 13:42:42 +01:00
Giovanni Ricca
e7c1ea03b3 msm8953-common: Cleanup conflicting libs
Change-Id: I9361ad55f8aba96cc77bd8b0c7294a49ff999d10
2024-12-01 13:42:42 +01:00
Sebastiano Barezzi
fe41da9091 msm8953-common: Append _vendor to conflicting vendor libs
Change-Id: I74306c87e12079204223caccc0c77eacd4e01ec0
2024-12-01 13:42:42 +01:00
Aaron Kling
5c5792f0d3 msm8953-common: Add vendor soong imports to extract
Change-Id: Ib19e69dc35af6b04519eeb695228af65f3d01d2a
2024-12-01 13:42:41 +01:00
Aaron Kling
094c75230d msm8953-common: Enable elf checks
Change-Id: Ia6c9a381abb3384c77532d75e02fd84c841a4d1e
2024-12-01 13:42:41 +01:00
Kelvin Zhang
ac08671212 msm8953-common: Allow to access bootable/deprecated-ota targets
msm8953-common is still using non-AB update.
non-AB code will be moved to a separated namespace, add
deprecated-ota to msm8953-common namespace list ahead of time to avoid
breakage.

Test: th
Bug: 324360816
Change-Id: I909064be36e8febe80492cf010eb6eac3d6bc33d
2024-12-01 13:42:41 +01:00
dianlujitao
acf806d862 msm8953-common: Nuke ATFWD
It's normally not used at all.

Change-Id: Idb824b3b8c783b6ac962e604df05f9154beb4ed2
2024-12-01 13:42:41 +01:00
Michael Bestas
e98b943ffc msm8953-common: Shim widevine with libcrypto_shim
The following change
e202e51cb0
removed symbols that our libs require.

Change-Id: I1325c34ecec3d339dd68c665010ecb36fa2e6a29
2024-12-01 13:42:41 +01:00
Yumi Yukimura
e36cd47462 msm8953-common: Switch to QTI Memtrack AIDL HAL
Change-Id: Ibcbaff02fd56fbccc3a88c01a5f46a89cb212ef5
2024-12-01 13:42:41 +01:00
Giovanni Ricca
432af04ffc msm8953-common: Unset BUILD_BROKEN_DUP_RULES
Change-Id: Ideab7852287e28d8a4283332d7bf8b730ac4a014
2024-12-01 13:42:41 +01:00
Bruno Martins
bc2c8ea3d6 msm8953-common: Unset BUILD_BROKEN_INCORRECT_PARTITION_IMAGES
Qualcomm targets can now build hermetic partitions.

Change-Id: I241105e01d85fea983b34846ca675666ac07541b
2024-12-01 13:42:41 +01:00
Bruno Martins
9ea4a78187 msm8953-common: Convert WiFi firmware symlink to install_symlink target
The last bit that was preventing building hermetic images.

Change-Id: I75bb7de4593a7992f6015317cf97e088beeba0cb
2024-12-01 13:42:40 +01:00
Bruno Martins
779af5d92c msm8953-common: Declare IMS libs as symlinks during extraction
Change-Id: Ia1b8097d28dd4888232fe383b830515b1b9bafaa
2024-12-01 13:42:40 +01:00
Bruno Martins
1e1996b046 msm8953-common: Move to new RFS install_symlink targets
Change-Id: I9560fd0da00958d9349a0881b5a5f64a2c02e495
2024-12-01 13:42:38 +01:00
ix5
dfd38482ba msm8953-common: Add protobuf vendorcompat lib
Our blobs are compiled against libprotobuf-full-cpp.so, but
starting in R, Android is using a versioned naming approach,
e.g. libprotobuf-cpp-full-3.9.1.so.

See https://r.android.com/1109518

The entry in public.libraries.txt is needed to allow the
linker to find and use the lib outside the VNDK.

See https://source.android.com/devices/tech/config/namespaces_libraries

[wight554: added libprotobuf-cpp-lite as well]

Signed-off-by: Volodymyr Zhdanov <wight554@gmail.com>
Change-Id: I28222c89e1e07017867088492a726ee9d45d8e6f
2024-11-15 23:26:02 +01:00
Giovanni Ricca
413795eb89 msm8953-common: Migrate to py extract utils
Change-Id: I2a7a0e7803940ef6105e55b88a94b7ba066a1929
2024-11-15 23:26:01 +01:00
me-cafebabe
4b27361aa4 msm8953-common: Change bluetooth.sco.disable_enhanced_connection 1 -> true
* In Android 14, `osi_property_get_bool()` treat it as true only if
  the property value equals to "true".

Change-Id: I8879a8cce4f82621624d760d7154e51a0a115fc0
2024-08-29 22:54:11 +02:00
Chirayu Desai
e0167e1f53 msm8953-common: rro_overlays: Move CarrierConfig to RRO
Change-Id: Ia57acd244608848f70fdcc30d5694c919db60671
2024-08-19 01:14:46 +02:00
Yumi Yukimura
95d6a697b5 msm8953-common: Kill androidboot.usbconfigfs=true kernel cmdline
* Wastes space

Change-Id: Iaf8a7b3de83381f58120aa41102d5bb8e699434b
2024-08-19 01:14:46 +02:00
Giovanni Ricca
0133597095 msm8953-common: Specify caymanslm source at the top
Change-Id: Iee0ae1f85148985edce4f06d3b3a40450d70877d
2024-08-19 01:14:46 +02:00
Giovanni Ricca
f766768c26 msm8953-common: Decommonize TARGET_TS_MAKEUP
* Only oreo (and below) targets actually use this feature.

Change-Id: I2e74031f99d4a473c4f214128b18d201f824d9d0
2024-08-19 01:14:46 +02:00
Michael Bestas
f071f9f5a9 msm8953-common: Remove media_codecs_google_c2*
AOSP codecs can be used by default and it is not necessary to include
them device side.

Change-Id: I8227b06f0466b614f12fa9008402b92461ea3dd0
2024-08-19 01:14:46 +02:00
Michael Bestas
6d9c85eaf0 msm8953-common: Use AOSP default Codec2/OMX ranks
Change-Id: Idf55ec02c2c0f4d2fa73f949cffef0d820a54570
2024-07-19 17:35:45 +02:00
Aaron Kling
b0e2d84c7b msm8953-common: Remove software omx codec references
These are no longer available as of Android 14 QPR3. The C2 codecs
available by default in the swcodec apex will be used instead.

Change-Id: I8cdf3e700823779a7382c66c3df8410d41209b7c
2024-07-19 17:35:45 +02:00
Sujin Panicker
8d9d0e33f9 msm8953-common: Set higher priority to c2 than OMX
Change-Id: If047caf630df17c9dfa94b67fab9f6259aa47e25
2024-07-19 17:35:45 +02:00
Paras Nagda
fee76362b5 msm8953-common: media: Finetune mediacodec performance values.
- Fine tune the performance xml based on CTS results.
- Update max instance for hevc and vp9 as per result
  on GSI.

Change-Id: I1f30158b4352f7c836b3b350798a72b3d856b2a3
2024-07-19 17:35:45 +02:00
Paras Nagda
f4c4bef4cd msm8953-common: media: finetune performance xml
- Fine tune entry for vp8 based on the cts results.
- Prefer HW codecs over sw.

Change-Id: I82e5e8b325c0843bb5b532afe84498e04fe790a9
2024-07-19 17:35:45 +02:00
Paras Nagda
2a1f1d223a msm8953-common: media: mark the target with slow cpu
This would enable low resolution for c2 sw codecs.
Reduce the max instance of hevc based on cts results.

Change-Id: I85f479f39d983fa7629128f1dfd9d4ad39aba381
2024-07-19 17:35:45 +02:00
Vasantha Balla
1ba528b7e7 msm8953-common: media: Update media codec performance values.
Enter values for c2 codecs as per results

Change-Id: I3eb117055cc8a3a2f50497dacf0598badc50a8a3
2024-07-19 17:35:44 +02:00
Sanjay Singh
238bb5dad3 msm8953-common: media: Added performance point tag for msm8953
Q version expects publishing of performance points.

Change-Id: Id32d96b57edd853cb450ce6ab3aa6e687ced131c
2024-07-19 17:35:43 +02:00
Han Sol Jin
506fdf405d msm8953-common: Explicitly disable protected management frames
This fixes support with WPA2/3 mixed access points; the primary issue
was that while this device doesn't support PMF, said access points try
to query for PMF in order to check for WPA3 support, which causes our
WLAN driver to die a painful death.

Disable it from the overlay, as AOSP enables it by default.

It's a wonder why it was enabled in the first place.

Change-Id: I89dbce7ae4c91cea9f1828e8b627a828e2b08011
2024-07-19 17:35:43 +02:00
Giovanni Ricca
952a3eaa80 msm8953-common: Drop parts once and for all
Change-Id: I910fc0283acab09125d173cc83410128c270b83b
2024-07-02 07:52:35 +02:00
Michael Bestas
2dae40961c msm8953-common: Build missing libraries for 14 QPR3
Change-Id: I6a84526ca1e9f4e5140c8068646433cab3fe85b2
2024-06-20 18:12:41 +02:00
Giovanni Ricca
cdf6330fb4 msm8953-common: Add atcmdfwd on framework compatibility matrix
Change-Id: I9943e6510a014523c3e13e2ff3599c5a1bd6135f
2024-06-20 13:36:29 +02:00
Michael Bestas
48c92b6cc6 msm8953-common: Inherit from legacy QTI FCM
Change-Id: I0bde1c273d4abe689f61e7d4ebcf80965d785489
2024-06-20 13:36:29 +02:00
Michael Bestas
51271b72fd msm8953-common: Include lineage FCM
Change-Id: Ib4408e941d920a3a38132ba1c8360994f5534c0b
2024-06-20 13:36:29 +02:00
Bruno Martins
f6cdc75377 msm8953-common: Inherit from QTI FCM
Change-Id: I0bdd4d63b60a1e29cdd69e71f7268932a105c16b
2024-06-20 13:36:29 +02:00
Tim Zimmermann
8ebfe97d32 msm8953-common: Set manifest target-level to 5
Change-Id: Ic72d17ebdb388dee9e63e27a36190c93c095fb0c
2024-06-20 13:36:29 +02:00
Bruno Martins
31f72c0c75 msm8953-common: Move to QTI health AIDL service
The health AIDL HAL service provides functionalities of charger,
therefore system charger at /system/bin/charger is deprecated.
On top of that, QTI health AIDL HAL service enables suspend by
default, the equivalent of setting ro.charger.enable_suspend
for legacy charger.

Change-Id: I59c23e7974cea1174b0161f31a535fa3afa1e5c9
2024-06-20 13:36:28 +02:00
Michael Bestas
234207a6da msm8953-common: Switch to QTI vibrator HAL
Change-Id: I911001c14167f7dfceb609090f7b90117310da07
2024-06-20 13:36:26 +02:00
Alexander Koskovich
c8da87d011 msm8953-common: Disable the usage of ConfigStore.
* As per commit
11a113a67e
("Add disable_configstore").

[SebaUbuntu] Remove manifest entry as well

Change-Id: I5482989a8a96227a3e2a5317eacf613c641bfa8e
2024-06-19 22:25:41 +02:00
Alexander Winkowski
f9a7b74d0c msm8953-common: overlay: Don't pin home app in memory
Similar to Ic2f9edd811879e3f18876a508273a9544d8a23e0, there is little
point in pinning the Home application.

Change-Id: I822de21e469d840994fb87c5eb2
2024-05-09 21:00:23 +02:00
basamaryan
da208fa37e msm8953-common: Don't explicitly include updatable_apex.mk
It is inherited by base_system.mk as of QPR2

Change-Id: I020a05b233f61ea28d03199cbc76051e6e97e1dc
2024-03-23 18:51:35 +01:00
Aaron Kling
c21776385c msm8953-common: Uprev usb hal to 1.3
Change-Id: I5d34c71663b31fe03b0d28f8c76e5a4f8cd2385c
2024-03-22 14:15:43 +01:00
Bruno Martins
da8fd9edee msm8953-common: Remove deprecated trust HAL
Change-Id: Ic5ac79b4ca60b87a97622877b97f806c07cab907
2024-03-22 14:15:42 +01:00
Yumi Yukimura
e9c0b201a5 Revert "msm8953-common: Switch to legacy WiFi HIDL HAL"
* WiFi AIDL HAL works in U QPR2
  (also, the legacy WiFi HIDL HAL has stopped working, lol)

This reverts commit ec336ce3f8.

Change-Id: I4d38fcc7e5999f934344bc364afb4f4d8a049711
2024-03-22 14:15:42 +01:00
Chaohui Wang
f42f488fce msm8953-common: parts: Migrate to CompoundButton.OnCheckedChangeListener
Switch and SwitchCompat are both CompoundButton.

Using CompoundButton in Java will helps migration in the future.

Bug: 306658427
Test: manual - check Settings pages
Test: m RunSettingsLibRoboTests
Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835
2024-03-22 14:15:42 +01:00
Peter Kalauskas
a22a3cb8d3 msm8953-common: parts: Enable use_resource_processor for all sysui deps
This will make the build faster

Test: m checkbuild
Bug: 295208392
Change-Id: I0c1bd901429bbe3bf81c1530e156735f8637a96e
2024-03-22 14:15:41 +01:00
Tomasz Wasilczyk
143f7d646d msm8953-common: gps: Don't include cutils/threads.h
Bug: 289414897
Test: buildserver
Change-Id: I14b99f42feaae7af00cbd17cfe482eb2e5da71e8
2024-03-22 14:15:41 +01:00
Cole Faust
eb47db6aad msm8953-common: Add BUILD_BROKEN_INCORRECT_PARTITION_IMAGES
Floral has issues that prevent it from working with a hermetic
partition build.

Bug: 205632228
Test: Presubmits
Change-Id: I490a29da38a6f68e7dd3650d8140cb11adaa8c7a
2024-03-22 14:15:40 +01:00
Bruno Martins
cb4b3c5576 msm8953-common: rootdir: Reconfigure ZRAM
This time around with ZRAM size set to 75% of total RAM size,
as per Qualcomm Android GO Performance Tuning Guide.

Change-Id: I8f8362ccb5110fba6c5ed50b5d87a0b94a48e01c
2024-03-18 14:06:45 +01:00
Dhina17
397a9475d2 msm8953-common: overlay: Drop useless config_pinnerCameraApp
- From this change [0], To pin the camera app, We need to set boolean phenotype property (DeviceConfig) "pin_camera" or fallback system
  boolean property "pinner.pin_camera" to true [1] even if the config_pinnerCameraApp config value set to true [2].

- Anyways, I don't pin the camera app since our device has low RAM.

Reference:
[0] - LineageOS/android_frameworks_base@599a834
[1] - b8404be70d/services/core/java/com/android/server/PinnerService.java (L103-L106)
[2] - b8404be70d/services/core/java/com/android/server/PinnerService.java (L180-L182)

Change-Id: Ia88de4775b3b60245e8eabce08b71c186e00d1c4
2024-01-24 13:19:25 +01:00
Jake Weinstein
0a1895e47f msm8953-common: Revert "fpc: keep fpc in system-background"
While Google found that fingerprint HAL is insensitive to
increased CPU throughput, we have not found that to be the
case and allowing more CPUs makes fingerprint unlock up to
2x faster in some tests.

This reverts commit d0fdb4431d26e4f257b8867f67ffd9b4a9818d9e.

Change-Id: I817f52e36530114cbd9185d88e44f38f379ff93b
2024-01-23 21:10:01 +01:00
Edwin Moquete
efa993ff4f msm8953-common: Disable display refresh rate override
This got enabled by default on U, and it causes apps like
Chrome and Youtube to set the refresh rate to 30FPS when
playing some videos.

Change-Id: I649bf03d550c2b9726c7957d15ed09e455d874ec
2024-01-21 22:54:30 +01:00
Yumi Yukimura
d4e9af0052 fixup! msm8953-common: Stop building VR HAL
* Considering msm89xx as VR high performance in 2023? lol
* The commit which introduced VR in this tree was
  42f734c8ef
  (I641c5f2bcbf31ff5a1dd26c9feb6209f7a5a633c)

Change-Id: I251fa87e4694e45347b078477ff4a00452e1b8e9
2023-12-09 18:49:29 +01:00
Giovanni Ricca
dae2985212 msm8953-common: rootdir: Setup zram with fstab
Change-Id: I4b172ee5c61693b5d6ae14b297374ff679f4938c
2023-12-06 09:33:12 +01:00
Sebastiano Barezzi
b34f24765d msm8953-common: biometrics: Move fingerprint HIDL to 2.3
Change-Id: I2e5ed64ac7ae2f1003503072666204c0788a003a
2023-11-13 14:47:05 +00:00
Sebastiano Barezzi
9742bfd13e msm8953-common: biometrics: Drop LOG_VERBOSE
* It's useless since it's the same as LOG_TAG

Change-Id: I1a15ea85f840b7af6d41b59cf01b0ec3c2457705
2023-11-13 14:44:56 +00:00
Bruno Martins
9bd64d18e8 msm8953-common: biometrics: Use pragma once
Change-Id: I335b0a1b73effa6f9c0b0866052d74dc524ad99b
2023-11-13 14:44:55 +00:00
Arian
c9d99efd6e msm8953-common: parts: Target current sdk
Change-Id: Ia623282960775569325714ab3bff5ad027776352
2023-11-13 11:50:25 +00:00
Arian
ed189e1a23 msm8953-common: parts: Get rid of HelpDialogFragment class
As preparation to upgrade the sdk get rid of this private class.
Fragments must be a public static class to be properly recreated from instance state.

Also change the behaviour to only hide the dialog when confirmed instead of also when it is cancelled.

Change-Id: I171aa2345058edae7520c37942c3c11b3cdfdfdc
2023-11-13 11:50:25 +00:00
Micheal
9148988164 msm8953-common: parts: Add an exported flag in manifest
Targeting S+ (version 31 and above) requires that an explicit value
for android:exported be defined when intent filters are present

Change-Id: I12d27c23624eb5259da582b86ac1bd7572754f0c
2023-11-13 11:50:20 +00:00
Rick Yiu
82d43214db msm8953-common: Remove some camera-daemon commands
Those commands have moved to init.rc.

Bug: 170507876
Bug: 171740453
Test: build pass
Change-Id: Icfe520e7f7367461607cc8fb5e524d9699e79124
2023-11-13 11:38:31 +00:00
Suren Baghdasaryan
f560ef2e32 msm8953-common: Replace writepid with task_profiles command for cgroup migration
writepid command usage to join a cgroup has been deprecated in favor
of a more flexible approach using task_profiles. This way cgroup path
is not hardcoded and cgroup changes can be easily made. Replace
writepid with task_profiles command to migrate between cgroups.

Bug: 191283136
Test: build and boot
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ibb56d2379c42e5ed4b2f15c1b04d5fb163b48678
2023-11-13 11:38:31 +00:00
Sebastiano Barezzi
324235bf2d msm8953-common: Raise VINTF target level to 4
Change-Id: I4c4783dc112102f127f3b1d796e206dcac672faf
2023-11-13 11:32:55 +00:00
Giovanni Ricca
5d13890b1d msm8953-common: Drop ILocHidlGnss manifest entry
* vendor.qti.gnss@3.0-service.xml has it already

Change-Id: I5b93d9b17bb5c6a841e8ec9f9ccefe8e95dec66f
2023-11-13 11:32:55 +00:00
Yi Kong
3ec107285a msm8953-common: gps: Fix unqualified-std-cast-call warning
hardware/qcom/sm8150/gps/utils/LocIpc.cpp:315:24: error: unqualified call to std::move [-Werror,-Wunqualified-std-cast-call]
            mIpcRecver(move(ipcRecver)) {}
                       ^
                       std::

Test: presubmit
Change-Id: I7378416e788f20ebb3f8d1d065d60964dc76eb99
2023-11-13 11:32:55 +00:00
Madhanraj Chelladurai
71cc80055d msm8953-common: gps: Add NULL check before object access
Correct the NULL check code block and add NULL check before
object access.

Change-Id: Ic41b781b41fb4e21bbff8801d500a41a6d7219d0
CRs-fixed: 3084543
2023-11-13 11:32:55 +00:00
Yingjie Wang
9a9597f374 msm8953-common: gps: Re-init battery listener when Health hal died
When system_server and health hal both died, battery listener
will get blocked in serviceDied. Make complete cleanup
for re-init.

Change-Id: I7ecc5b2e6e2aeb1e79ed45db94b05662eb9f37b9
CRs-fixed: 2640795
2023-11-13 11:32:54 +00:00
Erfan Abdi
0049f231bd msm8953-common: Set loop.max_part
Change-Id: Ibfb9e215c53111de4e8de018ea1934405468c6c9
Signed-off-by: Erfan Abdi <erfangplus@gmail.com>
2023-11-13 11:32:54 +00:00
Jiyong Park
2ce56ac9aa msm8953-common: Add updatable_apex.mk
The product abstracts configs that need to be set to support updating of APEXes.

Change-Id: Id5aa944ceba6a6846308f1c18a08af8b3bb38589
2023-11-13 11:32:54 +00:00
Giovanni Ricca
09d3a8cc08 Revert "msm8953-common: Force disable updatable APEX"
We will miss you :(

https://android-review.googlesource.com/c/platform/system/apex/+/2636909

This reverts commit 47aa83341a.
2023-11-13 11:32:54 +00:00
Alexander Martinz
76f10c994b Revert "msm8953-common: Disable APEX compression"
This reverts commit bd99b805a0.

Test: build, flash and boot device with flag reverted.
Test: boot GSI with compressed APEX enabled.

Change-Id: I5988614cc055d565b17a5c8d830e35feb0e33e92
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2023-11-13 11:32:54 +00:00
Adithya R
8e4147819a msm8953-common: Switch to full IWLAN mode
[basamaryan: This is needed for Android U to fix RIL]

Signed-off-by: basamaryan <basam.aryan@gmail.com>
Change-Id: Ie3fa610f71077b4ee2af1b4d57bd0c30b34f30fa
2023-11-13 11:32:53 +00:00
Giovanni Ricca
f1287dd679 msm8953-common: rootdir: Tissot doesn't have a vendor partition
* Mi8953 in his true form :P

Change-Id: I43da62492c22f51e49ffb84830a99250dced8ae5
2023-11-13 11:32:53 +00:00
Chenyang Zhong
4836a2cb13 msm8953-common: Specify androidboot.boot_devices
So that /dev/block/by-name/ symlinks are created.

Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
Change-Id: I270c1899e4487ed5e7657038c4ed07e407476953
2023-11-13 11:32:53 +00:00
Sebastiano Barezzi
c948e3c7e6 msm8953-common: Switch to two-stage init mounting
* Stop handling cust and vendor mounting from kernel, first stage init is gonna do that, together with system (which is now /system)
* Use correct mount flags coming from kernel dts
* Move system, system_ext and vendor mount points to /dev/block/by-name/, we don't have bootdevice symlink to that point in init
* Copy fstab to ramdisk for first stage init

Change-Id: If8d75837f47c70f7ea02183bffaff233b4d6bb26
2023-11-13 11:32:53 +00:00
me-cafebabe
ec336ce3f8 msm8953-commom: Switch to legacy WiFi HIDL HAL
* With the new WiFi AIDL HAL, the framework thinks the device
  supports interface combination for some unknown reason,
  even though the service doesn't advertise it. As a result,
  the WiFi service fails on configureChip method.

Change-Id: I0c3fa7b4c947c3525c30f7cef0b2674bee224da7
2023-11-13 11:32:52 +00:00
me-cafebabe
7dacfd60b5 msm8953-common: libstdc++.vendor => libstdc++_vendor
Change-Id: I478eb89aa2ac106d855b168844863032612bc8e8
2023-11-13 11:32:52 +00:00
LuK1337
8316d3cb4f msm8953-common: Use libutils-v33 for pm-service
Change-Id: Ia998fa72d8747de18010abe6491d2c374cb7aa0a
2023-11-13 11:32:52 +00:00
LuK1337
db9ee175a1 msm8953-common: Build android.frameworks.sensorservice@1.0.vendor
Required by mm-pp-deps.

Change-Id: Iaf821dcbb07d7820f2fc3ff5ca9cca5e973360f2
2023-11-13 11:32:52 +00:00
Gabriel Biren
d4ce73f564 msm8953-common: Update makefile to use the AIDL Wifi Vendor HAL.
Bug: 274964641
Test: Pre-submit tests
Change-Id: I4d9114377fe75b593bbfe6a59f03d8f5d607d6a1
2023-11-13 11:32:51 +00:00
Giovanni Ricca
73d2b22e27 msm8953-common: rootdir: Don't read bluetooth.hciattach
* Unused with our current stack anyway

Change-Id: I80dda7f78dca91bd6b1c6f200a885045048f597f
2023-09-18 01:06:48 +02:00
Giovanni Ricca
2a46ce1cdd msm8953-common: rootdir: Don't start gamed
* We don't have this service

Change-Id: Ifa583998ec12343ff3fc0d783604520172832114
2023-09-18 01:06:47 +02:00
Giovanni Ricca
ea153565e2 msm8953-common: rootdir: Don't set store_user nodes to 0
* Not only they throw an useless denial on boot, they are already on 0

Change-Id: I6407e2293a3df47796ff5beebe3349c67a0ce715
2023-09-18 01:06:47 +02:00
Nolen Johnson
a5063eab2b msm8953-common: sepolicy: Allow hal_gnss_qti to get xtra_control_prop
Change-Id: I6eeeeb2a42b4d0c3e934af3da9ab3aaa2d4c10b4
2023-09-18 01:06:47 +02:00
Nolen Johnson
41de346640 msm8953-common: sepolicy: Resolve BPF denials
Change-Id: I3a4ec030a6c56f0a7a8df1b510bc9636eb74c8bd
2023-09-18 01:06:47 +02:00
Erfan Abdi
6cd38df0d3 msm8953-common: rootdir: Disable qemu.hw.mainkeys setprop
We are enabling software navigation bar using overlay. Thus, this is
not required. Not to mention, this causes SELinux denials as well.

selinux: avc:  denied  { set } for property=qemu.hw.mainkeys pid=1262 uid=0 gid=0 scontext=u:r:qti_init_shell:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service permissive=0
Change-Id: I6f641bcde6b55ccc9a0ccad98b00de938d62d00f
2023-09-16 17:12:10 +02:00
Nolen Johnson
921e7f7390 msm8953-common: sepolicy: Label discard_max_bytes
Change-Id: Ic4ced7dd219b5981f9327b55d4ac5a69d8504900
2023-09-16 17:05:18 +02:00
Giovanni Ricca
d29cc1a3fc msm8953-common: sepolicy: Label Extcon nodes
Change-Id: Ic994af95fcd32d41ff9758a35a9496dd28280945
2023-09-16 16:53:10 +02:00
Dhina17
d4ee93d696 msm8953-common: Drop audiosphere
AudioSphere post processing is used to add
virtualization effect to audio playback on stereo speakers.

It's supported by neither our stock nor CLO for msm89xx.
Plus our device don't have stereo speakers.

Change-Id: I1b985ec97d5edee529cac00e6c21f8eb64c1b19a
2023-09-16 13:52:52 +02:00
Georg Veichtlbauer
2d4f521e08 msm8953-common: rootdir: Setup all the sub-system as related.
They can restart itself, but let the phone keep
running instead of triggering an reboot.

Change-Id: Idc486acbd6bb091fc9fddc7a0d876824215a757b
2023-09-12 20:06:18 +02:00
Nolen Johnson
5a93f5b8f7 msm8953-common: Explicitly disable AVB
* This allows infra to sign successfully, I hate it, but it builds,
  boots, and works fine enough as a workaround.

* The underlying issue is that this flag causes avbtool args and location
  to be set in `misc_info.txt` whereas before it was not.

Change-Id: I7bdf237ec30d692c7d8b5c626a6e761e2c1a2593
2023-09-12 20:06:18 +02:00
Giovanni Ricca
85b6ca4249 msm8953-common: Switch to fragmented defconfigs
Change-Id: I5c3a7c41a9764221a2872830abf078ecc2cdf192
2023-09-12 20:06:18 +02:00
Giovanni Ricca
fc92fe6918 msm8953-common: Drop TARGET_KERNEL_VERSION
* Uneeded since https://review.lineageos.org/c/LineageOS/android_vendor_lineage/+/357531

Change-Id: I6df78f445c917b82bdc22eacf05c6f4242a789c3
2023-09-12 20:06:18 +02:00
bohu
d57dbd3160 msm8953-common: Set ro.crypto.volume.filenames_mode to aes-256-cts
BUG: 129557601
Test:
CtsAppSecurityHostTestCases android.appsecurity.cts.AdoptableHostTest

Change-Id: I414e76714a55531f095de757d0bec066cf350f8b
2023-09-12 20:06:17 +02:00
Michael Bestas
bf7a2fdeb8 msm8953-common: ueventd: Remove all permissions from /sys/devices/soc0/serial_number
Change-Id: I688347cfe59f56e4de2e4bf3c3324ca465f7a897
2023-09-12 20:06:17 +02:00
Michael Bestas
bcd545d091 msm8953-common: Implement xtra-daemon control via property
Default to false if the property is not set.
Device init scripts will need to be adapted to restart
loc_launcher service when property change is detected.

Change-Id: Icbda789cd2a9a3391f437af2c07fc5127f2f09ab
2023-09-12 20:06:17 +02:00
Kevin Tang
b4e658c323 msm8953-common: gps: Remove XTRA version check.
Remove legacy XTRA version check as it is
deprecated.
Update the xtra time url.

CRs-Fixed: 2684513
Change-Id: I8566d367c6a7ccebf295836b4c8d46509a428044
2023-09-12 20:06:17 +02:00
Michael Bestas
93cf315760 msm8953-common: gps: Remove all Wno-error flags
Almost all warnings/errors have been fixed.
Ignore undefined bool conversion error on purpose.

Change-Id: I00cb5f38711fa9f873da030fc6a0ebc6cde3ceeb
2023-09-12 20:06:17 +02:00
Albert I
6dab3f496c msm8953-common: gps: Implement list empty error code for msg_q
This fixes enum-conversion warning due to implicit type enum casting
between linked_list and msg_q which happens only for status -6.

Change-Id: I27ba74c4d840b7ba0cb1017d69a30fc25b80d6b9
2023-09-12 20:06:16 +02:00
Albert I
30c9bafae6 msm8953-common: gps: Reorder initializations list to satisfy warnings
-Wreorder-ctor is a compile-time, Clang-only flag which is enabled by
default since Clang 12, which will warn whenever a specified field will
be initialized right after field specified below it. However, since it
doesn't sweep through all fields, compiler may miss some of them.

This order has been checked thoroughly through many trial and errors to
ensure that no such warns will be triggered anymore.

Change-Id: Id24cbb7277dc8d6c02767f8f365818ab6c017683
2023-09-12 20:06:16 +02:00
Giovanni Ricca
2a8bd459b6 msm8953-common: sepolicy: Set vendor_fp_prop to restricted
Change-Id: I4d1428e4a7c2b94645c5de516eea632f1d3411d4
2023-09-12 20:06:16 +02:00
Nolen Johnson
a2da82198c msm8953-common: sepolicy: Allow FMRadio app what it needs
Change-Id: I3392ffb28cea6a80f3b9e493920a3bdfbee9dce7
2023-09-12 20:06:16 +02:00
Michael Bestas
a5aee13932 msm8953-common: Automatically add apk/jar/vintf fragments to PRODUCT_PACKAGES
Change-Id: Iaa9d66b0bbdc55f046ee1347cbf83c7eecebb35e
2023-09-12 20:06:16 +02:00
Georg Veichtlbauer
5ba494352b msm8953-common: Fix PowerOffAlarm
* The APK is prepared to not run as system user
* Adjust /persist/alarm/data permissions accordingly

Change-Id: Ie24ccb3749d1dda2deb670cdb531e35d153034ed
2023-09-12 20:06:15 +02:00
Qimeng Pan
737aceef21 msm8953-common: rootdir: add power_off_alarm into init.rc
Add power_off_alarm into init.rc on charge mode

Change-Id: I18158cde8b3ae0890a92bd1ced56782fa053230a
CRs-Fixed: 2373093
2023-09-12 20:06:15 +02:00
Mao Jinlong
2e47fe50dc msm8953-common: rootdir: Add vendor prefix to power_off_alarm service
power_off_alarm is a vendor service. Add vendor prefix to it.

Change-Id: Ib4a988467a54bbe4544960180afeeeb5dd0e85f3
2023-09-12 20:06:15 +02:00
Mao Jinlong
3cd3f87a1d msm8953-common: rootdir: Add power off alarm service
Add power off alarm service for power off alarm feature to
reboot device when power off alarm is up in some special
mode like power off charging mode.

CRs-Fixed: 2095984
Change-Id: Ib8d82e63e92a85a7f60d5559064a1f19e0de5a22
2023-09-12 20:06:15 +02:00
Giovanni Ricca
e5cc6fde61 msm8953-common: Enable Qcrild
Change-Id: I6eec8ed7b81acde0904d47ec6707a680b513318d
2023-09-12 20:06:12 +02:00
Giovanni Ricca
84846914f2 msm8953-common: Commonize qcril blobs
This reverts commit 9a0c0303d5.

Change-Id: Ie486479236154d91d8857baa59c5ef1ceacfd1c3
2023-05-22 08:22:34 +02:00
OnlyTomInSecond
5e5181a2e7 msm8953-common: Set block_binder_thread_on_incoming_calls prop
In order to fix incoming calls.

Change-Id: Id474622f3e08b88f1d099e3d6507fd1d84de4d88
2023-05-21 11:47:33 +02:00
Tim Lin
331e2e7f1a msm8953-common: qcril: fix MT SMS sent during power off
qcril will block any further MT SMS if previous one is not ACKed.
For this bug, IMS service is not ready and resulted in qcril stuck in blocking state.
This solution will add 30s timer to reset blocking state if there is no ACK from Telephony.

Bug: 169549852
Test: MT SMS during power off
Change-Id: I6f52170654925143aeb55f8bc0cf4c379717e718
2023-04-19 12:05:45 +02:00
Bruno Martins
b1b63fc994 msm8953-common: parts: Fix compilation for QPR1 merge
Change-Id: I71ad7db85592ca18e3f0f8155bba5a472bfadbaa
2023-04-19 12:05:44 +02:00
Bruno Martins
20b115feb5 msm8953-common: parts: Move XiaomiParts to /system_ext
Change-Id: Ic3ed16bb0bea98d9dd5da96da63c65ebe735036a
2023-04-19 12:05:44 +02:00
Bruno Martins
20f95cb9fc msm8953-common: parts: Use all shared resources from devicesettings
Change-Id: Icd7f381c574ea36eb4d797cefd60ba9f1a0941bd
2023-04-19 12:05:44 +02:00
Timi Rautamäki
3d7ddbbb4b msm8953-common: switch to threaded Skia render engine backend
´threaded´ option has issues with night light, etc.

Co-authored-by: Michal Pražák <michal.prazak1@gmail.com>
Change-Id: I142b95a38bf664f54c12d5c17ab11214375f705b
2023-04-19 12:05:44 +02:00
Nolen Johnson
6dcab244ed msm8953-common: Enforce EPPE
Change-Id: Ib7934f55293a3757e29c503e0613c0dab9a4381d
2023-04-19 12:05:44 +02:00
Etienne Ruffieux
0e8301720f msm8953-common: Removed audio A2dp from device.mk
Bug: 220306859
Test: atest
Tag: #feature
Change-Id: I300369d36399ffb558b98bafc2478b872d09faba
2023-04-19 12:05:43 +02:00
Nolen Johnson
755c66409b msm8953-common: AOSP WFD doesn't support protected Wi-Fi Display buffers
Change-Id: I971373b5c57b8591b1bf676849cc511f8a425023
(cherry picked from commit d52231052828d4390d630681d651874ffb50388b)
2023-04-19 12:05:43 +02:00
Georg Veichtlbauer
1c8dff8c7b msm8953-common: Drop config_setColorTransformAccelerated
It's now enabled by default

Change-Id: I57f059c872fc2ad2fd15e788b1391eeebaff9bde
2023-04-19 12:05:43 +02:00
Santiago Seifert
c6b83f7eb8 msm8953-common: Unpin updatable-media from memory
Bug: 214499288
Change-Id: I4823afa45553b9484ad5215d081b0e6635c4b183
Test: Presubmit
2023-04-19 12:05:43 +02:00
Les Lee
847387d3cf msm8953-common: wifi: Configure correct overlay configuration.
ag/16564596 will change default value to false.
Configure correct overlay configuration.

Bug: 212488775
Test: manual test & build
Change-Id: Iaf1a0a23dae69fde5995e591a757a8ef5374d5b5
2023-04-19 12:05:43 +02:00
Sevenrock
0b0107fa73 msm8953-common: add ro.hw_timeout_multiplier
Fixes watchdog kicking in while formatting huge sdcards.

Change-Id: I60e8acff8a9f113e3f12f31061e0bb9b1fe24e46
2023-04-19 12:05:42 +02:00
Woody Lin
89070329cb msm8953-common: Enable zygote critical window
Bug: 141948707
Change-Id: I5dc57312118b0f6d95fc9fe164363ec7e15f1b51
2023-04-19 12:05:42 +02:00
Mohammed Mirza Mandayappurath Manzoor
08d8cedc8e msm8953-common: ueventd: Set permissions for KGSL sysfs node
Some KGSL sysfs nodes need to be access controlled. Set proper
permissions for the same.

Change-Id: Idc7e2447d02742074873901c6539f2c6d9d25862
2023-04-19 12:05:42 +02:00
Bruno Martins
61db34ecdd msm8953-common: Migrate to AIDL ClearKey DRM HAL
Change-Id: Iad5cc1176978137c647069197b33f49fb4d98ab2
2023-04-19 12:05:42 +02:00
Bruno Martins
ce22b48613 msm8953-common: Drop default DRM service
This is not needed, since Widevine DRM and Clearkey DRM
services are available.

Change-Id: I97023f1bab88ddb8fa4cb205df190c516a759951
2023-04-19 12:05:42 +02:00
Sebastiano Barezzi
1fd70f0d65 msm8953-common: Drop QTI camera device usage
* qcom-camera topic hasn't been ported to 19.1
* Keep building vendor.qti.hardware.camera.device@1.0 interface lib, IMS stack and possibly camera HAL still needs it

Change-Id: I87bcd5b54ad986d5844df50de243fc1a18507198
2023-04-19 12:05:41 +02:00
Sebastiano Barezzi
27437ba160 msm8953-common: Remove USE_DEVICE_SPECIFIC_CAMERA
* Doesn't exist

Change-Id: I10fc7de8721f3c871d00522e1d85c2a8d8c18160
2023-04-19 12:05:41 +02:00
Bruno Martins
ef87c4f705 msm8953-common: Drop custom APM flag
Custom audio policy manager is hard disabled by CAF
for 2 years now.

Change-Id: Idd34d1cbbdb735d6cf0de3b159c2670bf7ddd1e3
2023-04-19 12:05:41 +02:00
Alexander Martinz
0140717e1b msm8953-common: audio: fix VTS
Using "dynamic" is invalid according to xml schema
"audio_policy_configuration_V6_0.xsd".

Test: atest VtsHalAudioV6_0TargetTest
Test: atest VtsHalAudioEffectV6_0TargetTest

Change-Id: Ic1660f0d593f83e5568a4ad678383e600e27b793
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
2023-04-19 12:05:41 +02:00
llololo
b0e15c2fac msm8953-common: Remove A2DP input module in audio policy configuration
No Pixel device support A2DP sink functionality.

Bug: 163050296
Test: A2DP related test.
Change-Id: I269220cf29451ea79362fc004fa073713f72fdb2
2023-04-19 12:05:41 +02:00
me-cafebabe
b8296e3fa7 msm8953-common: Disable bluetooth enhanced SCO connection
Change-Id: Ib8013cf76a176fc3214d1ab57b77b63b85a1741b
2023-04-19 12:05:40 +02:00
Michael Bestas
ccc6857a3c msm8953-common: Remove bdroid_buildcfg.h
As of I3c7aed1bdb45db728d319f7d757400e44d232283 the Bluetooth stack
defaults to reasonable defaults that should work for all devices.

Change-Id: I056d63c4c8a2727e384172e964dc0000b6773504
2023-04-19 12:05:40 +02:00
Bruno Martins
c591bf9aeb msm8953-common: Remove QTI BT stack bits
Change-Id: Ice6c2b0735aa7cb4b2e638a794c778883e706c97
2023-04-19 12:05:40 +02:00
Bruno Martins
384338ae9a msm8953-common: Drop component overrides
This is no longer needed as of Android 13.

Change-Id: I38435c47c8781678f82014decbbae40dcab0a07b
2023-04-19 12:05:40 +02:00
Georg Veichtlbauer
960f881b7e msm8953-common: Move Bluetooth power config away from overlay
Same values go to:
- power profile xml for power calculation
- vendor props for the A13 BT stack

Change-Id: I04dbb8736a599c4798223f7e3e317b2fcc873ded
2023-04-19 12:05:40 +02:00
Alice Kuo
5dc16f86d8 msm8953-common: Disable LE audio related profiles
Bug: 231671426
Test: build
Change-Id: I78e2ddfc636a0fa31b977b5f9ba9a7d7bc0f2a26
Merged-In: I78e2ddfc636a0fa31b977b5f9ba9a7d7bc0f2a26
(cherry picked from commit acb0b19b8348a4b9518d2f46b1599f423f620347)
2023-04-19 12:05:39 +02:00
Sal Savage
d0a2eee258 msm8953-common: Use the ?= operator so BT properties can be overridden
System properties set with the "=" operator cannot be overriden. This
device is used elsewhere in the system and some of the properties need
to be overridden. The "?=" operator will use the assigned value if no
other values are assigned elsewhere, allowing for overrides.

Bug: 230638462
Test: adb shell getprop | grep bluetooth
Change-Id: Id6cd7901555edafef141bbc1bbd5e06dc3a54d0c
2023-04-19 12:05:39 +02:00
Sal Savage
388e89a9e8 msm8953-common: Set default the Bluetooth class of device
The class of device is a string with a list of uint8t values:
90,2,12

The meaning is as follows:
{Service Field, Major class, Minor class}

Service Field: 0x5A -> 90
    Bit 17: Networking
    Bit 19: Capturing
    Bit 20: Object Transfer
    Bit 22: Telephony
MAJOR_CLASS: 0x02 -> 2 (Phone)
MINOR_CLASS: 0x0C -> 12 (Smart Phone)

Bug: 217452259
Test: make -j; -- check that bluetooth.device.class_of_device is
correct

Change-Id: I24fd57bacbf6786a26f7079e7a6e9857dbe170d1
2023-04-19 12:05:39 +02:00
Sal Savage
194b93effb msm8953-common: Update LE Audio profile properties to match spec and implementation
Bug: 217448211
Test: atest BluetoothInstrumentationTests
Change-Id: I9312b9b70b51603aca6da6f4081533ab73c1614d
2023-04-19 12:05:39 +02:00
Alexander Koskovich
6f2ba9923a msm8953-common: Move BT profiles props to vendor
* Makes it GSI compatible

Change-Id: I8f7caf241d508af59c16482e6185c42f23f8a460
2023-04-19 12:05:39 +02:00
Sal Savage
f8344bc1d8 msm8953-common: Enable bluetooth profiles with product.prop
Bug: 217448211
Test: make -j
Change-Id: Idd7e52b7822915ed61299f1c0b29bf87ca0339fe
2023-04-19 12:05:38 +02:00
Josh Wu
23739d94af msm8953-common: Switch BtAudio to AIDL
Test: m
Bug: 203490261
Change-Id: I4b8ac40d5ad410b89eb6a0573d740d86471ecfc7
Merged-In: I4b8ac40d5ad410b89eb6a0573d740d86471ecfc7
2023-04-19 12:05:38 +02:00
Jakub Pawlowski
c3dc95363b msm8953-common: Use bluetooth.audio@2.1
bluetooth.audio@2.1 adds new functionalities required for Bluetooth LE
Audio development

Bug: 150670922
Change-Id: Iac2ece0c029a38fef82e81f5ba3ba491163818ef
2023-04-19 12:05:38 +02:00
LuK1337
312973b340 msm8953-common: Rework way to prevent adding duplicate dependencies
Change-Id: I2eb6484dbe3a9fddc883bf1290da1b76c4e1c54c
2023-04-19 12:05:38 +02:00
Nolen Johnson
dd02e1f6dc msm8953-common: Move to libhidl shim in hardware/lineage/compat
Change-Id: Ia2cd305baf3ce0fa7ac52d440a4ff51f94654438
2023-04-19 12:05:38 +02:00
Nolen Johnson
eb8160db31 msm8953-common: Move to libgui shim in hardware/lineage/compat
Change-Id: I04c4e15c6128de33ab7124de28b2fbd82eb2d62a
2023-04-19 12:05:37 +02:00
Nolen Johnson
1f56e5f420 msm8953-common: Move to libcutils shim in hardware/lineage/compat
Change-Id: I96b8485c1a868e271607cf205ac1366dc77f69d0
2023-04-19 12:05:37 +02:00
Giovanni Ricca
eb88348f05 msm8953-common: Drop HALv1 once and for all
* Has been deprecated on aosp-12

Change-Id: I02d5f320db9243c04d89d58fef775dfe33fe4ac7
2023-04-19 12:05:37 +02:00
Giovanni Ricca
df2c0a07c9 msm8953-common: Remove reorder libs script
* Is now inside tools/extract-utils/

Change-Id: Ia7682e69b388bc82877a0d62c4bf2def8e787d3f
2023-04-19 12:05:37 +02:00
Manoj Basapathi
aac36026db msm8953-common: Remove unused fast dormancy persist property.
[    7.265723] audit: type=1107 audit(129718197.409:4): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=u:r:init:s0 msg='avc:  denied  { read } for property=persist.env.fastdorm.enabled pid=0 uid=0 gid=0 scontext=u:r:vendor_init:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0'

Properties which are related to the fastdormancy apk
are removed. Legacy fast dormancy code is obsolete and removed
all its instances.

CRs-Fixed: 2748503
Change-Id: I7a2bd24d78bb49765af59c933eca4503015b6792
2023-04-19 12:05:37 +02:00
dianlujitao
ddf6526d8a msm8953-common: Don't apply persist.vendor.usb.config
* Otherwise adb turns on after reboot every time.

Change-Id: I66631f1f38a3e3a16e6d3dad87c83d0a98e6f851
2023-04-19 12:05:37 +02:00
Jorim Jaggi
3d02cb444b msm8953-common: Disable sdm rotator downscaler
Rotator down scaler is causing additional delays that are better
handled by GL composition.

Test: Open app, no jank
Bug: 73640835
Change-Id: I6ea9baa28acc222afcf365f3bf107149bc8974d9
2023-04-19 12:05:36 +02:00
Dominik Baronelli
289846f5f4 msm8953-common: disable scaler
Test: Add clock widget with moving clock arm to homescreen.
      With enabled scaler there is obvious flickering.
      With scaler disabled, the flickering is gone.

Change-Id: I68e32bfa01eec4e74c2190b4afbb780b9353ffbb
2023-04-19 12:05:36 +02:00
Giovanni Ricca
a880e78558 Revert "msm8953-common: properties: don't latch unsignal buffers"
* The props actually helps us reducing some lags/janks we currently have

This reverts commit f8853496f5.

Change-Id: Ie2588ac21f844e0b0f96d601c54e8f71fc1ffa1e
2023-04-19 12:05:36 +02:00
dianlujitao
61f9a7d01b msm8953-common: Build new GNSS HAL
* Remove unnecessary dependencies on liblbs_core.so
 * Hardcode vendor loc HIDL version to 3.0 to enable vendor HIDL when
   building w/o BSP.

Change-Id: I01f661f1d1e038737801f5a9db88e3388d470f74
2023-04-19 12:05:36 +02:00
Michael Bestas
5b47152a9e msm8953-common: gps: Lower debug level
* Kill logcat spam

Change-Id: I20d1f698d3c2d1b56e79f6eb6c5c17069e43c60f
2023-04-19 12:05:35 +02:00
Ethan Chen
8e810d6eb7 msm8953-common: gps: Increase batch size to max
* Hardware supports 40

Change-Id: I075fff615814fa105ec1493c5bdde60b8abccf0e
2023-04-19 12:05:35 +02:00
TheStrix
8c8dad85c8 msm8953-common: gps: disable unused location services
* Disable XTWIFI

Change-Id: I70f39d8d611167f65bb3912590b05f8a8d121c80
2023-04-19 12:05:35 +02:00
dianlujitao
96f28cdc70 msm8953-common: Fix non-ASCII character in gps.conf
:caf:

Change-Id: Iea9c44c0fbad574cbc077feea3d9f1de83d7d99a
2023-04-19 12:05:35 +02:00
Giovanni Ricca
ffc32a7dc0 msm8953-common: gps: Pull gps configs from daisy
Change-Id: I437ca5388a6070108da1fb9d314d424658f75c49
2023-04-19 12:05:35 +02:00
Michael Bestas
6e9df9ae75 msm8953-common: gps: Ignore some build warnings
Change-Id: If1dfd39ab820cdf5e7ac5caf05dc8fea1cd95235
2023-04-19 12:05:34 +02:00
Michael Bestas
931fadb6eb msm8953-common: gps: Resolve unused parameter warnings
Change-Id: I0acef3da2c3567a28edd0a71dac89a5828f7725d
2023-04-19 12:05:34 +02:00
Giovanni Ricca
af2b1e73e4 msm8953-common: Import Gps hal
* from LA.UM.8.6.r1-02600-89xx.0

Change-Id: I9cead1517e71e1ae9381e6435ca746033d9a1446
2023-04-19 12:05:34 +02:00
me-cafebabe
721a333301 msm8953-common: Legacy devices doesn't support ICE Encryption
Change-Id: I07003e50aea9a8fe5bf59437e769166c8dcd4668
2023-04-19 12:05:34 +02:00
Nicholas Lim
00edd4169b msm8953-common: Drop FDE support entirely
Change-Id: Ifecd15ee6c86a4571e5a7cc961372348455c4d5c
2023-04-19 12:05:34 +02:00
Anver sadhique
228384abfc msm8953-common: audio: set valid and supported channel mask for earpiece
For earpiece to be properly enumerated as a output device,
set valid and supported out_ channel mask.

Change-Id: Ic83b009956ff43567b3acbb186d0069b16e91e83
2023-04-19 12:05:33 +02:00
Shalini Manjunatha
8c7fd2d3fa msm8953-common: audio: Use AOSP implementation for sw effects
Change-Id: Iae6212f135fc4cc7bfb0528380daf9f13101a2ec
2023-04-19 12:05:33 +02:00
Bruno Martins
3359e801bb msm8953-commom: sepolicy: Add rules for older IMS blobs
Since Android 10 blobs are being used, org.codeaurora.ims still runs as phone UID as seen by these denials:

  m.android.phone: type=1400 audit(0.0:2914): avc: denied { read } for name="u:object_r:qcom_ims_prop:s0" dev="tmpfs" ino=13660 scontext=u:r:radio:s0 tcontext=u:object_r:qcom_ims_prop:s0 tclass=file permissive=0
  m.android.phone: type=1400 audit(0.0:473): avc: denied { call } for scontext=u:r:radio:s0 tcontext=u:r:hal_imsrtp:s0 tclass=binder permissive=0

Change-Id: Ic8c1b7996b9e0e7b63ba2a153441c9e8467a8a31
2023-04-19 12:05:33 +02:00
Giovanni Ricca
1cca8f4709 msm8953-common: sepolicy: Drop chargeonlymode rule
* We don't ship it anymore

Change-Id: Iaca9ea838759cf47f211ddd1b53f5dc6dab17df5
2023-04-19 12:05:33 +02:00
Giovanni Ricca
dd09bf512d msm8953-common: sepolicy: Drop goodix init script rules
* Unused since we switched to oss biometrics hal

Change-Id: I77239dabb2c533bfa09f0bd109351bf85923db74
2023-04-19 12:05:33 +02:00
Giovanni Ricca
c4535611ca msm8953-common: sepolicy: Allow system to set fingerprint props
05-06 11:44:22.514     0     0 E init    : Unable to set property 'persist.sys.fp.info' from uid:1000 gid:1000 pid:884: SELinux permission check failed
05-06 11:44:22.514     0     0 E init    : Unable to set property 'persist.sys.fp.vendor' from uid:1000 gid:1000 pid:884: SELinux permission check failed
05-06 11:44:22.516     0     0 E init    : Unable to set property 'persist.sys.fp.factory' from uid:1000 gid:1000 pid:884: SELinux permission check failed

Change-Id: Ia7ff2905143cb889722c5c773e1cea0897fc9d4d
2023-04-19 12:05:32 +02:00
Giovanni Ricca
9ae1cf9e7b msm8953-common: sepolicy: Checkout fingerprint selinux policy from asus/msm8937-common
Change-Id: I20ddaf6bd0a7df3a7ac56b851e2533c142a197ad
2023-04-19 12:05:32 +02:00
Giovanni Ricca
1a4d1a84a8 msm8953-common: sepolicy: Address camera denials
Change-Id: I5d4377f81376242321d3d709a1081fc2b75d6633
2023-04-19 12:05:32 +02:00
Giovanni Ricca
ceb3bbdc39 msm8953-common: sepolicy: Label sensors path
Change-Id: I87371fbdb8ad069d3b93de72a09c1d1b1ce6da1e
2023-04-19 12:05:32 +02:00
Giovanni Ricca
4cd1093aee msm8953-common: sepolicy: Label sakura dt2w node
* android.hardwar: type=1400 audit(0.0:5255): avc: denied { open } for path="/sys/devices/platform/soc/78b7000.i2c/i2c-3/3-0038/wakeup_gesture" dev="sysfs" ino=35169 scontext=u:r:hal_power_default:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1

Change-Id: I72daf2a1037727561a64d4a369f001e6bff23595
2023-04-19 12:05:32 +02:00
dianlujitao
88b12c1fdd msm8953-common: sepolicy: Label /sys/touchpanel/ DT2W node
Change-Id: Id55db9b6614320650c8c61e698f71ddc9f04d086
2023-04-19 12:05:31 +02:00
Pulkit077
09a28fe1d9 msm8953-common: sepolicy: Label pmi8940 nodes
Signed-off-by: Pulkit077 <pulkitagarwal2k1@gmail.com>
Change-Id: I3bc38a4182c41d174a88f7e72cb6eec9e746527e
2023-04-19 12:05:31 +02:00
Sebastiano Barezzi
574abaed96 msm8953-common: rootdir: Import recovery init scripts
* From phoenixin recovery

Change-Id: Ic83f991e22052abd5a4c7ec012ba66a222358e22
2023-04-19 12:05:31 +02:00
Giovanni Ricca
229247c226 msm8953-common: rootdir: Mount /vendor block conditionally
* Set `TARGET_IS_LEGACY := true` on BoardConfig.mk to revert back to /cust

Change-Id: Id6bbb6c5d4873032a7ce5ec1419413c661a34787
2023-04-19 12:05:31 +02:00
Giovanni Ricca
c5ef1dd2e1 msm8953-common: rootdir: Chown dt2w nodes
Change-Id: I443cdfe61d5405b08516bcef0c367e308eb8c3f0
2023-04-19 12:05:31 +02:00
crevanth
6569e213a4 msm8953-common: rootdir: Add permission for /dev/spidev5.1
Change-Id: I5163e8125a7adf04e001e0402c1398786f8fd81f
2023-04-19 12:05:30 +02:00
Giovanni Ricca
ba960ceccc msm8953-common: biometrics: Commonize biometrics permissions
Change-Id: I4191f1712ecf6c5228ef2a811769c6913a19173a
2023-04-19 12:05:30 +02:00
LuK1337
7937cb82d4 msm8953-common: biometrics: Make fingerprint HIDL fully treble compliant
This is more like a hack, also observed in the stock HAL, for pre-P shipped devices
because those have fpdata store path set to /data/system/users/ by the FingerprintService.

Force treble compliant path and thus avoid using data_between_core_and_vendor_violators
attribute:

 > typeattribute hal_fingerprint_default data_between_core_and_vendor_violators;
 > # access to /data/system/users/[0-9]+/fpdata
 > allow hal_fingerprint_default fingerprintd_data_file:dir rw_dir_perms;
 > allow hal_fingerprint_default fingerprintd_data_file:file create_file_perms;

Change-Id: I388f993de7f95fc68007d945f5a9cc975afde120
2023-04-19 12:05:30 +02:00
Giovanni Ricca
d3b97606c0 msm8953-common: biometrics: Handle ysl goodix hal
Change-Id: Ie7d9302648455a88447541e41165572121543c9e
2023-04-19 12:05:30 +02:00
Giovanni Ricca
9d040c42a1 Revert "msm8953-common: Add goodix fingerprint keylayout"
Reason: Goodix driver doesn't call for it anymore

This reverts commit af5986972a.

Change-Id: Iae7b4f991fcba67601c046068912d19ac0783504
2023-04-19 12:05:30 +02:00
Offain
d23b1e256d msm8953-common: keylayout: Fix daisy goodix Fingerprint Gestures
Change-Id: If359f9031fe124cdac491309cc54f144f79ac59a
2023-04-19 12:05:10 +02:00
Giovanni Ricca
bcf9c18bb7 msm8953-common: overlay: Decommonize Auto Brightness overlays
Change-Id: I794c8c45b3c8a5e6554721e1ee918c42b8df4fad
2023-03-11 22:05:02 +01:00
Giovanni Ricca
a9156ae25a msm8953-common: overlay-lineage: Decommonize HW Keys overlay
Change-Id: I7afb5014c94f1671b25525f63f5c6fc56da4ec17
2023-03-11 22:05:01 +01:00
Giovanni Ricca
a6b162853d msm8953-common: Make system partion size overridable
Change-Id: Iec146727eef511f52d185b5cf16086d39d367d68
2023-03-11 22:05:01 +01:00
Giovanni Ricca
2c9d327d98 msm8953-common: Commonize bootanimation flags
* And make them overideble overridable

Change-Id: Ic31ba986d24df1a29aafcab150e873740a1a3e82
2023-03-11 22:05:01 +01:00
Giovanni Ricca
a0f5e28ec3 msm8953-common: Make Screen Density config overridable
* ysl uses a 720p+ display instead of 1080p

Change-Id: Ie4eef6295f99fab2917249d25b9bb2aed5187dd1
2023-03-11 22:05:01 +01:00
Giovanni Ricca
902b62ebc4 Revert "msm8953-common: rro: TetheringOverlay: Disable BPF"
This reverts commit d37facb234.

Change-Id: I17ad54232b3aea9a4b422d737ac56c06e8d957b9
2023-03-11 22:05:01 +01:00
Bruno Martins
8caabad575 msm8953-common: Remove obsolete eBPF property
Android 12 enforces support for eBPF in all kernels.

Change-Id: Iefa9071cb10eabbaeb2f3d2c7c60cb3d0cc2fa2e
2023-03-11 22:05:00 +01:00
Bruno Martins
3a14f0dcb0 msm8953-common: Bump target-level to match new kernel
This fixes the annoying warning on every boot:

  Runtime info <==> Framework Compatibility Matrix?        INCOMPATIBLE, Missing config CONFIG_NETFILTER_XT_MATCH_QTAGUID
  VintfObject::CheckCompatibility?                         INCOMPATIBLE, Runtime info and framework compatibility matrix are incompatible: Missing config CONFIG_NETFILTER_XT_MATCH_QTAGUID

Change-Id: I7cbe2f48671cfdce038825b046af1b8c9c23880e
2023-03-11 22:05:00 +01:00
Giovanni Ricca
e6e20dcc28 msm8953-common: Goodbye 3.18
* No one misses you

Change-Id: I44c5434c0466674a57095edad805e31a1fc55e10
2023-03-11 22:04:59 +01:00
300 changed files with 3956 additions and 23030 deletions

View File

@@ -2,21 +2,21 @@ soong_namespace {
}
install_symlink {
name: "firmware_WCNSS_qcom_cfg.ini_symlink",
name: "firmware_wcnss_qcom_cfg.bin_symlink",
vendor: true,
installed_location: "firmware/wlan/prima/WCNSS_qcom_cfg.ini",
symlink_target: "/vendor/etc/wifi/WCNSS_qcom_cfg.ini",
}
install_symlink {
name: "firmware_WCNSS_qcom_wlan_nv.bin_symlink",
vendor: true,
name: "firmware_wcnss_qcom_wlan_nv.bin_symlink",
vendor: true,
installed_location: "firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin",
symlink_target: "/mnt/vendor/persist/WCNSS_qcom_wlan_nv.bin",
}
install_symlink {
name: "firmware_WCNSS_wlan_dictionary.dat_symlink",
name: "firmware_wcnss_wlan_dictionary.dat_symlink",
vendor: true,
installed_location: "firmware/wlan/prima/WCNSS_wlan_dictionary.dat",
symlink_target: "/mnt/vendor/persist/WCNSS_wlan_dictionary.dat",

View File

@@ -1,29 +0,0 @@
#
# Copyright (C) 2017-2021 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
LOCAL_PATH := $(call my-dir)
ifneq ($(filter daisy mido sakura tissot vince ysl,$(TARGET_DEVICE)),)
include $(call all-makefiles-under,$(LOCAL_PATH))
include $(CLEAR_VARS)
#A/B builds require us to create the mount points at compile time.
#Just creating it for all cases since it does not hurt.
FIRMWARE_MOUNT_POINT := $(TARGET_OUT_VENDOR)/firmware_mnt
DSP_MOUNT_POINT := $(TARGET_OUT_VENDOR)/dsp
ALL_DEFAULT_INSTALLED_MODULES += $(FIRMWARE_MOUNT_POINT) \
$(DSP_MOUNT_POINT)
$(FIRMWARE_MOUNT_POINT):
@echo "Creating $(FIRMWARE_MOUNT_POINT)"
@mkdir -p $(TARGET_OUT_VENDOR)/firmware_mnt
$(DSP_MOUNT_POINT):
@echo "Creating $(DSP_MOUNT_POINT)"
@mkdir -p $(TARGET_OUT_VENDOR)/dsp
endif

View File

@@ -19,25 +19,17 @@ TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a53
# Build
BUILD_BROKEN_DUP_RULES := true
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true
# Kernel
BOARD_KERNEL_BASE := 0x80000000
BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78af000
BOARD_KERNEL_CMDLINE += printk.devkmsg=on
BOARD_KERNEL_CMDLINE += loop.max_part=7
BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc/7824900.sdhci
BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
BOARD_KERNEL_PAGESIZE := 2048
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01000000 --tags_offset 0x00000100
TARGET_KERNEL_SOURCE := kernel/xiaomi/msm8953
TARGET_KERNEL_LLVM_BINUTILS := true
BOARD_KERNEL_CMDLINE += androidboot.usbconfigfs=true
# ANT
BOARD_ANT_WIRELESS_DEVICE := "vfs-prerelease"
TARGET_KERNEL_CONFIG := msm8953-perf_defconfig xiaomi/xiaomi.config
TARGET_KERNEL_CLANG_VERSION := r530567
# Audio
AUDIO_FEATURE_ENABLED_ANC_HEADSET := true
@@ -58,6 +50,7 @@ AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
AUDIO_FEATURE_ENABLED_EXT_AMPLIFIER := false
AUDIO_USE_LL_AS_PRIMARY_OUTPUT := true
BOARD_SUPPORTS_SOUND_TRIGGER := true
BOARD_SUPPORTS_OPENSOURCE_STHAL := true
BOARD_USES_ALSA_AUDIO := true
# Bootloader
@@ -65,47 +58,30 @@ TARGET_BOOTLOADER_BOARD_NAME := MSM8953
TARGET_NO_BOOTLOADER := true
# Camera
USE_DEVICE_SPECIFIC_CAMERA := true
TARGET_USES_QTI_CAMERA_DEVICE := true
BOARD_QTI_CAMERA_32BIT_ONLY := true
MALLOC_SVELTE_FOR_LIBC32 := true
# Display
TARGET_USES_ION := true
TARGET_USES_GRALLOC1 := true
TARGET_USES_HWC2 := true
NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# FM
BOARD_HAVE_QCOM_FM := true
TARGET_QCOM_NO_FM_FIRMWARE := true
TARGET_SUPPORT_HAL1 := false
# GPS
BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default
LOC_HIDL_VERSION := 3.0
# Filesystem
TARGET_FS_CONFIG_GEN := $(COMMON_PATH)/config.fs
# HIDL
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
$(COMMON_PATH)/framework_compatibility_matrix.xml \
hardware/qcom-caf/common/vendor_framework_compatibility_matrix.xml \
hardware/qcom-caf/common/vendor_framework_compatibility_matrix_legacy.xml \
vendor/lineage/config/device_framework_matrix.xml
DEVICE_MANIFEST_FILE := $(COMMON_PATH)/manifest.xml
DEVICE_MATRIX_FILE := $(COMMON_PATH)/compatibility_matrix.xml
DEVICE_MATRIX_FILE := hardware/qcom-caf/common/compatibility_matrix.xml
# Init
TARGET_INIT_VENDOR_LIB := //$(COMMON_PATH):libinit_msm8953
TARGET_RECOVERY_DEVICE_MODULES := libinit_msm8953
# Lineage Health
TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS := false
# Media
TARGET_USES_ION := true
# Partitions
BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_SYSTEMIMAGE_PARTITION_SIZE ?= 3221225472
BOARD_SYSTEMIMAGE_JOURNAL_SIZE := 0
BOARD_PERSISTIMAGE_PARTITION_SIZE := 33554432
BOARD_FLASH_BLOCK_SIZE := 131072 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_ROOT_EXTRA_SYMLINKS := \
@@ -124,20 +100,10 @@ TARGET_BOARD_PLATFORM := msm8953
TARGET_ODM_PROP += $(COMMON_PATH)/odm.prop
TARGET_SYSTEM_PROP += $(COMMON_PATH)/system.prop
TARGET_SYSTEM_EXT_PROP += $(COMMON_PATH)/system_ext.prop
TARGET_PRODUCT_PROP += $(COMMON_PATH)/product.prop
TARGET_VENDOR_PROP += $(COMMON_PATH)/vendor.prop
# Recovery
ifeq ($(AB_OTA_UPDATER), true)
ifeq ($(TARGET_IS_LEGACY), true)
TARGET_RECOVERY_FSTAB := $(COMMON_PATH)/rootdir/etc/fstab_legacy_AB.qcom
else
TARGET_RECOVERY_FSTAB := $(COMMON_PATH)/rootdir/etc/fstab_AB.qcom
endif
else ifeq ($(TARGET_IS_LEGACY), true)
TARGET_RECOVERY_FSTAB := $(COMMON_PATH)/rootdir/etc/fstab_legacy.qcom
else
TARGET_RECOVERY_FSTAB := $(COMMON_PATH)/rootdir/etc/fstab.qcom
endif
TARGET_USERIMAGES_USE_F2FS := true
TARGET_USERIMAGES_USE_EXT4 := true
@@ -152,7 +118,10 @@ PRODUCT_PRIVATE_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/private
# Treble
PRODUCT_FULL_TREBLE_OVERRIDE := true
BOARD_VNDK_VERSION := current
NEED_AIDL_NDK_PLATFORM_BACKEND := true
# Verity
# Only needed for signing
BOARD_AVB_ENABLE := false
# Wi-Fi
BOARD_HAS_QCOM_WLAN := true
@@ -161,7 +130,6 @@ BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_qcwcn
BOARD_WLAN_DEVICE := qcwcn
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_qcwcn
TARGET_HAS_BROKEN_WLAN_SET_INTERFACE := true
WIFI_DRIVER_FW_PATH_AP := "ap"
WIFI_DRIVER_FW_PATH_STA := "sta"
WIFI_AVOID_IFACE_RESET_MAC_CHANGE := true

View File

@@ -11,7 +11,6 @@
<library name="proxy" path="libeffectproxy.so"/>
<library name="offload_bundle" path="libqcompostprocbundle.so"/>
<library name="audio_pre_processing" path="libqcomvoiceprocessing.so"/>
<library name="dirac" path="libdirac.so"/>
</libraries>
<effects>
<effectProxy name="bassboost" library="proxy" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
@@ -52,7 +51,6 @@
<effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
<effect name="aec" library="audio_pre_processing" uuid="0f8d0d2a-59e5-45fe-b6e4-248c8a799109"/>
<effect name="ns" library="audio_pre_processing" uuid="1d97bb0b-9e2f-4403-9ae3-58c2554306f8"/>
<effect name="dirac" library="dirac" uuid="e069d9e0-8329-11df-9168-0002a5d5c51b"/>
</effects>
<preprocess>
<stream type="voice_communication">

View File

@@ -41,14 +41,14 @@ outputs {
}
compress_offload_16 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING
formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_WMA|AUDIO_FORMAT_WMA_PRO|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2
formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_WMA|AUDIO_FORMAT_WMA_PRO|AUDIO_FORMAT_VORBIS|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2
sampling_rates 44100|48000|96000|192000
bit_width 16
app_type 69936
}
compress_offload_24 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING
formats AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE
formats AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_VORBIS
sampling_rates 44100|48000|96000|192000
bit_width 24
app_type 69940

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) 2016-2020, The Linux Foundation. All rights reserved
<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved
Not a Contribution.
-->
<!-- Copyright (C) 2015 The Android Open Source Project
@@ -63,6 +63,11 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="raw" role="source"
flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_RAW">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="deep_buffer" role="source"
flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
@@ -244,31 +249,31 @@
<!-- route declaration, i.e. list all available sources for a given sink -->
<routes>
<route type="mix" sink="Earpiece"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="Speaker"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="Wired Headset"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="Wired Headphones"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="Line"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="HDMI"
sources="primary output,deep_buffer,direct_pcm,compressed_offload"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
<route type="mix" sink="Proxy"
sources="primary output,deep_buffer,direct_pcm,compressed_offload"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
<route type="mix" sink="FM"
sources="primary output"/>
<route type="mix" sink="BT SCO"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="BT SCO Headset"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="BT SCO Car Kit"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
<route type="mix" sink="primary input"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner"/>
sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="voip_tx"

View File

@@ -1,36 +0,0 @@
cc_defaults {
name: "fingerprint_service_xiaomi_msm8953_defaults",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
srcs: [
"BiometricsFingerprint.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"libcutils",
"liblog",
"libhidlbase",
"libhardware",
"libutils",
"android.hardware.biometrics.fingerprint@2.1",
"android.hardware.biometrics.fingerprint@2.2",
"android.hardware.biometrics.fingerprint@2.3",
],
vendor: true,
}
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953",
defaults: ["fingerprint_service_xiaomi_msm8953_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953.xml"],
}
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953-32",
defaults: ["fingerprint_service_xiaomi_msm8953_defaults"],
compile_multilib: "32",
init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953-32.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953-32.xml"],
}

View File

@@ -1,403 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
* Copyright (C) 2021 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953"
#include <hardware/hw_auth_token.h>
#include <android-base/strings.h>
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include "BiometricsFingerprint.h"
#include <inttypes.h>
#include <unistd.h>
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_3 {
namespace implementation {
// Supported fingerprint HAL version
static const uint16_t kVersion = HARDWARE_MODULE_API_VERSION(2, 1);
// List of fingerprint HALs
typedef struct hw_module_info {
std::string id_name;
std::string class_name;
} hw_module_info_t;
static const hw_module_info_t kHALModules[] = {
{FINGERPRINT_HARDWARE_MODULE_ID, "fpc"},
{"gf_" FINGERPRINT_HARDWARE_MODULE_ID, "goodix"},
};
using RequestStatus =
android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
using ::android::base::StartsWith;
BiometricsFingerprint *BiometricsFingerprint::sInstance = nullptr;
BiometricsFingerprint::BiometricsFingerprint() : mClientCallback(nullptr), mDevice(nullptr) {
sInstance = this; // keep track of the most recent instance
for (const auto& HMI : kHALModules) {
mDevice = openHal(HMI.id_name.c_str(), HMI.class_name.c_str());
if (!mDevice) {
ALOGE("Can't open HAL module, module ID %s, class name %s",
HMI.id_name.c_str(), HMI.class_name.c_str());
} else {
ALOGI("Opened fingerprint HAL, module ID %s, class name %s",
HMI.id_name.c_str(), HMI.class_name.c_str());
break;
}
}
}
BiometricsFingerprint::~BiometricsFingerprint() {
ALOGV("~BiometricsFingerprint()");
if (mDevice == nullptr) {
ALOGE("No valid device");
return;
}
int err;
if (0 != (err = mDevice->common.close(
reinterpret_cast<hw_device_t*>(mDevice)))) {
ALOGE("Can't close fingerprint module, error: %d", err);
return;
}
mDevice = nullptr;
}
Return<RequestStatus> BiometricsFingerprint::ErrorFilter(int32_t error) {
switch(error) {
case 0: return RequestStatus::SYS_OK;
case -2: return RequestStatus::SYS_ENOENT;
case -4: return RequestStatus::SYS_EINTR;
case -5: return RequestStatus::SYS_EIO;
case -11: return RequestStatus::SYS_EAGAIN;
case -12: return RequestStatus::SYS_ENOMEM;
case -13: return RequestStatus::SYS_EACCES;
case -14: return RequestStatus::SYS_EFAULT;
case -16: return RequestStatus::SYS_EBUSY;
case -22: return RequestStatus::SYS_EINVAL;
case -28: return RequestStatus::SYS_ENOSPC;
case -110: return RequestStatus::SYS_ETIMEDOUT;
default:
ALOGE("An unknown error returned from fingerprint vendor library: %d", error);
return RequestStatus::SYS_UNKNOWN;
}
}
// Translate from errors returned by traditional HAL (see fingerprint.h) to
// HIDL-compliant FingerprintError.
FingerprintError BiometricsFingerprint::VendorErrorFilter(int32_t error,
int32_t* vendorCode) {
*vendorCode = 0;
switch(error) {
case FINGERPRINT_ERROR_HW_UNAVAILABLE:
return FingerprintError::ERROR_HW_UNAVAILABLE;
case FINGERPRINT_ERROR_UNABLE_TO_PROCESS:
return FingerprintError::ERROR_UNABLE_TO_PROCESS;
case FINGERPRINT_ERROR_TIMEOUT:
return FingerprintError::ERROR_TIMEOUT;
case FINGERPRINT_ERROR_NO_SPACE:
return FingerprintError::ERROR_NO_SPACE;
case FINGERPRINT_ERROR_CANCELED:
return FingerprintError::ERROR_CANCELED;
case FINGERPRINT_ERROR_UNABLE_TO_REMOVE:
return FingerprintError::ERROR_UNABLE_TO_REMOVE;
case FINGERPRINT_ERROR_LOCKOUT:
return FingerprintError::ERROR_LOCKOUT;
default:
if (error >= FINGERPRINT_ERROR_VENDOR_BASE) {
// vendor specific code.
*vendorCode = error - FINGERPRINT_ERROR_VENDOR_BASE;
return FingerprintError::ERROR_VENDOR;
}
}
ALOGE("Unknown error from fingerprint vendor library: %d", error);
return FingerprintError::ERROR_UNABLE_TO_PROCESS;
}
// Translate acquired messages returned by traditional HAL (see fingerprint.h)
// to HIDL-compliant FingerprintAcquiredInfo.
FingerprintAcquiredInfo BiometricsFingerprint::VendorAcquiredFilter(
int32_t info, int32_t* vendorCode) {
*vendorCode = 0;
switch(info) {
case FINGERPRINT_ACQUIRED_GOOD:
return FingerprintAcquiredInfo::ACQUIRED_GOOD;
case FINGERPRINT_ACQUIRED_PARTIAL:
return FingerprintAcquiredInfo::ACQUIRED_PARTIAL;
case FINGERPRINT_ACQUIRED_INSUFFICIENT:
return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
case FINGERPRINT_ACQUIRED_IMAGER_DIRTY:
return FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY;
case FINGERPRINT_ACQUIRED_TOO_SLOW:
return FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW;
case FINGERPRINT_ACQUIRED_TOO_FAST:
return FingerprintAcquiredInfo::ACQUIRED_TOO_FAST;
default:
if (info >= FINGERPRINT_ACQUIRED_VENDOR_BASE) {
// vendor specific code.
*vendorCode = info - FINGERPRINT_ACQUIRED_VENDOR_BASE;
return FingerprintAcquiredInfo::ACQUIRED_VENDOR;
}
}
ALOGE("Unknown acquiredmsg from fingerprint vendor library: %d", info);
return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
}
Return<uint64_t> BiometricsFingerprint::setNotify(
const sp<IBiometricsFingerprintClientCallback>& clientCallback) {
std::lock_guard<std::mutex> lock(mClientCallbackMutex);
mClientCallback = clientCallback;
// This is here because HAL 2.1 doesn't have a way to propagate a
// unique token for its driver. Subsequent versions should send a unique
// token for each call to setNotify(). This is fine as long as there's only
// one fingerprint device on the platform.
return reinterpret_cast<uint64_t>(mDevice);
}
Return<uint64_t> BiometricsFingerprint::preEnroll() {
return mDevice->pre_enroll(mDevice);
}
Return<RequestStatus> BiometricsFingerprint::enroll(const hidl_array<uint8_t, 69>& hat,
uint32_t gid, uint32_t timeoutSec) {
const hw_auth_token_t* authToken =
reinterpret_cast<const hw_auth_token_t*>(hat.data());
return ErrorFilter(mDevice->enroll(mDevice, authToken, gid, timeoutSec));
}
Return<RequestStatus> BiometricsFingerprint::postEnroll() {
return ErrorFilter(mDevice->post_enroll(mDevice));
}
Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
return mDevice->get_authenticator_id(mDevice);
}
Return<RequestStatus> BiometricsFingerprint::cancel() {
return ErrorFilter(mDevice->cancel(mDevice));
}
Return<RequestStatus> BiometricsFingerprint::enumerate() {
return ErrorFilter(mDevice->enumerate(mDevice));
}
Return<RequestStatus> BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) {
return ErrorFilter(mDevice->remove(mDevice, gid, fid));
}
Return<RequestStatus> BiometricsFingerprint::setActiveGroup(uint32_t gid,
const hidl_string& storePath) {
if (storePath.size() >= PATH_MAX || storePath.size() <= 0) {
ALOGE("Bad path length: %zd", storePath.size());
return RequestStatus::SYS_EINVAL;
}
std::string mutableStorePath = storePath;
if (android::base::StartsWith(mutableStorePath, "/data/system/users/")) {
mutableStorePath = "/data/vendor_de/";
mutableStorePath +=
static_cast<std::string>(storePath).substr(strlen("/data/system/users/"));
}
if (access(mutableStorePath.c_str(), W_OK)) {
return RequestStatus::SYS_EINVAL;
}
return ErrorFilter(mDevice->set_active_group(mDevice, gid,
mutableStorePath.c_str()));
}
Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId,
uint32_t gid) {
return ErrorFilter(mDevice->authenticate(mDevice, operationId, gid));
}
Return<bool> BiometricsFingerprint::isUdfps(uint32_t /*sensorId*/) {
return false;
}
Return<void> BiometricsFingerprint::onFingerDown(uint32_t /*x*/, uint32_t /*y*/, float /*minor*/,
float /*major*/) {
return Void();
}
Return<void> BiometricsFingerprint::onFingerUp() {
return Void();
}
IBiometricsFingerprint* BiometricsFingerprint::getInstance() {
if (!sInstance) {
sInstance = new BiometricsFingerprint();
}
return sInstance;
}
fingerprint_device_t* BiometricsFingerprint::openHal(const char* id_name, const char* class_name) {
int err;
const hw_module_t *hw_mdl = nullptr;
ALOGD("Opening fingerprint hal library...");
if (0 != (err = hw_get_module_by_class(id_name, class_name, &hw_mdl))) {
ALOGE("Can't open fingerprint HW Module, module ID %s, class name %s, error: %d",
id_name, class_name, err);
return nullptr;
}
if (hw_mdl == nullptr) {
ALOGE("No valid fingerprint module, module ID %s, class name %s", id_name, class_name);
return nullptr;
}
fingerprint_module_t const *module =
reinterpret_cast<const fingerprint_module_t*>(hw_mdl);
if (module->common.methods->open == nullptr) {
ALOGE("No valid open method, module ID %s, class name %s", id_name, class_name);
return nullptr;
}
hw_device_t *device = nullptr;
if (0 != (err = module->common.methods->open(hw_mdl, nullptr, &device))) {
ALOGE("Can't open fingerprint methods, module ID %s, class name %s, error: %d",
id_name, class_name, err);
return nullptr;
}
if (kVersion != device->version) {
// enforce version on new devices because of HIDL@2.1 translation layer
ALOGE("Wrong fp version, module ID %s, class name %s. Expected %d, got %d",
id_name, class_name, kVersion, device->version);
return nullptr;
}
fingerprint_device_t* fp_device =
reinterpret_cast<fingerprint_device_t*>(device);
if (0 != (err =
fp_device->set_notify(fp_device, BiometricsFingerprint::notify))) {
ALOGE("Can't register fingerprint module callback, module ID %s, class name %s, error: %d",
id_name, class_name, err);
return nullptr;
}
return fp_device;
}
void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) {
BiometricsFingerprint* thisPtr = static_cast<BiometricsFingerprint*>(
BiometricsFingerprint::getInstance());
std::lock_guard<std::mutex> lock(thisPtr->mClientCallbackMutex);
if (thisPtr == nullptr || thisPtr->mClientCallback == nullptr) {
ALOGE("Receiving callbacks before the client callback is registered.");
return;
}
const uint64_t devId = reinterpret_cast<uint64_t>(thisPtr->mDevice);
switch (msg->type) {
case FINGERPRINT_ERROR: {
int32_t vendorCode = 0;
FingerprintError result = VendorErrorFilter(msg->data.error, &vendorCode);
ALOGD("onError(%d)", result);
if (!thisPtr->mClientCallback->onError(devId, result, vendorCode).isOk()) {
ALOGE("failed to invoke fingerprint onError callback");
}
}
break;
case FINGERPRINT_ACQUIRED: {
int32_t vendorCode = 0;
FingerprintAcquiredInfo result =
VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
ALOGD("onAcquired(%d)", result);
if (!thisPtr->mClientCallback->onAcquired(devId, result, vendorCode).isOk()) {
ALOGE("failed to invoke fingerprint onAcquired callback");
}
}
break;
case FINGERPRINT_TEMPLATE_ENROLLING:
ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)",
msg->data.enroll.finger.fid,
msg->data.enroll.finger.gid,
msg->data.enroll.samples_remaining);
if (!thisPtr->mClientCallback->onEnrollResult(devId,
msg->data.enroll.finger.fid,
msg->data.enroll.finger.gid,
msg->data.enroll.samples_remaining).isOk()) {
ALOGE("failed to invoke fingerprint onEnrollResult callback");
}
break;
case FINGERPRINT_TEMPLATE_REMOVED:
ALOGD("onRemove(fid=%d, gid=%d, rem=%d)",
msg->data.removed.finger.fid,
msg->data.removed.finger.gid,
msg->data.removed.remaining_templates);
if (!thisPtr->mClientCallback->onRemoved(devId,
msg->data.removed.finger.fid,
msg->data.removed.finger.gid,
msg->data.removed.remaining_templates).isOk()) {
ALOGE("failed to invoke fingerprint onRemoved callback");
}
break;
case FINGERPRINT_AUTHENTICATED:
if (msg->data.authenticated.finger.fid != 0) {
ALOGD("onAuthenticated(fid=%d, gid=%d)",
msg->data.authenticated.finger.fid,
msg->data.authenticated.finger.gid);
const uint8_t* hat =
reinterpret_cast<const uint8_t *>(&msg->data.authenticated.hat);
const hidl_vec<uint8_t> token(
std::vector<uint8_t>(hat, hat + sizeof(msg->data.authenticated.hat)));
if (!thisPtr->mClientCallback->onAuthenticated(devId,
msg->data.authenticated.finger.fid,
msg->data.authenticated.finger.gid,
token).isOk()) {
ALOGE("failed to invoke fingerprint onAuthenticated callback");
}
} else {
// Not a recognized fingerprint
if (!thisPtr->mClientCallback->onAuthenticated(devId,
msg->data.authenticated.finger.fid,
msg->data.authenticated.finger.gid,
hidl_vec<uint8_t>()).isOk()) {
ALOGE("failed to invoke fingerprint onAuthenticated callback");
}
}
break;
case FINGERPRINT_TEMPLATE_ENUMERATING:
ALOGD("onEnumerate(fid=%d, gid=%d, rem=%d)",
msg->data.enumerated.finger.fid,
msg->data.enumerated.finger.gid,
msg->data.enumerated.remaining_templates);
if (!thisPtr->mClientCallback->onEnumerate(devId,
msg->data.enumerated.finger.fid,
msg->data.enumerated.finger.gid,
msg->data.enumerated.remaining_templates).isOk()) {
ALOGE("failed to invoke fingerprint onEnumerate callback");
}
break;
}
}
} // namespace implementation
} // namespace V2_3
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android

View File

@@ -1,89 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <log/log.h>
#include <android/log.h>
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h>
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_3 {
namespace implementation {
using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo;
using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintError;
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
using ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct BiometricsFingerprint : public IBiometricsFingerprint {
public:
BiometricsFingerprint();
~BiometricsFingerprint();
// Method to wrap legacy HAL with BiometricsFingerprint class
static IBiometricsFingerprint* getInstance();
// Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow.
Return<uint64_t> setNotify(const sp<IBiometricsFingerprintClientCallback>& clientCallback) override;
Return<uint64_t> preEnroll() override;
Return<RequestStatus> enroll(const hidl_array<uint8_t, 69>& hat, uint32_t gid, uint32_t timeoutSec) override;
Return<RequestStatus> postEnroll() override;
Return<uint64_t> getAuthenticatorId() override;
Return<RequestStatus> cancel() override;
Return<RequestStatus> enumerate() override;
Return<RequestStatus> remove(uint32_t gid, uint32_t fid) override;
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
// Methods from ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint
// follow.
Return<bool> isUdfps(uint32_t sensorId) override;
Return<void> onFingerDown(uint32_t x, uint32_t y, float minor, float major) override;
Return<void> onFingerUp() override;
private:
static fingerprint_device_t* openHal(const char* id_name, const char* class_name);
static void notify(const fingerprint_msg_t *msg); /* Static callback for legacy HAL implementation */
static Return<RequestStatus> ErrorFilter(int32_t error);
static FingerprintError VendorErrorFilter(int32_t error, int32_t* vendorCode);
static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode);
static BiometricsFingerprint* sInstance;
std::mutex mClientCallbackMutex;
sp<IBiometricsFingerprintClientCallback> mClientCallback;
fingerprint_device_t *mDevice;
};
} // namespace implementation
} // namespace V2_3
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android

View File

@@ -1,29 +0,0 @@
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953-32
# "class hal" causes a race condition on some devices due to files created
# in /data. As a workaround, postpone startup until later in boot once
# /data is mounted.
class late_start
user system
group system input uhid
task_profiles ServiceCapacityLow
on boot
# add for goodix
chown system system /dev/goodix_fp
chmod 0644 /dev/goodix_fp
# add for fpc
chown system system /sys/devices/platform/soc/soc:fpc1020/compatible_all
chmod 0664 /sys/devices/platform/soc/soc:fpc1020/compatible_all
chown system system /sys/devices/platform/soc/soc:fpc1020/irq
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/irq
chown system system /sys/devices/platform/soc/soc:fpc1020/hw_reset
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/hw_reset
chown system system /sys/devices/platform/soc/soc:fpc1020/wakeup_enable
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/wakeup_enable
chown system system /sys/devices/platform/soc/soc:fpc1020/fingerdown_wait
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/fingerdown_wait
on post-fs-data
mkdir /data/vendor/goodix 0770 system system
mkdir /data/vendor/fpc 0770 system system

View File

@@ -1,11 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<transport>hwbinder</transport>
<version>2.3</version>
<interface>
<name>IBiometricsFingerprint</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -1,29 +0,0 @@
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953
# "class hal" causes a race condition on some devices due to files created
# in /data. As a workaround, postpone startup until later in boot once
# /data is mounted.
class late_start
user system
group system input uhid
task_profiles ServiceCapacityLow
on boot
# add for goodix
chown system system /dev/goodix_fp
chmod 0644 /dev/goodix_fp
# add for fpc
chown system system /sys/devices/platform/soc/soc:fpc1020/compatible_all
chmod 0664 /sys/devices/platform/soc/soc:fpc1020/compatible_all
chown system system /sys/devices/platform/soc/soc:fpc1020/irq
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/irq
chown system system /sys/devices/platform/soc/soc:fpc1020/hw_reset
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/hw_reset
chown system system /sys/devices/platform/soc/soc:fpc1020/wakeup_enable
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/wakeup_enable
chown system system /sys/devices/platform/soc/soc:fpc1020/fingerdown_wait
chmod 0660 /sys/devices/platform/soc/soc:fpc1020/fingerdown_wait
on post-fs-data
mkdir /data/vendor/goodix 0770 system system
mkdir /data/vendor/fpc 0770 system system

View File

@@ -1,11 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<transport>hwbinder</transport>
<version>2.3</version>
<interface>
<name>IBiometricsFingerprint</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -1,48 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_msm8953"
#include <android/log.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
#include <android/hardware/biometrics/fingerprint/2.2/types.h>
#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h>
#include "BiometricsFingerprint.h"
using android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
using android::hardware::biometrics::fingerprint::V2_3::implementation::BiometricsFingerprint;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::sp;
int main() {
android::sp<IBiometricsFingerprint> bio = BiometricsFingerprint::getInstance();
configureRpcThreadpool(1, true /*callerWillJoin*/);
if (bio != nullptr) {
if (::android::OK != bio->registerAsService()) {
return 1;
}
} else {
ALOGE("Can't create instance of BiometricsFingerprint, nullptr");
}
joinRpcThreadpool();
return 0; // should never get here
}

View File

@@ -1,74 +0,0 @@
<compatibility-matrix version="1.0" type="device">
<hal format="hidl" optional="false">
<name>android.frameworks.displayservice</name>
<version>1.0</version>
<interface>
<name>IDisplayService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.frameworks.schedulerservice</name>
<version>1.0</version>
<interface>
<name>ISchedulingPolicyService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.frameworks.sensorservice</name>
<version>1.0</version>
<interface>
<name>ISensorManager</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.hidl.allocator</name>
<version>1.0</version>
<interface>
<name>IAllocator</name>
<instance>ashmem</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.hidl.manager</name>
<version>1.0</version>
<interface>
<name>IServiceManager</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.hidl.memory</name>
<version>1.0</version>
<interface>
<name>IMapper</name>
<instance>ashmem</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.hidl.token</name>
<version>1.0</version>
<interface>
<name>ITokenManager</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.system.net.netd</name>
<version>1.0</version>
<interface>
<name>INetd</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.system.wifi.keystore</name>
<version>1.0</version>
<interface>
<name>IKeystore</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@@ -32,7 +32,6 @@
<config>
<!-- These are telephony components that need to freely run in the background -->
<allow-in-power-save package="com.qualcomm.atfwd" />
<allow-in-power-save package="com.qualcomm.qti.telephonyservice" />
<allow-in-power-save package="com.qualcomm.qcrilmsgtunnel" />
<allow-in-power-save package="com.qualcomm.qti.ims" />
@@ -41,7 +40,6 @@
<!-- These telephony applications need access to non-[System]SDK APIs -->
<hidden-api-whitelisted-app package="com.qualcomm.uimremoteserver" />
<hidden-api-whitelisted-app package="com.qualcomm.uimremoteclient" />
<hidden-api-whitelisted-app package="com.qualcomm.atfwd" />
<hidden-api-whitelisted-app package="com.qti.qualcomm.datastatusnotification" />
<hidden-api-whitelisted-app package="com.qti.qualcomm.deviceinfo" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.modemtestmode" />
@@ -57,8 +55,6 @@
<hidden-api-whitelisted-app package="com.qualcomm.qcrilmsgtunnel" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.ltedirect" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.app" />
<hidden-api-whitelisted-app package="com.qualcomm.embms" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.embmstuneaway" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.uimlpatest" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.lpa" />
<hidden-api-whitelisted-app package="com.qualcomm.qti.uim" />

69
extract-files.py Executable file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3
#
# SPDX-FileCopyrightText: 2024 The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
from extract_utils.fixups_blob import (
blob_fixup,
blob_fixups_user_type,
)
from extract_utils.fixups_lib import (
lib_fixup_remove,
lib_fixups,
lib_fixups_user_type,
)
from extract_utils.main import (
ExtractUtils,
ExtractUtilsModule,
)
namespace_imports = [
'device/xiaomi/msm8953-common',
'hardware/qcom-caf/msm8996',
'vendor/qcom/opensource/dataservices',
]
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
return f'{lib}_{partition}' if partition == 'vendor' else None
lib_fixups: lib_fixups_user_type = {
**lib_fixups,
(
'com.qualcomm.qti.dpm.api@1.0',
'vendor.qti.ims.callinfo@1.0',
'vendor.qti.ims.rcsconfig@1.0',
'vendor.qti.imsrtpservice@2.0',
'vendor.qti.imsrtpservice@2.1',
): lib_fixup_vendor_suffix,
('libwifi-hal-ctrl'): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
('system_ext/etc/init/dpmd.rc', 'system_ext/etc/permissions/com.qti.dpmframework.xml', 'system_ext/etc/permissions/dpmapi.xml', 'system_ext/etc/permissions/qcrilhook.xml', 'system_ext/etc/permissions/telephonyservice.xml'): blob_fixup()
.regex_replace('/product/', '/system_ext/'),
('system_ext/lib/libdpmframework.so', 'system_ext/lib64/libdpmframework.so'): blob_fixup()
.add_needed('libcutils_shim.so'),
('system_ext/lib64/lib-imscamera.so', 'system_ext/lib64/lib-imsvideocodec.so'): blob_fixup()
.add_needed('libgui_shim.so'),
'vendor/bin/pm-service': blob_fixup()
.add_needed('libutils-v33.so'),
('vendor/etc/data/dsi_config.xml', 'vendor/etc/data/netmgr_config.xml'): blob_fixup()
.fix_xml(),
('vendor/lib64/mediadrm/libwvdrmengine.so', 'vendor/lib64/libwvhidl.so'): blob_fixup()
.add_needed('libcrypto_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'msm8953-common',
'xiaomi',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()

View File

@@ -1,122 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.."
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"
# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true
ONLY_COMMON=
ONLY_TARGET=
KANG=
SECTION=
while [ "${#}" -gt 0 ]; do
case "${1}" in
--only-common )
ONLY_COMMON=true
;;
--only-target )
ONLY_TARGET=true
;;
-n | --no-cleanup )
CLEAN_VENDOR=false
;;
-k | --kang )
KANG="--kang"
;;
-s | --section )
SECTION="${2}"; shift
CLEAN_VENDOR=false
;;
* )
SRC="${1}"
;;
esac
shift
done
if [ -z "${SRC}" ]; then
SRC="adb"
fi
function blob_fixup() {
case "${1}" in
product/etc/permissions/vendor.qti.hardware.data.connection-V1.0-java.xml | product/etc/permissions/vendor.qti.hardware.data.connection-V1.1-java.xml)
sed -i 's/version="2.0"/version="1.0"/g' "${2}"
;;
system_ext/etc/init/dpmd.rc)
sed -i "s|/system/product/bin/|/system/system_ext/bin/|g" "${2}"
;;
system_ext/etc/permissions/com.qti.dpmframework.xml \
| system_ext/etc/permissions/com.qualcomm.qti.imscmservice-V2.0-java.xml \
| system_ext/etc/permissions/com.qualcomm.qti.imscmservice-V2.1-java.xml \
| system_ext/etc/permissions/com.qualcomm.qti.imscmservice-V2.2-java.xml \
| system_ext/etc/permissions/dpmapi.xml \
| system_ext/etc/permissions/telephonyservice.xml )
sed -i "s|/system/product/framework/|/system/system_ext/framework/|g" "${2}"
;;
system_ext/etc/permissions/embms.xml)
sed -i "s|/product/framework/|/system_ext/framework/|g" "${2}"
;;
system_ext/etc/permissions/qcrilhook.xml)
sed -i 's|/product/framework/qcrilhook.jar|/system_ext/framework/qcrilhook.jar|g' "${2}"
;;
system_ext/lib64/libdpmframework.so)
grep -q "libcutils_shim.so" "${2}" || "${PATCHELF}" --add-needed "libcutils_shim.so" "${2}"
;;
system_ext/lib64/lib-imsvideocodec.so)
grep -q "libgui_shim.so" "${2}" || "${PATCHELF}" --add-needed "libgui_shim.so" "${2}"
;;
vendor/bin/pm-service)
grep -q "libutils-v33.so" "${2}" || "${PATCHELF}" --add-needed "libutils-v33.so" "${2}"
;;
vendor/lib/mediadrm/libwvdrmengine.so|vendor/lib64/mediadrm/libwvdrmengine.so)
"${PATCHELF}" --replace-needed "libprotobuf-cpp-lite.so" "libprotobuf-cpp-lite-v29.so" "${2}"
;;
vendor/lib64/libril-qc-hal-qmi.so)
"${PATCHELF}" --replace-needed "libprotobuf-cpp-full.so" "libprotobuf-cpp-full-v29.so" "${2}"
;;
vendor/lib64/libsettings.so)
"${PATCHELF}" --replace-needed "libprotobuf-cpp-full.so" "libprotobuf-cpp-full-v29.so" "${2}"
;;
vendor/lib64/libwvhidl.so)
"${PATCHELF}" --replace-needed "libprotobuf-cpp-lite.so" "libprotobuf-cpp-lite-v29.so" "${2}"
;;
esac
}
if [ -z "${ONLY_TARGET}" ]; then
# Initialize the helper for common device
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi
if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then
# Reinitialize the helper for device
source "${MY_DIR}/../${DEVICE}/extract-files.sh"
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi
"${MY_DIR}/setup-makefiles.sh"

View File

@@ -1,10 +0,0 @@
<compatibility-matrix version="2.0" type="framework">
<hal format="hidl">
<name>vendor.qti.hardware.radio.atcmdfwd</name>
<version>1.0</version>
<interface>
<name>IAtCmdFwd</name>
<instance>AtCmdFwdService</instance>
</interface>
</hal>
</compatibility-matrix>

4
gps/Android.bp Normal file
View File

@@ -0,0 +1,4 @@
GNSS_CFLAGS = [
"-Werror",
"-Wno-undefined-bool-conversion",
]

View File

@@ -1,5 +0,0 @@
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/build/target_specific_features.mk
include $(call all-makefiles-under,$(LOCAL_PATH))
endif

View File

@@ -1,203 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_AGnssInterface"
#include <log_util.h>
#include "Gnss.h"
#include "AGnss.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
static AGnss* spAGnss = nullptr;
AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
spAGnss = this;
}
AGnss::~AGnss() {
spAGnss = nullptr;
}
void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){
if (nullptr != spAGnss) {
spAGnss->statusIpV4Cb(status);
}
}
void AGnss::statusIpV4Cb(AGnssExtStatusIpV4 status) {
IAGnssCallback::AGnssStatusIpV4 st = {};
switch (status.type) {
case LOC_AGPS_TYPE_SUPL:
st.type = IAGnssCallback::AGnssType::TYPE_SUPL;
break;
case LOC_AGPS_TYPE_C2K:
st.type = IAGnssCallback::AGnssType::TYPE_C2K;
break;
default:
LOC_LOGE("invalid type: %d", status.type);
return;
}
switch (status.status) {
case LOC_GPS_REQUEST_AGPS_DATA_CONN:
st.status = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
break;
case LOC_GPS_RELEASE_AGPS_DATA_CONN:
st.status = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
break;
case LOC_GPS_AGPS_DATA_CONNECTED:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
break;
case LOC_GPS_AGPS_DATA_CONN_DONE:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
break;
case LOC_GPS_AGPS_DATA_CONN_FAILED:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
break;
default:
LOC_LOGE("invalid status: %d", status.status);
return;
}
st.ipV4Addr = status.ipV4Addr;
if (mAGnssCbIface != nullptr) {
auto r = mAGnssCbIface->agnssStatusIpV4Cb(st);
if (!r.isOk()) {
LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str());
}
} else {
LOC_LOGw("setCallback has not been called yet");
}
}
Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return Void();
}
// Save the interface
mAGnssCbIface = callback;
AgpsCbInfo cbInfo = {};
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
mGnss->getGnssInterface()->agpsInit(cbInfo);
return Void();
}
Return<bool> AGnss::dataConnClosed() {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
mGnss->getGnssInterface()->agpsDataConnClosed(LOC_AGPS_TYPE_SUPL);
return true;
}
Return<bool> AGnss::dataConnFailed() {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
mGnss->getGnssInterface()->agpsDataConnFailed(LOC_AGPS_TYPE_SUPL);
return true;
}
Return<bool> AGnss::dataConnOpen(const hidl_string& apn,
IAGnss::ApnIpType apnIpType) {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
/* Validate */
if(apn.empty()){
LOC_LOGE("Invalid APN");
return false;
}
LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
AGpsBearerType bearerType;
switch (apnIpType) {
case IAGnss::ApnIpType::IPV4:
bearerType = AGPS_APN_BEARER_IPV4;
break;
case IAGnss::ApnIpType::IPV6:
bearerType = AGPS_APN_BEARER_IPV6;
break;
case IAGnss::ApnIpType::IPV4V6:
bearerType = AGPS_APN_BEARER_IPV4V6;
break;
default:
bearerType = AGPS_APN_BEARER_IPV4;
break;
}
mGnss->getGnssInterface()->agpsDataConnOpen(
LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
return true;
}
Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname,
int32_t port) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
config.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
if (type == IAGnssCallback::AGnssType::TYPE_SUPL) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
} else if (type == IAGnssCallback::AGnssType::TYPE_C2K) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
} else {
LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<int>(type));
return false;
}
config.assistanceServer.hostName = strdup(hostname.c_str());
config.assistanceServer.port = port;
return mGnss->updateConfiguration(config);
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,79 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
#define ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
#include <android/hardware/gnss/1.0/IAGnss.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnss;
using ::android::hardware::gnss::V1_0::IAGnssCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
struct AGnss : public IAGnss {
AGnss(Gnss* gnss);
~AGnss();
/*
* Methods from ::android::hardware::gnss::V1_0::IAGnss interface follow.
* These declarations were generated from IAGnss.hal.
*/
Return<void> setCallback(const sp<IAGnssCallback>& callback) override;
Return<bool> dataConnClosed() override;
Return<bool> dataConnFailed() override;
Return<bool> dataConnOpen(const hidl_string& apn,
IAGnss::ApnIpType apnIpType) override;
Return<bool> setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname, int32_t port) override;
void statusIpV4Cb(AGnssExtStatusIpV4 status);
/* Data call setup callback passed down to GNSS HAL implementation */
static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
private:
Gnss* mGnss = nullptr;
sp<IAGnssCallback> mAGnssCbIface = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H

View File

@@ -1,114 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc__AGnssRilInterface"
#include <log_util.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sstream>
#include <string>
#include "Gnss.h"
#include "AGnssRil.h"
#include <DataItemConcreteTypesBase.h>
typedef void* (getLocationInterface)();
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
AGnssRil::AGnssRil(Gnss* gnss) : mGnss(gnss) {
ENTRY_LOG_CALLFLOW();
}
AGnssRil::~AGnssRil() {
ENTRY_LOG_CALLFLOW();
}
Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool /*roaming*/) {
ENTRY_LOG_CALLFLOW();
// Extra NetworkTypes not available in IAgnssRil enums
const int NetworkType_BLUETOOTH = 7;
const int NetworkType_ETHERNET = 9;
const int NetworkType_PROXY = 16;
// for XTRA
if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
int8_t typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
switch(type)
{
case IAGnssRil::NetworkType::MOBILE:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_MOBILE;
break;
case IAGnssRil::NetworkType::WIFI:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIFI;
break;
case IAGnssRil::NetworkType::MMS:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_MMS;
break;
case IAGnssRil::NetworkType::SUPL:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_SUPL;
break;
case IAGnssRil::NetworkType::DUN:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_DUN;
break;
case IAGnssRil::NetworkType::HIPRI:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_HIPRI;
break;
case IAGnssRil::NetworkType::WIMAX:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIMAX;
break;
default:
{
int networkType = (int) type;
// Handling network types not available in IAgnssRil
switch(networkType)
{
case NetworkType_BLUETOOTH:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_BLUETOOTH;
break;
case NetworkType_ETHERNET:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_ETHERNET;
break;
case NetworkType_PROXY:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_PROXY;
break;
default:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
}
}
break;
}
mGnss->getGnssInterface()->updateConnectionStatus(connected, false, typeout, 0);
}
return true;
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
#define ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
#include <android/hardware/gnss/1.0/IAGnssRil.h>
#include <hidl/Status.h>
#include <location_interface.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnssRil;
using ::android::hardware::gnss::V1_0::IAGnssRilCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
/*
* Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface Layer interface
* allows the GNSS chipset to request radio interface layer information from Android platform.
* Examples of such information are reference location, unique subscriber ID, phone number string
* and network availability changes. Also contains wrapper methods to allow methods from
* IAGnssiRilCallback interface to be passed into the conventional implementation of the GNSS HAL.
*/
struct AGnssRil : public IAGnssRil {
AGnssRil(Gnss* gnss);
~AGnssRil();
/*
* Methods from ::android::hardware::gnss::V1_0::IAGnssRil follow.
* These declarations were generated from IAGnssRil.hal.
*/
Return<void> setCallback(const sp<IAGnssRilCallback>& /*callback*/) override {
return Void();
}
Return<void> setRefLocation(const IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override {
return Void();
}
Return<bool> setSetId(IAGnssRil::SetIDType /*type*/, const hidl_string& /*setid*/) override {
return false;
}
Return<bool> updateNetworkAvailability(bool /*available*/,
const hidl_string& /*apn*/) override {
return false;
}
Return<bool> updateNetworkState(bool connected, NetworkType type, bool roaming) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_

View File

@@ -1,103 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
AGnss.cpp \
Gnss.cpp \
GnssBatching.cpp \
GnssGeofencing.cpp \
GnssMeasurement.cpp \
GnssNi.cpp \
GnssConfiguration.cpp \
GnssDebug.cpp \
AGnssRil.cpp
LOCAL_SRC_FILES += \
location_api/LocationUtil.cpp \
location_api/GnssAPIClient.cpp \
location_api/GeofenceAPIClient.cpp \
location_api/BatchingAPIClient.cpp \
location_api/MeasurementAPIClient.cpp \
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/location_api
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers \
liblocbatterylistener_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libhidlbase \
libhidltransport \
libhwbinder \
libcutils \
libutils \
android.hardware.gnss@1.0 \
android.hardware.health@1.0 \
android.hardware.health@2.0 \
android.hardware.power@1.2 \
libbase
LOCAL_SHARED_LIBRARIES += \
libloc_core \
libgps.utils \
libdl \
liblocation_api \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
LOCAL_STATIC_LIBRARIES := liblocbatterylistener
LOCAL_STATIC_LIBRARIES += libhealthhalutils
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.0-service-qti.xml
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
LOCAL_SRC_FILES := \
service.cpp \
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/location_api
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libdl \
libbase \
libutils \
libgps.utils \
libqti_vndfwk_detect \
LOCAL_SHARED_LIBRARIES += \
libhwbinder \
libhidlbase \
libhidltransport \
android.hardware.gnss@1.0 \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE)

View File

@@ -1,360 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssInterface"
#define LOG_NDEBUG 0
#include <fstream>
#include <log_util.h>
#include <dlfcn.h>
#include <cutils/properties.h>
#include "Gnss.h"
#include <LocationUtil.h>
#include "battery_listener.h"
typedef const GnssInterface* (getLocationInterface)();
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
static sp<Gnss> sGnss;
void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnss != nullptr) {
mGnss->stop();
mGnss->cleanup();
}
}
void location_on_battery_status_changed(bool charging) {
LOC_LOGd("battery status changed to %s charging", charging ? "" : "not ");
if (sGnss != nullptr) {
sGnss->getGnssInterface()->updateBatteryStatus(charging);
}
}
Gnss::Gnss() {
ENTRY_LOG_CALLFLOW();
sGnss = this;
// register health client to listen on battery change
loc_extn_battery_properties_listener_init(location_on_battery_status_changed);
// clear pending GnssConfig
memset(&mPendingConfig, 0, sizeof(GnssConfig));
mGnssDeathRecipient = new GnssDeathRecipient(this);
}
Gnss::~Gnss() {
ENTRY_LOG_CALLFLOW();
if (mApi != nullptr) {
delete mApi;
mApi = nullptr;
}
sGnss = nullptr;
}
GnssAPIClient* Gnss::getApi() {
if (mApi == nullptr && (mGnssCbIface != nullptr || mGnssNiCbIface != nullptr)) {
mApi = new GnssAPIClient(mGnssCbIface, mGnssNiCbIface);
if (mApi == nullptr) {
LOC_LOGE("%s] faild to create GnssAPIClient", __FUNCTION__);
return mApi;
}
if (mPendingConfig.size == sizeof(GnssConfig)) {
// we have pending GnssConfig
mApi->gnssConfigurationUpdate(mPendingConfig);
// clear size to invalid mPendingConfig
mPendingConfig.size = 0;
if (mPendingConfig.assistanceServer.hostName != nullptr) {
free((void*)mPendingConfig.assistanceServer.hostName);
}
}
}
if (mApi == nullptr) {
LOC_LOGW("%s] GnssAPIClient is not ready", __FUNCTION__);
}
return mApi;
}
const GnssInterface* Gnss::getGnssInterface() {
static bool getGnssInterfaceFailed = false;
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__);
getLocationInterface* getter = NULL;
const char *error = NULL;
dlerror();
void *handle = dlopen("libgnss.so", RTLD_NOW);
if (NULL == handle || (error = dlerror()) != NULL) {
LOC_LOGW("dlopen for libgnss.so failed, error = %s", error);
} else {
getter = (getLocationInterface*)dlsym(handle, "getGnssInterface");
if ((error = dlerror()) != NULL) {
LOC_LOGW("dlsym for libgnss.so::getGnssInterface failed, error = %s", error);
getter = NULL;
}
}
if (NULL == getter) {
getGnssInterfaceFailed = true;
} else {
mGnssInterface = (const GnssInterface*)(*getter)();
}
}
return mGnssInterface;
}
Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
}
mGnssCbIface = callback;
if (mGnssCbIface != nullptr) {
mGnssCbIface->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
}
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
api->requestCapabilities();
}
return true;
}
Return<bool> Gnss::setGnssNiCb(const sp<IGnssNiCallback>& callback) {
ENTRY_LOG_CALLFLOW();
mGnssNiCbIface = callback;
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
}
return true;
}
Return<bool> Gnss::updateConfiguration(GnssConfig& gnssConfig) {
ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi();
if (api) {
api->gnssConfigurationUpdate(gnssConfig);
} else if (gnssConfig.flags != 0) {
// api is not ready yet, update mPendingConfig with gnssConfig
mPendingConfig.size = sizeof(GnssConfig);
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
mPendingConfig.gpsLock = gnssConfig.gpsLock;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
mPendingConfig.suplVersion = gnssConfig.suplVersion;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
mPendingConfig.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
mPendingConfig.assistanceServer.type = gnssConfig.assistanceServer.type;
if (mPendingConfig.assistanceServer.hostName != nullptr) {
free((void*)mPendingConfig.assistanceServer.hostName);
mPendingConfig.assistanceServer.hostName =
strdup(gnssConfig.assistanceServer.hostName);
}
mPendingConfig.assistanceServer.port = gnssConfig.assistanceServer.port;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
mPendingConfig.lppProfile = gnssConfig.lppProfile;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
mPendingConfig.lppeControlPlaneMask = gnssConfig.lppeControlPlaneMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT;
mPendingConfig.lppeUserPlaneMask = gnssConfig.lppeUserPlaneMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
mPendingConfig.aGlonassPositionProtocolMask = gnssConfig.aGlonassPositionProtocolMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
mPendingConfig.emergencyPdnForEmergencySupl = gnssConfig.emergencyPdnForEmergencySupl;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
mPendingConfig.suplEmergencyServices = gnssConfig.suplEmergencyServices;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
mPendingConfig.suplModeMask = gnssConfig.suplModeMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
mPendingConfig.blacklistedSvIds = gnssConfig.blacklistedSvIds;
}
}
return true;
}
Return<bool> Gnss::start() {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
retVal = api->gnssStart();
}
return retVal;
}
Return<bool> Gnss::stop() {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
retVal = api->gnssStop();
}
return retVal;
}
Return<void> Gnss::cleanup() {
ENTRY_LOG_CALLFLOW();
if (mApi != nullptr) {
mApi->gnssDisable();
}
return Void();
}
Return<bool> Gnss::injectLocation(double latitudeDegrees,
double longitudeDegrees,
float accuracyMeters) {
ENTRY_LOG_CALLFLOW();
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
gnssInterface->injectLocation(latitudeDegrees, longitudeDegrees, accuracyMeters);
return true;
} else {
return false;
}
}
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
int32_t uncertaintyMs) {
ENTRY_LOG_CALLFLOW();
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
return true;
} else {
return false;
}
}
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi();
if (api) {
api->gnssDeleteAidingData(aidingDataFlags);
}
return Void();
}
Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
preferredAccuracyMeters, preferredTimeMs);
}
return retVal;
}
Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
ENTRY_LOG_CALLFLOW();
mAGnssIface = new AGnss(this);
return mAGnssIface;
}
Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
ENTRY_LOG_CALLFLOW();
mGnssNi = new GnssNi(this);
return mGnssNi;
}
Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
ENTRY_LOG_CALLFLOW();
if (mGnssMeasurement == nullptr)
mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
}
Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
ENTRY_LOG_CALLFLOW();
mGnssConfig = new GnssConfiguration(this);
return mGnssConfig;
}
Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
ENTRY_LOG_CALLFLOW();
mGnssGeofencingIface = new GnssGeofencing();
return mGnssGeofencingIface;
}
Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
mGnssBatching = new GnssBatching();
return mGnssBatching;
}
Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
ENTRY_LOG_CALLFLOW();
mGnssDebug = new GnssDebug(this);
return mGnssDebug;
}
Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
mGnssRil = new AGnssRil(this);
return mGnssRil;
}
IGnss* HIDL_FETCH_IGnss(const char* hal) {
ENTRY_LOG_CALLFLOW();
IGnss* iface = nullptr;
iface = new Gnss();
if (iface == nullptr) {
LOC_LOGE("%s]: failed to get %s", __FUNCTION__, hal);
}
return iface;
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,143 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
#include <AGnss.h>
#include <AGnssRil.h>
#include <GnssBatching.h>
#include <GnssConfiguration.h>
#include <GnssGeofencing.h>
#include <GnssMeasurement.h>
#include <GnssNi.h>
#include <GnssDebug.h>
#include <android/hardware/gnss/1.0/IGnss.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <GnssAPIClient.h>
#include <location_interface.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
using ::android::hardware::gnss::V1_0::GnssLocation;
struct Gnss : public IGnss {
Gnss();
~Gnss();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnss follow.
* These declarations were generated from Gnss.hal.
*/
Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
Return<bool> start() override;
Return<bool> stop() override;
Return<void> cleanup() override;
Return<bool> injectLocation(double latitudeDegrees,
double longitudeDegrees,
float accuracyMeters) override;
Return<bool> injectTime(int64_t timeMs,
int64_t timeReferenceMs,
int32_t uncertaintyMs) override;
Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) override;
Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
return nullptr;
}
inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
return nullptr;
}
Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
// These methods are not part of the IGnss base class.
GnssAPIClient* getApi();
Return<bool> setGnssNiCb(const sp<IGnssNiCallback>& niCb);
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
const GnssInterface* getGnssInterface();
// Callback for ODCPI request
void odcpiRequestCb(const OdcpiRequestInfo& request);
private:
struct GnssDeathRecipient : hidl_death_recipient {
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
}
~GnssDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<Gnss> mGnss;
};
private:
sp<GnssDeathRecipient> mGnssDeathRecipient = nullptr;
sp<AGnss> mAGnssIface = nullptr;
sp<GnssNi> mGnssNi = nullptr;
sp<GnssMeasurement> mGnssMeasurement = nullptr;
sp<GnssConfiguration> mGnssConfig = nullptr;
sp<GnssGeofencing> mGnssGeofencingIface = nullptr;
sp<GnssBatching> mGnssBatching = nullptr;
sp<IGnssDebug> mGnssDebug = nullptr;
sp<AGnssRil> mGnssRil = nullptr;
GnssAPIClient* mApi = nullptr;
sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
GnssConfig mPendingConfig;
const GnssInterface* mGnssInterface = nullptr;
};
extern "C" IGnss* HIDL_FETCH_IGnss(const char* name);
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSS_H

View File

@@ -1,130 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssBatchingInterface"
#include <log_util.h>
#include <BatchingAPIClient.h>
#include "GnssBatching.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
void GnssBatching::GnssBatchingDeathRecipient::serviceDied(
uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnssBatching != nullptr) {
mGnssBatching->stop();
mGnssBatching->cleanup();
}
}
GnssBatching::GnssBatching() : mApi(nullptr) {
mGnssBatchingDeathRecipient = new GnssBatchingDeathRecipient(this);
}
GnssBatching::~GnssBatching() {
if (mApi != nullptr) {
delete mApi;
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
if (mApi != nullptr) {
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
delete mApi;
mApi = nullptr;
}
mApi = new BatchingAPIClient(callback);
if (mApi == nullptr) {
LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
return false;
}
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
}
mGnssBatchingCbIface = callback;
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
}
return true;
}
Return<uint16_t> GnssBatching::getBatchSize() {
uint16_t ret = 0;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
ret = mApi->getBatchSize();
}
return ret;
}
Return<bool> GnssBatching::start(const IGnssBatching::Options& options) {
bool ret = false;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
ret = mApi->startSession(options);
}
return ret;
}
Return<void> GnssBatching::flush() {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->flushBatchedLocations();
}
return Void();
}
Return<bool> GnssBatching::stop() {
bool ret = false;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
ret = mApi->stopSession();
}
return ret;
}
Return<void> GnssBatching::cleanup() {
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
}
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,80 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
#include <android/hardware/gnss/1.0/IGnssBatching.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching;
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
using ::android::hidl::base::V1_0::IBase;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
class BatchingAPIClient;
struct GnssBatching : public IGnssBatching {
GnssBatching();
~GnssBatching();
// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
Return<uint16_t> getBatchSize() override;
Return<bool> start(const IGnssBatching::Options& options ) override;
Return<void> flush() override;
Return<bool> stop() override;
Return<void> cleanup() override;
private:
struct GnssBatchingDeathRecipient : hidl_death_recipient {
GnssBatchingDeathRecipient(sp<GnssBatching> gnssBatching) :
mGnssBatching(gnssBatching) {
}
~GnssBatchingDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssBatching> mGnssBatching;
};
private:
sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
BatchingAPIClient* mApi = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H

View File

@@ -1,230 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssConfigurationInterface"
#include <log_util.h>
#include "Gnss.h"
#include "GnssConfiguration.h"
#include <android/hardware/gnss/1.0/types.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::GnssConstellationType;
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
}
// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setSuplEs(bool enabled) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
config.suplEmergencyServices = (enabled ?
GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES :
GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO);
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setSuplVersion(uint32_t version) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
switch (version) {
case 0x00020002:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_2;
break;
case 0x00020000:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_0;
break;
case 0x00010000:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
break;
default:
LOC_LOGE("%s]: invalid version: 0x%x.", __FUNCTION__, version);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setSuplMode(uint8_t mode) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
switch (mode) {
case 0:
config.suplModeMask = 0; // STANDALONE ONLY
break;
case 1:
config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT;
break;
case 2:
config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSA_BIT;
break;
case 3:
config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT | GNSS_CONFIG_SUPL_MODE_MSA_BIT;
break;
default:
LOC_LOGE("%s]: invalid mode: %d.", __FUNCTION__, mode);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
switch (lppProfile) {
case 0:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
break;
case 1:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE;
break;
case 2:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE;
break;
case 3:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE;
break;
default:
LOC_LOGE("%s]: invalid lppProfile: %d.", __FUNCTION__, lppProfile);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
if (protocol & (1<<0)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRC_CONTROL_PLANE_BIT;
}
if (protocol & (1<<1)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRLP_USER_PLANE_BIT;
}
if (protocol & (1<<2)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_USER_PLANE_BIT;
}
if (protocol & (1<<3)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_CONTROL_PLANE_BIT;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
switch (lock) {
case 0:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
break;
case 1:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
break;
case 2:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
break;
case 3:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
break;
default:
LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
config.emergencyPdnForEmergencySupl = (enabled ?
GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES :
GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO);
return mGnss->updateConfiguration(config);
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,71 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
#include <android/hardware/gnss/1.0/IGnssConfiguration.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssConfiguration;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
/*
* Interface for passing GNSS configuration info from platform to HAL.
*/
struct Gnss;
struct GnssConfiguration : public IGnssConfiguration {
GnssConfiguration(Gnss* gnss);
~GnssConfiguration() = default;
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
* These declarations were generated from IGnssConfiguration.hal.
*/
Return<bool> setSuplVersion(uint32_t version) override;
Return<bool> setSuplMode(uint8_t mode) override;
Return<bool> setSuplEs(bool enabled) override;
Return<bool> setLppProfile(uint8_t lppProfile) override;
Return<bool> setGlonassPositioningProtocol(uint8_t protocol) override;
Return<bool> setEmergencySuplPdn(bool enable) override;
Return<bool> setGpsLock(uint8_t lock) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H

View File

@@ -1,173 +0,0 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssDebugInterface"
#include <log/log.h>
#include <log_util.h>
#include "Gnss.h"
#include "GnssDebug.h"
#include "LocationUtil.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::hidl_vec;
#define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000)
#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000)
#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500)
#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180)
#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
{
}
/*
* This methods requests position, time and satellite ephemeris debug information
* from the HAL.
*
* @return void
*/
Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
{
LOC_LOGD("%s]: ", __func__);
DebugData data = { };
if((nullptr == mGnss) || (nullptr == mGnss->getGnssInterface())){
LOC_LOGE("GnssDebug - Null GNSS interface");
_hidl_cb(data);
return Void();
}
// get debug report snapshot via hal interface
GnssDebugReport reports = { };
mGnss->getGnssInterface()->getDebugReport(reports);
// location block
if (reports.mLocation.mValid) {
data.position.valid = true;
data.position.latitudeDegrees = reports.mLocation.mLocation.latitude;
data.position.longitudeDegrees = reports.mLocation.mLocation.longitude;
data.position.altitudeMeters = reports.mLocation.mLocation.altitude;
data.position.speedMetersPerSec =
(double)(reports.mLocation.mLocation.speed);
data.position.bearingDegrees =
(double)(reports.mLocation.mLocation.bearing);
data.position.horizontalAccuracyMeters =
(double)(reports.mLocation.mLocation.accuracy);
data.position.verticalAccuracyMeters =
reports.mLocation.verticalAccuracyMeters;
data.position.speedAccuracyMetersPerSecond =
reports.mLocation.speedAccuracyMetersPerSecond;
data.position.bearingAccuracyDegrees =
reports.mLocation.bearingAccuracyDegrees;
timeval tv_now, tv_report;
tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
gettimeofday(&tv_now, NULL);
data.position.ageSeconds =
(tv_now.tv_sec - tv_report.tv_sec) +
(float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
}
else {
data.position.valid = false;
}
if (data.position.horizontalAccuracyMeters <= 0 ||
data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) {
data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS;
}
if (data.position.verticalAccuracyMeters <= 0 ||
data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) {
data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS;
}
if (data.position.speedAccuracyMetersPerSecond <= 0 ||
data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) {
data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC;
}
if (data.position.bearingAccuracyDegrees <= 0 ||
data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) {
data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG;
}
// time block
if (reports.mTime.mValid) {
data.time.timeEstimate = reports.mTime.timeEstimate;
data.time.timeUncertaintyNs = reports.mTime.timeUncertaintyNs;
data.time.frequencyUncertaintyNsPerSec =
reports.mTime.frequencyUncertaintyNsPerSec;
}
if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
}
if (data.time.timeUncertaintyNs <= 0 ||
data.time.timeUncertaintyNs > (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC) {
data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC;
}
if (data.time.frequencyUncertaintyNsPerSec <= 0 ||
data.time.frequencyUncertaintyNsPerSec > (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC) {
data.time.frequencyUncertaintyNsPerSec = (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC;
}
// satellite data block
SatelliteData s = { };
std::vector<SatelliteData> s_array = { };
for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
memset(&s, 0, sizeof(s));
s.svid = reports.mSatelliteInfo[i].svid;
convertGnssConstellationType(
reports.mSatelliteInfo[i].constellation, s.constellation);
convertGnssEphemerisType(
reports.mSatelliteInfo[i].mEphemerisType, s.ephemerisType);
convertGnssEphemerisSource(
reports.mSatelliteInfo[i].mEphemerisSource, s.ephemerisSource);
convertGnssEphemerisHealth(
reports.mSatelliteInfo[i].mEphemerisHealth, s.ephemerisHealth);
s.ephemerisAgeSeconds =
reports.mSatelliteInfo[i].ephemerisAgeSeconds;
s.serverPredictionIsAvailable =
reports.mSatelliteInfo[i].serverPredictionIsAvailable;
s.serverPredictionAgeSeconds =
reports.mSatelliteInfo[i].serverPredictionAgeSeconds;
s_array.push_back(s);
}
data.satelliteDataArray = s_array;
// callback HIDL with collected debug data
_hidl_cb(data);
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,59 +0,0 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
#include <android/hardware/gnss/1.0/IGnssDebug.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssDebug;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
/* Interface for GNSS Debug support. */
struct Gnss;
struct GnssDebug : public IGnssDebug {
GnssDebug(Gnss* gnss);
~GnssDebug() {};
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
* These declarations were generated from IGnssDebug.hal.
*/
Return<void> getDebugData(getDebugData_cb _hidl_cb) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H

View File

@@ -1,141 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "GnssHal_GnssGeofencing"
#include <log_util.h>
#include <GeofenceAPIClient.h>
#include "GnssGeofencing.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
void GnssGeofencing::GnssGeofencingDeathRecipient::serviceDied(
uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnssGeofencing != nullptr) {
mGnssGeofencing->removeAllGeofences();
}
}
GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
mGnssGeofencingDeathRecipient = new GnssGeofencingDeathRecipient(this);
}
GnssGeofencing::~GnssGeofencing() {
if (mApi != nullptr) {
delete mApi;
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
Return<void> GnssGeofencing::setCallback(const sp<IGnssGeofenceCallback>& callback) {
if (mApi != nullptr) {
LOC_LOGE("%s]: mApi is NOT nullptr", __FUNCTION__);
return Void();
}
mApi = new GeofenceAPIClient(callback);
if (mApi == nullptr) {
LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
}
if (mGnssGeofencingCbIface != nullptr) {
mGnssGeofencingCbIface->unlinkToDeath(mGnssGeofencingDeathRecipient);
}
mGnssGeofencingCbIface = callback;
if (mGnssGeofencingCbIface != nullptr) {
mGnssGeofencingCbIface->linkToDeath(mGnssGeofencingDeathRecipient, 0 /*cookie*/);
}
return Void();
}
Return<void> GnssGeofencing::addGeofence(
int32_t geofenceId,
double latitudeDegrees,
double longitudeDegrees,
double radiusMeters,
IGnssGeofenceCallback::GeofenceTransition lastTransition,
int32_t monitorTransitions,
uint32_t notificationResponsivenessMs,
uint32_t unknownTimerMs) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofenceAdd(
geofenceId,
latitudeDegrees,
longitudeDegrees,
radiusMeters,
static_cast<int32_t>(lastTransition),
monitorTransitions,
notificationResponsivenessMs,
unknownTimerMs);
}
return Void();
}
Return<void> GnssGeofencing::pauseGeofence(int32_t geofenceId) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofencePause(geofenceId);
}
return Void();
}
Return<void> GnssGeofencing::resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofenceResume(geofenceId, monitorTransitions);
}
return Void();
}
Return<void> GnssGeofencing::removeGeofence(int32_t geofenceId) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofenceRemove(geofenceId);
}
return Void();
}
Return<void> GnssGeofencing::removeAllGeofences() {
if (mApi == nullptr) {
LOC_LOGD("%s]: mApi is nullptr, do nothing", __FUNCTION__);
} else {
mApi->geofenceRemoveAll();
}
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,91 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
using ::android::hardware::gnss::V1_0::IGnssGeofencing;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
class GeofenceAPIClient;
struct GnssGeofencing : public IGnssGeofencing {
GnssGeofencing();
~GnssGeofencing();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
* These declarations were generated from IGnssGeofencing.hal.
*/
Return<void> setCallback(const sp<IGnssGeofenceCallback>& callback) override;
Return<void> addGeofence(int32_t geofenceId,
double latitudeDegrees,
double longitudeDegrees,
double radiusMeters,
IGnssGeofenceCallback::GeofenceTransition lastTransition,
int32_t monitorTransitions,
uint32_t notificationResponsivenessMs,
uint32_t unknownTimerMs) override;
Return<void> pauseGeofence(int32_t geofenceId) override;
Return<void> resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) override;
Return<void> removeGeofence(int32_t geofenceId) override;
private:
// This method is not part of the IGnss base class.
// It is called by GnssGeofencingDeathRecipient to remove all geofences added so far.
Return<void> removeAllGeofences();
private:
struct GnssGeofencingDeathRecipient : hidl_death_recipient {
GnssGeofencingDeathRecipient(sp<GnssGeofencing> gnssGeofencing) :
mGnssGeofencing(gnssGeofencing) {
}
~GnssGeofencingDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssGeofencing> mGnssGeofencing;
};
private:
sp<GnssGeofencingDeathRecipient> mGnssGeofencingDeathRecipient = nullptr;
sp<IGnssGeofenceCallback> mGnssGeofencingCbIface = nullptr;
GeofenceAPIClient* mApi = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H

View File

@@ -1,101 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssMeasurementInterface"
#include <log_util.h>
#include <MeasurementAPIClient.h>
#include "GnssMeasurement.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied(
uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnssMeasurement != nullptr) {
mGnssMeasurement->close();
}
}
GnssMeasurement::GnssMeasurement() {
mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this);
mApi = new MeasurementAPIClient();
}
GnssMeasurement::~GnssMeasurement() {
if (mApi) {
delete mApi;
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) {
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mGnssMeasurementCbIface != nullptr) {
LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__);
return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT;
}
if (callback == nullptr) {
LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
return ret;
}
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return ret;
}
mGnssMeasurementCbIface = callback;
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback(callback);
}
Return<void> GnssMeasurement::close() {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return Void();
}
if (mGnssMeasurementCbIface != nullptr) {
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr;
}
mApi->measurementClose();
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,77 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
class MeasurementAPIClient;
struct GnssMeasurement : public IGnssMeasurement {
GnssMeasurement();
~GnssMeasurement();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
* These declarations were generated from IGnssMeasurement.hal.
*/
Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) override;
Return<void> close() override;
private:
struct GnssMeasurementDeathRecipient : hidl_death_recipient {
GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
mGnssMeasurement(gnssMeasurement) {
}
~GnssMeasurementDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssMeasurement> mGnssMeasurement;
};
private:
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
MeasurementAPIClient* mApi;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssNiInterface"
#include <log_util.h>
#include "Gnss.h"
#include "GnssNi.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
void GnssNi::GnssNiDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
// we do nothing here
// Gnss::GnssDeathRecipient will stop the session
}
GnssNi::GnssNi(Gnss* gnss) : mGnss(gnss) {
mGnssNiDeathRecipient = new GnssNiDeathRecipient(this);
}
// Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
Return<void> GnssNi::setCallback(const sp<IGnssNiCallback>& callback) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return Void();
}
mGnss->setGnssNiCb(callback);
if (mGnssNiCbIface != nullptr) {
mGnssNiCbIface->unlinkToDeath(mGnssNiDeathRecipient);
}
mGnssNiCbIface = callback;
if (mGnssNiCbIface != nullptr) {
mGnssNiCbIface->linkToDeath(mGnssNiDeathRecipient, 0 /*cookie*/);
}
return Void();
}
Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return Void();
}
GnssAPIClient* api = mGnss->getApi();
if (api == nullptr) {
LOC_LOGE("%s]: api is nullptr", __FUNCTION__);
return Void();
}
api->gnssNiRespond(notifId, userResponse);
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,75 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
#include <android/hardware/gnss/1.0/IGnssNi.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssNi;
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
struct GnssNi : public IGnssNi {
GnssNi(Gnss* gnss);
~GnssNi() = default;
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
* These declarations were generated from IGnssNi.hal.
*/
Return<void> setCallback(const sp<IGnssNiCallback>& callback) override;
Return<void> respond(int32_t notifId,
IGnssNiCallback::GnssUserResponseType userResponse) override;
private:
struct GnssNiDeathRecipient : hidl_death_recipient {
GnssNiDeathRecipient(sp<GnssNi> gnssNi) : mGnssNi(gnssNi) {
}
~GnssNiDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssNi> mGnssNi;
};
private:
sp<GnssNiDeathRecipient> mGnssNiDeathRecipient = nullptr;
sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H

View File

@@ -1,4 +0,0 @@
service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
class hal
user gps
group system gps radio vendor_qti_diag

View File

@@ -1,35 +0,0 @@
<!-- Copyright (c) 2019, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.gnss</name>
<transport>hwbinder</transport>
<fqname>@1.0::IGnss/default</fqname>
</hal>
</manifest>

View File

@@ -1,196 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_BatchingAPIClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "BatchingAPIClient.h"
#include "limits.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching;
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask);
BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback) :
LocationAPIClientBase(),
mGnssBatchingCbIface(callback),
mDefaultId(UINT_MAX),
mLocationCapabilitiesMask(0)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = nullptr;
if (mGnssBatchingCbIface != nullptr) {
locationCallbacks.batchingCb = [this](size_t count, Location* location,
BatchingOptions batchOptions) {
onBatchingCb(count, location, batchOptions);
};
}
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
BatchingAPIClient::~BatchingAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
int BatchingAPIClient::getBatchSize()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
return locAPIGetBatchSize();
}
int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
{
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
int retVal = -1;
LocationOptions options;
convertBatchOption(opts, options, mLocationCapabilitiesMask);
uint32_t mode = 0;
if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
mode = SESSION_MODE_ON_FULL;
}
if (locAPIStartSession(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
return retVal;
}
int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
{
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
int retVal = -1;
LocationOptions options;
convertBatchOption(opts, options, mLocationCapabilitiesMask);
uint32_t mode = 0;
if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
mode = SESSION_MODE_ON_FULL;
}
if (locAPIUpdateSessionOptions(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
return retVal;
}
int BatchingAPIClient::stopSession()
{
LOC_LOGD("%s]: ", __FUNCTION__);
int retVal = -1;
if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
return retVal;
}
void BatchingAPIClient::getBatchedLocation(int last_n_locations)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
locAPIGetBatchedLocations(mDefaultId, last_n_locations);
}
void BatchingAPIClient::flushBatchedLocations()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
}
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
}
void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
BatchingOptions /*batchOptions*/)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
if (mGnssBatchingCbIface != nullptr && count > 0) {
hidl_vec<GnssLocation> locationVec;
locationVec.resize(count);
for (size_t i = 0; i < count; i++) {
convertGnssLocation(location[i], locationVec[i]);
}
auto r = mGnssBatchingCbIface->gnssLocationBatchCb(locationVec);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationBatchCb description=%s",
__func__, r.description().c_str());
}
}
}
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask)
{
memset(&out, 0, sizeof(LocationOptions));
out.size = sizeof(LocationOptions);
out.minInterval = (uint32_t)(in.periodNanos / 1000000L);
out.minDistance = 0;
out.mode = GNSS_SUPL_MODE_STANDALONE;
if (mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
out.mode = GNSS_SUPL_MODE_MSA;
if (mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
out.mode = GNSS_SUPL_MODE_MSB;
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,74 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef BATCHING_API_CLINET_H
#define BATCHING_API_CLINET_H
#include <android/hardware/gnss/1.0/IGnssBatching.h>
#include <android/hardware/gnss/1.0/IGnssBatchingCallback.h>
#include <pthread.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
class BatchingAPIClient : public LocationAPIClientBase
{
public:
BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
~BatchingAPIClient();
int getBatchSize();
int startSession(const V1_0::IGnssBatching::Options& options);
int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
int stopSession();
void getBatchedLocation(int last_n_locations);
void flushBatchedLocations();
inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
// callbacks
void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
private:
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
uint32_t mDefaultId;
LocationCapabilitiesMask mLocationCapabilitiesMask;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // BATCHING_API_CLINET_H

View File

@@ -1,275 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_GeofenceApiClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "GeofenceAPIClient.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
LocationAPIClientBase(),
mGnssGeofencingCbIface(callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
if (mGnssGeofencingCbIface != nullptr) {
locationCallbacks.geofenceBreachCb =
[this](GeofenceBreachNotification geofenceBreachNotification) {
onGeofenceBreachCb(geofenceBreachNotification);
};
locationCallbacks.geofenceStatusCb =
[this](GeofenceStatusNotification geofenceStatusNotification) {
onGeofenceStatusCb(geofenceStatusNotification);
};
}
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
void GeofenceAPIClient::geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms)
{
LOC_LOGD("%s]: (%d %f %f %f %d %d %d %d)", __FUNCTION__,
geofence_id, latitude, longitude, radius_meters,
last_transition, monitor_transitions, notification_responsiveness_ms, unknown_timer_ms);
GeofenceOption options;
memset(&options, 0, sizeof(GeofenceOption));
options.size = sizeof(GeofenceOption);
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
options.breachTypeMask |= GEOFENCE_BREACH_ENTER_BIT;
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
options.breachTypeMask |= GEOFENCE_BREACH_EXIT_BIT;
options.responsiveness = notification_responsiveness_ms;
GeofenceInfo data;
data.size = sizeof(GeofenceInfo);
data.latitude = latitude;
data.longitude = longitude;
data.radius = radius_meters;
LocationError err = (LocationError)locAPIAddGeofences(1, &geofence_id, &options, &data);
if (LOCATION_ERROR_SUCCESS != err) {
onAddGeofencesCb(1, &err, &geofence_id);
}
}
void GeofenceAPIClient::geofencePause(uint32_t geofence_id)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
locAPIPauseGeofences(1, &geofence_id);
}
void GeofenceAPIClient::geofenceResume(uint32_t geofence_id, int32_t monitor_transitions)
{
LOC_LOGD("%s]: (%d %d)", __FUNCTION__, geofence_id, monitor_transitions);
GeofenceBreachTypeMask mask = 0;
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
mask |= GEOFENCE_BREACH_ENTER_BIT;
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
mask |= GEOFENCE_BREACH_EXIT_BIT;
locAPIResumeGeofences(1, &geofence_id, &mask);
}
void GeofenceAPIClient::geofenceRemove(uint32_t geofence_id)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
locAPIRemoveGeofences(1, &geofence_id);
}
void GeofenceAPIClient::geofenceRemoveAll()
{
LOC_LOGD("%s]", __FUNCTION__);
// TODO locAPIRemoveAllGeofences();
}
// callbacks
void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, geofenceBreachNotification.count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < geofenceBreachNotification.count; i++) {
GnssLocation gnssLocation;
convertGnssLocation(geofenceBreachNotification.location, gnssLocation);
IGnssGeofenceCallback::GeofenceTransition transition;
if (geofenceBreachNotification.type == GEOFENCE_BREACH_ENTER)
transition = IGnssGeofenceCallback::GeofenceTransition::ENTERED;
else if (geofenceBreachNotification.type == GEOFENCE_BREACH_EXIT)
transition = IGnssGeofenceCallback::GeofenceTransition::EXITED;
else {
// continue with other breach if transition is
// nether GPS_GEOFENCE_ENTERED nor GPS_GEOFENCE_EXITED
continue;
}
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
geofenceBreachNotification.ids[i], gnssLocation, transition,
static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, geofenceStatusNotification.available);
if (mGnssGeofencingCbIface != nullptr) {
IGnssGeofenceCallback::GeofenceAvailability status =
IGnssGeofenceCallback::GeofenceAvailability::UNAVAILABLE;
if (geofenceStatusNotification.available == GEOFENCE_STATUS_AVAILABILE_YES) {
status = IGnssGeofenceCallback::GeofenceAvailability::AVAILABLE;
}
GnssLocation gnssLocation;
memset(&gnssLocation, 0, sizeof(GnssLocation));
auto r = mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceStatusCb description=%s",
__func__, r.description().c_str());
}
}
}
void GeofenceAPIClient::onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_EXISTS;
auto r = mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceAddCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
auto r = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceRemoveCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
auto r = mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofencePauseCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
auto r = mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceResumeCb description=%s",
__func__, r.description().c_str());
}
}
}
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,76 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GEOFENCE_API_CLINET_H
#define GEOFENCE_API_CLINET_H
#include <android/hardware/gnss/1.0/IGnssGeofenceCallback.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::sp;
class GeofenceAPIClient : public LocationAPIClientBase
{
public:
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
virtual ~GeofenceAPIClient() = default;
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
void geofencePause(uint32_t geofence_id);
void geofenceResume(uint32_t geofence_id, int32_t monitor_transitions);
void geofenceRemove(uint32_t geofence_id);
void geofenceRemoveAll();
// callbacks
void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification) final;
void onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification) final;
void onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
void onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
void onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
private:
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // GEOFENCE_API_CLINET_H

View File

@@ -1,566 +0,0 @@
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_GnssAPIClient"
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "GnssAPIClient.h"
#include <LocContext.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnss;
using ::android::hardware::gnss::V1_0::IGnssCallback;
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb) :
LocationAPIClientBase(),
mGnssCbIface(nullptr),
mGnssNiCbIface(nullptr),
mControlClient(new LocationAPIControlClient()),
mLocationCapabilitiesMask(0),
mLocationCapabilitiesCached(false)
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
// set default LocationOptions.
memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
mTrackingOptions.size = sizeof(TrackingOptions);
mTrackingOptions.minInterval = 1000;
mTrackingOptions.minDistance = 0;
mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
gnssUpdateCallbacks(gpsCb, niCb);
}
GnssAPIClient::~GnssAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
if (mControlClient) {
delete mControlClient;
mControlClient = nullptr;
}
}
// for GpsInterface
void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb)
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
mMutex.lock();
mGnssCbIface = gpsCb;
mGnssNiCbIface = niCb;
mMutex.unlock();
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
if (mGnssCbIface != nullptr) {
locationCallbacks.trackingCb = [this](Location location) {
onTrackingCb(location);
};
}
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
loc_core::ContextBase* context =
loc_core::LocContext::getLocContext(
NULL, NULL,
loc_core::LocContext::mLocationHalName, false);
if (mGnssNiCbIface != nullptr && !context->hasAgpsExtendedCapabilities()) {
LOC_LOGD("Registering NI CB");
locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotification) {
onGnssNiCb(id, gnssNiNotification);
};
}
locationCallbacks.gnssSvCb = nullptr;
if (mGnssCbIface != nullptr) {
locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
onGnssSvCb(gnssSvNotification);
};
}
locationCallbacks.gnssNmeaCb = nullptr;
if (mGnssCbIface != nullptr) {
locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
onGnssNmeaCb(gnssNmeaNotification);
};
}
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
bool GnssAPIClient::gnssStart()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
bool retVal = true;
locAPIStartTracking(mTrackingOptions);
return retVal;
}
bool GnssAPIClient::gnssStop()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
bool retVal = true;
locAPIStopTracking();
return retVal;
}
bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs,
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
{
LOC_LOGD("%s]: (%d %d %d %d %d %d %d)", __FUNCTION__,
(int)mode, recurrence, minIntervalMs, preferredAccuracyMeters,
preferredTimeMs, (int)powerMode, timeBetweenMeasurement);
bool retVal = true;
memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
mTrackingOptions.size = sizeof(TrackingOptions);
mTrackingOptions.minInterval = minIntervalMs;
if (IGnss::GnssPositionMode::MS_ASSISTED == mode ||
IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
// We set a very large interval to simulate SINGLE mode. Once we report a fix,
// the caller should take the responsibility to stop the session.
// For MSA, we always treat it as SINGLE mode.
mTrackingOptions.minInterval = SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC;
}
mTrackingOptions.minDistance = preferredAccuracyMeters;
if (mode == IGnss::GnssPositionMode::STANDALONE)
mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
else if (mode == IGnss::GnssPositionMode::MS_BASED)
mTrackingOptions.mode = GNSS_SUPL_MODE_MSB;
else if (mode == IGnss::GnssPositionMode::MS_ASSISTED)
mTrackingOptions.mode = GNSS_SUPL_MODE_MSA;
else {
LOC_LOGD("%s]: invalid GnssPositionMode: %d", __FUNCTION__, (int)mode);
retVal = false;
}
if (GNSS_POWER_MODE_INVALID != powerMode) {
mTrackingOptions.powerMode = powerMode;
mTrackingOptions.tbm = timeBetweenMeasurement;
}
locAPIUpdateTrackingOptions(mTrackingOptions);
return retVal;
}
// for GpsNiInterface
void GnssAPIClient::gnssNiRespond(int32_t notifId,
IGnssNiCallback::GnssUserResponseType userResponse)
{
LOC_LOGD("%s]: (%d %d)", __FUNCTION__, notifId, static_cast<int>(userResponse));
GnssNiResponse data;
switch (userResponse) {
case IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT:
data = GNSS_NI_RESPONSE_ACCEPT;
break;
case IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY:
data = GNSS_NI_RESPONSE_DENY;
break;
case IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP:
data = GNSS_NI_RESPONSE_NO_RESPONSE;
break;
default:
data = GNSS_NI_RESPONSE_IGNORE;
break;
}
locAPIGnssNiResponse(notifId, data);
}
// these apis using LocationAPIControlClient
void GnssAPIClient::gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags)
{
LOC_LOGD("%s]: (%02hx)", __FUNCTION__, aidingDataFlags);
if (mControlClient == nullptr) {
return;
}
GnssAidingData data;
memset(&data, 0, sizeof (GnssAidingData));
data.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_GPS_BIT |
GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT |
GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT |
GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT |
GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
data.posEngineMask = STANDARD_POSITIONING_ENGINE;
if (aidingDataFlags == IGnss::GnssAidingData::DELETE_ALL)
data.deleteAll = true;
else {
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_EPHEMERIS)
data.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_ALMANAC)
data.sv.svMask |= GNSS_AIDING_DATA_SV_ALMANAC_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_POSITION)
data.common.mask |= GNSS_AIDING_DATA_COMMON_POSITION_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_TIME)
data.common.mask |= GNSS_AIDING_DATA_COMMON_TIME_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_IONO)
data.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_UTC)
data.common.mask |= GNSS_AIDING_DATA_COMMON_UTC_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_HEALTH)
data.sv.svMask |= GNSS_AIDING_DATA_SV_HEALTH_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVDIR)
data.sv.svMask |= GNSS_AIDING_DATA_SV_DIRECTION_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVSTEER)
data.sv.svMask |= GNSS_AIDING_DATA_SV_STEER_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SADATA)
data.sv.svMask |= GNSS_AIDING_DATA_SV_SA_DATA_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_RTI)
data.common.mask |= GNSS_AIDING_DATA_COMMON_RTI_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_CELLDB_INFO)
data.common.mask |= GNSS_AIDING_DATA_COMMON_CELLDB_BIT;
}
mControlClient->locAPIGnssDeleteAidingData(data);
}
void GnssAPIClient::gnssEnable(LocationTechnologyType techType)
{
LOC_LOGD("%s]: (%0d)", __FUNCTION__, techType);
if (mControlClient == nullptr) {
return;
}
mControlClient->locAPIEnable(techType);
}
void GnssAPIClient::gnssDisable()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
if (mControlClient == nullptr) {
return;
}
mControlClient->locAPIDisable();
}
void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, gnssConfig.flags);
if (mControlClient == nullptr) {
return;
}
mControlClient->locAPIGnssUpdateConfig(gnssConfig);
}
void GnssAPIClient::requestCapabilities() {
// only send capablities if it's already cached, otherwise the first time LocationAPI
// is initialized, capabilities will be sent by LocationAPI
if (mLocationCapabilitiesCached) {
onCapabilitiesCb(mLocationCapabilitiesMask);
}
}
// callbacks
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
mLocationCapabilitiesCached = true;
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
uint32_t data = 0;
if ((capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT) ||
(capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT) ||
(capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT) ||
(capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT))
data |= IGnssCallback::Capabilities::SCHEDULING;
if (capabilitiesMask & LOCATION_CAPABILITIES_GEOFENCE_BIT)
data |= IGnssCallback::Capabilities::GEOFENCING;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT)
data |= IGnssCallback::Capabilities::MEASUREMENTS;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
data |= IGnssCallback::Capabilities::MSB;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
data |= IGnssCallback::Capabilities::MSA;
auto r = gnssCbIface->gnssSetCapabilitesCb(data);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
__func__, r.description().c_str());
}
}
if (gnssCbIface != nullptr) {
IGnssCallback::GnssSystemInfo gnssInfo;
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
gnssInfo.yearOfHw = 2018;
} else if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
gnssInfo.yearOfHw = 2017;
} else if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
gnssInfo.yearOfHw = 2016;
} else {
gnssInfo.yearOfHw = 2015;
}
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
auto r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onTrackingCb(Location location)
{
LOC_LOGD("%s]: (flags: %02x)", __FUNCTION__, location.flags);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
GnssLocation gnssLocation;
convertGnssLocation(location, gnssLocation);
auto r = gnssCbIface->gnssLocationCb(gnssLocation);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationCb description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification)
{
LOC_LOGD("%s]: (id: %d)", __FUNCTION__, id);
mMutex.lock();
auto gnssNiCbIface(mGnssNiCbIface);
mMutex.unlock();
if (gnssNiCbIface == nullptr) {
LOC_LOGE("%s]: mGnssNiCbIface is nullptr", __FUNCTION__);
return;
}
IGnssNiCallback::GnssNiNotification notificationGnss = {};
notificationGnss.notificationId = id;
if (gnssNiNotification.type == GNSS_NI_TYPE_VOICE)
notificationGnss.niType = IGnssNiCallback::GnssNiType::VOICE;
else if (gnssNiNotification.type == GNSS_NI_TYPE_SUPL)
notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_SUPL;
else if (gnssNiNotification.type == GNSS_NI_TYPE_CONTROL_PLANE)
notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_CTRL_PLANE;
else if (gnssNiNotification.type == GNSS_NI_TYPE_EMERGENCY_SUPL)
notificationGnss.niType = IGnssNiCallback::GnssNiType::EMERGENCY_SUPL;
if (gnssNiNotification.options & GNSS_NI_OPTIONS_NOTIFICATION_BIT)
notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_NOTIFY;
if (gnssNiNotification.options & GNSS_NI_OPTIONS_VERIFICATION_BIT)
notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_VERIFY;
if (gnssNiNotification.options & GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT)
notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::PRIVACY_OVERRIDE;
notificationGnss.timeoutSec = gnssNiNotification.timeout;
if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_ACCEPT)
notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT;
else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_DENY)
notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY;
else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_NO_RESPONSE ||
gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_IGNORE)
notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP;
notificationGnss.requestorId = gnssNiNotification.requestor;
notificationGnss.notificationMessage = gnssNiNotification.message;
if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_NONE)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_NONE)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
gnssNiCbIface->niNotifyCb(notificationGnss);
}
void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssSvNotification.count);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
IGnssCallback::GnssSvStatus svStatus;
convertGnssSvStatus(gnssSvNotification, svStatus);
auto r = gnssCbIface->gnssSvStatusCb(svStatus);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSvStatusCb description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
{
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
const std::string s(gnssNmeaNotification.nmea);
std::stringstream ss(s);
std::string each;
while(std::getline(ss, each, '\n')) {
each += '\n';
android::hardware::hidl_string nmeaString;
nmeaString.setToExternal(each.c_str(), each.length());
auto r = gnssCbIface->gnssNmeaCb(
static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__,
gnssNmeaNotification.nmea, gnssNmeaNotification.length,
r.description().c_str());
}
}
}
}
void GnssAPIClient::onStartTrackingCb(LocationError error)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb SESSION_BEGIN description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onStopTrackingCb(LocationError error)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb ENGINE_OFF description=%s",
__func__, r.description().c_str());
}
}
}
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out)
{
memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
out.numSvs = in.count;
if (out.numSvs > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.",
__FUNCTION__, out.numSvs, V1_0::GnssMax::SVS_COUNT);
out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
info.svid = in.gnssSvs[i].svId;
convertGnssConstellationType(in.gnssSvs[i].type, info.constellation);
info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
info.elevationDegrees = in.gnssSvs[i].elevation;
info.azimuthDegrees = in.gnssSvs[i].azimuth;
info.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
info.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
}
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,109 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GNSS_API_CLINET_H
#define GNSS_API_CLINET_H
#include <mutex>
#include <android/hardware/gnss/1.0/IGnss.h>
#include <android/hardware/gnss/1.0/IGnssCallback.h>
#include <android/hardware/gnss/1.0/IGnssNiCallback.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::sp;
class GnssAPIClient : public LocationAPIClientBase
{
public:
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<V1_0::IGnssNiCallback>& niCb);
virtual ~GnssAPIClient();
GnssAPIClient(const GnssAPIClient&) = delete;
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
// for GpsInterface
void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<V1_0::IGnssNiCallback>& niCb);
bool gnssStart();
bool gnssStop();
bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs,
GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
uint32_t timeBetweenMeasurement = 0);
// for GpsNiInterface
void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
// these apis using LocationAPIControlClient
void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
void gnssEnable(LocationTechnologyType techType);
void gnssDisable();
void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
inline LocationCapabilitiesMask gnssGetCapabilities() const {
return mLocationCapabilitiesMask;
}
void requestCapabilities();
// callbacks we are interested in
void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
void onTrackingCb(Location location) final;
void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification) final;
void onGnssSvCb(GnssSvNotification gnssSvNotification) final;
void onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) final;
void onStartTrackingCb(LocationError error) final;
void onStopTrackingCb(LocationError error) final;
private:
sp<V1_0::IGnssCallback> mGnssCbIface;
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
std::mutex mMutex;
LocationAPIControlClient* mControlClient;
LocationCapabilitiesMask mLocationCapabilitiesMask;
bool mLocationCapabilitiesCached;
TrackingOptions mTrackingOptions;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // GNSS_API_CLINET_H

View File

@@ -1,206 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <LocationUtil.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::GnssLocation;
using ::android::hardware::gnss::V1_0::GnssConstellationType;
using ::android::hardware::gnss::V1_0::GnssLocationFlags;
void convertGnssLocation(Location& in, GnssLocation& out)
{
memset(&out, 0, sizeof(GnssLocation));
if (in.flags & LOCATION_HAS_LAT_LONG_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
out.latitudeDegrees = in.latitude;
out.longitudeDegrees = in.longitude;
}
if (in.flags & LOCATION_HAS_ALTITUDE_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
out.altitudeMeters = in.altitude;
}
if (in.flags & LOCATION_HAS_SPEED_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
out.speedMetersPerSec = in.speed;
}
if (in.flags & LOCATION_HAS_BEARING_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
out.bearingDegrees = in.bearing;
}
if (in.flags & LOCATION_HAS_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
out.horizontalAccuracyMeters = in.accuracy;
}
if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
out.verticalAccuracyMeters = in.verticalAccuracy;
}
if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
}
if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
out.bearingAccuracyDegrees = in.bearingAccuracy;
}
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
}
void convertGnssLocation(const GnssLocation& in, Location& out)
{
memset(&out, 0, sizeof(out));
if (in.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG) {
out.flags |= LOCATION_HAS_LAT_LONG_BIT;
out.latitude = in.latitudeDegrees;
out.longitude = in.longitudeDegrees;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE) {
out.flags |= LOCATION_HAS_ALTITUDE_BIT;
out.altitude = in.altitudeMeters;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED) {
out.flags |= LOCATION_HAS_SPEED_BIT;
out.speed = in.speedMetersPerSec;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
out.flags |= LOCATION_HAS_BEARING_BIT;
out.bearing = in.bearingDegrees;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY) {
out.flags |= LOCATION_HAS_ACCURACY_BIT;
out.accuracy = in.horizontalAccuracyMeters;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
out.verticalAccuracy = in.verticalAccuracyMeters;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
out.speedAccuracy = in.speedAccuracyMetersPerSecond;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
out.bearingAccuracy = in.bearingAccuracyDegrees;
}
out.timestamp = static_cast<uint64_t>(in.timestamp);
}
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
{
switch(in) {
case GNSS_SV_TYPE_GPS:
out = GnssConstellationType::GPS;
break;
case GNSS_SV_TYPE_SBAS:
out = GnssConstellationType::SBAS;
break;
case GNSS_SV_TYPE_GLONASS:
out = GnssConstellationType::GLONASS;
break;
case GNSS_SV_TYPE_QZSS:
out = GnssConstellationType::QZSS;
break;
case GNSS_SV_TYPE_BEIDOU:
out = GnssConstellationType::BEIDOU;
break;
case GNSS_SV_TYPE_GALILEO:
out = GnssConstellationType::GALILEO;
break;
case GNSS_SV_TYPE_UNKNOWN:
default:
out = GnssConstellationType::UNKNOWN;
break;
}
}
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
{
switch(in) {
case GNSS_EPH_TYPE_EPHEMERIS:
out = GnssDebug::SatelliteEphemerisType::EPHEMERIS;
break;
case GNSS_EPH_TYPE_ALMANAC:
out = GnssDebug::SatelliteEphemerisType::ALMANAC_ONLY;
break;
case GNSS_EPH_TYPE_UNKNOWN:
default:
out = GnssDebug::SatelliteEphemerisType::NOT_AVAILABLE;
break;
}
}
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out)
{
switch(in) {
case GNSS_EPH_SOURCE_DEMODULATED:
out = GnssDebug::SatelliteEphemerisSource::DEMODULATED;
break;
case GNSS_EPH_SOURCE_SUPL_PROVIDED:
out = GnssDebug::SatelliteEphemerisSource::SUPL_PROVIDED;
break;
case GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED:
out = GnssDebug::SatelliteEphemerisSource::OTHER_SERVER_PROVIDED;
break;
case GNSS_EPH_SOURCE_LOCAL:
case GNSS_EPH_SOURCE_UNKNOWN:
default:
out = GnssDebug::SatelliteEphemerisSource::OTHER;
break;
}
}
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out)
{
switch(in) {
case GNSS_EPH_HEALTH_GOOD:
out = GnssDebug::SatelliteEphemerisHealth::GOOD;
break;
case GNSS_EPH_HEALTH_BAD:
out = GnssDebug::SatelliteEphemerisHealth::BAD;
break;
case GNSS_EPH_HEALTH_UNKNOWN:
default:
out = GnssDebug::SatelliteEphemerisHealth::UNKNOWN;
break;
}
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,55 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef LOCATION_UTIL_H
#define LOCATION_UTIL_H
#include <android/hardware/gnss/1.0/types.h>
#include <LocationAPI.h>
#include <GnssDebug.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // LOCATION_UTIL_H

View File

@@ -1,276 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_MeasurementAPIClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "MeasurementAPIClient.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback;
static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out);
static void convertGnssMeasurement(GnssMeasurementsData& in,
V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
MeasurementAPIClient::MeasurementAPIClient() :
mGnssMeasurementCbIface(nullptr),
mTracking(false)
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
MeasurementAPIClient::~MeasurementAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
// for GpsInterface
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
mMutex.lock();
mGnssMeasurementCbIface = callback;
mMutex.unlock();
return startTracking();
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::startTracking()
{
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
if (mGnssMeasurementCbIface != nullptr) {
locationCallbacks.gnssMeasurementsCb =
[this](GnssMeasurementsNotification gnssMeasurementsNotification) {
onGnssMeasurementsCb(gnssMeasurementsNotification);
};
}
locAPISetCallbacks(locationCallbacks);
TrackingOptions options = {};
memset(&options, 0, sizeof(TrackingOptions));
options.size = sizeof(TrackingOptions);
options.minInterval = 1000;
options.mode = GNSS_SUPL_MODE_STANDALONE;
mTracking = true;
LOC_LOGD("%s]: start tracking session", __FUNCTION__);
locAPIStartTracking(options);
return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
}
// for GpsMeasurementInterface
void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
mTracking = false;
locAPIStopTracking();
}
// callbacks
void MeasurementAPIClient::onGnssMeasurementsCb(
GnssMeasurementsNotification gnssMeasurementsNotification)
{
LOC_LOGD("%s]: (count: %zu active: %d)",
__FUNCTION__, gnssMeasurementsNotification.count, mTracking);
if (mTracking) {
mMutex.lock();
sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
if (mGnssMeasurementCbIface != nullptr) {
gnssMeasurementCbIface = mGnssMeasurementCbIface;
}
mMutex.unlock();
if (gnssMeasurementCbIface != nullptr) {
V1_0::IGnssMeasurementCallback::GnssData gnssData;
convertGnssData(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
__func__, r.description().c_str());
}
}
}
}
static void convertGnssMeasurement(GnssMeasurementsData& in,
V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
{
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_FREQUENCY;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_CYCLES;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
out.svid = in.svId;
convertGnssConstellationType(in.svType, out.constellation);
out.timeOffsetNs = in.timeOffsetNs;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
out.receivedSvTimeInNs = in.receivedSvTimeNs;
out.receivedSvTimeUncertaintyInNs = in.receivedSvTimeUncertaintyNs;
out.cN0DbHz = in.carrierToNoiseDbHz;
out.pseudorangeRateMps = in.pseudorangeRateMps;
out.pseudorangeRateUncertaintyMps = in.pseudorangeRateUncertaintyMps;
if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
out.accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
out.accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
out.accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
out.accumulatedDeltaRangeM = in.adrMeters;
out.accumulatedDeltaRangeUncertaintyM = in.adrUncertaintyMeters;
out.carrierFrequencyHz = in.carrierFrequencyHz;
out.carrierCycles = in.carrierCycles;
out.carrierPhase = in.carrierPhase;
out.carrierPhaseUncertainty = in.carrierPhaseUncertainty;
uint8_t indicator =
static_cast<uint8_t>(IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN);
if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT)
indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_PRESENT;
if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT)
indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATIOR_NOT_PRESENT;
out.multipathIndicator =
static_cast<IGnssMeasurementCallback::GnssMultipathIndicator>(indicator);
out.snrDb = in.signalToNoiseRatioDb;
out.agcLevelDb = in.agcLevelDb;
}
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out)
{
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssClock));
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_LEAP_SECOND;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_TIME_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_FULL_BIAS;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT_UNCERTAINTY;
out.leapSecond = in.leapSecond;
out.timeNs = in.timeNs;
out.timeUncertaintyNs = in.timeUncertaintyNs;
out.fullBiasNs = in.fullBiasNs;
out.biasNs = in.biasNs;
out.biasUncertaintyNs = in.biasUncertaintyNs;
out.driftNsps = in.driftNsps;
out.driftUncertaintyNsps = in.driftUncertaintyNsps;
out.hwClockDiscontinuityCount = in.hwClockDiscontinuityCount;
}
static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out)
{
out.measurementCount = in.count;
if (out.measurementCount > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.",
__FUNCTION__, out.measurementCount, V1_0::GnssMax::SVS_COUNT);
out.measurementCount = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.measurementCount; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i]);
}
convertGnssClock(in.clock, out.clock);
}
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,77 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef MEASUREMENT_API_CLINET_H
#define MEASUREMENT_API_CLINET_H
#include <mutex>
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
#include <android/hardware/gnss/1.0/IGnssMeasurementCallback.h>
#include <LocationAPIClientBase.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {
using ::android::sp;
class MeasurementAPIClient : public LocationAPIClientBase
{
public:
MeasurementAPIClient();
virtual ~MeasurementAPIClient();
MeasurementAPIClient(const MeasurementAPIClient&) = delete;
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
// for GpsMeasurementInterface
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback);
void measurementClose();
Return<IGnssMeasurement::GnssMeasurementStatus> startTracking();
// callbacks we are interested in
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private:
std::mutex mMutex;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
bool mTracking;
};
} // namespace implementation
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // MEASUREMENT_API_CLINET_H

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.gnss@1.0-service-qti"
#include <android/hardware/gnss/1.0/IGnss.h>
#include <hidl/LegacySupport.h>
#include "loc_cfg.h"
#include "loc_misc_utils.h"
extern "C" {
#include "vndfwk-detect.h"
}
#ifdef ARCH_ARM_32
#define DEFAULT_HW_BINDER_MEM_SIZE 65536
#endif
using android::hardware::gnss::V1_0::IGnss;
using android::hardware::configureRpcThreadpool;
using android::hardware::registerPassthroughServiceImplementation;
using android::hardware::joinRpcThreadpool;
using android::status_t;
using android::OK;
typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []);
int main() {
ALOGI("%s", __FUNCTION__);
int vendorInfo = getVendorEnhancedInfo();
bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo );
setVendorEnhanced(vendorEnhanced);
#ifdef ARCH_ARM_32
android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
#endif
configureRpcThreadpool(1, true);
status_t status;
status = registerPassthroughServiceImplementation<IGnss>();
if (status == OK) {
if (vendorEnhanced) {
#ifdef LOC_HIDL_VERSION
#define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so"
void* libHandle = NULL;
vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*)
dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main");
if (NULL != vendorEnhancedMainMethod) {
(*vendorEnhancedMainMethod)(0, NULL);
}
#else
ALOGE("LOC_HIDL_VERSION not defined.");
#endif
}
joinRpcThreadpool();
} else {
ALOGE("Error while registering IGnss 1.0 service: %d", status);
}
return 0;
}

View File

@@ -1,203 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_AGnssInterface"
#include <log_util.h>
#include "Gnss.h"
#include "AGnss.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
static AGnss* spAGnss = nullptr;
AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
spAGnss = this;
}
AGnss::~AGnss() {
spAGnss = nullptr;
}
void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){
if (nullptr != spAGnss) {
spAGnss->statusIpV4Cb(status);
}
}
void AGnss::statusIpV4Cb(AGnssExtStatusIpV4 status) {
IAGnssCallback::AGnssStatusIpV4 st = {};
switch (status.type) {
case LOC_AGPS_TYPE_SUPL:
st.type = IAGnssCallback::AGnssType::TYPE_SUPL;
break;
case LOC_AGPS_TYPE_C2K:
st.type = IAGnssCallback::AGnssType::TYPE_C2K;
break;
default:
LOC_LOGE("invalid type: %d", status.type);
return;
}
switch (status.status) {
case LOC_GPS_REQUEST_AGPS_DATA_CONN:
st.status = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
break;
case LOC_GPS_RELEASE_AGPS_DATA_CONN:
st.status = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
break;
case LOC_GPS_AGPS_DATA_CONNECTED:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
break;
case LOC_GPS_AGPS_DATA_CONN_DONE:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
break;
case LOC_GPS_AGPS_DATA_CONN_FAILED:
st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
break;
default:
LOC_LOGE("invalid status: %d", status.status);
return;
}
st.ipV4Addr = status.ipV4Addr;
if (mAGnssCbIface != nullptr) {
auto r = mAGnssCbIface->agnssStatusIpV4Cb(st);
if (!r.isOk()) {
LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str());
}
} else {
LOC_LOGw("setCallback has not been called yet");
}
}
Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return Void();
}
// Save the interface
mAGnssCbIface = callback;
AgpsCbInfo cbInfo = {};
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
mGnss->getGnssInterface()->agpsInit(cbInfo);
return Void();
}
Return<bool> AGnss::dataConnClosed() {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
mGnss->getGnssInterface()->agpsDataConnClosed(LOC_AGPS_TYPE_SUPL);
return true;
}
Return<bool> AGnss::dataConnFailed() {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
mGnss->getGnssInterface()->agpsDataConnFailed(LOC_AGPS_TYPE_SUPL);
return true;
}
Return<bool> AGnss::dataConnOpen(const hidl_string& apn,
IAGnss::ApnIpType apnIpType) {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
/* Validate */
if(apn.empty()){
LOC_LOGE("Invalid APN");
return false;
}
LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
AGpsBearerType bearerType;
switch (apnIpType) {
case IAGnss::ApnIpType::IPV4:
bearerType = AGPS_APN_BEARER_IPV4;
break;
case IAGnss::ApnIpType::IPV6:
bearerType = AGPS_APN_BEARER_IPV6;
break;
case IAGnss::ApnIpType::IPV4V6:
bearerType = AGPS_APN_BEARER_IPV4V6;
break;
default:
bearerType = AGPS_APN_BEARER_IPV4;
break;
}
mGnss->getGnssInterface()->agpsDataConnOpen(
LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
return true;
}
Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname,
int32_t port) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
config.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
if (type == IAGnssCallback::AGnssType::TYPE_SUPL) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
} else if (type == IAGnssCallback::AGnssType::TYPE_C2K) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
} else {
LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<int>(type));
return false;
}
config.assistanceServer.hostName = strdup(hostname.c_str());
config.assistanceServer.port = port;
return mGnss->updateConfiguration(config);
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,79 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
#define ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
#include <android/hardware/gnss/1.0/IAGnss.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnss;
using ::android::hardware::gnss::V1_0::IAGnssCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
struct AGnss : public IAGnss {
AGnss(Gnss* gnss);
~AGnss();
/*
* Methods from ::android::hardware::gnss::V1_0::IAGnss interface follow.
* These declarations were generated from IAGnss.hal.
*/
Return<void> setCallback(const sp<IAGnssCallback>& callback) override;
Return<bool> dataConnClosed() override;
Return<bool> dataConnFailed() override;
Return<bool> dataConnOpen(const hidl_string& apn,
IAGnss::ApnIpType apnIpType) override;
Return<bool> setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname, int32_t port) override;
void statusIpV4Cb(AGnssExtStatusIpV4 status);
/* Data call setup callback passed down to GNSS HAL implementation */
static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
private:
Gnss* mGnss = nullptr;
sp<IAGnssCallback> mAGnssCbIface = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H

View File

@@ -1,114 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc__AGnssRilInterface"
#include <log_util.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sstream>
#include <string>
#include "Gnss.h"
#include "AGnssRil.h"
#include <DataItemConcreteTypesBase.h>
typedef void* (getLocationInterface)();
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
AGnssRil::AGnssRil(Gnss* gnss) : mGnss(gnss) {
ENTRY_LOG_CALLFLOW();
}
AGnssRil::~AGnssRil() {
ENTRY_LOG_CALLFLOW();
}
Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool /*roaming*/) {
ENTRY_LOG_CALLFLOW();
// Extra NetworkTypes not available in IAgnssRil enums
const int NetworkType_BLUETOOTH = 7;
const int NetworkType_ETHERNET = 9;
const int NetworkType_PROXY = 16;
// for XTRA
if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
int8_t typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
switch(type)
{
case IAGnssRil::NetworkType::MOBILE:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_MOBILE;
break;
case IAGnssRil::NetworkType::WIFI:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIFI;
break;
case IAGnssRil::NetworkType::MMS:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_MMS;
break;
case IAGnssRil::NetworkType::SUPL:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_SUPL;
break;
case IAGnssRil::NetworkType::DUN:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_DUN;
break;
case IAGnssRil::NetworkType::HIPRI:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_HIPRI;
break;
case IAGnssRil::NetworkType::WIMAX:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIMAX;
break;
default:
{
int networkType = (int) type;
// Handling network types not available in IAgnssRil
switch(networkType)
{
case NetworkType_BLUETOOTH:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_BLUETOOTH;
break;
case NetworkType_ETHERNET:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_ETHERNET;
break;
case NetworkType_PROXY:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_PROXY;
break;
default:
typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
}
}
break;
}
mGnss->getGnssInterface()->updateConnectionStatus(connected, false, typeout, 0);
}
return true;
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
#define ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
#include <android/hardware/gnss/1.0/IAGnssRil.h>
#include <hidl/Status.h>
#include <location_interface.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnssRil;
using ::android::hardware::gnss::V1_0::IAGnssRilCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
/*
* Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface Layer interface
* allows the GNSS chipset to request radio interface layer information from Android platform.
* Examples of such information are reference location, unique subscriber ID, phone number string
* and network availability changes. Also contains wrapper methods to allow methods from
* IAGnssiRilCallback interface to be passed into the conventional implementation of the GNSS HAL.
*/
struct AGnssRil : public IAGnssRil {
AGnssRil(Gnss* gnss);
~AGnssRil();
/*
* Methods from ::android::hardware::gnss::V1_0::IAGnssRil follow.
* These declarations were generated from IAGnssRil.hal.
*/
Return<void> setCallback(const sp<IAGnssRilCallback>& /*callback*/) override {
return Void();
}
Return<void> setRefLocation(const IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override {
return Void();
}
Return<bool> setSetId(IAGnssRil::SetIDType /*type*/, const hidl_string& /*setid*/) override {
return false;
}
Return<bool> updateNetworkAvailability(bool /*available*/,
const hidl_string& /*apn*/) override {
return false;
}
Return<bool> updateNetworkState(bool connected, NetworkType type, bool roaming) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_

View File

@@ -1,105 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.1-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
AGnss.cpp \
Gnss.cpp \
GnssBatching.cpp \
GnssGeofencing.cpp \
GnssMeasurement.cpp \
GnssNi.cpp \
GnssConfiguration.cpp \
GnssDebug.cpp \
AGnssRil.cpp
LOCAL_SRC_FILES += \
location_api/LocationUtil.cpp \
location_api/GnssAPIClient.cpp \
location_api/GeofenceAPIClient.cpp \
location_api/BatchingAPIClient.cpp \
location_api/MeasurementAPIClient.cpp \
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/location_api
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers \
liblocbatterylistener_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libhidlbase \
libhidltransport \
libhwbinder \
libcutils \
libutils \
android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
android.hardware.health@1.0 \
android.hardware.health@2.0 \
android.hardware.power@1.2 \
libbase
LOCAL_SHARED_LIBRARIES += \
libloc_core \
libgps.utils \
libdl \
liblocation_api \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
LOCAL_STATIC_LIBRARIES := liblocbatterylistener
LOCAL_STATIC_LIBRARIES += libhealthhalutils
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.1-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.1-service-qti.xml
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.gnss@1.1-service-qti.rc
LOCAL_SRC_FILES := \
service.cpp \
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/location_api
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libdl \
libbase \
libutils \
libgps.utils \
libqti_vndfwk_detect \
LOCAL_SHARED_LIBRARIES += \
libhwbinder \
libhidlbase \
libhidltransport \
android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE)

View File

@@ -1,477 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssInterface"
#define LOG_NDEBUG 0
#include <fstream>
#include <log_util.h>
#include <dlfcn.h>
#include <cutils/properties.h>
#include "Gnss.h"
#include <LocationUtil.h>
#include "battery_listener.h"
typedef const GnssInterface* (getLocationInterface)();
#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
#define DELIMITER ";"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
static sp<Gnss> sGnss;
static std::string getVersionString() {
static std::string version;
if (!version.empty())
return version;
char value[PROPERTY_VALUE_MAX] = {0};
property_get("ro.hardware", value, "unknown");
version.append(value).append(DELIMITER);
std::ifstream in(IMAGES_INFO_FILE);
std::string s;
while(getline(in, s)) {
std::size_t found = s.find("CRM:");
if (std::string::npos == found) {
continue;
}
// skip over space characters after "CRM:"
const char* substr = s.c_str();
found += 4;
while (0 != substr[found] && isspace(substr[found])) {
found++;
}
if (s.find("11:") != found) {
continue;
}
s.erase(0, found + 3);
found = s.find_first_of("\r\n");
if (std::string::npos != found) {
s.erase(s.begin() + found, s.end());
}
version.append(s).append(DELIMITER);
}
return version;
}
void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnss != nullptr) {
mGnss->stop();
mGnss->cleanup();
}
}
void location_on_battery_status_changed(bool charging) {
LOC_LOGd("battery status changed to %s charging", charging ? "" : "not");
if (sGnss != nullptr) {
sGnss->getGnssInterface()->updateBatteryStatus(charging);
}
}
Gnss::Gnss() {
ENTRY_LOG_CALLFLOW();
sGnss = this;
// register health client to listen on battery change
loc_extn_battery_properties_listener_init(location_on_battery_status_changed);
// clear pending GnssConfig
memset(&mPendingConfig, 0, sizeof(GnssConfig));
mGnssDeathRecipient = new GnssDeathRecipient(this);
}
Gnss::~Gnss() {
ENTRY_LOG_CALLFLOW();
if (mApi != nullptr) {
delete mApi;
mApi = nullptr;
}
sGnss = nullptr;
}
GnssAPIClient* Gnss::getApi() {
if (mApi == nullptr && (mGnssCbIface != nullptr || mGnssNiCbIface != nullptr)) {
mApi = new GnssAPIClient(mGnssCbIface, mGnssNiCbIface);
if (mApi == nullptr) {
LOC_LOGE("%s] faild to create GnssAPIClient", __FUNCTION__);
return mApi;
}
if (mPendingConfig.size == sizeof(GnssConfig)) {
// we have pending GnssConfig
mApi->gnssConfigurationUpdate(mPendingConfig);
// clear size to invalid mPendingConfig
mPendingConfig.size = 0;
if (mPendingConfig.assistanceServer.hostName != nullptr) {
free((void*)mPendingConfig.assistanceServer.hostName);
}
}
}
if (mApi == nullptr) {
LOC_LOGW("%s] GnssAPIClient is not ready", __FUNCTION__);
}
return mApi;
}
const GnssInterface* Gnss::getGnssInterface() {
static bool getGnssInterfaceFailed = false;
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__);
getLocationInterface* getter = NULL;
const char *error = NULL;
dlerror();
void *handle = dlopen("libgnss.so", RTLD_NOW);
if (NULL == handle || (error = dlerror()) != NULL) {
LOC_LOGW("dlopen for libgnss.so failed, error = %s", error);
} else {
getter = (getLocationInterface*)dlsym(handle, "getGnssInterface");
if ((error = dlerror()) != NULL) {
LOC_LOGW("dlsym for libgnss.so::getGnssInterface failed, error = %s", error);
getter = NULL;
}
}
if (NULL == getter) {
getGnssInterfaceFailed = true;
} else {
mGnssInterface = (const GnssInterface*)(*getter)();
}
}
return mGnssInterface;
}
Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
}
mGnssCbIface = callback;
if (mGnssCbIface != nullptr) {
mGnssCbIface->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
}
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
api->requestCapabilities();
}
return true;
}
Return<bool> Gnss::setGnssNiCb(const sp<IGnssNiCallback>& callback) {
ENTRY_LOG_CALLFLOW();
mGnssNiCbIface = callback;
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
}
return true;
}
Return<bool> Gnss::updateConfiguration(GnssConfig& gnssConfig) {
ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi();
if (api) {
api->gnssConfigurationUpdate(gnssConfig);
} else if (gnssConfig.flags != 0) {
// api is not ready yet, update mPendingConfig with gnssConfig
mPendingConfig.size = sizeof(GnssConfig);
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
mPendingConfig.gpsLock = gnssConfig.gpsLock;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
mPendingConfig.suplVersion = gnssConfig.suplVersion;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
mPendingConfig.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
mPendingConfig.assistanceServer.type = gnssConfig.assistanceServer.type;
if (mPendingConfig.assistanceServer.hostName != nullptr) {
free((void*)mPendingConfig.assistanceServer.hostName);
mPendingConfig.assistanceServer.hostName =
strdup(gnssConfig.assistanceServer.hostName);
}
mPendingConfig.assistanceServer.port = gnssConfig.assistanceServer.port;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
mPendingConfig.lppProfile = gnssConfig.lppProfile;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
mPendingConfig.lppeControlPlaneMask = gnssConfig.lppeControlPlaneMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT;
mPendingConfig.lppeUserPlaneMask = gnssConfig.lppeUserPlaneMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
mPendingConfig.aGlonassPositionProtocolMask = gnssConfig.aGlonassPositionProtocolMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
mPendingConfig.emergencyPdnForEmergencySupl = gnssConfig.emergencyPdnForEmergencySupl;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
mPendingConfig.suplEmergencyServices = gnssConfig.suplEmergencyServices;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
mPendingConfig.suplModeMask = gnssConfig.suplModeMask;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
mPendingConfig.blacklistedSvIds = gnssConfig.blacklistedSvIds;
}
}
return true;
}
Return<bool> Gnss::start() {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
retVal = api->gnssStart();
}
return retVal;
}
Return<bool> Gnss::stop() {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
retVal = api->gnssStop();
}
return retVal;
}
Return<void> Gnss::cleanup() {
ENTRY_LOG_CALLFLOW();
if (mApi != nullptr) {
mApi->gnssDisable();
}
return Void();
}
Return<bool> Gnss::injectLocation(double latitudeDegrees,
double longitudeDegrees,
float accuracyMeters) {
ENTRY_LOG_CALLFLOW();
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
gnssInterface->injectLocation(latitudeDegrees, longitudeDegrees, accuracyMeters);
return true;
} else {
return false;
}
}
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
int32_t uncertaintyMs) {
ENTRY_LOG_CALLFLOW();
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
return true;
} else {
return false;
}
}
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi();
if (api) {
api->gnssDeleteAidingData(aidingDataFlags);
}
return Void();
}
Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
preferredAccuracyMeters, preferredTimeMs);
}
return retVal;
}
Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
ENTRY_LOG_CALLFLOW();
mAGnssIface = new AGnss(this);
return mAGnssIface;
}
Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
ENTRY_LOG_CALLFLOW();
mGnssNi = new GnssNi(this);
return mGnssNi;
}
Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
ENTRY_LOG_CALLFLOW();
if (mGnssMeasurement == nullptr)
mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
}
Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
ENTRY_LOG_CALLFLOW();
mGnssConfig = new GnssConfiguration(this);
return mGnssConfig;
}
Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
ENTRY_LOG_CALLFLOW();
mGnssGeofencingIface = new GnssGeofencing();
return mGnssGeofencingIface;
}
Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
mGnssBatching = new GnssBatching();
return mGnssBatching;
}
Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
ENTRY_LOG_CALLFLOW();
mGnssDebug = new GnssDebug(this);
return mGnssDebug;
}
Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
mGnssRil = new AGnssRil(this);
return mGnssRil;
}
// Methods from ::android::hardware::gnss::V1_1::IGnss follow.
Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
callback->gnssNameCb(getVersionString());
mGnssCbIface_1_1 = callback;
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest);
};
gnssInterface->odcpiInit(cb);
}
return setCallback(callback);
}
Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs,
bool lowPowerMode) {
ENTRY_LOG_CALLFLOW();
bool retVal = false;
GnssAPIClient* api = getApi();
if (api) {
GnssPowerMode powerMode = lowPowerMode?
GNSS_POWER_MODE_M4 : GNSS_POWER_MODE_M2;
retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
preferredAccuracyMeters, preferredTimeMs, powerMode, minIntervalMs);
}
return retVal;
}
Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() {
ENTRY_LOG_CALLFLOW();
if (mGnssMeasurement == nullptr)
mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
}
Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
ENTRY_LOG_CALLFLOW();
if (mGnssConfig == nullptr)
mGnssConfig = new GnssConfiguration(this);
return mGnssConfig;
}
Return<bool> Gnss::injectBestLocation(const GnssLocation& gnssLocation) {
ENTRY_LOG_CALLFLOW();
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
Location location = {};
convertGnssLocation(gnssLocation, location);
gnssInterface->odcpiInject(location);
}
return true;
}
void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) {
ENTRY_LOG_CALLFLOW();
if (mGnssCbIface_1_1 != nullptr) {
// For emergency mode, request DBH (Device based hybrid) location
// Mark Independent from GNSS flag to false.
if (ODCPI_REQUEST_TYPE_START == request.type) {
auto r = mGnssCbIface_1_1->gnssRequestLocationCb(!request.isEmergencyMode);
if (!r.isOk()) {
LOC_LOGe("Error invoking gnssRequestLocationCb %s", r.description().c_str());
}
} else {
LOC_LOGv("Unsupported ODCPI request type: %d", request.type);
}
} else {
LOC_LOGe("ODCPI request not supported.");
}
}
V1_0::IGnss* HIDL_FETCH_IGnss(const char* hal) {
ENTRY_LOG_CALLFLOW();
V1_0::IGnss* iface = nullptr;
iface = new Gnss();
if (iface == nullptr) {
LOC_LOGE("%s]: failed to get %s", __FUNCTION__, hal);
}
return iface;
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,154 +0,0 @@
/*
* Copyright (c) 2017-2018-2018-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
#include <AGnss.h>
#include <AGnssRil.h>
#include <GnssBatching.h>
#include <GnssConfiguration.h>
#include <GnssGeofencing.h>
#include <GnssMeasurement.h>
#include <GnssNi.h>
#include <GnssDebug.h>
#include <android/hardware/gnss/1.1/IGnss.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <GnssAPIClient.h>
#include <location_interface.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
using ::android::hardware::gnss::V1_0::GnssLocation;
struct Gnss : public IGnss {
Gnss();
~Gnss();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnss follow.
* These declarations were generated from Gnss.hal.
*/
Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
Return<bool> start() override;
Return<bool> stop() override;
Return<void> cleanup() override;
Return<bool> injectLocation(double latitudeDegrees,
double longitudeDegrees,
float accuracyMeters) override;
Return<bool> injectTime(int64_t timeMs,
int64_t timeReferenceMs,
int32_t uncertaintyMs) override;
Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) override;
Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
return nullptr;
}
inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
return nullptr;
}
Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
// Methods from ::android::hardware::gnss::V1_1::IGnss follow.
Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override;
Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs, bool lowPowerMode) override;
Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override;
Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override;
Return<bool> injectBestLocation(const GnssLocation& location) override;
// These methods are not part of the IGnss base class.
GnssAPIClient* getApi();
Return<bool> setGnssNiCb(const sp<IGnssNiCallback>& niCb);
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
const GnssInterface* getGnssInterface();
// Callback for ODCPI request
void odcpiRequestCb(const OdcpiRequestInfo& request);
private:
struct GnssDeathRecipient : hidl_death_recipient {
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
}
~GnssDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<Gnss> mGnss;
};
private:
sp<GnssDeathRecipient> mGnssDeathRecipient = nullptr;
sp<AGnss> mAGnssIface = nullptr;
sp<GnssNi> mGnssNi = nullptr;
sp<GnssMeasurement> mGnssMeasurement = nullptr;
sp<GnssConfiguration> mGnssConfig = nullptr;
sp<GnssGeofencing> mGnssGeofencingIface = nullptr;
sp<GnssBatching> mGnssBatching = nullptr;
sp<IGnssDebug> mGnssDebug = nullptr;
sp<AGnssRil> mGnssRil = nullptr;
GnssAPIClient* mApi = nullptr;
sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr;
sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
GnssConfig mPendingConfig;
const GnssInterface* mGnssInterface = nullptr;
};
extern "C" V1_0::IGnss* HIDL_FETCH_IGnss(const char* name);
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSS_H

View File

@@ -1,130 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssBatchingInterface"
#include <log_util.h>
#include <BatchingAPIClient.h>
#include "GnssBatching.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
void GnssBatching::GnssBatchingDeathRecipient::serviceDied(
uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnssBatching != nullptr) {
mGnssBatching->stop();
mGnssBatching->cleanup();
}
}
GnssBatching::GnssBatching() : mApi(nullptr) {
mGnssBatchingDeathRecipient = new GnssBatchingDeathRecipient(this);
}
GnssBatching::~GnssBatching() {
if (mApi != nullptr) {
delete mApi;
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
if (mApi != nullptr) {
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
delete mApi;
mApi = nullptr;
}
mApi = new BatchingAPIClient(callback);
if (mApi == nullptr) {
LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
return false;
}
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
}
mGnssBatchingCbIface = callback;
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
}
return true;
}
Return<uint16_t> GnssBatching::getBatchSize() {
uint16_t ret = 0;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
ret = mApi->getBatchSize();
}
return ret;
}
Return<bool> GnssBatching::start(const IGnssBatching::Options& options) {
bool ret = false;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
ret = mApi->startSession(options);
}
return ret;
}
Return<void> GnssBatching::flush() {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->flushBatchedLocations();
}
return Void();
}
Return<bool> GnssBatching::stop() {
bool ret = false;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
ret = mApi->stopSession();
}
return ret;
}
Return<void> GnssBatching::cleanup() {
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
}
return Void();
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,80 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
#include <android/hardware/gnss/1.0/IGnssBatching.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching;
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
using ::android::hidl::base::V1_0::IBase;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
class BatchingAPIClient;
struct GnssBatching : public IGnssBatching {
GnssBatching();
~GnssBatching();
// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
Return<uint16_t> getBatchSize() override;
Return<bool> start(const IGnssBatching::Options& options ) override;
Return<void> flush() override;
Return<bool> stop() override;
Return<void> cleanup() override;
private:
struct GnssBatchingDeathRecipient : hidl_death_recipient {
GnssBatchingDeathRecipient(sp<GnssBatching> gnssBatching) :
mGnssBatching(gnssBatching) {
}
~GnssBatchingDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssBatching> mGnssBatching;
};
private:
sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
BatchingAPIClient* mApi = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H

View File

@@ -1,313 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssConfigurationInterface"
#include <log_util.h>
#include "Gnss.h"
#include "GnssConfiguration.h"
#include <android/hardware/gnss/1.0/types.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::GnssConstellationType;
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
}
// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setSuplEs(bool enabled) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
config.suplEmergencyServices = (enabled ?
GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES :
GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO);
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setSuplVersion(uint32_t version) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
switch (version) {
case 0x00020002:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_2;
break;
case 0x00020000:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_0;
break;
case 0x00010000:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
break;
default:
LOC_LOGE("%s]: invalid version: 0x%x.", __FUNCTION__, version);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setSuplMode(uint8_t mode) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
switch (mode) {
case 0:
config.suplModeMask = 0; // STANDALONE ONLY
break;
case 1:
config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT;
break;
case 2:
config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSA_BIT;
break;
case 3:
config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT | GNSS_CONFIG_SUPL_MODE_MSA_BIT;
break;
default:
LOC_LOGE("%s]: invalid mode: %d.", __FUNCTION__, mode);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
switch (lppProfile) {
case 0:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
break;
case 1:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE;
break;
case 2:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE;
break;
case 3:
config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE;
break;
default:
LOC_LOGE("%s]: invalid lppProfile: %d.", __FUNCTION__, lppProfile);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
if (protocol & (1<<0)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRC_CONTROL_PLANE_BIT;
}
if (protocol & (1<<1)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRLP_USER_PLANE_BIT;
}
if (protocol & (1<<2)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_USER_PLANE_BIT;
}
if (protocol & (1<<3)) {
config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_CONTROL_PLANE_BIT;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
switch (lock) {
case 0:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
break;
case 1:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
break;
case 2:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
break;
case 3:
config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
break;
default:
LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
return false;
break;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
config.emergencyPdnForEmergencySupl = (enabled ?
GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES :
GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO);
return mGnss->updateConfiguration(config);
}
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setBlacklist(
const hidl_vec<GnssConfiguration::BlacklistedSource>& blacklist) {
ENTRY_LOG_CALLFLOW();
if (nullptr == mGnss) {
LOC_LOGe("mGnss is null");
return false;
}
// blValid is true if blacklist is empty, i.e. clearing the BL;
// if blacklist is not empty, blValid is initialied to false, and later
// updated in the for loop to become true only if there is at least
// one {constellation, svid} in the list that is valid.
bool blValid = (0 == blacklist.size());
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
config.blacklistedSvIds.clear();
GnssSvIdSource source = {};
for (int idx = 0; idx < (int)blacklist.size(); idx++) {
// Set blValid true if any one source is valid
blValid = setBlacklistedSource(source, blacklist[idx]) || blValid;
config.blacklistedSvIds.push_back(source);
}
// Update configuration only if blValid is true
// i.e. only if atleast one source is valid for blacklisting
return (blValid && mGnss->updateConfiguration(config));
}
bool GnssConfiguration::setBlacklistedSource(
GnssSvIdSource& copyToSource,
const GnssConfiguration::BlacklistedSource& copyFromSource) {
bool retVal = true;
uint16_t svIdOffset = 0;
copyToSource.size = sizeof(GnssSvIdSource);
copyToSource.svId = copyFromSource.svid;
switch(copyFromSource.constellation) {
case GnssConstellationType::GPS:
copyToSource.constellation = GNSS_SV_TYPE_GPS;
LOC_LOGe("GPS SVs can't be blacklisted.");
retVal = false;
break;
case GnssConstellationType::SBAS:
copyToSource.constellation = GNSS_SV_TYPE_SBAS;
LOC_LOGe("SBAS SVs can't be blacklisted.");
retVal = false;
break;
case GnssConstellationType::GLONASS:
copyToSource.constellation = GNSS_SV_TYPE_GLONASS;
svIdOffset = GNSS_SV_CONFIG_GLO_INITIAL_SV_ID - 1;
break;
case GnssConstellationType::QZSS:
copyToSource.constellation = GNSS_SV_TYPE_QZSS;
svIdOffset = 0;
break;
case GnssConstellationType::BEIDOU:
copyToSource.constellation = GNSS_SV_TYPE_BEIDOU;
svIdOffset = GNSS_SV_CONFIG_BDS_INITIAL_SV_ID - 1;
break;
case GnssConstellationType::GALILEO:
copyToSource.constellation = GNSS_SV_TYPE_GALILEO;
svIdOffset = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID - 1;
break;
default:
copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
LOC_LOGe("Invalid constellation %d", copyFromSource.constellation);
retVal = false;
break;
}
if (copyToSource.svId > 0 && svIdOffset > 0) {
copyToSource.svId += svIdOffset;
}
return retVal;
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,78 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_1::IGnssConfiguration;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
/*
* Interface for passing GNSS configuration info from platform to HAL.
*/
struct Gnss;
struct GnssConfiguration : public IGnssConfiguration {
GnssConfiguration(Gnss* gnss);
~GnssConfiguration() = default;
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
* These declarations were generated from IGnssConfiguration.hal.
*/
Return<bool> setSuplVersion(uint32_t version) override;
Return<bool> setSuplMode(uint8_t mode) override;
Return<bool> setSuplEs(bool enabled) override;
Return<bool> setLppProfile(uint8_t lppProfile) override;
Return<bool> setGlonassPositioningProtocol(uint8_t protocol) override;
Return<bool> setEmergencySuplPdn(bool enable) override;
Return<bool> setGpsLock(uint8_t lock) override;
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Return<bool> setBlacklist(
const hidl_vec<GnssConfiguration::BlacklistedSource>& blacklist) override;
private:
Gnss* mGnss = nullptr;
bool setBlacklistedSource(
GnssSvIdSource& copyToSource,
const GnssConfiguration::BlacklistedSource& copyFromSource);
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H

View File

@@ -1,175 +0,0 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssDebugInterface"
#include <log/log.h>
#include <log_util.h>
#include "Gnss.h"
#include "GnssDebug.h"
#include "LocationUtil.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::hidl_vec;
#define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000)
#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000)
#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500)
#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180)
#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MIN (999) // 999 ns
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX (1.57783680E17) // 5 years in ns
#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
{
}
/*
* This methods requests position, time and satellite ephemeris debug information
* from the HAL.
*
* @return void
*/
Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
{
LOC_LOGD("%s]: ", __func__);
DebugData data = { };
if((nullptr == mGnss) || (nullptr == mGnss->getGnssInterface())){
LOC_LOGE("GnssDebug - Null GNSS interface");
_hidl_cb(data);
return Void();
}
// get debug report snapshot via hal interface
GnssDebugReport reports = { };
mGnss->getGnssInterface()->getDebugReport(reports);
// location block
if (reports.mLocation.mValid) {
data.position.valid = true;
data.position.latitudeDegrees = reports.mLocation.mLocation.latitude;
data.position.longitudeDegrees = reports.mLocation.mLocation.longitude;
data.position.altitudeMeters = reports.mLocation.mLocation.altitude;
data.position.speedMetersPerSec =
(double)(reports.mLocation.mLocation.speed);
data.position.bearingDegrees =
(double)(reports.mLocation.mLocation.bearing);
data.position.horizontalAccuracyMeters =
(double)(reports.mLocation.mLocation.accuracy);
data.position.verticalAccuracyMeters =
reports.mLocation.verticalAccuracyMeters;
data.position.speedAccuracyMetersPerSecond =
reports.mLocation.speedAccuracyMetersPerSecond;
data.position.bearingAccuracyDegrees =
reports.mLocation.bearingAccuracyDegrees;
timeval tv_now, tv_report;
tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
gettimeofday(&tv_now, NULL);
data.position.ageSeconds =
(tv_now.tv_sec - tv_report.tv_sec) +
(float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
}
else {
data.position.valid = false;
}
if (data.position.horizontalAccuracyMeters <= 0 ||
data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) {
data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS;
}
if (data.position.verticalAccuracyMeters <= 0 ||
data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) {
data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS;
}
if (data.position.speedAccuracyMetersPerSecond <= 0 ||
data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) {
data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC;
}
if (data.position.bearingAccuracyDegrees <= 0 ||
data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) {
data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG;
}
// time block
if (reports.mTime.mValid) {
data.time.timeEstimate = reports.mTime.timeEstimate;
data.time.timeUncertaintyNs = reports.mTime.timeUncertaintyNs;
data.time.frequencyUncertaintyNsPerSec =
reports.mTime.frequencyUncertaintyNsPerSec;
}
if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
}
if (data.time.timeUncertaintyNs <= 0) {
data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MIN;
} else if (data.time.timeUncertaintyNs > GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX) {
data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX;
}
if (data.time.frequencyUncertaintyNsPerSec <= 0 ||
data.time.frequencyUncertaintyNsPerSec > (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC) {
data.time.frequencyUncertaintyNsPerSec = (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC;
}
// satellite data block
SatelliteData s = { };
std::vector<SatelliteData> s_array = { };
for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
memset(&s, 0, sizeof(s));
s.svid = reports.mSatelliteInfo[i].svid;
convertGnssConstellationType(
reports.mSatelliteInfo[i].constellation, s.constellation);
convertGnssEphemerisType(
reports.mSatelliteInfo[i].mEphemerisType, s.ephemerisType);
convertGnssEphemerisSource(
reports.mSatelliteInfo[i].mEphemerisSource, s.ephemerisSource);
convertGnssEphemerisHealth(
reports.mSatelliteInfo[i].mEphemerisHealth, s.ephemerisHealth);
s.ephemerisAgeSeconds =
reports.mSatelliteInfo[i].ephemerisAgeSeconds;
s.serverPredictionIsAvailable =
reports.mSatelliteInfo[i].serverPredictionIsAvailable;
s.serverPredictionAgeSeconds =
reports.mSatelliteInfo[i].serverPredictionAgeSeconds;
s_array.push_back(s);
}
data.satelliteDataArray = s_array;
// callback HIDL with collected debug data
_hidl_cb(data);
return Void();
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,59 +0,0 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
#include <android/hardware/gnss/1.0/IGnssDebug.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssDebug;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
/* Interface for GNSS Debug support. */
struct Gnss;
struct GnssDebug : public IGnssDebug {
GnssDebug(Gnss* gnss);
~GnssDebug() {};
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
* These declarations were generated from IGnssDebug.hal.
*/
Return<void> getDebugData(getDebugData_cb _hidl_cb) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H

View File

@@ -1,141 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "GnssHal_GnssGeofencing"
#include <log_util.h>
#include <GeofenceAPIClient.h>
#include "GnssGeofencing.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
void GnssGeofencing::GnssGeofencingDeathRecipient::serviceDied(
uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnssGeofencing != nullptr) {
mGnssGeofencing->removeAllGeofences();
}
}
GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
mGnssGeofencingDeathRecipient = new GnssGeofencingDeathRecipient(this);
}
GnssGeofencing::~GnssGeofencing() {
if (mApi != nullptr) {
delete mApi;
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
Return<void> GnssGeofencing::setCallback(const sp<IGnssGeofenceCallback>& callback) {
if (mApi != nullptr) {
LOC_LOGd("mApi is NOT nullptr");
return Void();
}
mApi = new GeofenceAPIClient(callback);
if (mApi == nullptr) {
LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
}
if (mGnssGeofencingCbIface != nullptr) {
mGnssGeofencingCbIface->unlinkToDeath(mGnssGeofencingDeathRecipient);
}
mGnssGeofencingCbIface = callback;
if (mGnssGeofencingCbIface != nullptr) {
mGnssGeofencingCbIface->linkToDeath(mGnssGeofencingDeathRecipient, 0 /*cookie*/);
}
return Void();
}
Return<void> GnssGeofencing::addGeofence(
int32_t geofenceId,
double latitudeDegrees,
double longitudeDegrees,
double radiusMeters,
IGnssGeofenceCallback::GeofenceTransition lastTransition,
int32_t monitorTransitions,
uint32_t notificationResponsivenessMs,
uint32_t unknownTimerMs) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofenceAdd(
geofenceId,
latitudeDegrees,
longitudeDegrees,
radiusMeters,
static_cast<int32_t>(lastTransition),
monitorTransitions,
notificationResponsivenessMs,
unknownTimerMs);
}
return Void();
}
Return<void> GnssGeofencing::pauseGeofence(int32_t geofenceId) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofencePause(geofenceId);
}
return Void();
}
Return<void> GnssGeofencing::resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofenceResume(geofenceId, monitorTransitions);
}
return Void();
}
Return<void> GnssGeofencing::removeGeofence(int32_t geofenceId) {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
mApi->geofenceRemove(geofenceId);
}
return Void();
}
Return<void> GnssGeofencing::removeAllGeofences() {
if (mApi == nullptr) {
LOC_LOGD("%s]: mApi is nullptr, do nothing", __FUNCTION__);
} else {
mApi->geofenceRemoveAll();
}
return Void();
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,91 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
using ::android::hardware::gnss::V1_0::IGnssGeofencing;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
class GeofenceAPIClient;
struct GnssGeofencing : public IGnssGeofencing {
GnssGeofencing();
~GnssGeofencing();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
* These declarations were generated from IGnssGeofencing.hal.
*/
Return<void> setCallback(const sp<IGnssGeofenceCallback>& callback) override;
Return<void> addGeofence(int32_t geofenceId,
double latitudeDegrees,
double longitudeDegrees,
double radiusMeters,
IGnssGeofenceCallback::GeofenceTransition lastTransition,
int32_t monitorTransitions,
uint32_t notificationResponsivenessMs,
uint32_t unknownTimerMs) override;
Return<void> pauseGeofence(int32_t geofenceId) override;
Return<void> resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) override;
Return<void> removeGeofence(int32_t geofenceId) override;
private:
// This method is not part of the IGnss base class.
// It is called by GnssGeofencingDeathRecipient to remove all geofences added so far.
Return<void> removeAllGeofences();
private:
struct GnssGeofencingDeathRecipient : hidl_death_recipient {
GnssGeofencingDeathRecipient(sp<GnssGeofencing> gnssGeofencing) :
mGnssGeofencing(gnssGeofencing) {
}
~GnssGeofencingDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssGeofencing> mGnssGeofencing;
};
private:
sp<GnssGeofencingDeathRecipient> mGnssGeofencingDeathRecipient = nullptr;
sp<IGnssGeofenceCallback> mGnssGeofencingCbIface = nullptr;
GeofenceAPIClient* mApi = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H

View File

@@ -1,134 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssMeasurementInterface"
#include <log_util.h>
#include <MeasurementAPIClient.h>
#include "GnssMeasurement.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied(
uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
if (mGnssMeasurement != nullptr) {
mGnssMeasurement->close();
}
}
GnssMeasurement::GnssMeasurement() {
mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this);
mApi = new MeasurementAPIClient();
}
GnssMeasurement::~GnssMeasurement() {
if (mApi) {
delete mApi;
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) {
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mGnssMeasurementCbIface != nullptr) {
LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__);
return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT;
}
if (callback == nullptr) {
LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
return ret;
}
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return ret;
}
mGnssMeasurementCbIface = callback;
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback(callback);
}
Return<void> GnssMeasurement::close() {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return Void();
}
if (mGnssMeasurementCbIface != nullptr) {
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr;
}
if (mGnssMeasurementCbIface_1_1 != nullptr) {
mGnssMeasurementCbIface_1_1->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface_1_1 = nullptr;
}
mApi->measurementClose();
return Void();
}
// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
const sp<IGnssMeasurementCallback>& callback, bool enableFullTracking) {
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mGnssMeasurementCbIface_1_1 != nullptr) {
LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__);
return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT;
}
if (callback == nullptr) {
LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
return ret;
}
if (nullptr == mApi) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return ret;
}
mGnssMeasurementCbIface_1_1 = callback;
mGnssMeasurementCbIface_1_1->linkToDeath(mGnssMeasurementDeathRecipient, 0);
GnssPowerMode powerMode = enableFullTracking?
GNSS_POWER_MODE_M1 : GNSS_POWER_MODE_M2;
return mApi->measurementSetCallback_1_1(callback, powerMode);
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_1::IGnssMeasurement;
using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
class MeasurementAPIClient;
struct GnssMeasurement : public IGnssMeasurement {
GnssMeasurement();
~GnssMeasurement();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
* These declarations were generated from IGnssMeasurement.hal.
*/
Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) override;
Return<void> close() override;
// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
Return<GnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
const sp<IGnssMeasurementCallback>& callback,
bool enableFullTracking) override;
private:
struct GnssMeasurementDeathRecipient : hidl_death_recipient {
GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
mGnssMeasurement(gnssMeasurement) {
}
~GnssMeasurementDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssMeasurement> mGnssMeasurement;
};
private:
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
MeasurementAPIClient* mApi;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LocSvc_GnssNiInterface"
#include <log_util.h>
#include "Gnss.h"
#include "GnssNi.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
void GnssNi::GnssNiDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
// we do nothing here
// Gnss::GnssDeathRecipient will stop the session
}
GnssNi::GnssNi(Gnss* gnss) : mGnss(gnss) {
mGnssNiDeathRecipient = new GnssNiDeathRecipient(this);
}
// Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
Return<void> GnssNi::setCallback(const sp<IGnssNiCallback>& callback) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return Void();
}
mGnss->setGnssNiCb(callback);
if (mGnssNiCbIface != nullptr) {
mGnssNiCbIface->unlinkToDeath(mGnssNiDeathRecipient);
}
mGnssNiCbIface = callback;
if (mGnssNiCbIface != nullptr) {
mGnssNiCbIface->linkToDeath(mGnssNiDeathRecipient, 0 /*cookie*/);
}
return Void();
}
Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return Void();
}
GnssAPIClient* api = mGnss->getApi();
if (api == nullptr) {
LOC_LOGE("%s]: api is nullptr", __FUNCTION__);
return Void();
}
api->gnssNiRespond(notifId, userResponse);
return Void();
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,75 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
#include <android/hardware/gnss/1.0/IGnssNi.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssNi;
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
struct GnssNi : public IGnssNi {
GnssNi(Gnss* gnss);
~GnssNi() = default;
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
* These declarations were generated from IGnssNi.hal.
*/
Return<void> setCallback(const sp<IGnssNiCallback>& callback) override;
Return<void> respond(int32_t notifId,
IGnssNiCallback::GnssUserResponseType userResponse) override;
private:
struct GnssNiDeathRecipient : hidl_death_recipient {
GnssNiDeathRecipient(sp<GnssNi> gnssNi) : mGnssNi(gnssNi) {
}
~GnssNiDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssNi> mGnssNi;
};
private:
sp<GnssNiDeathRecipient> mGnssNiDeathRecipient = nullptr;
sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H

View File

@@ -1,4 +0,0 @@
service gnss_service /vendor/bin/hw/android.hardware.gnss@1.1-service-qti
class hal
user gps
group system gps radio vendor_qti_diag

View File

@@ -1,35 +0,0 @@
<!-- Copyright (c) 2019, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.gnss</name>
<transport>hwbinder</transport>
<fqname>@1.1::IGnss/default</fqname>
</hal>
</manifest>

View File

@@ -1,196 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_BatchingAPIClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "BatchingAPIClient.h"
#include "limits.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching;
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask);
BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback) :
LocationAPIClientBase(),
mGnssBatchingCbIface(callback),
mDefaultId(UINT_MAX),
mLocationCapabilitiesMask(0)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = nullptr;
if (mGnssBatchingCbIface != nullptr) {
locationCallbacks.batchingCb = [this](size_t count, Location* location,
BatchingOptions batchOptions) {
onBatchingCb(count, location, batchOptions);
};
}
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
BatchingAPIClient::~BatchingAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
int BatchingAPIClient::getBatchSize()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
return locAPIGetBatchSize();
}
int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
{
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
int retVal = -1;
LocationOptions options;
convertBatchOption(opts, options, mLocationCapabilitiesMask);
uint32_t mode = 0;
if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
mode = SESSION_MODE_ON_FULL;
}
if (locAPIStartSession(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
return retVal;
}
int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
{
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
int retVal = -1;
LocationOptions options;
convertBatchOption(opts, options, mLocationCapabilitiesMask);
uint32_t mode = 0;
if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
mode = SESSION_MODE_ON_FULL;
}
if (locAPIUpdateSessionOptions(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
return retVal;
}
int BatchingAPIClient::stopSession()
{
LOC_LOGD("%s]: ", __FUNCTION__);
int retVal = -1;
if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
return retVal;
}
void BatchingAPIClient::getBatchedLocation(int last_n_locations)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
locAPIGetBatchedLocations(mDefaultId, last_n_locations);
}
void BatchingAPIClient::flushBatchedLocations()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
}
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
}
void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
BatchingOptions /*batchOptions*/)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
if (mGnssBatchingCbIface != nullptr && count > 0) {
hidl_vec<GnssLocation> locationVec;
locationVec.resize(count);
for (size_t i = 0; i < count; i++) {
convertGnssLocation(location[i], locationVec[i]);
}
auto r = mGnssBatchingCbIface->gnssLocationBatchCb(locationVec);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationBatchCb description=%s",
__func__, r.description().c_str());
}
}
}
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask)
{
memset(&out, 0, sizeof(LocationOptions));
out.size = sizeof(LocationOptions);
out.minInterval = (uint32_t)(in.periodNanos / 1000000L);
out.minDistance = 0;
out.mode = GNSS_SUPL_MODE_STANDALONE;
if (mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
out.mode = GNSS_SUPL_MODE_MSA;
if (mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
out.mode = GNSS_SUPL_MODE_MSB;
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,74 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef BATCHING_API_CLINET_H
#define BATCHING_API_CLINET_H
#include <android/hardware/gnss/1.0/IGnssBatching.h>
#include <android/hardware/gnss/1.0/IGnssBatchingCallback.h>
#include <pthread.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
class BatchingAPIClient : public LocationAPIClientBase
{
public:
BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
~BatchingAPIClient();
int getBatchSize();
int startSession(const V1_0::IGnssBatching::Options& options);
int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
int stopSession();
void getBatchedLocation(int last_n_locations);
void flushBatchedLocations();
inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
// callbacks
void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
private:
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
uint32_t mDefaultId;
LocationCapabilitiesMask mLocationCapabilitiesMask;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // BATCHING_API_CLINET_H

View File

@@ -1,275 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_GeofenceApiClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "GeofenceAPIClient.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
LocationAPIClientBase(),
mGnssGeofencingCbIface(callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
if (mGnssGeofencingCbIface != nullptr) {
locationCallbacks.geofenceBreachCb =
[this](GeofenceBreachNotification geofenceBreachNotification) {
onGeofenceBreachCb(geofenceBreachNotification);
};
locationCallbacks.geofenceStatusCb =
[this](GeofenceStatusNotification geofenceStatusNotification) {
onGeofenceStatusCb(geofenceStatusNotification);
};
}
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
void GeofenceAPIClient::geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms)
{
LOC_LOGD("%s]: (%d %f %f %f %d %d %d %d)", __FUNCTION__,
geofence_id, latitude, longitude, radius_meters,
last_transition, monitor_transitions, notification_responsiveness_ms, unknown_timer_ms);
GeofenceOption options;
memset(&options, 0, sizeof(GeofenceOption));
options.size = sizeof(GeofenceOption);
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
options.breachTypeMask |= GEOFENCE_BREACH_ENTER_BIT;
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
options.breachTypeMask |= GEOFENCE_BREACH_EXIT_BIT;
options.responsiveness = notification_responsiveness_ms;
GeofenceInfo data;
data.size = sizeof(GeofenceInfo);
data.latitude = latitude;
data.longitude = longitude;
data.radius = radius_meters;
LocationError err = (LocationError)locAPIAddGeofences(1, &geofence_id, &options, &data);
if (LOCATION_ERROR_SUCCESS != err) {
onAddGeofencesCb(1, &err, &geofence_id);
}
}
void GeofenceAPIClient::geofencePause(uint32_t geofence_id)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
locAPIPauseGeofences(1, &geofence_id);
}
void GeofenceAPIClient::geofenceResume(uint32_t geofence_id, int32_t monitor_transitions)
{
LOC_LOGD("%s]: (%d %d)", __FUNCTION__, geofence_id, monitor_transitions);
GeofenceBreachTypeMask mask = 0;
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
mask |= GEOFENCE_BREACH_ENTER_BIT;
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
mask |= GEOFENCE_BREACH_EXIT_BIT;
locAPIResumeGeofences(1, &geofence_id, &mask);
}
void GeofenceAPIClient::geofenceRemove(uint32_t geofence_id)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
locAPIRemoveGeofences(1, &geofence_id);
}
void GeofenceAPIClient::geofenceRemoveAll()
{
LOC_LOGD("%s]", __FUNCTION__);
// TODO locAPIRemoveAllGeofences();
}
// callbacks
void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, geofenceBreachNotification.count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < geofenceBreachNotification.count; i++) {
GnssLocation gnssLocation;
convertGnssLocation(geofenceBreachNotification.location, gnssLocation);
IGnssGeofenceCallback::GeofenceTransition transition;
if (geofenceBreachNotification.type == GEOFENCE_BREACH_ENTER)
transition = IGnssGeofenceCallback::GeofenceTransition::ENTERED;
else if (geofenceBreachNotification.type == GEOFENCE_BREACH_EXIT)
transition = IGnssGeofenceCallback::GeofenceTransition::EXITED;
else {
// continue with other breach if transition is
// nether GPS_GEOFENCE_ENTERED nor GPS_GEOFENCE_EXITED
continue;
}
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
geofenceBreachNotification.ids[i], gnssLocation, transition,
static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, geofenceStatusNotification.available);
if (mGnssGeofencingCbIface != nullptr) {
IGnssGeofenceCallback::GeofenceAvailability status =
IGnssGeofenceCallback::GeofenceAvailability::UNAVAILABLE;
if (geofenceStatusNotification.available == GEOFENCE_STATUS_AVAILABILE_YES) {
status = IGnssGeofenceCallback::GeofenceAvailability::AVAILABLE;
}
GnssLocation gnssLocation;
memset(&gnssLocation, 0, sizeof(GnssLocation));
auto r = mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceStatusCb description=%s",
__func__, r.description().c_str());
}
}
}
void GeofenceAPIClient::onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_EXISTS;
auto r = mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceAddCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
auto r = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceRemoveCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
auto r = mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofencePauseCb description=%s",
__func__, r.description().c_str());
}
}
}
}
void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
{
LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
if (mGnssGeofencingCbIface != nullptr) {
for (size_t i = 0; i < count; i++) {
IGnssGeofenceCallback::GeofenceStatus status =
IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
if (errors[i] == LOCATION_ERROR_SUCCESS)
status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
auto r = mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceResumeCb description=%s",
__func__, r.description().c_str());
}
}
}
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,76 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GEOFENCE_API_CLINET_H
#define GEOFENCE_API_CLINET_H
#include <android/hardware/gnss/1.0/IGnssGeofenceCallback.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::sp;
class GeofenceAPIClient : public LocationAPIClientBase
{
public:
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
virtual ~GeofenceAPIClient() = default;
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
void geofencePause(uint32_t geofence_id);
void geofenceResume(uint32_t geofence_id, int32_t monitor_transitions);
void geofenceRemove(uint32_t geofence_id);
void geofenceRemoveAll();
// callbacks
void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification) final;
void onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification) final;
void onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
void onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
void onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
private:
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // GEOFENCE_API_CLINET_H

View File

@@ -1,566 +0,0 @@
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_GnssAPIClient"
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "GnssAPIClient.h"
#include <LocContext.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnss;
using ::android::hardware::gnss::V1_0::IGnssCallback;
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb) :
LocationAPIClientBase(),
mGnssCbIface(nullptr),
mGnssNiCbIface(nullptr),
mControlClient(new LocationAPIControlClient()),
mLocationCapabilitiesMask(0),
mLocationCapabilitiesCached(false)
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
// set default LocationOptions.
memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
mTrackingOptions.size = sizeof(TrackingOptions);
mTrackingOptions.minInterval = 1000;
mTrackingOptions.minDistance = 0;
mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
gnssUpdateCallbacks(gpsCb, niCb);
}
GnssAPIClient::~GnssAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
if (mControlClient) {
delete mControlClient;
mControlClient = nullptr;
}
}
// for GpsInterface
void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb)
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
mMutex.lock();
mGnssCbIface = gpsCb;
mGnssNiCbIface = niCb;
mMutex.unlock();
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
if (mGnssCbIface != nullptr) {
locationCallbacks.trackingCb = [this](Location location) {
onTrackingCb(location);
};
}
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
loc_core::ContextBase* context =
loc_core::LocContext::getLocContext(
NULL, NULL,
loc_core::LocContext::mLocationHalName, false);
if (mGnssNiCbIface != nullptr && !context->hasAgpsExtendedCapabilities()) {
LOC_LOGD("Registering NI CB");
locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotification) {
onGnssNiCb(id, gnssNiNotification);
};
}
locationCallbacks.gnssSvCb = nullptr;
if (mGnssCbIface != nullptr) {
locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
onGnssSvCb(gnssSvNotification);
};
}
locationCallbacks.gnssNmeaCb = nullptr;
if (mGnssCbIface != nullptr) {
locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
onGnssNmeaCb(gnssNmeaNotification);
};
}
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
bool GnssAPIClient::gnssStart()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
bool retVal = true;
locAPIStartTracking(mTrackingOptions);
return retVal;
}
bool GnssAPIClient::gnssStop()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
bool retVal = true;
locAPIStopTracking();
return retVal;
}
bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs,
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
{
LOC_LOGD("%s]: (%d %d %d %d %d %d %d)", __FUNCTION__,
(int)mode, recurrence, minIntervalMs, preferredAccuracyMeters,
preferredTimeMs, (int)powerMode, timeBetweenMeasurement);
bool retVal = true;
memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
mTrackingOptions.size = sizeof(TrackingOptions);
mTrackingOptions.minInterval = minIntervalMs;
if (IGnss::GnssPositionMode::MS_ASSISTED == mode ||
IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
// We set a very large interval to simulate SINGLE mode. Once we report a fix,
// the caller should take the responsibility to stop the session.
// For MSA, we always treat it as SINGLE mode.
mTrackingOptions.minInterval = SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC;
}
mTrackingOptions.minDistance = preferredAccuracyMeters;
if (mode == IGnss::GnssPositionMode::STANDALONE)
mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
else if (mode == IGnss::GnssPositionMode::MS_BASED)
mTrackingOptions.mode = GNSS_SUPL_MODE_MSB;
else if (mode == IGnss::GnssPositionMode::MS_ASSISTED)
mTrackingOptions.mode = GNSS_SUPL_MODE_MSA;
else {
LOC_LOGD("%s]: invalid GnssPositionMode: %d", __FUNCTION__, (int)mode);
retVal = false;
}
if (GNSS_POWER_MODE_INVALID != powerMode) {
mTrackingOptions.powerMode = powerMode;
mTrackingOptions.tbm = timeBetweenMeasurement;
}
locAPIUpdateTrackingOptions(mTrackingOptions);
return retVal;
}
// for GpsNiInterface
void GnssAPIClient::gnssNiRespond(int32_t notifId,
IGnssNiCallback::GnssUserResponseType userResponse)
{
LOC_LOGD("%s]: (%d %d)", __FUNCTION__, notifId, static_cast<int>(userResponse));
GnssNiResponse data;
switch (userResponse) {
case IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT:
data = GNSS_NI_RESPONSE_ACCEPT;
break;
case IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY:
data = GNSS_NI_RESPONSE_DENY;
break;
case IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP:
data = GNSS_NI_RESPONSE_NO_RESPONSE;
break;
default:
data = GNSS_NI_RESPONSE_IGNORE;
break;
}
locAPIGnssNiResponse(notifId, data);
}
// these apis using LocationAPIControlClient
void GnssAPIClient::gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags)
{
LOC_LOGD("%s]: (%02hx)", __FUNCTION__, aidingDataFlags);
if (mControlClient == nullptr) {
return;
}
GnssAidingData data;
memset(&data, 0, sizeof (GnssAidingData));
data.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_GPS_BIT |
GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT |
GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT |
GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT |
GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
data.posEngineMask = STANDARD_POSITIONING_ENGINE;
if (aidingDataFlags == IGnss::GnssAidingData::DELETE_ALL)
data.deleteAll = true;
else {
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_EPHEMERIS)
data.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_ALMANAC)
data.sv.svMask |= GNSS_AIDING_DATA_SV_ALMANAC_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_POSITION)
data.common.mask |= GNSS_AIDING_DATA_COMMON_POSITION_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_TIME)
data.common.mask |= GNSS_AIDING_DATA_COMMON_TIME_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_IONO)
data.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_UTC)
data.common.mask |= GNSS_AIDING_DATA_COMMON_UTC_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_HEALTH)
data.sv.svMask |= GNSS_AIDING_DATA_SV_HEALTH_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVDIR)
data.sv.svMask |= GNSS_AIDING_DATA_SV_DIRECTION_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVSTEER)
data.sv.svMask |= GNSS_AIDING_DATA_SV_STEER_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SADATA)
data.sv.svMask |= GNSS_AIDING_DATA_SV_SA_DATA_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_RTI)
data.common.mask |= GNSS_AIDING_DATA_COMMON_RTI_BIT;
if (aidingDataFlags & IGnss::GnssAidingData::DELETE_CELLDB_INFO)
data.common.mask |= GNSS_AIDING_DATA_COMMON_CELLDB_BIT;
}
mControlClient->locAPIGnssDeleteAidingData(data);
}
void GnssAPIClient::gnssEnable(LocationTechnologyType techType)
{
LOC_LOGD("%s]: (%0d)", __FUNCTION__, techType);
if (mControlClient == nullptr) {
return;
}
mControlClient->locAPIEnable(techType);
}
void GnssAPIClient::gnssDisable()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
if (mControlClient == nullptr) {
return;
}
mControlClient->locAPIDisable();
}
void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, gnssConfig.flags);
if (mControlClient == nullptr) {
return;
}
mControlClient->locAPIGnssUpdateConfig(gnssConfig);
}
void GnssAPIClient::requestCapabilities() {
// only send capablities if it's already cached, otherwise the first time LocationAPI
// is initialized, capabilities will be sent by LocationAPI
if (mLocationCapabilitiesCached) {
onCapabilitiesCb(mLocationCapabilitiesMask);
}
}
// callbacks
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
mLocationCapabilitiesCached = true;
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
uint32_t data = 0;
if ((capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT) ||
(capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT) ||
(capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT) ||
(capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT))
data |= IGnssCallback::Capabilities::SCHEDULING;
if (capabilitiesMask & LOCATION_CAPABILITIES_GEOFENCE_BIT)
data |= IGnssCallback::Capabilities::GEOFENCING;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT)
data |= IGnssCallback::Capabilities::MEASUREMENTS;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
data |= IGnssCallback::Capabilities::MSB;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
data |= IGnssCallback::Capabilities::MSA;
auto r = gnssCbIface->gnssSetCapabilitesCb(data);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
__func__, r.description().c_str());
}
}
if (gnssCbIface != nullptr) {
IGnssCallback::GnssSystemInfo gnssInfo;
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
gnssInfo.yearOfHw = 2018;
} else if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
gnssInfo.yearOfHw = 2017;
} else if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
gnssInfo.yearOfHw = 2016;
} else {
gnssInfo.yearOfHw = 2015;
}
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
auto r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onTrackingCb(Location location)
{
LOC_LOGD("%s]: (flags: %02x)", __FUNCTION__, location.flags);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
GnssLocation gnssLocation;
convertGnssLocation(location, gnssLocation);
auto r = gnssCbIface->gnssLocationCb(gnssLocation);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationCb description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification)
{
LOC_LOGD("%s]: (id: %d)", __FUNCTION__, id);
mMutex.lock();
auto gnssNiCbIface(mGnssNiCbIface);
mMutex.unlock();
if (gnssNiCbIface == nullptr) {
LOC_LOGE("%s]: mGnssNiCbIface is nullptr", __FUNCTION__);
return;
}
IGnssNiCallback::GnssNiNotification notificationGnss = {};
notificationGnss.notificationId = id;
if (gnssNiNotification.type == GNSS_NI_TYPE_VOICE)
notificationGnss.niType = IGnssNiCallback::GnssNiType::VOICE;
else if (gnssNiNotification.type == GNSS_NI_TYPE_SUPL)
notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_SUPL;
else if (gnssNiNotification.type == GNSS_NI_TYPE_CONTROL_PLANE)
notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_CTRL_PLANE;
else if (gnssNiNotification.type == GNSS_NI_TYPE_EMERGENCY_SUPL)
notificationGnss.niType = IGnssNiCallback::GnssNiType::EMERGENCY_SUPL;
if (gnssNiNotification.options & GNSS_NI_OPTIONS_NOTIFICATION_BIT)
notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_NOTIFY;
if (gnssNiNotification.options & GNSS_NI_OPTIONS_VERIFICATION_BIT)
notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_VERIFY;
if (gnssNiNotification.options & GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT)
notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::PRIVACY_OVERRIDE;
notificationGnss.timeoutSec = gnssNiNotification.timeout;
if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_ACCEPT)
notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT;
else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_DENY)
notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY;
else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_NO_RESPONSE ||
gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_IGNORE)
notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP;
notificationGnss.requestorId = gnssNiNotification.requestor;
notificationGnss.notificationMessage = gnssNiNotification.message;
if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_NONE)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
notificationGnss.requestorIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_NONE)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
gnssNiCbIface->niNotifyCb(notificationGnss);
}
void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssSvNotification.count);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
IGnssCallback::GnssSvStatus svStatus;
convertGnssSvStatus(gnssSvNotification, svStatus);
auto r = gnssCbIface->gnssSvStatusCb(svStatus);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSvStatusCb description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
{
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (gnssCbIface != nullptr) {
const std::string s(gnssNmeaNotification.nmea);
std::stringstream ss(s);
std::string each;
while(std::getline(ss, each, '\n')) {
each += '\n';
android::hardware::hidl_string nmeaString;
nmeaString.setToExternal(each.c_str(), each.length());
auto r = gnssCbIface->gnssNmeaCb(
static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__,
gnssNmeaNotification.nmea, gnssNmeaNotification.length,
r.description().c_str());
}
}
}
}
void GnssAPIClient::onStartTrackingCb(LocationError error)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb SESSION_BEGIN description=%s",
__func__, r.description().c_str());
}
}
}
void GnssAPIClient::onStopTrackingCb(LocationError error)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb ENGINE_OFF description=%s",
__func__, r.description().c_str());
}
}
}
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out)
{
memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
out.numSvs = in.count;
if (out.numSvs > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.",
__FUNCTION__, out.numSvs, V1_0::GnssMax::SVS_COUNT);
out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
info.svid = in.gnssSvs[i].svId;
convertGnssConstellationType(in.gnssSvs[i].type, info.constellation);
info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
info.elevationDegrees = in.gnssSvs[i].elevation;
info.azimuthDegrees = in.gnssSvs[i].azimuth;
info.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
info.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
}
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,109 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GNSS_API_CLINET_H
#define GNSS_API_CLINET_H
#include <mutex>
#include <android/hardware/gnss/1.1/IGnss.h>
#include <android/hardware/gnss/1.1/IGnssCallback.h>
#include <android/hardware/gnss/1.0/IGnssNiCallback.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::sp;
class GnssAPIClient : public LocationAPIClientBase
{
public:
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<V1_0::IGnssNiCallback>& niCb);
virtual ~GnssAPIClient();
GnssAPIClient(const GnssAPIClient&) = delete;
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
// for GpsInterface
void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<V1_0::IGnssNiCallback>& niCb);
bool gnssStart();
bool gnssStop();
bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs,
GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
uint32_t timeBetweenMeasurement = 0);
// for GpsNiInterface
void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
// these apis using LocationAPIControlClient
void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
void gnssEnable(LocationTechnologyType techType);
void gnssDisable();
void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
inline LocationCapabilitiesMask gnssGetCapabilities() const {
return mLocationCapabilitiesMask;
}
void requestCapabilities();
// callbacks we are interested in
void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
void onTrackingCb(Location location) final;
void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification) final;
void onGnssSvCb(GnssSvNotification gnssSvNotification) final;
void onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) final;
void onStartTrackingCb(LocationError error) final;
void onStopTrackingCb(LocationError error) final;
private:
sp<V1_0::IGnssCallback> mGnssCbIface;
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
std::mutex mMutex;
LocationAPIControlClient* mControlClient;
LocationCapabilitiesMask mLocationCapabilitiesMask;
bool mLocationCapabilitiesCached;
TrackingOptions mTrackingOptions;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // GNSS_API_CLINET_H

View File

@@ -1,206 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <LocationUtil.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::GnssLocation;
using ::android::hardware::gnss::V1_0::GnssConstellationType;
using ::android::hardware::gnss::V1_0::GnssLocationFlags;
void convertGnssLocation(Location& in, GnssLocation& out)
{
memset(&out, 0, sizeof(GnssLocation));
if (in.flags & LOCATION_HAS_LAT_LONG_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
out.latitudeDegrees = in.latitude;
out.longitudeDegrees = in.longitude;
}
if (in.flags & LOCATION_HAS_ALTITUDE_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
out.altitudeMeters = in.altitude;
}
if (in.flags & LOCATION_HAS_SPEED_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
out.speedMetersPerSec = in.speed;
}
if (in.flags & LOCATION_HAS_BEARING_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
out.bearingDegrees = in.bearing;
}
if (in.flags & LOCATION_HAS_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
out.horizontalAccuracyMeters = in.accuracy;
}
if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
out.verticalAccuracyMeters = in.verticalAccuracy;
}
if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
}
if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT) {
out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
out.bearingAccuracyDegrees = in.bearingAccuracy;
}
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
}
void convertGnssLocation(const GnssLocation& in, Location& out)
{
memset(&out, 0, sizeof(out));
if (in.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG) {
out.flags |= LOCATION_HAS_LAT_LONG_BIT;
out.latitude = in.latitudeDegrees;
out.longitude = in.longitudeDegrees;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE) {
out.flags |= LOCATION_HAS_ALTITUDE_BIT;
out.altitude = in.altitudeMeters;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED) {
out.flags |= LOCATION_HAS_SPEED_BIT;
out.speed = in.speedMetersPerSec;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
out.flags |= LOCATION_HAS_BEARING_BIT;
out.bearing = in.bearingDegrees;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY) {
out.flags |= LOCATION_HAS_ACCURACY_BIT;
out.accuracy = in.horizontalAccuracyMeters;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
out.verticalAccuracy = in.verticalAccuracyMeters;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
out.speedAccuracy = in.speedAccuracyMetersPerSecond;
}
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
out.bearingAccuracy = in.bearingAccuracyDegrees;
}
out.timestamp = static_cast<uint64_t>(in.timestamp);
}
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
{
switch(in) {
case GNSS_SV_TYPE_GPS:
out = GnssConstellationType::GPS;
break;
case GNSS_SV_TYPE_SBAS:
out = GnssConstellationType::SBAS;
break;
case GNSS_SV_TYPE_GLONASS:
out = GnssConstellationType::GLONASS;
break;
case GNSS_SV_TYPE_QZSS:
out = GnssConstellationType::QZSS;
break;
case GNSS_SV_TYPE_BEIDOU:
out = GnssConstellationType::BEIDOU;
break;
case GNSS_SV_TYPE_GALILEO:
out = GnssConstellationType::GALILEO;
break;
case GNSS_SV_TYPE_UNKNOWN:
default:
out = GnssConstellationType::UNKNOWN;
break;
}
}
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
{
switch(in) {
case GNSS_EPH_TYPE_EPHEMERIS:
out = GnssDebug::SatelliteEphemerisType::EPHEMERIS;
break;
case GNSS_EPH_TYPE_ALMANAC:
out = GnssDebug::SatelliteEphemerisType::ALMANAC_ONLY;
break;
case GNSS_EPH_TYPE_UNKNOWN:
default:
out = GnssDebug::SatelliteEphemerisType::NOT_AVAILABLE;
break;
}
}
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out)
{
switch(in) {
case GNSS_EPH_SOURCE_DEMODULATED:
out = GnssDebug::SatelliteEphemerisSource::DEMODULATED;
break;
case GNSS_EPH_SOURCE_SUPL_PROVIDED:
out = GnssDebug::SatelliteEphemerisSource::SUPL_PROVIDED;
break;
case GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED:
out = GnssDebug::SatelliteEphemerisSource::OTHER_SERVER_PROVIDED;
break;
case GNSS_EPH_SOURCE_LOCAL:
case GNSS_EPH_SOURCE_UNKNOWN:
default:
out = GnssDebug::SatelliteEphemerisSource::OTHER;
break;
}
}
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out)
{
switch(in) {
case GNSS_EPH_HEALTH_GOOD:
out = GnssDebug::SatelliteEphemerisHealth::GOOD;
break;
case GNSS_EPH_HEALTH_BAD:
out = GnssDebug::SatelliteEphemerisHealth::BAD;
break;
case GNSS_EPH_HEALTH_UNKNOWN:
default:
out = GnssDebug::SatelliteEphemerisHealth::UNKNOWN;
break;
}
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,55 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef LOCATION_UTIL_H
#define LOCATION_UTIL_H
#include <android/hardware/gnss/1.0/types.h>
#include <LocationAPI.h>
#include <GnssDebug.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // LOCATION_UTIL_H

View File

@@ -1,332 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_MeasurementAPIClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "MeasurementAPIClient.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out);
static void convertGnssData_1_1(GnssMeasurementsNotification& in,
IGnssMeasurementCallback::GnssData& out);
static void convertGnssMeasurement(GnssMeasurementsData& in,
V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
MeasurementAPIClient::MeasurementAPIClient() :
mGnssMeasurementCbIface(nullptr),
mGnssMeasurementCbIface_1_1(nullptr),
mTracking(false)
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
MeasurementAPIClient::~MeasurementAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
// for GpsInterface
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
mMutex.lock();
mGnssMeasurementCbIface = callback;
mMutex.unlock();
return startTracking();
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback_1_1(
const sp<IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
{
LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
__FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
mMutex.lock();
mGnssMeasurementCbIface_1_1 = callback;
mMutex.unlock();
return startTracking(powerMode, timeBetweenMeasurement);
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::startTracking(
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
{
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
if (mGnssMeasurementCbIface_1_1 != nullptr || mGnssMeasurementCbIface != nullptr) {
locationCallbacks.gnssMeasurementsCb =
[this](GnssMeasurementsNotification gnssMeasurementsNotification) {
onGnssMeasurementsCb(gnssMeasurementsNotification);
};
}
locAPISetCallbacks(locationCallbacks);
TrackingOptions options = {};
memset(&options, 0, sizeof(TrackingOptions));
options.size = sizeof(TrackingOptions);
options.minInterval = 1000;
options.mode = GNSS_SUPL_MODE_STANDALONE;
if (GNSS_POWER_MODE_INVALID != powerMode) {
options.powerMode = powerMode;
options.tbm = timeBetweenMeasurement;
}
mTracking = true;
LOC_LOGD("%s]: start tracking session", __FUNCTION__);
locAPIStartTracking(options);
return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
}
// for GpsMeasurementInterface
void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
mTracking = false;
locAPIStopTracking();
}
// callbacks
void MeasurementAPIClient::onGnssMeasurementsCb(
GnssMeasurementsNotification gnssMeasurementsNotification)
{
LOC_LOGD("%s]: (count: %zu active: %d)",
__FUNCTION__, gnssMeasurementsNotification.count, mTracking);
if (mTracking) {
mMutex.lock();
sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
sp<IGnssMeasurementCallback> gnssMeasurementCbIface_1_1 = nullptr;
if (mGnssMeasurementCbIface_1_1 != nullptr) {
gnssMeasurementCbIface_1_1 = mGnssMeasurementCbIface_1_1;
} else if (mGnssMeasurementCbIface != nullptr) {
gnssMeasurementCbIface = mGnssMeasurementCbIface;
}
mMutex.unlock();
if (gnssMeasurementCbIface_1_1 != nullptr) {
IGnssMeasurementCallback::GnssData gnssData;
convertGnssData_1_1(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface_1_1->gnssMeasurementCb(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssMeasurementCb description=%s",
__func__, r.description().c_str());
}
} else if (gnssMeasurementCbIface != nullptr) {
V1_0::IGnssMeasurementCallback::GnssData gnssData;
convertGnssData(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
__func__, r.description().c_str());
}
}
}
}
static void convertGnssMeasurement(GnssMeasurementsData& in,
V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
{
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_FREQUENCY;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_CYCLES;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
out.svid = in.svId;
convertGnssConstellationType(in.svType, out.constellation);
out.timeOffsetNs = in.timeOffsetNs;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
out.receivedSvTimeInNs = in.receivedSvTimeNs;
out.receivedSvTimeUncertaintyInNs = in.receivedSvTimeUncertaintyNs;
out.cN0DbHz = in.carrierToNoiseDbHz;
out.pseudorangeRateMps = in.pseudorangeRateMps;
out.pseudorangeRateUncertaintyMps = in.pseudorangeRateUncertaintyMps;
if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
out.accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
out.accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
out.accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
out.accumulatedDeltaRangeM = in.adrMeters;
out.accumulatedDeltaRangeUncertaintyM = in.adrUncertaintyMeters;
out.carrierFrequencyHz = in.carrierFrequencyHz;
out.carrierCycles = in.carrierCycles;
out.carrierPhase = in.carrierPhase;
out.carrierPhaseUncertainty = in.carrierPhaseUncertainty;
uint8_t indicator =
static_cast<uint8_t>(IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN);
if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT)
indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_PRESENT;
if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT)
indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATIOR_NOT_PRESENT;
out.multipathIndicator =
static_cast<IGnssMeasurementCallback::GnssMultipathIndicator>(indicator);
out.snrDb = in.signalToNoiseRatioDb;
out.agcLevelDb = in.agcLevelDb;
}
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out)
{
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssClock));
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_LEAP_SECOND;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_TIME_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_FULL_BIAS;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT;
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT)
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT_UNCERTAINTY;
out.leapSecond = in.leapSecond;
out.timeNs = in.timeNs;
out.timeUncertaintyNs = in.timeUncertaintyNs;
out.fullBiasNs = in.fullBiasNs;
out.biasNs = in.biasNs;
out.biasUncertaintyNs = in.biasUncertaintyNs;
out.driftNsps = in.driftNsps;
out.driftUncertaintyNsps = in.driftUncertaintyNsps;
out.hwClockDiscontinuityCount = in.hwClockDiscontinuityCount;
}
static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out)
{
out.measurementCount = in.count;
if (out.measurementCount > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.",
__FUNCTION__, out.measurementCount, V1_0::GnssMax::SVS_COUNT);
out.measurementCount = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.measurementCount; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i]);
}
convertGnssClock(in.clock, out.clock);
}
static void convertGnssData_1_1(GnssMeasurementsNotification& in,
IGnssMeasurementCallback::GnssData& out)
{
out.measurements.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_0);
if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
out.measurements[i].accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
out.measurements[i].accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
out.measurements[i].accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT)
out.measurements[i].accumulatedDeltaRangeState |=
IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_HALF_CYCLE_RESOLVED;
}
convertGnssClock(in.clock, out.clock);
}
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -1,84 +0,0 @@
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef MEASUREMENT_API_CLINET_H
#define MEASUREMENT_API_CLINET_H
#include <mutex>
#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
#include <android/hardware/gnss/1.1/IGnssMeasurementCallback.h>
#include <LocationAPIClientBase.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::sp;
class MeasurementAPIClient : public LocationAPIClientBase
{
public:
MeasurementAPIClient();
virtual ~MeasurementAPIClient();
MeasurementAPIClient(const MeasurementAPIClient&) = delete;
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
// for GpsMeasurementInterface
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback);
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_1_1(
const sp<IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
void measurementClose();
Return<IGnssMeasurement::GnssMeasurementStatus> startTracking(
GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
// callbacks we are interested in
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private:
std::mutex mMutex;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
bool mTracking;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // MEASUREMENT_API_CLINET_H

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.gnss@1.1-service-qti"
#include <android/hardware/gnss/1.1/IGnss.h>
#include <hidl/LegacySupport.h>
#include "loc_cfg.h"
#include "loc_misc_utils.h"
extern "C" {
#include "vndfwk-detect.h"
}
#ifdef ARCH_ARM_32
#define DEFAULT_HW_BINDER_MEM_SIZE 65536
#endif
using android::hardware::gnss::V1_1::IGnss;
using android::hardware::configureRpcThreadpool;
using android::hardware::registerPassthroughServiceImplementation;
using android::hardware::joinRpcThreadpool;
using android::status_t;
using android::OK;
typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []);
int main() {
ALOGI("%s", __FUNCTION__);
int vendorInfo = getVendorEnhancedInfo();
bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo );
setVendorEnhanced(vendorEnhanced);
#ifdef ARCH_ARM_32
android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
#endif
configureRpcThreadpool(1, true);
status_t status;
status = registerPassthroughServiceImplementation<IGnss>();
if (status == OK) {
if (vendorEnhanced) {
#ifdef LOC_HIDL_VERSION
#define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so"
void* libHandle = NULL;
vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*)
dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main");
if (NULL != vendorEnhancedMainMethod) {
(*vendorEnhancedMainMethod)(0, NULL);
}
#else
ALOGE("LOC_HIDL_VERSION not defined.");
#endif
}
joinRpcThreadpool();
} else {
ALOGE("Error while registering IGnss 1.1 service: %d", status);
}
return 0;
}

View File

@@ -0,0 +1,96 @@
cc_library_shared {
name: "android.hardware.gnss@2.0-impl-qti",
vendor: true,
relative_install_path: "hw",
srcs: [
"AGnss.cpp",
"Gnss.cpp",
"AGnssRil.cpp",
"GnssMeasurement.cpp",
"GnssConfiguration.cpp",
"GnssBatching.cpp",
"GnssGeofencing.cpp",
"GnssNi.cpp",
"GnssDebug.cpp",
"measurement_corrections/1.0/MeasurementCorrections.cpp",
"visibility_control/1.0/GnssVisibilityControl.cpp",
] + [
"location_api/GnssAPIClient.cpp",
"location_api/MeasurementAPIClient.cpp",
"location_api/GeofenceAPIClient.cpp",
"location_api/BatchingAPIClient.cpp",
"location_api/LocationUtil.cpp",
],
local_include_dirs: [
"location_api",
"measurement_corrections/1.0",
"visibility_control/1.0",
"location_api",
],
header_libs: [
"libgps.utils_headers",
"libloc_core_headers",
"libloc_pla_headers",
"liblocation_api_headers",
"liblocbatterylistener_headers",
],
shared_libs: [
"liblog",
"libhidlbase",
"libcutils",
"libutils",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
"android.hardware.gnss.measurement_corrections@1.0",
"android.hardware.gnss.visibility_control@1.0",
"android.hardware.health@1.0",
"android.hardware.health@2.0",
"android.hardware.power@1.2",
"libbase",
] + [
"libloc_core",
"libgps.utils",
"libdl",
"liblocation_api",
],
cflags: GNSS_CFLAGS,
static_libs: ["liblocbatterylistener"] + ["libhealthhalutils"],
}
cc_binary {
name: "android.hardware.gnss@2.0-service-qti",
vintf_fragments: ["android.hardware.gnss@2.0-service-qti.xml"],
vendor: true,
relative_install_path: "hw",
init_rc: ["android.hardware.gnss@2.0-service-qti.rc"],
srcs: ["service.cpp"],
header_libs: [
"libgps.utils_headers",
"libloc_core_headers",
"libloc_pla_headers",
"liblocation_api_headers",
],
shared_libs: [
"liblog",
"libcutils",
"libdl",
"libbase",
"libutils",
"libgps.utils",
"libqti_vndfwk_detect",
] + [
"libhidlbase",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
],
cflags: GNSS_CFLAGS + ["-DLOC_HIDL_VERSION=\"3.0\""],
}

View File

@@ -1,116 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.0-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
AGnss.cpp \
Gnss.cpp \
AGnssRil.cpp \
GnssMeasurement.cpp \
GnssConfiguration.cpp \
GnssBatching.cpp \
GnssGeofencing.cpp \
GnssNi.cpp \
GnssDebug.cpp \
../measurement_corrections/1.0/MeasurementCorrections.cpp \
../visibility_control/1.0/GnssVisibilityControl.cpp
LOCAL_SRC_FILES += \
location_api/GnssAPIClient.cpp \
location_api/MeasurementAPIClient.cpp \
location_api/GeofenceAPIClient.cpp \
location_api/BatchingAPIClient.cpp \
location_api/LocationUtil.cpp \
ifeq ($(GNSS_HIDL_LEGACY_MEASURMENTS),true)
LOCAL_CFLAGS += \
-DGNSS_HIDL_LEGACY_MEASURMENTS
endif
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/location_api \
$(LOCAL_PATH)/../measurement_corrections/1.0 \
$(LOCAL_PATH)/../visibility_control/1.0
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers \
liblocbatterylistener_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libhidlbase \
libhidltransport \
libhwbinder \
libcutils \
libutils \
android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
android.hardware.gnss@2.0 \
android.hardware.gnss.measurement_corrections@1.0 \
android.hardware.gnss.visibility_control@1.0 \
android.hardware.health@1.0 \
android.hardware.health@2.0 \
android.hardware.power@1.2 \
libbase
LOCAL_SHARED_LIBRARIES += \
libloc_core \
libgps.utils \
libdl \
liblocation_api \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
LOCAL_STATIC_LIBRARIES := liblocbatterylistener
LOCAL_STATIC_LIBRARIES += libhealthhalutils
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.0-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@2.0-service-qti.xml
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.gnss@2.0-service-qti.rc
LOCAL_SRC_FILES := \
service.cpp \
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libdl \
libbase \
libutils \
libgps.utils \
libqti_vndfwk_detect \
LOCAL_SHARED_LIBRARIES += \
libhwbinder \
libhidlbase \
libhidltransport \
android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
android.hardware.gnss@2.0 \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1 @@
../measurement_corrections

View File

@@ -0,0 +1 @@
../visibility_control/

View File

@@ -1,15 +0,0 @@
LOCAL_PATH := $(call my-dir)
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
include $(CLEAR_VARS)
DIR_LIST := $(LOCAL_PATH)
include $(DIR_LIST)/utils/Android.mk
ifeq ($(GNSS_HIDL_VERSION),2.0)
include $(DIR_LIST)/2.0/Android.mk
else
ifeq ($(GNSS_HIDL_VERSION),1.1)
include $(DIR_LIST)/1.1/Android.mk
else
include $(DIR_LIST)/1.0/Android.mk
endif #GNSS HIDL 1.1
endif #GNSS HIDL 2.0
endif #BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE

View File

@@ -0,0 +1,34 @@
cc_library_static {
name: "liblocbatterylistener",
vendor: true,
cflags: GNSS_CFLAGS + ["-DBATTERY_LISTENER_ENABLED"],
local_include_dirs: ["."],
srcs: ["battery_listener.cpp"],
shared_libs: [
"liblog",
"libhidlbase",
"libcutils",
"libutils",
"android.hardware.health@1.0",
"android.hardware.health@2.0",
"android.hardware.power@1.2",
"libbase",
],
static_libs: ["libhealthhalutils"],
header_libs: [
"libloc_pla_headers",
],
}
cc_library_headers {
name: "liblocbatterylistener_headers",
vendor: true,
export_include_dirs: ["."],
}

View File

@@ -1,40 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := liblocbatterylistener
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += $(GNSS_CFLAGS)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH) \
LOCAL_SRC_FILES:= \
battery_listener.cpp
LOCAL_SHARED_LIBRARIES := \
liblog \
libhidlbase \
libhidltransport \
libhwbinder \
libcutils \
libutils \
android.hardware.health@1.0 \
android.hardware.health@2.0 \
android.hardware.power@1.2 \
libbase
LOCAL_STATIC_LIBRARIES := libhealthhalutils
LOCAL_CFLAGS += -DBATTERY_LISTENER_ENABLED
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := liblocbatterylistener_headers
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
include $(BUILD_HEADER_LIBRARY)

29
gps/batching/Android.bp Normal file
View File

@@ -0,0 +1,29 @@
cc_library_shared {
name: "libbatching",
vendor: true,
shared_libs: [
"libutils",
"libcutils",
"liblog",
"libloc_core",
"libgps.utils",
"libdl",
],
srcs: [
"location_batching.cpp",
"BatchingAdapter.cpp",
],
header_libs: [
"libgps.utils_headers",
"libloc_core_headers",
"libloc_pla_headers",
"liblocation_api_headers",
],
cflags: GNSS_CFLAGS,
}

View File

@@ -1,39 +0,0 @@
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
ifneq ($(BUILD_TINY_ANDROID),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libbatching
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
liblog \
libloc_core \
libgps.utils \
libdl
LOCAL_SRC_FILES += \
location_batching.cpp \
BatchingAdapter.cpp
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers
LOCAL_PRELINK_MODULE := false
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_SHARED_LIBRARY)
endif # not BUILD_TINY_ANDROID
endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE

View File

@@ -1,59 +0,0 @@
GNSS_CFLAGS := \
-Werror \
-Wno-undefined-bool-conversion
# GPS-HIDL
GNSS_HIDL_1_0_TARGET_LIST := msm8960
GNSS_HIDL_1_0_TARGET_LIST += msm8974
GNSS_HIDL_1_0_TARGET_LIST += msm8226
GNSS_HIDL_1_0_TARGET_LIST += msm8610
GNSS_HIDL_1_0_TARGET_LIST += apq8084
GNSS_HIDL_1_0_TARGET_LIST += msm8916
GNSS_HIDL_1_0_TARGET_LIST += msm8994
GNSS_HIDL_1_0_TARGET_LIST += msm8909
GNSS_HIDL_1_0_TARGET_LIST += msm8952
GNSS_HIDL_1_0_TARGET_LIST += msm8992
GNSS_HIDL_1_0_TARGET_LIST += msm8996
GNSS_HIDL_2_0_TARGET_LIST := msm8937
GNSS_HIDL_2_0_TARGET_LIST += msm8953
GNSS_HIDL_2_0_TARGET_LIST += msm8998
GNSS_HIDL_2_0_TARGET_LIST += apq8098_latv
GNSS_HIDL_2_0_TARGET_LIST += sdm710
GNSS_HIDL_2_0_TARGET_LIST += qcs605
GNSS_HIDL_2_0_TARGET_LIST += sdm845
GNSS_HIDL_2_0_TARGET_LIST += sdm660
GNSS_HIDL_2_0_TARGET_LIST += msmnile
GNSS_HIDL_2_0_TARGET_LIST += sdmshrike
GNSS_HIDL_2_0_TARGET_LIST += $(MSMSTEPPE)
GNSS_HIDL_2_0_TARGET_LIST += $(TRINKET)
GNSS_HIDL_2_0_TARGET_LIST += kona
GNSS_HIDL_2_0_TARGET_LIST += atoll
GNSS_HIDL_2_0_TARGET_LIST += lito
GNSS_HIDL_2_0_TARGET_LIST += bengal
ifneq (,$(filter $(GNSS_HIDL_2_0_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
GNSS_HIDL_VERSION = 2.0
endif
ifneq (,$(filter $(GNSS_HIDL_1_0_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
GNSS_HIDL_VERSION = 1.0
endif
ifneq (,$(filter $(GNSS_HIDL_1_1_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
GNSS_HIDL_VERSION = 1.1
endif
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST := msm8937
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8953
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8998
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += apq8098_latv
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm710
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += qcs605
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm845
GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm660
ifneq (,$(filter $(GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
GNSS_HIDL_LEGACY_MEASURMENTS = true
endif
# Activate the following two lines for regression testing
#GNSS_SANITIZE := address cfi alignment bounds null unreachable integer
#GNSS_SANITIZE_DIAG := address cfi alignment bounds null unreachable integer

54
gps/core/Android.bp Normal file
View File

@@ -0,0 +1,54 @@
cc_library_shared {
name: "libloc_core",
vendor: true,
shared_libs: [
"liblog",
"libutils",
"libcutils",
"libgps.utils",
"libdl",
"liblog",
],
srcs: [
"LocApiBase.cpp",
"LocAdapterBase.cpp",
"ContextBase.cpp",
"LocContext.cpp",
"loc_core_log.cpp",
"data-items/DataItemsFactoryProxy.cpp",
"SystemStatusOsObserver.cpp",
"SystemStatus.cpp",
],
cflags: [
"-fno-short-enums",
"-D_ANDROID_",
] + GNSS_CFLAGS,
local_include_dirs: [
"data-items",
"observer",
],
header_libs: [
"libutils_headers",
"libgps.utils_headers",
"libloc_pla_headers",
"liblocation_api_headers",
],
}
cc_library_headers {
name: "libloc_core_headers",
vendor: true,
export_include_dirs: ["."] + [
"data-items",
"observer",
],
}

View File

@@ -1,62 +0,0 @@
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
ifneq ($(BUILD_TINY_ANDROID),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libloc_core
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
liblog \
libutils \
libcutils \
libgps.utils \
libdl \
liblog
LOCAL_SRC_FILES += \
LocApiBase.cpp \
LocAdapterBase.cpp \
ContextBase.cpp \
LocContext.cpp \
loc_core_log.cpp \
data-items/DataItemsFactoryProxy.cpp \
SystemStatusOsObserver.cpp \
SystemStatus.cpp
LOCAL_CFLAGS += \
-fno-short-enums \
-D_ANDROID_
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/data-items \
$(LOCAL_PATH)/data-items/common \
$(LOCAL_PATH)/observer \
LOCAL_HEADER_LIBRARIES := \
libutils_headers \
libgps.utils_headers \
libloc_pla_headers \
liblocation_api_headers
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libloc_core_headers
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/data-items \
$(LOCAL_PATH)/data-items/common \
$(LOCAL_PATH)/observer
include $(BUILD_HEADER_LIBRARY)
endif # not BUILD_TINY_ANDROID
endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE

View File

@@ -66,7 +66,6 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
{"ACCURACY_THRES", &mGps_conf.ACCURACY_THRES, NULL, 'n'},
{"NMEA_PROVIDER", &mGps_conf.NMEA_PROVIDER, NULL, 'n'},
{"CAPABILITIES", &mGps_conf.CAPABILITIES, NULL, 'n'},
{"XTRA_VERSION_CHECK", &mGps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
{"XTRA_SERVER_1", &mGps_conf.XTRA_SERVER_1, NULL, 's'},
{"XTRA_SERVER_2", &mGps_conf.XTRA_SERVER_2, NULL, 's'},
{"XTRA_SERVER_3", &mGps_conf.XTRA_SERVER_3, NULL, 's'},
@@ -134,8 +133,6 @@ void ContextBase::readConfig()
mGps_conf.LPP_PROFILE = 0;
/*By default no positioning protocol is selected on A-GLONASS system*/
mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
/*XTRA version check is disabled by default*/
mGps_conf.XTRA_VERSION_CHECK=0;
/*Use emergency PDN by default*/
mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
/* By default no LPPe CP technology is enabled*/

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -49,7 +49,6 @@ typedef struct loc_gps_cfg_s
uint32_t SUPL_ES;
uint32_t CAPABILITIES;
uint32_t LPP_PROFILE;
uint32_t XTRA_VERSION_CHECK;
char XTRA_SERVER_1[LOC_MAX_PARAM_STRING];
char XTRA_SERVER_2[LOC_MAX_PARAM_STRING];
char XTRA_SERVER_3[LOC_MAX_PARAM_STRING];

View File

@@ -59,13 +59,6 @@ int decodeAddress(char *addr_string, int string_size,
#define TO_1ST_HANDLING_ADAPTER(adapters, call) \
for (int i = 0; i <MAX_ADAPTERS && NULL != (adapters)[i] && !(call); i++);
enum xtra_version_check {
DISABLED,
AUTO,
XTRA2,
XTRA3
};
class LocAdapterBase;
struct LocSsrMsg;
struct LocOpenMsg;

Some files were not shown because too many files have changed in this diff Show More