278 Commits
vic ... udc

Author SHA1 Message Date
Prathamk07
bba833cf13 dump 2024-12-29 04:29:12 +01:00
Prathamk07
87cd8a8b5b veux: Add missing Camera Blob resulting in Broken Camera API
ref : 43fcf674a4/common.mk (L130)
Signed-off-by: Prathamk07 <prathamkalra.dev@gmail.com>
2024-12-26 12:41:40 +01:00
Prathamk07
93ecc8b248 veux: Welcome to EvolutionX 2024-12-26 05:06:02 +05:30
LuK1337
b83aa23489 veux: audio: Disable ULL mode
* Ultra low latency playback is currently broken. Crackling audio
   can be well noticed while playing WhatsApp audio messages or even
   during some games.

 * This patch routes all audio that normally used audio-ull-playback
   paths to low-latency-playback paths instead, thus meaning we're
   switching from ULL to LL mode.

Change-Id: I7d672f1ff10b984c8096c9c4ca83475e730fd16f
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:58:55 +05:30
kleidione Freitas
97071f51e6 veux: parts: Drop doze settings
Signed-off-by: kleidione <kleidione@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:58:55 +05:30
Alexander Winkowski
269181ab67 veux: Include MiuiCamera
Change-Id: Ic043018f738c92212564ae499e05e34f6b3e6d11
Signed-off-by: MrTopia <redkarmakar@gmail.com>
2024-12-26 04:58:55 +05:30
Prathamk07
285f725a73 veux: Include AGC Camera
Signed-off-by: Prathamk07 <prathamkalra.dev@gmail.com>
2024-12-26 04:58:55 +05:30
ghostrider-reborn
45b007139d veux: Fix battery and USB OTG detection
* In cape (msm-5.10) pmic driver now lies in adsp [1], so
   adsp firmware must to be loaded along with qti battery/
   charger kernel module, in order to get battery and usb
   power_supply up & running

 * With this, we dont need to set usb mode to peripheral
   explicitly either

 * The GKI kernel for 5.10 explicitly disabled
   FW_LOADER_USER_HELPER_FALLBACK, and the right way to enable it is to
   echo 1 to the /proc/sys/kernel/firmware_config/force_sysfs_fallback,
   so do this before writing to adsp sysfs node.

[1]: 4e2b0f663a

Depends-On: Id0e64302dbbdc53620cbc1825c36e13bb9e58aef
Change-Id: I835fa5daaa53eb704cc6c0777d7069d47ecbe10c
Signed-off-by: MrTopia <redkarmakar@gmail.com>
2024-12-26 04:58:55 +05:30
Lunarixus
23be56c831 veux: Remove unwanted GApps
Signed-off-by: MrTopia <redkarmakar@gmail.com>
2024-12-26 04:58:55 +05:30
Taki /
1ab863d10e veux: audio: Use QCOM implementation for audio effects
* AOSP effects doesn't give as thicc'n'sicc bass boost as the QC effects do.

Co-Authored-By: ANUSH MADATHUMKARA <Anush.4376@gmail.com>
Co-Authored-By: Ivan Martynov <johnivan19999@gmail.com>
Co-Authored-By: Murat Kozan <muratkozan350@gmail.com>
2024-12-26 04:58:55 +05:30
Frost
7b26811e23 veux: Update from V816.0.9.0.TKCMIXM
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:58:47 +05:30
Frost
e1b48f0353 veux: Fix soname of renamed libraries
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:40:11 +05:30
Sebastiano Barezzi
675c164916 veux: Rename prebuilt audio HAL and libs
Change-Id: Ia46a5ba431767795135f058f092aa38999e860ae
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:39:25 +05:30
Frost
c1bb328c3e veux: Update proprietary files list
Add missing libs

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:39:03 +05:30
Park Ju Hyung
9597ab96ee veux: Optimize everything on preopt We have plenty of space left at /system
Change-Id: I39d552259b66ec329c56cd4f4a7fc46fb2c07457
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: orgesified <gesishabani1@gmail.com>
Signed-off-by: clarencelol <clarencekuiek@icloud.com>
Signed-off-by: mutixd <afatsum.605@gmail.com>
Signed-off-by: Arijit78 <sahaarijit2007@gmail.com>
2024-12-26 04:38:42 +05:30
DarkJoker360
2d40559065 veux: rootdir: Stop bootanimation service after boot
Some users reported bootanimation lags and freezes   after a while. Looking from logs it fails to exit   once boot is completed. Stopping bootanimation   service, as workaround, is preventing this issue.

Signed-off-by: improbir <ghosh_probir@yahoo.com>
Signed-off-by: kssrao13882 <kssrao13882@gmail.com>
Signed-off-by: Omar Mohamed <omarcoptan9@gmail.com>
Signed-off-by: Arijit78 <sahaarijit2007@gmail.com>
2024-12-26 04:37:52 +05:30
Taki
7757c1e281 veux: overlay: Steal CarrierConfig from phone1
* From Nothing OS 2.0.4

Change-Id: I8b761a30c86d72d6bd454332ec3042a22c1a7aac
Signed-off-by: Omkar Chandorkar <gotenksIN@aospa.co>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Co-Authored-By: Omkar Chandorkar <forumomkar@gmail.com>
2024-12-26 04:37:06 +05:30
Eric Laurent
fce16e5c73 veux: Configuration for spatial audio
Update audio configuration to enable spatial audio:
- build with spatial audio feature enabled and rondo library
- list spatializer effect in audio effect configuration file
- update audio policy configuration files to declare spatializer output
- declare immersive end point in audio platform configuration
- updated spatial audio blobs from cheetah-14-AP1A.240405.002

Bug: 237677573
Test: spatial audio playback
Change-Id: Ic9c32d813a19ba2789425e12ee9016d53ab30678
Signed-off-by: ULTIMATE-RITESH <ultimateritesh987@gmail.com>
Signed-off-by: MrTopia <redkarmakar@gmail.com>
2024-12-26 04:37:06 +05:30
Chenyang Zhong
f0e82e9b44 veux: enable Seamless Transfer
It allows users to switch between audio output devices by tapping the music
note icon on the notification of a music app.

Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
Signed-off-by: krtonia <krtonia@gmail.com>
2024-12-26 04:37:06 +05:30
Daniel Jacob Chittoor
53b77f8fd6 veux: init: Enable suspend to RAM
* Improve idle drain considerably
2024-12-26 04:37:06 +05:30
ZVNexus
21cfe4d8fc veux: properties: Enable Qualcomm TrueWireless™ Stereo audio
* Enable/Disable TWS plus feature support using persist property - persist.vendor.btstack.enable.twsplus

* TWS plus feature is supported only if property is set to True else feature is not supported.By default property is set to False.

Signed-off-by: kibria5 <mdkibria687@gmail.com>
2024-12-26 04:37:06 +05:30
Tommaso Fonda
5645183ac2 veux: gps: Use GrapheneOS's SUPL server 2024-12-26 04:36:52 +05:30
Mudit200408
0883dbf803 veux: parts: Move Thermal Settings to System 2024-12-26 04:33:38 +05:30
Peter Kalauskas
80a7799d06 veux: parts: dirac: Fixup for QPR2 2024-12-26 04:33:19 +05:30
wangchaohui
c9aa905be0 veux: parts: Dirac: 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
2024-12-26 04:32:12 +05:30
Taki
47be66e2a9 veux: parts: Import Dirac from Marble
Co-Authored-By: Shaz <joey@evolution-x.org>
2024-12-26 04:31:52 +05:30
kamikaonashi
b255425762 veux: parts: update clear_speaker_sound.mp3
nobody uses it, so include easter egg :)
2024-12-26 04:31:24 +05:30
Amrito Das /
588ad3037f veux: Migrate Some Audio Configs [2/2]
* From - https://github.com/Amrito-Projects/hardware_qcom-caf_sm8350_audio_configs_holi.git
2024-12-26 04:31:04 +05:30
kamikaonashi
9176cf4396 veux: switch to AOSP WFD 2024-12-26 04:30:43 +05:30
danielml
2350ef46a0 veux: Build xiaomi-telephony-stub
To provide the required Xiaomi IMS methods

Change-Id: I1e75476a0d2ed55b5eae2a0a2c6ca4c3c4e2c0f1
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-12-26 04:30:01 +05:30
Malathi Gottam
3871a0886b veux: media_profiles: Edit profiles xml in accordance with schema
Export of Video Editor codec profiles & levels and
configuration of Video editor capalibilies,
these two entries are no longer needed hence removed.

Original-Change-Id: I8252415f37f2b1089e7281eec32deda9fd6e98cf
Change-Id: Ib8b4f52b4b83a0a31a66d118c75005ac9945a4e9
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
7f3d5daec7 veux: Remove software OMX blobs
Default to C2 codecs from swcodec apex.

Change-Id: I32f0b0abe680c1f350268115a3cc5488a2a57ec3
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Michael Bestas
0bde6a0203 veux: 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
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Michael Bestas
508963b866 veux: Use AOSP default Codec2/OMX ranks
debug.stagefright.ccodec=4
is the default value in frameworks.

debug.stagefright.omx_default_rank=0
was used to rank OMX SW codecs lower than OMX HW codecs
but we have removed all OMX SW codecs now.

Change-Id: Idf55ec02c2c0f4d2fa73f949cffef0d820a54570
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Aaron Kling
3aab763cf5 veux: 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
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
8c8fd7785e veux: Import media configs
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
2cbea04f8a veux: Update from V816.0.8.0.TKCMIXM
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Manish Kushwaha
490534372f veux: Migrate sensor HAL to AIDL interface
Bug: 247478991
Test: tested on-device (P23) ab/P46941077
Test: `sensor_test -ahal list` and `sensor_test list`
Test: `sensor_test -ahal sample -s0` and `sensor_test sample -s0`

Change-Id: I40f6ab6b7780c53cd638a1f77c95f6c324dc2d15
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
b56c46cc83 veux: sepolicy: Label qcom rtc sysfs
* rtc-pm8xxx: probe of 1c40000.qcom,spmi:qcom,pm6125@0:qcom,pm6125_rtc failed with error -1

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
blazerpaul15
64f01485ed veux: props: Silence ACDB-LOADER log spam
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Rheygine Medel
6559df72e5 veux: Add IDisplayConfig 2.0 libraries to product packages
This will generate the 32-bit version of vendor.display.config@2.0
and libdisplayconfig.qti.so libraries.

Change-Id: Id4e49fa23a89bf4e5f62a7bbf7a8768a8197f50c
CRs-Fixed: 2672109
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
8f7e6caa15 veux: Declare EGL libs as symlinks during extraction
Change-Id: I4b2f3e79b5e518889d9771bf8990e27babca8b61
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Master
6bc2792c9b veux: audio: Set correct channel mask
* AidlConversionCppNdk: legacy2aidl_audio_channel_mask_t_AudioChannelLayout: no AudioChannelLayout found for legacy output audio_channel_mask_t value 0x10

Change-Id: I31fa119c7bdaae2d6df27864f738fb0af11c0a39
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Yumi Yukimura
6f8cf0657e veux: Disable UFFD GC via OVERRIDE_ENABLE_UFFD_GC
Unable to determine UFFD GC flag for kernel version "5.4.259-qgki".
You can fix this by explicitly setting PRODUCT_ENABLE_UFFD_GC to "true"
or
"false" based on the kernel version.
1. Set PRODUCT_ENABLE_UFFD_GC to "true" if the kernel supports
userfaultfd(2)
   and MREMAP_DONTUNMAP.
2. Set PRODUCT_ENABLE_UFFD_GC to "false" otherwise.

Change-Id: Ia8a17467e13d343c03ee29e514994946e7e84985
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
a82f7d709d veux: Update from V816.0.6.0.TKCMIXM
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
minaripenguin
656e642ff9 veux: sepolicy: Allow system apps to access zram nodes
* needed by settings app

E ndroid.settings: Can't find memory status under: /sys/block/zram0/

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Pranav Temkar <pranavtemkar@gmail.com>
Change-Id: Ic40d2aef2812344d0a94bcd1da4367a2ee9272fe
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Michael Bestas
486071702c veux: Sync extract scripts with templates
Change-Id: I98a36854c5a0c0390592911bb2558b34eff77efc
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Pawin Vongmasa
b3cc170036 veux: props: Move input surface to CCodec
Test: atest CtsMediaTestCases -- \
--module-arg CtsMediaTestCases:size:small
Bug: 131800183
Change-Id: I8783a7de4a4fdf7ff2eac6697c71f6592c9a9e06
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
basamaryan
37de36b2da veux: rootdir: Fix PowerOffAlarm
* As seen on sweet MIUI V14.0.7.0.TKFMIXM

Change-Id: I5d4e6f515d52290463d4f46882ec771fba7049b1
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Kanishk
aebaa8ef1c veux: props: Disable backpressure propagation
• According to 42bc4bf8e0

Signed-off-by: Kanishk <kanishkthederp@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Michael Bestas
c003d5281c veux: sepolicy: Move common wakeup nodes to qcom sepolicy
These are not device specific and don't belong here.

Change-Id: I47de84155fa4bd81fb67b3d6ba5465b0b5db4437
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Yumi Yukimura
42b587c239 veux: Switch to QTI Memtrack AIDL HAL
Change-Id: Ibcbaff02fd56fbccc3a88c01a5f46a89cb212ef5
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
roynatech2544
dc9730364d veux: audio: Disable DRC
* DRC is audio policy to 'compress' volume table, which causes low max volume. Disable it for now

Change-Id: I2e2d8729a8cc5886861e09bf71f5a170f1deb121
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
LuK1337
3e5643e053 veux: props: Enable ro.audio.monitorRotation
Adjusts stereo speaker according to device orientation.

Change-Id: I3084018f6caec67c42959dc97bde8dee00eba388
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Zhou Song
24e5269b29 veux: rootdir: Start audio rpc daemon early to improve performance
Audio HAL initialization relies on rpc daemon to load
dynamic libs, if daemon is not ready when HAL tries
to load libs, HAL has to wait until that finished.
Start this daemon early can smooth boot up of audio HAL
process, as this can save time for dynamic libs loading.

Change-Id: Id05ffc46fab812a718b6cb601e0610974b123679
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
SamarV-121
f9747ed8b8 veux: props: Disable continuous transaction tracing on all build types
Change-Id: I95657a00e38f1229675682e784b20cca12c119b0
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
UtsavBalar1231
7ae7168247 veux: sepolicy: Label qcom extcon sysfs
Error -
W ExtconUEventObserver: Unable to read /sys/devices/platform/soc/1628000.qcom,msm-eud/extcon/extcon0/cable.1/name. This probably means the selinux policies need to be changed.
W ExtconUEventObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon0/cable.1/name: open failed: EACCES (Permission denied)
W ExtconUEventObserver: Unable to read /sys/devices/platform/soc/soc:rt-pd-manager/extcon/extcon5/cable.1/name. This probably means the selinux policies need to be changed.
W ExtconUEventObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon5/cable.1/name: open failed: EACCES (Permission denied)

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
2fa92eabd6 veux: Update from V816.0.5.0.TKCMIXM
- Blobs from veux-user-13-TKQ1.221114.001-V816.0.5.0.TKCMIXM-release-keys

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
PainKiller3
8ed19bf0bc veux: props: Disable vsync for CPU rendered Apps
Choreographer VSync has some performance impact for CPU rendered apps
as the app has to wait for VSync to start a new frame draw. When the
frame draw time exceeds one VSync, this has a direct impact on the FPS.
debug.cpurend.vsync property controls the VSync for CPU rendered apps.

Disable VSync for CPU rendered app, by setting this property to false.

Change-Id: I6fd7f570aef796ed2b16f9531d5d897f2c533e4d
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
LiMee233
f19908d9c9 veux: overlay: Auto brightness adjustment
* Make auto brightness more stable, prevent the brightness from
  jittering repeatedly in dim environment.

Change-Id: I720e04dc4ea28a73af2c48967fd0f943c825245c
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Kanishk
33a147ffcc veux: powerhint: Drop SUSTAINED_PERFORMANCE
• This sometimes keeps the CPU frequencies locked at the set limit even when it's not needed, i.e. playing videos which need hardware decoder, leading to increased power draw, battery drain and heat. Drop SUSTAINED_PERFORMANCE tick from powerhint and let the CPU ramp up it's frequencies when needed, i.e. on demand to counteract the said issue.

Signed-off-by: Kanishk <kanishkthederp@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
8e9818ed41 veux: powerhint: Set launch boost to 3000ms (3s)
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Adithya R
8428bc5647 veux: parts: Get rid of proguard flags
This is obsolete.

Change-Id: I1b692d3e1a96c49ac6efd54907ea23c4b4494f7e
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Jyotiraditya Panda
4c455881e5 veux: parts: Refactor ClearSpeakerFragment code
- Remove unused imports
- Proper resource release by using try-finally block
- Add null checks for MediaPlayer methods
- Remove audio parameter as it's unused

Change-Id: I7dc2ba7baf6e0193e13583a7454da296254d7333
Signed-off-by: Jyotiraditya Panda <jyotiraditya@aospa.co>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
kssrao13882
e2931f888c veux: parts: Remove order preference for Thermal Profiles
- In VoltageOS this tab at top spoils the look of Battery section

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
truly-irham
9597a98894 veux: sepolicy: Address denial for per-app thermal profile parts
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Adithya R
b4d028fa26 veux: parts: Move to device encrypted storage
Kill unnecessary explicit app version while we're at it.

Change-Id: I678e3598b28b57e1920da584102d8c526ab452ef
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Chaohui Wang
dbf35ef9c8 veux: 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
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Peter Kalauskas
4a91d632b9 veux: parts: Enable use_resource_processor for all sysui deps
This will make the build faster

Test: m checkbuild
Bug: 295208392
Change-Id: I0c1bd901429bbe3bf81c1530e156735f8637a96e
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Adithya R
ae7593b87a veux: parts: Fix thermal profile screen state handling
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
EmanuelCN
6940ed9b90 veux: parts: Checkout thermal profiles to xiaomi-sm8250 implementation
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Arian
35596f162b veux: parts: Import from xiaomi_sdm845-common
e261035d91/parts

Change-Id: I442f48780ca020f3e420ee4ccaf8ac07b05457cb
Signed-off-by: Anush02198 <anush.4376@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Arian
6c07102cd2 veux: props: Redefine bluetooth a2dp offload capabilities
Drop unsupported aptx codecs and rank aac below aptx

Change-Id: Ic0c4cefce9f4c39b609490b124230882dec605e9
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
aeb4f07d9e veux: Unset BUILD_BROKEN_INCORRECT_PARTITION_IMAGES
Qualcomm targets can now build hermetic partitions.

Change-Id: I241105e01d85fea983b34846ca675666ac07541b
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
c36da4c3b1 veux: Convert WiFi firmware symlink to install_symlink target
The last bit that was preventing building hermetic images.

Change-Id: I75bb7de4593a7992f6015317cf97e088beeba0cb
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
e8b27e9e92 veux: Move to new RFS install_symlink targets
Change-Id: I9560fd0da00958d9349a0881b5a5f64a2c02e495
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Sebastiano Barezzi
d253b473b8 veux: Use the fragment for QTI vibrator HAL
Change-Id: Id07088526d4698af0872ab427d1b823e098e39d1
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Michael Bestas
acb581c0c0 veux: Build missing libraries for 14 QPR3
Change-Id: I6a84526ca1e9f4e5140c8068646433cab3fe85b2
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
b3a7b5f5a6 veux: Inherit from common Xiaomi FCM
Change-Id: I8d4d54bba1b3dff27c11b0034852697b818ee609
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
helliscloser
9b45bd6168 veux: props: Explicitly disable GL comp backpressure
When blur is enabled, There is severe lag in Launcher3 while scrolling apps in App drawer, scrolling through recents and occasionally on QS pull down. Lag & janks are gone now, even with blur.

Signed-off-by: helliscloser <mrumais@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bart Van Assche
534f9f7fcc veux: rootdir: Restore I/O performance
As one can see in cfq_arm_slice_timer(), the CFQ I/O scheduler supports
two parameters that can make it delay I/O: group_idle and slice_idle.
Restore I/O performance by setting both the group_idle and slice_idle
parameters to zero.

Bug: 213617178
Bug: 313578691
Change-Id: I02429876790a6456ca957ff7c38f0c8bf88127f9
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
TheStrechh
bd33596089 veux: props: Enable WiFi calling over IMS
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Alex Sarraf
5a7395cdb1 veux: props: Set debug.sf.auto_latch_unsignaled to 0
Need to explicitly set auto_latch_unsignaled property to
disabled state to keep latch-unsignaled as the default
behavior.

Change-Id: I3856caaf0a68e7e720819f25338d1eb9196f56b0
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Alexander Winkowski
714f25e0f4 veux: props: Fix vendor.qcom.bluetooth.soc value
BT stack sets persist.vendor.qcom.bluetooth.soc which has
the correct value. This fixes FM radio.

Change-Id: I28f9bd479e966264b3d615f7d5fc5ee891cd31d6
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Alan Chen
b6580beb9a veux: wifi: Enable Optimized Power Management
- This config was renamed as of CLO commit [1] and [2].

[1]: 10989ba376
[2]: 9ef1447db3

Change-Id: Ie6ffbeebb45e5dd97b98592b7dfc195a4fb7045d
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
markakash
9b62cfd6c8 veux: audio: Fix mic issues in apps like WhatsApp
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Dmitrii
c6525e228f veux: Correct bootanimation res
- ref: https://github.com/VoltageOS/vendor_voltage/blob/14/config/bootanimation.mk#L7

Signed-off-by: Dmitrii <bankersenator@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
8e5b4072c9 veux: Use common libqti-perfd-client and power-libperfmgr
Change-Id: I22d6b35c72629553817005deaefcae60abc72cfd
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
adi8900
a829eb912e veux: Address QCOM WFD denials
* Fixes buggy QCOM WFD connections.

Change-Id: I9e0b92e7bc9d0ae5e3f50a4f18a0b19988da9a00
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Edwin Moquete
30ca8a5f11 veux: Build android.media.audio.common.types-V2-cpp
* Needed for WFD, and not built by default on QPR2

Change-Id: If860613ef4cb6bae7f7a7e72707c24510e36abd6
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Georg Veichtlbauer
b1ae2d1628 veux: powerhint: Add DT2W
Change-Id: I7d0dfe249798864a39afd4f339b692584faaf3ec
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
UtsavBalar1231
a8514195b7 veux: Define AAPT configuration
Change-Id: Ic12fc243a6b86a0972ef5dc0bb26148be540be57
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Mathieu Chartier
c2c037ceda veux: Speed profile services and wifi-service
* Reduce RAM and Storage

Change-Id: I1d907b24cb2760ddd9cc65ac4335730c8e61a0a3
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Albert I
e2123901be veux: Configure zRAM using fstab
* "32-bit overflow" CAF mentioned in the function wrapper inside post-boot
  script sounds very bs, since if it's 64-bit it won't be affected anyways

* We do the setup using fstab instead to allow setting up more flags such
  as setting up backing device and compression streams; as such kanged from
  Pixels

* zRAM size = 50% and swappiness 30%

* Use LZ4 compression even for regular devices

Signed-off-by: Albert I <kras@raphielgang.org>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Change-Id: Ia6efb3d28e56fb026d9b28fc6633b2eac77dfa47
Signed-off-by: Nippon <adamayyad1999@hotmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Sebastiano Barezzi
b0dfac7927 veux: Switch to common Xiaomi light HAL
Change-Id: Ic773e6e411a5cf178bba3a61b20457d62d177db0
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Alex Naidis
8a960eaecd veux: wifi: Tune bmps listening interval
Tune the BMPS listening interval for the moderate power level to achieve
 power savings during wifi idle.

Change-Id: I0f5f8fafb6f6b3eaa6a855aa1a7dc12c3886ddce
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
GeoPD
f1d00a5720 veux: props: Disable camera perflock
* Seems to improve the HDR processing in Gcam a bit fast
   and we don't have any boostframework binaries either

Signed-off-by: GeoPD <geoemmanuelpd2001@gmail.com>
Signed-off-by: LinkBoi00 <linkdevel@protonmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Pranav Vashi
bf6410fdc6 veux: overlay: Support smart pixels
- Disabled by default in source, enable it by device side overlay
 - Reference : 0449022bdc (diff-afc3235e8e72a3a65b4bbb5c62a40d0c3624b40f1a1f1eac9b751b2038c140b1)

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Rajan Palaniya
4dda766714 veux: overlay: Set smooth display config to false
* Enabling smooth display causes flicker to some screens in veux

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Alex Naidis
45db78e231 veux: wifi: Improve 5GHz AP selection preference
* Implement a smarter system on whether to connect to the provided 2Ghz or 5Ghz network.

Change-Id: Idd41e3d9a5e2bde3ea9b4873dffc4274d1530324
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Tim Zimmermann
c39dd37c44 veux: overlay: Disable STATE_DOZE_SUSPEND
* Screen content never gets updated with AOD

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
AtlanPrime
8d9a4ac624 veux: props: Set wide color display prop to false
* Fixes yellowish tint in Google-Photos

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Pranav Vashi
13a97723a4 veux: audio: Use 24 bit packed format
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
dataoutputstream
0ca7896ae3 veux: Build audio.primary.default
Fixes:
AudioSystem-JNI: AudioSystem::listAudioPorts error -19

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
LuK1337
b02f85e0dc veux: overlay: Don't check proximity sensor before pulsing
- Since we don't have a proper proximity sensor, doze is unable to perform a proximity check
- Fixes ambient display

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Demon000
3c7147ba26 veux: overlay: Disable proximity usage during doze
* We have a virtual (ultrasound) proximity sensor so this will never work

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Ramii Ahmed
322ba9c44a veux: Allow OTA assert
* to support both variants of the device

Change-Id: Idbf3d58c306a317ff21636c93c34b1420c714cba
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
aryan
603d46e1ab veux: props: Use low gamma implementation for brightness curve
Change-Id: I976fc4fdf9c3baae089cb4aa1a64927deb13f87b
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
TheScarastic
95f317e68a veux: overlay: Add support for doze auto brightness
- Based on observing it's values, xiaomi.sensor.aod reports
  the following events:

3.0: Dark environment
4.0: Bright environment
5.0: Switched from bright to dark environment

3.0 does not seem to be triggered anymore after bright
environment has been reported.

- Enable brightness buckets in doze to disable animation
  between the brightness levels.

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Doctor Strange
8f71e729f7 veux: overlay: disable STATE_DOZE
- Our device doesn't support doze
- Fixes AOD flickering issues

Change-Id: I44855e85f7d9e26666a8efb79afc202c69770615
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Michael Bestas
b98b02aebf veux: Build Lineage Health HAL
Change-Id: I70cc903a03ac9fa3303bb8fa039c9de4806449bf
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
sashascurtu
c121beea3c veux: Build sensorservice 1.0 HAL
Fixes:
W HidlServiceManagement: Waited one second for android.frameworks.sensorservice@1.0::ISensorManager/default
I hwservicemanager: Since android.frameworks.sensorservice@1.0::ISensorManager/default is not registered, trying to start it as a lazy HAL (if it's not configured to be a lazy HAL, it may be stuck starting or still starting).
I HidlServiceManagement: getService: Trying again for android.frameworks.sensorservice@1.0::ISensorManager/default...
W libc    : Unable to set property "ctl.interface_start" to "android.frameworks.sensorservice@1.0::ISensorManager/default": error code: 0x20
I hwservicemanager: Tried to start android.frameworks.sensorservice@1.0::ISensorManager/default as a lazy service, but was unable to. Usually this happens when a service is not installed, but if the service is intended to be used as a lazy service, then it may be configured incorrectly.

Change-Id: If6fdef9dc39daaba9138fe3f8acf06cb6a0e78f8
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
ghostrider-reborn
4ddd46f8d3 veux: props: Enable QCRIL radio power saving
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
¨raystef66¨
db38f499b8 veux: overlay: Push 120 FPS for ScreenRecorder
Our Device is with 120hz display and Snapdragon 695, there is no reason to lock on 60fps

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Cole Faust
c097aa01ba veux: Add BUILD_BROKEN_INCORRECT_PARTITION_IMAGES
Qcom has issues that prevent it from working with a hermetic
partition build.

Bug: 205632228
Test: Presubmits
Change-Id: I490a29da38a6f68e7dd3650d8140cb11adaa8c7a
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
sabarop
b28b5fd51d veux: props: Silence OpenGLRenderer logspam
E OpenGLRenderer: Unable to match the desired swap behavior

Signed-off-by: BalayBera <balaybera@proton.me>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
ExactExampl
7da38a9c12 veux: props: Enable ro.hwui.render_ahead
* Rendering ahead makes some animations handling better (especially qs pulldown on a13 qpr2)

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Alessio Balsini
645a1b3dbe veux: props: Use FUSE passthrough by default
Enable the persist.sys.fuse.passthrough.enable flag for the veux device
configuration to enable the FUSE passthrough feature.
This feature has been enabled on Cuttlefish, Wembley and Redbull devices for
months and no issues have been detected yet.

Fixup:
- The prop is supposed to be set in product instead of system as per [1].

[1]: https://source.android.com/docs/core/storage/fuse-passthrough

Bug: 168023149
Test: 'adb shell getprop | grep persist.sys.fuse.passthrough.enable',
    ScopedStorageTest
Signed-off-by: Alessio Balsini <balsini@google.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
afterallafk
2b272b72c1 veux: props: Enable IMS Volte
Signed-off-by: afterallafk <shivamatiet2001@gmail.com>
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
pengfeix
c84b313428 veux: overlay: Enable IMS feature flags for supported carriers
- Enable VoLTE/VoWIFI for all indian cariers
- Enable VoLTE for Viettel Vietnam
- Enable VoLTE for Mobifone Vietnam
- Add full Support Carrier Smartfren VoLTE
- Enable VoLTE support for Indosat and XL Axiata
- Enable VoLTE support for Telkomsel (Indonesia)
- Enable VoLTE support for Three
- Enable VoLTE support for Bakcell (Azerbaijan)

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
johnmart19
70fe51dcc3 veux: props: Enable VoNR Calls support
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Adithya R
c64d79af02 veux: Enable VoNR on Jio 5G
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
basamaryan
13700ee78b veux: Don't explicitly include updatable_apex.mk
It is inherited by base_system.mk as of QPR2

Change-Id: I020a05b233f61ea28d03199cbc76051e6e97e1dc
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Ido Ben-Hur
bad20562fb veux: overlay: Limit AOD refresh rate to 60hz
- This is second part of VoltageOS/frameworks_base@cb296b8

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
e2bfa25e01 veux: props: Move to proper path
- Minor Cleanup
- Add system.prop
- Copy out props from BoardConfig.mk

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
mikeNG
57c7362682 veux: overlay: Enable battery cycle count
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Tomasz Wasilczyk
19e2a5ab3b veux: gps: Don't include cutils/threads.h
Bug: 289414897
Test: buildserver
Change-Id: I14b99f42feaae7af00cbd17cfe482eb2e5da71e8
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
Frost
f051197fc6 veux: Update from V816.0.3.0.TKCMIXM
* Update blobs from latest HyperOS update

Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
2024-10-18 18:33:00 +05:30
chuspita
a2e588557e veux: Add props for better signal
Signed-off-by: Frost <karanraj132804@gmail.com>
2024-10-18 18:33:00 +05:30
spkal01
a4df00734e veux: Add Battery Information in battery settings
Signed-off-by: Frost <karanraj132804@gmail.com>
2024-10-18 18:33:00 +05:30
Frost
ba57af2c58 veux: README: Update with proper information
Update according to device

Signed-off-by: Frost <karanraj132804@gmail.com>
2024-10-18 18:33:00 +05:30
Alexander Winkowski
daa24c2825 veux: overlay: Override WifiCustomization resources
Change-Id: I13e70f752d4688189ef301d515876294a0fc0677
Signed-off-by: Frost <karanraj132804@gmail.com>
2024-10-18 18:33:00 +05:30
Alexander Winkowski
0d1fc8a2e3 veux: Update WFD blobs
Change-Id: I663d4132969fc50c117ac29760b36536269712c2
2024-10-18 18:33:00 +05:30
Alexander Winkowski
4a6cf62fa7 veux: overlay: Allow lower auto brightness
Change-Id: I493ed432717dc19b1014a106debaaea47f8c0459
2024-10-18 18:33:00 +05:30
Alexander Winkowski
6d9339ce7c veux: Set device name as per the stock ROM
Change-Id: I611e5f912096b3853a7d80f4135656d20bbf7f26
2024-10-18 18:33:00 +05:30
Alexander Winkowski
3ccabc2a06 veux: Add support for different NFC variants
Change-Id: I28efbcacbabb8c00405eec2ca87a47fb09fa143a
2024-10-18 18:33:00 +05:30
Alexander Winkowski
d2f5e33dff veux: rootdir: Enable libperfmgr
Change-Id: I4d99ad4b474df8c3631d13735d1d72f7297ec5a8
2024-10-18 18:33:00 +05:30
Alexander Winkowski
518ad01b2d veux: sepolicy: Initial adaptation
* Reformat and alphabettically sort

* Remove cameraperf, camerapostproc_xiaomi,
  udfps, perfd, powershare, citsensor, mius
  and touchfeature parts

* nv_mac seems to be "merged" into BT HAL
  on this device

* Add libperfmgr rules from Xiaomi SM6250

Change-Id: I38d6934f94cc5615a72a58785f79c19e02df38b0
2024-10-18 18:33:00 +05:30
Alexander Winkowski
6bbb9a9231 veux: Pull SELinux policy from Xiaomi SM8350 tree
At commit 67b8a98cf0128e04a1f33614690b5bfa5ac443b9

Change-Id: I8cdf0dd602347a9a4440f2a2ab813eb734f55646
2024-10-18 18:33:00 +05:30
Alexander Winkowski
c46196f34c veux: Reserve space in dynamic partitions
Reserve 1G in system partitions for flashing GApps packages when they're
not included, otherwise, reserve 24M in each partition.

Change-Id: I76d5583cd85d87a88a9b38aee5305927eb5067de
2024-10-18 18:33:00 +05:30
LuK1337
93515bd6cf veux: Prevent adding same dependency twice in blob_fixup
Change-Id: Idedeb51e027a09f64a29ac67a3a2f2a0594213f6
2024-10-18 18:33:00 +05:30
althafvly
59d6666ea8 veux: Add libpiex_shim for com.mi.node.mialgocontrol.so
Change-Id: I9e8b125ab5dfaa325db63b02a7fcf51577ee7b0d
2024-10-18 18:33:00 +05:30
Arian
5c21eb8921 veux: Patch ims.apk
Patched to remove com.qti.permission.BIND_QTI_IMS_SERVICE and
Landroid/telephony/TelephonyBaseUtilsStub;->isMiuiRom()

Full patch: https://paste.myself5.de/zitiketuto.diff

Change-Id: I1ecff29d7089bffa50d41acb6b55c6d8e36d1d9c
2024-10-18 18:33:00 +05:30
Alexander Winkowski
c7656e6290 veux: Update display blobs from tundra
To match the display HAL

Change-Id: Idb215acad93043cfd8d4cc5ba3696d9ebcd5fbb8
2024-10-18 18:33:00 +05:30
Jabiyeff
f105f6c501 veux: Strip size of com.qti.node.mialgocontrol.so
* Size decreased from 148 mb to 12 mb.

Change-Id: If680f2b0511f9e348973ea2a98f9f832745f6d79
Signed-off-by: Jabiyeff <cebiyevanar@gmail.com>
2024-10-18 18:33:00 +05:30
Bruno Martins
485a5d9f14 veux: Fix charger init triggers after moving to health AIDL
Change-Id: I58e7c493d3b300b1efb1685fba637fee6b56bec3
2024-10-18 18:33:00 +05:30
Pig
ccbad365fd veux: Suppress CamX debug
Change-Id: I001be38a19664bcf4994fc88fa1f4448c8cc7891
2024-10-18 18:33:00 +05:30
dianlujitao
9286f09867 veux: Drop dependencies on android.hidl.base@1.0.so
Change-Id: I4c6803a6f1bfdd3fde7d83f59c0642f3398f531b
2024-10-18 18:33:00 +05:30
Alexander Winkowski
8610b8681e veux: Control wfdservice64 with vendor.wfdservice prop
Change-Id: I984c413ce2455065b717c04df02cd2d121640798
2024-10-18 18:33:00 +05:30
Alexander Winkowski
dd7c9609ec veux: Add SKU props from stock
Change-Id: Ib7b6a0d8b992f264762c21f477c42f2114e51c7f
2024-10-18 18:33:00 +05:30
Chirayu Desai
792e952f0f veux: Set BOOT_SECURITY_PATCH
* This is put in vbmeta, and stock OS sets it

Change-Id: I69485c8207eca5ee9e7f1f4e02d684707c6dece3
2024-10-18 18:33:00 +05:30
Alexander Winkowski
52a932044b veux: Initial proprietary files list
Change-Id: Ie0b6450e1494fdb4342497c5c5f5e55ed7d916d3
2024-10-18 18:33:00 +05:30
Edwin Moquete
084799fbe4 veux: 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-10-18 18:33:00 +05:30
danielml
42e589355a veux: Override doze mode support
Change-Id: Ibdc4080dc66b5667993307f4c8ff6f83dc751e85
2024-10-18 18:33:00 +05:30
Midas Chien
ab853c821d veux: Don't latch unsignal buffers
Set debug.sf.latch_unsignaled=1 is used to allow surfaceflinger to
latch unsignal buffers that can give more time for buffer to render.
But if the buffer takes longer time to finish, it will block whole
display pipeline result to jank.

Bug: 157964883
Test: scrolling, launch
Change-Id: I56c3e05921de5fc9569bf3f93fde03022a64b6a4
2024-10-18 18:33:00 +05:30
LuK1337
53f9de110f veux: Pull appropriate USB props from vendor_product.mk
Change-Id: I93b25c5d0989c83d1c8d7b7946a083771febdddd
2024-10-18 18:33:00 +05:30
Arian
933fd2e814 veux: Set ro.media.xml_variant.profiles to choose media profiles
This was introduced with [1] and allows to choose target specific media
profiles without caf changes to frameworks/av. Unset media.settings.xml
so that the new property gets respected.

[1]: eaac82f33f#

Change-Id: I7ec306bf3dd595c09308ed26c9d3a6db8490c7f0
2024-10-18 18:32:59 +05:30
Alexander Winkowski
36837bf025 veux: Inline init.qti.media.sh into build.prop
Change-Id: I23d206aef57ab0b729fe5180f94c035f93d7ef3d
2024-10-18 18:32:59 +05:30
Alexander Winkowski
f122a18dae veux: Set vendor SKU in build.prop
Stock QCV scripts don't set it for holi platform.

Change-Id: I4b160246c24c889e80a5fa94e26d21fcbb7d91dd
2024-10-18 18:32:59 +05:30
Alexander Winkowski
d6eb8d64ea veux: Import build properties from V14.0.6.0.TKCMIXM
Change-Id: I3e9ac05a2ef9d934ff2fcd26ac09c9100a9b9cb9
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
cccfa74a18 veux: Build vendor interfaces libraries
Change-Id: I0c8760ff6923c2d2a43ec058554d724ca6600f3c
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
d217dc7549 veux: Build WFD libs
Change-Id: I859cd3ff8e1729323f2c72df4feca55559262878
2024-10-18 18:32:59 +05:30
Jimmy Chen
80d0cbe71a veux: Move supplicant service init to wpa_supplicant
Bug: 138790309
Test: boot and wifi function is ok
Change-Id: I35cf3e03566443e20799623045eacd423fd7f5c4
2024-10-18 18:32:59 +05:30
Alexander Winkowski
a89342742b veux: Import WiFi configs from V14.0.6.0.TKCMIXM
Change-Id: Idb380aa74bdf146739adefb076acb49c2e89bfbd
2024-10-18 18:32:59 +05:30
Mohammad Asaad Akram
4187437ce7 veux: Enable asynchronous library events in WPA supplicant
Change-Id: I3b028afa54605bd57d9fb5700d792cb9e5e0e76f
2024-10-18 18:32:59 +05:30
Demon000
7edf5eccff veux: Build WiFi packages
Change-Id: Id0e785d1d22bda58922658de6ab0b5b0cf1e9927
2024-10-18 18:32:59 +05:30
Fenglin Wu
7453ea17cf veux: Add config to exclude haptics devices from input subsystem
Haptics devices which registers as input FF devices are not supposed to
be detected by input subsystem. Add excluded-input-devices.xml file for
input subsystem to exclude them.

Change-Id: I52dc6e502b29e2813299d073195a0991bb2cf692
2024-10-18 18:32:59 +05:30
Bharat Pawar
d7379ef77a veux: Enable LED based vibrator
Enable LED based vibrator for talos, moorea and
atoll targets.

Change-Id: I079eefaefff77fe19304acc8749773febf91a7fc
2024-10-18 18:32:59 +05:30
LuK1337
4b24e43c42 veux: Build vndservicemanager
* Needed for FCM >= R.

Change-Id: I6d5eb8084127e295e4abec2c0192c0ad5b07b867
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
d57335f185 veux: Use QTI USB init configs from USB HAL repo
Change-Id: I966d251a2756c9d9e91f621cbc5872448d022de4
2024-10-18 18:32:59 +05:30
Cosmin Tanislav
e99242b226 veux: Build QTI USB service
Change-Id: I2c6ed5c909c31837321fc587050ff810422d95b0
2024-10-18 18:32:59 +05:30
Alex Deymo
2229f08815 veux: Build A/B update engine
Change-Id: I9dbf84e1531ed3e32b21c8fec13266cfe4d23cd3
2024-10-18 18:32:59 +05:30
LuK1337
a5ce4298a1 veux: Build android.hardware.thermal@2.0-service.qti
As seen on stock ROM.

Change-Id: I950ab50ded7b3c1164ff88ab18d7f1e3365a6086
2024-10-18 18:32:59 +05:30
Demon000
a72fc32c2e veux: Build telephony packages
Change-Id: I5fafc22fc696b04abc2f79100306f1625ac03fbc
2024-10-18 18:32:59 +05:30
Alexander Winkowski
dc8a347687 veux: Set shipping API level
Change-Id: Ic710848ea8329eb0b0eabbfb3771ecf9cba3c7e7
2024-10-18 18:32:59 +05:30
Alexander Winkowski
2ed7b1e08e veux: Build Xiaomi common sensors Multi-HAL
Change-Id: I96425bc0907b37ebebfca8600eb07c71f3afaab8
2024-10-18 18:32:59 +05:30
Nolen Johnson
5d99aa3761 veux: Simplify AVB flag logic
* AVB's `--flags 3` argument builds a disabled VBMeta with
  disabled hashtree, so no need to set both flags individually.

Change-Id: Ibe9ee322a5af58f13e76d53e18dee49451fe8838
2024-10-18 18:32:59 +05:30
Christian Oder
4d3d7d1a5a veux: Build disabled VBMeta image
Partitions that use vbmeta_system can be found by looking at
avb flag in fstab from boot ramdisk.

--flags 2 makes the verification function of avb always return a
positive result.

--set_hashtree_disabled_flag builds the vbmeta images with the
HASHTREE_DISABLED bit set and as a result they don't need to manually
disable dm-verity via e.g. 'adb disable-verity'.

The rest of the configuration is taken from
https://source.android.com/devices/tech/ota/dynamic_partitions/implement#avb-configuration-changes

Change-Id: I381feef8f6fefc8449ca50d85d704b67bcc8a77e
2024-10-18 18:32:59 +05:30
Michael Bestas
f2db59df5f veux: 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
2024-10-18 18:32:59 +05:30
Michael Bestas
c2c19d4103 veux: ueventd: Remove all permissions from /sys/devices/soc0/serial_number
Change-Id: I688347cfe59f56e4de2e4bf3c3324ca465f7a897
2024-10-18 18:32:59 +05:30
Michael Bestas
cf9c0179dd veux: ueventd: Remove stray line
Change-Id: Iddee28c06db20b20a8977c3d9d4982f86a279e92
2024-10-18 18:32:59 +05:30
PRANAY BHARGAV BHAVARAJU
11d4c0bbc4 veux: ueventd: Avoid setting permission for /dev/hw_random
Below patch from system/core is setting required access policy
for /dev/hw_random. And CTS test is updated accordingly

https://android-review.googlesource.com/c/platform/system/core/+/2229337
https://android-review.googlesource.com/c/platform/cts/+/2232052

Change-Id: I762dfa3b1e84dee6c49fc178b5b75cf1c134cfb7
2024-10-18 18:32:59 +05:30
Mohammed Mirza Mandayappurath Manzoor
4329310a6d veux: 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
2024-10-18 18:32:59 +05:30
Albert I
8d2429bcf5 veux: fstab: Handle avb= fs_mgr flags correctly
Specifying avb=<vbmeta-partition> is only necessary for first entry of
partition groups that use same vbmeta partition. The following entry can have
<vbmeta-parititon> part omitted.

Test: None
Link: https://source.android.com/devices/architecture/kernel/mounting-partitions-early#fstab-entries
Change-Id: I5a42fd3de72c400acfae56d6a1e1b85c22a79537
Signed-off-by: Albert I <kras@raphielgang.org>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2024-10-18 18:32:59 +05:30
Alexander Winkowski
8c72cdc256 veux: fstab: Remove MIUI partitions
Change-Id: Iec571091763012f599c74f11d27e368e80371b38
2024-10-18 18:32:59 +05:30
LuK1337
3254b0b998 veux: rootdir: Set SSR restart level to 'RELATED'
Change-Id: I32fc08c9ad36b9c8ebfc019fc87a19eece18f0b4
2024-10-18 18:32:59 +05:30
Randall Huang
f3605e89a4 veux: rootdir: Remove IO read_ahead_kb tune
If we set 2048KB ra value in the beginning of the
boot process, services initialized at this time would
keep 2048KB ra value even though we adjust the ra value
to 128KB after boot completion.

This may cause memory pressure.

Bug: 174700194
Signed-off-by: Randall Huang <huangrandall@google.com>
Change-Id: I97ee0ee9511eaada011f2634afd68d68cdca4570
2024-10-18 18:32:59 +05:30
Miguel de Dios
9572494bf1 veux: rootdir: Change readahead to 128KiB on post-boot
Reduce readahead from 512KiB to 128KiB to reduce thrashing when we
have a lot of apps running.

Bug: 110908295
Bug:  80426378
Test: manual - device boots
Test: manual - check app launch does not take long
Test: cts-tradefed.sh run cts -m CtsCameraTestCases
Change-Id: I59c1f2f8a6fbb5e0d956ba07a40a2bfac3b61481
2024-10-18 18:32:59 +05:30
Prabhanjan Kandula
1e1f924fa1 veux: rootdir: Avoid delay for vblank disable from DRM
Set drm_vblank_offdelay parameter to -1, to make DRM
issue the vblank disable immediately with out delay.
By defailt  the DRM framework has a delay of 5 secs
timeout before issuing the vblank disable.

Change-Id: Idc1dfe6a6994f2ac2d3c60ae8fd5a4e883b675d9
2024-10-18 18:32:59 +05:30
Alexander Winkowski
e01e78c408 veux: rootdir: Clean up
Change-Id: Id7277abb5725140fce1683e6d878e90dd7f17011
2024-10-18 18:32:59 +05:30
Kamal Wadhwa
a407903eed veux: Remove charger service restart and modem partition mount calls
Holi supports linux based charging and not via ADSP,
hence remove the modem partition mount logic.
This improves the entry time into power-off charging mode.

Change-Id: I69337e773f6078bc0847b7db199fc21e8c975a8a
2024-10-18 18:32:59 +05:30
Rama Aparna Mallavarapu
f5e4371a7f veux: rootdir: Import kernel rc script to be run during the boot
All the kernel tunables are now part of the kernel scripts.
Invoke kernel RC script during the boot. Also move the kernel
related settings to kernel-scripts folder.

Change-Id: Ic8f1114377345f1dc6ca8ec441aa99de61a7a453
2024-10-18 18:32:59 +05:30
Alexander Winkowski
0e09a44a2c veux: rootdir: Mark modem config copy completed unconditionally
Normally ro.vendor.ril.mbn_copy_completed is set by init.qcom.sh but
that script was dropped because it does nothing else on this platform.

Change-Id: I19edf64df2c8ed9ab405b5684cedbb1dc4248eab
2024-10-18 18:32:59 +05:30
Alexander Winkowski
5c2a49f05e veux: Import rootdir from V14.0.6.0.TKCMIXM
Change-Id: I1b51318f885e734f322864f7c61a599e9a7113c6
2024-10-18 18:32:59 +05:30
Arian
5c612a45d8 veux: Build librmnetctl
Change-Id: Ica941c1d2521e738d4990261bab41fee5daffa9d
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
28b7fbbc7f veux: Build QTI Framework detect libs
Change-Id: Ic4db96f8bd5a19f4805bd9c40544ed51d0352c61
2024-10-18 18:32:59 +05:30
LuK1337
199238d971 veux: Build libprotobuf-cpp-lite-3.9.1-vendorcompat
Change-Id: I0aac742db9c2b4b3e48ee20158f19405863893c2
2024-10-18 18:32:59 +05:30
Krzysztof Kosiński
022111fd5d veux: Add prebuilt protobuf 3.9.1 to vendor partition
Needed to work around a Qualcomm HAL prebuilt.

Bug: 203713560
Bug: 258322017
Bug: 254854421
Test: Forrest
Change-Id: I4eebc60f10fbea6a66127ed3e08441db32536f78
2024-10-18 18:32:59 +05:30
Alexander Winkowski
6213d6ebf5 veux: Refine powerhint according to freqbench results
Change-Id: Id4727badf9d85609c9a3697aadf1677906abb7b5
2024-10-18 18:32:59 +05:30
Alexander Winkowski
6558937dd6 veux: configs: Add initial powerhint for blair
Based on redbull, adapted nodes, removed unused/unneeded hints.

Change-Id: Iee610168800d9cbecccc4ca121418a9bce717cce
2024-10-18 18:32:59 +05:30
Alexander Winkowski
e6a42c70e8 veux: Build Xiaomi common power AIDL HAL
Change-Id: I0e10f0b36598b8cbf25ee2dc08b8a4eced95c2ed
2024-10-18 18:32:59 +05:30
Alexander Winkowski
1bc813e46f veux: Copy permissions from V14.0.6.0.TKCMIXM
Add android.software.opengles.deqp.level.xml, which seems to be missing.

Change-Id: Idd2f358b4aefd74bed26a9450870be85e67a44cf
2024-10-18 18:32:59 +05:30
Alexander Winkowski
0bb2f4916c veux: Override task_profiles.json
Change-Id: I7291a318d523c030bbb3f5aa71364d512eb7490c
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
9ded0719c8 veux: libqti-perfd-client: Move to C
* Why bothering with C++ mangling when we can just build it as a standard C library?

Change-Id: I45ea977edf7ea7fab6fece76f3049654a8d24c5d
2024-10-18 18:32:59 +05:30
Chenyang Zhong
893bddd28b veux: libqti-perfd-client: return a dummy value
Return a positive integer for perf lock acquire and release so
that Goodix/FPC fingerprint sensor blobs will not complain.

Goodix:
E [goodixHAL][gf_hal_milan_f_series]: goodix_perf_lock_acquire: Failed to acquire perf lock, err: 0
E [goodixHAL][gf_hal_milan_f_series]: goodix_perf_lock_release: Perf lock release error 0

FPC:
E fpc_tac : fpc_perf_lock_acquire: Incorrect params, Failed to acquire perf lock, err
E fpc_tac : fpc_perf_lock_release: Perf lock release error 0

Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
Change-Id: I861672e9a738c2204755d802670f4b28b662f286
2024-10-18 18:32:59 +05:30
Bruno Martins
fe45a92829 veux: libqti-perfd-client: Remove namespace declaration
It's pointless when using extern "C".

Change-Id: Ibdf9f06a70aa3a75687b33781c78cf2172bb334d
2024-10-18 18:32:59 +05:30
Lucchetto
d53fab4127 veux: Create dummy libqti-perfd-client
* proprietary perfd blobs can finally be nuked without breaking goodix
* we could even map the functions to use libperfmgr powerhints in the future

Change-Id: I124652f3041761966a3e3bd97c757fecc39cc5fb
2024-10-18 18:32:59 +05:30
Demon000
63c67e45ba veux: Use dynamic partitons
Change-Id: Iac89f608a7f8efa78da5200c68cb45ab2f439fd0
2024-10-18 18:32:59 +05:30
Danny Baumann
060914ed16 veux: overlay: Enable call recording
Change-Id: I1b4478b330b13cf5d0fe1ed0d40f43e4b3825f33
2024-10-18 18:32:59 +05:30
Alexander Winkowski
66c6186ff5 veux: overlay: Initial LineageSDK overlay
Change-Id: Ifecb5f30cbc1e95c130781eb306bab96d1f1765b
2024-10-18 18:32:59 +05:30
Jake Weinstein
6908a6d66c veux: overlay: Allow VoLTE and VoWiFi/WFC by default
Change-Id: I0df3d87074378224a6b29b26166dcf2fc59f34c2
2024-10-18 18:32:59 +05:30
Dyneteve
d697ec7503 veux: overlay: Remove "SIM x is HD capable" message
sed -i '/config_update_service_status/d' overlay/CarrierConfigOverlayCOMMON/res/xml/vendor.xml

Change-Id: I26ce187483d6d8c18bcd1901cd6d71ca6ec1e31f
2024-10-18 18:32:59 +05:30
Alexander Koskovich
2d2c0833fe veux: overlay: Use CarrierConfig DTMF & CSP booleans
* Overlays were deprecated awhile ago for these.

Change-Id: I51b70aa15f128186063ce52446cb67715a957185
2024-10-18 18:32:59 +05:30
Alexander Winkowski
1650756195 veux: overlay: Initial product overlays
Based on V14.0.6.0.TKCMIXM

Change-Id: I415b5877bf41fc3b78ae83a53450076a7c2b9386
2024-10-18 18:32:59 +05:30
Alexander Winkowski
41bb557145 veux: overlay: Initial vendor overlays
Based on V14.0.6.0.TKCMIXM, brightness overlays from lynx.

Change-Id: I4a06896f7cc3a599794cd3affd304e2c25f077e1
2024-10-18 18:32:59 +05:30
Anton Hansson
ae15b2c0a4 veux: Enforce RRO for all resource overlays
Bug: 118823052
Test: make
Change-Id: I579d09480c7a482543ea616dd5c493d825bb98b1
2024-10-18 18:32:59 +05:30
Alexander Winkowski
57b7497699 veux: Build extra NFC packages
Change-Id: Ide2ddbe1bd5e9626fa5c883475d1fafe6dcebbb1
2024-10-18 18:32:59 +05:30
LuK1337
2810dcf117 veux: Build AIDL NXP NFC HAL
Change-Id: I6ace3ac149c84d2cb9e2773e7ef5ddbf24c35b92
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
bdd55d3896 veux: Build mtdservice interface lib from source
Change-Id: Ie739f283c4be1b77d57aaee1941ed46957da1d1a
2024-10-18 18:32:59 +05:30
Bruno Martins
06c5fecaf8 veux: Build mlipay interface from source
Change-Id: I41361a4f1405950f73f94609171851972803d099
2024-10-18 18:32:59 +05:30
Alexander Koskovich
2a943266b3 veux: Copy out media permissions and build media packages
Change-Id: I26674be6f3d4d10685cd004b6dccf98a14d50f28
2024-10-18 18:32:59 +05:30
Volodymyr Zhdanov
5d67ff3cd4 veux: Build IR HAL from source
Change-Id: I619157582ece00d6fb7adef00182347211716706
2024-10-18 18:32:59 +05:30
Volodymyr Zhdanov
ae32235d4b veux: Build IPACM from source
Change-Id: Id40cea7059316370fc18dfbdb9e00b5b84f28b10
2024-10-18 18:32:59 +05:30
Giovanni Ricca
f9eeaacf67 veux: Build common iFAA service
Change-Id: Ib777523cbb3cbc29086c8f6ef3cc0c31d49b9405
2024-10-18 18:32:59 +05:30
Christian Oder
6ce96a5e61 veux: Add basic permission file for HotwordEnrollment
Change-Id: I2986ba3599fe65a8da27649d98d70cd548257aa8
2024-10-18 18:32:59 +05:30
Alexander Koskovich
407d743bd5 veux: Build vendor HIDL transport and HWBinder libraries
* Both these libraries are still widely used by QTI
   binaries & libraries.

Change-Id: Ib7a4576577426ffaf557ba8b9b4ca52573285fef
2024-10-18 18:32:59 +05:30
Alexander Koskovich
d0e78513ee veux: Build the QTI health HAL
Change-Id: I86abeb45119d1cdf05dfb1fd28090628cee64925
2024-10-18 18:32:59 +05:30
Alexander Winkowski
1605d50a5d veux: Build GNSS HAL from source
Change-Id: I92f2767976ff9cd70effd884d7c0fe22dde56a9e
2024-10-18 18:32:59 +05:30
Alexander Winkowski
6c767ce374 veux: gps: Enable lowi-server
To match Pixel setup.

Change-Id: I60097ef00debd3bcddb03d4e95c220d166d2a5de
2024-10-18 18:32:59 +05:30
Michael Bestas
fc179be7dc veux: gps: Disable unused location services
Disable xtwifi & slim_daemon, matching Pixel setup.

Change-Id: I27156e772ef138c9b2e112469c264236ea5c398c
2024-10-18 18:32:59 +05:30
Alexander Winkowski
6d4e4bcf24 veux: gps: Import izat.conf
From V14.0.3.0.TKCMIXM

Change-Id: I0d8a94672a011458d713e190a8e121f7ceb320ec
2024-10-18 18:32:59 +05:30
Michael Bestas
6d5dfe2612 veux: gps: Remove all Wno-error flags
Almost all warnings/errors have been fixed.
Ignore undefined bool conversion error on purpose.

Change-Id: I00cb5f38711fa9f873da030fc6a0ebc6cde3ceeb
2024-10-18 18:32:59 +05:30
Yi Kong
43c91cd373 veux: 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
2024-10-18 18:32:59 +05:30
Madhanraj Chelladurai
9dcddf4d06 veux: 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
2024-10-18 18:32:59 +05:30
Albert I
cb8f989f32 veux: 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
2024-10-18 18:32:59 +05:30
Albert I
087eb376cc veux: gps: Address logical-op-parentheses warning
Change-Id: I45d621a2b995afeb7757df3f89614a0d95552f33
2024-10-18 18:32:59 +05:30
Albert I
eba96e191d veux: 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
2024-10-18 18:32:59 +05:30
Pirama Arumuga Nainar
d4828721cf veux: gps: Fix -Wbitwise-instead-of-logical
Bug: http://b/215753485

Reported by clang-r445002

error: use of bitwise '|' with boolean operands [-Werro
r,-Wbitwise-instead-of-logical]

  if (gnssCbIface != nullptr || gnssCbIface_2_0 != nullptr| gnssCbIface_2_1 != nullptr) {
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                          ||

Test: build with clang-r445002
Change-Id: I9410eb5208227dd70bd036aee02fb2aeb912f266
Merged-In: I9410eb5208227dd70bd036aee02fb2aeb912f266
2024-10-18 18:32:59 +05:30
Michael Bestas
e7cd05c266 veux: gps: Lower debug level
* Kill logcat spam

Change-Id: I20d1f698d3c2d1b56e79f6eb6c5c17069e43c60f
2024-10-18 18:32:59 +05:30
Michael Bestas
6f1d76d781 veux: gps: Resolve unused parameter warnings
Change-Id: I0acef3da2c3567a28edd0a71dac89a5828f7725d
2024-10-18 18:32:59 +05:30
Alexander Winkowski
0ae6746228 veux: Import GPS HAL from LA.UM.9.14.r1-19100-LAHAINA.0
Cleaned up with commands:

rm -rf android/{1.*,2.0}/
rm -rf etc/seccomp_policy/
rm gps_vendor_*
find \( -name Makefile.am -o -name configure.ac -o -name '*.pc.in' \) -exec rm {} \;

Change-Id: If82619231c1a6d6eaa39adf9af94f341b8654320
2024-10-18 18:32:59 +05:30
Alexander Winkowski
96a83cbe71 veux: Build FM2 app
Change-Id: I6ff5a9352c5a2723e8850d1006707cad2458cfe0
2024-10-18 18:32:59 +05:30
Giovanni Ricca
ee62b64217 veux: Build Goodix interface from source
Change-Id: Ibaf1b9489b509318032c720c9c83e315cfe6ab3e
2024-10-18 18:32:59 +05:30
Giovanni Ricca
dabf45b58c veux: Build FPC interface from source
Change-Id: I80dd66139d1e53873beb14f7937cbfb721e582ca
2024-10-18 18:32:59 +05:30
Alexander Winkowski
c95e5f57c5 veux: Build Xiaomi common fingerprint service
Change-Id: Ie78d7d44630256162e41f1b22d22252e3377798b
2024-10-18 18:32:59 +05:30
Demon000
c3a4466d97 veux: Build fastbootd
Change-Id: I1056d3ed331c1590dce00f980bc78c6a5e23a799
2024-10-18 18:32:59 +05:30
Robert Shih
8ed4ca9d5d veux: enable AIDL DRM HALs
Bug: 219538389
Test: atest GtsMediaTestCases
Change-Id: I431554dcbef014f8235f048ee062a218a2131f9c
2024-10-18 18:32:59 +05:30
Alexander Winkowski
8d6d6ddcee veux: configs: Pull brightness configs from lynx
Change-Id: Ic58fb5a638c290e68633d9716be9bf907841f0af
2024-10-18 18:32:59 +05:30
Alexander Winkowski
77ad293d2f veux: Import display config from V14.0.6.0.TKCMIXM
Change-Id: I7017b425c091a7ae67adb0e6e9509f49dd314442
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
1fcf03fad5 veux: Build display stack
Change-Id: I8aa97b9847fd49fb1bebd35f8193aefa7e8997e1
2024-10-18 18:32:59 +05:30
P.Adarsh Reddy
050ca79fa0 veux: Enforce android-S new launch debugfs restrictions
Change-Id: I78878e1c4177c07d66b13e5659d4360252c5f87b
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
194b9ab923 veux: Build camera libs
Change-Id: I9b5d730c54018614c8e28a946a1d234663339b0c
2024-10-18 18:32:59 +05:30
LuK1337
921a54460d veux: Build QTI bootctrl HAL
Change-Id: I1e907c64ee4f88507bac78afe56e8fba0310f6d1
2024-10-18 18:32:59 +05:30
Cosmin Tanislav
3bb275d8e7 veux: gpt-utils: add system_ext and product to AB_PTN_LIST
Change-Id: I8d570695ed9d00c0b28f0e299ae11a61899d4dc9
2024-10-18 18:32:59 +05:30
Cosmin Tanislav
1dfe38c7cb veux: gpt-utils: add vbmeta_system to PTN_SWAP_LIST
Change-Id: Icbc04d6f326a7852a407835169cfc9e3066fb7ac
2024-10-18 18:32:59 +05:30
Luofan Chen
52a0bff2ef veux: gpt-utils: Check ufs device first before checking partition names
Change-Id: I51663ff8e074681191ac708fcd7b4d28e890deaf
2024-10-18 18:32:59 +05:30
Siddeswar Aluganti
72dada0c4c veux: gpt-utils: Add OTA handling for new partitions
Add new partitions to list of partitions needed for A/B update handling.

Change-Id: I9e1ad1b2d08730a0ab18728b5919c35ff5b6bc44
CRs-Fixed:: 2877573
2024-10-18 18:32:59 +05:30
Siddeswar Aluganti
2b2e4f1455 veux: gpt-utils: Update PTN_SWAP_LIST and handle multiimg(oem/qti)
* Update PTN_SWAP_LIST to reflect partition entry changes
   to BOOT LUN and handle "multiimgoem", "multiimgqti"
   partitions, similar to other BOOT LUN partitions.

Change-Id: I3fb2934c44f3c2555ef36437ae97c9a47bb874ed
2024-10-18 18:32:59 +05:30
LuK1337
49106a1f42 veux: gpt-utils: Fix build errors
Change-Id: Ie8245d1637e12b5979a8af1b864cc713135b5c95
2024-10-18 18:32:59 +05:30
LuK1337
08d39ee1c9 veux: gpt-utils: Drop unnecessary include
* When using generated_kernel_headers including
   stdio.h will cause errors due to redefined macros.

Change-Id: I2f753a64f760b636be1325873e17697466fbf33d
2024-10-18 18:32:59 +05:30
LuK1337
e0ca079412 veux: gpt-utils: Drop unnecessary include
* When using generated_kernel_headers including
   asm/byteorder.h will cause a warning due to
   unused static functions.

Change-Id: I2a74ec92487c13c4645048c96da8cb92b3cbd9f0
2024-10-18 18:32:59 +05:30
Tao Bao
aadffacfcf veux: gpt-utils: Address the warnings
[ 11% 2/18] target  C++: libgptutils <= device/google/crosshatch/gpt-utils/gpt-utils.cpp
In file included from device/google/crosshatch/gpt-utils/gpt-utils.cpp:54:
system/core/libcutils/include_vndk/cutils/log.h:38:2: warning: "Deprecated: don't include cutils/log.h, use either android/log.h or log/log.h" [-W#warnings]
 ^
device/google/crosshatch/gpt-utils/gpt-utils.cpp:750:17: warning: unused variable 'ufs_dir_stat' [-Wunused-variable]
    struct stat ufs_dir_stat;
                ^
device/google/crosshatch/gpt-utils/gpt-utils.cpp:973:13: warning: unused variable 'r' [-Wunused-variable]
        int r, fd;
            ^
device/google/crosshatch/gpt-utils/gpt-utils.cpp:973:16: warning: unused variable 'fd' [-Wunused-variable]
        int r, fd;
               ^
4 warnings generated.

Test: lunch blueline-userdebug && m -j libgptutils
Change-Id: Idd9174276d8a5b7b77c2ec48c745a78184f65fcf
2024-10-18 18:32:59 +05:30
Alexander Koskovich
629583b946 veux: Import gpt-utils from LA.UM.9.14.r1-19800.01-LAHAINA.QSSI12.0
Change-Id: I92baccc0524f88dcb439095288ac75fbc1401ae7
2024-10-18 18:32:59 +05:30
Sebastiano Barezzi
bd4ee70c2e veux: Build bluetooth libs
Change-Id: I999905b2b7a0f7fe8f808e88c7ab428f1d50b263
2024-10-18 18:32:59 +05:30
iovxw
cd23f682dc veux: Remove FM Tuner from audio input devices
* This fixes google voice recorder

Change-Id: Id90fc9ac1ad24b5d439592aecfdf4f8912893935
2024-10-18 18:32:58 +05:30
llololo
733dcdc4d0 veux: Remove A2DP input module in audio policy configuration
No Pixel device support A2DP sink functionality.

Bug: 163050296
Test: A2DP related test.
Change-Id: I269220cf29451ea79362fc004fa073713f72fdb2
2024-10-18 18:32:58 +05:30
dianlujitao
7ef0445510 veux: audio: Enable AOSP bluetooth audio HAL v2
Change-Id: I4d12752ae5fb2829d6612647c8740c84967f5434
2024-10-18 18:32:58 +05:30
LuK1337
a03b2d959e veux: audio: Don't advertise vorbis offloading support
* Doesn't work at all.

Change-Id: I8cd6341b240c3820dbbdef497e23e785b6ed99dc
2024-10-18 18:32:58 +05:30
Alexander Winkowski
291564c5d2 veux: Import audio configs from V14.0.6.0.TKCMIXM
* Use generic configs when possible

* Audio policy configuration from /vendor/etc/audio
  (identified by running dumpsys media.audio_policy on stock ROM)

* Mixer paths and sound_trigger configs from /vendor/etc

* audio_tuning_mixer.txt is copied to /vendor/etc
  because this is the only path libacdbloader supports

* Other configs from /vendor/etc/audio/sku_holi

* audio_policy_volumes.xml was edited to be compatible with AOSP

Change-Id: I424b4df55add814d29e713497f7f323766b8b72b
2024-10-18 18:32:58 +05:30
Bruno Martins
fdac214ce8 veux: Build opensource soundtrigger HAL
Change-Id: I956d53a67841a9e1e296de6b73f08ef2efac7470
2024-10-18 18:32:58 +05:30
Sebastiano Barezzi
45718b5282 veux: Build audio stack
Change-Id: Id1e28604c0c83093e309656a2059c517084984f5
2024-10-18 18:32:58 +05:30
Demon000
df39af87df veux: Include QCOM SEPolicy
Change-Id: Iaf54a187cda5e6921b791031fa2132a91a62d184
2024-10-18 18:32:58 +05:30
Demon000
364effd2ac veux: Define vendor RIL service usage
This can be checked by looking for a rild service in system.
If it's missing, then a vendor ril service is being used, in
our case, it is qcrild.

Change-Id: I5378de6eec4ff2511a49c19c0fc474658efe338f
2024-10-18 18:32:58 +05:30
Alexander Winkowski
f5dbac551c veux: Add recovery flags
Change-Id: I3def36bfc0644fae2c94531aecc5831bf389a8f9
2024-10-18 18:32:58 +05:30
Alexander Winkowski
ebff9b029f veux: Add platform flags
Change-Id: I4b583a43f133293dfee20d093aa0c0e5b17b2769
2024-10-18 18:32:58 +05:30
Alexander Winkowski
5b6cc27718 veux: Add partition flags
Change-Id: Iab108c3b116a0ab76d0ad33a3d32ea9a3a1931ba
2024-10-18 18:32:58 +05:30
Leo Liou
f989d3e54b veux: Inherit the virtual A/B config
For devices launching with virtual A/B, inherit the virtual A/B
device base configuration.

Bug: 146466421
Test: Build and boot & manual OTA.
Change-Id: I752178c2525335b3cebafa0254c077d93831b8ba
2024-10-18 18:32:58 +05:30
Alexander Winkowski
b5389a984f veux: Add kernel flags
Based on boot.img and vendor_boot.img from V14.0.6.0.TKCMIXM

Change-Id: I75c18ca39d3377eac10029b9bc20e6bc632c5020
2024-10-18 18:32:58 +05:30
323 changed files with 85029 additions and 118 deletions

View File

@@ -5,4 +5,17 @@
//
soong_namespace {
imports: [
"hardware/lineage/interfaces/power-libperfmgr",
"hardware/qcom-caf/bootctrl",
"hardware/qcom-caf/common/libqti-perfd-client",
"hardware/xiaomi",
],
}
install_symlink {
name: "firmware_WCNSS_qcom_cfg.ini_symlink",
vendor: true,
installed_location: "firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini",
symlink_target: "/vendor/etc/wifi/WCNSS_qcom_cfg.ini",
}

View File

@@ -31,63 +31,4 @@ $(DSP_MOUNT_POINT): $(LOCAL_INSTALLED_MODULE)
ALL_DEFAULT_INSTALLED_MODULES += $(FIRMWARE_MOUNT_POINT) $(BT_FIRMWARE_MOUNT_POINT) $(DSP_MOUNT_POINT)
RFS_MSM_ADSP_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/adsp/
$(RFS_MSM_ADSP_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM ADSP folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/lpass $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/adsp $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware
RFS_MSM_CDSP_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/cdsp/
$(RFS_MSM_CDSP_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM CDSP folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/cdsp $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/cdsp $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware
RFS_MSM_MPSS_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/mpss/
$(RFS_MSM_MPSS_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM MPSS folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/modem $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/mpss $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware
RFS_MSM_SLPI_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/slpi/
$(RFS_MSM_SLPI_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM SLPI folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/slpi $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/slpi $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware
ALL_DEFAULT_INSTALLED_MODULES += $(RFS_MSM_ADSP_SYMLINKS) $(RFS_MSM_CDSP_SYMLINKS) $(RFS_MSM_MPSS_SYMLINKS) $(RFS_MSM_SLPI_SYMLINKS)
WIFI_FIRMWARE_SYMLINKS := $(TARGET_OUT_VENDOR)/firmware/wlan/qca_cld/
$(WIFI_FIRMWARE_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating WiFi firmware symlinks: $@"
@rm -rf $@/*
mkdir -p $(dir $@)
$(hide) ln -sf /vendor/etc/wifi/WCNSS_qcom_cfg.ini $@/WCNSS_qcom_cfg.ini
ALL_DEFAULT_INSTALLED_MODULES += $(WIFI_FIRMWARE_SYMLINKS)
endif

View File

@@ -9,6 +9,20 @@ DEVICE_PATH := device/xiaomi/veux
BUILD_BROKEN_DUP_RULES := true
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true
# A/B
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS := \
boot \
dtbo \
odm \
product \
system \
system_ext \
vbmeta \
vbmeta_system \
vendor \
vendor_boot
# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-2a-dotprod
@@ -21,6 +35,18 @@ TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a55
# Audio
AUDIO_FEATURE_ENABLED_DLKM := true
AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
AUDIO_FEATURE_ENABLED_GEF_SUPPORT := true
AUDIO_FEATURE_ENABLED_GKI := true
AUDIO_FEATURE_ENABLED_INSTANCE_ID := true
AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := true
BOARD_SUPPORTS_OPENSOURCE_STHAL := true
BOARD_SUPPORTS_SOUND_TRIGGER := true
BOARD_USES_ALSA_AUDIO := true
# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := veux
TARGET_NO_BOOTLOADER := true
@@ -34,9 +60,14 @@ TARGET_SCREEN_DENSITY := 440
# Filesystem
TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/config.fs
# GNSS
BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default
LOC_HIDL_VERSION := 4.0
# HIDL
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
hardware/qcom-caf/common/vendor_framework_compatibility_matrix.xml \
hardware/xiaomi/vintf/xiaomi_framework_compatibility_matrix.xml \
$(DEVICE_PATH)/device_framework_matrix.xml
DEVICE_MANIFEST_FILE := \
@@ -44,3 +75,145 @@ DEVICE_MANIFEST_FILE := \
DEVICE_MATRIX_FILE := \
$(DEVICE_PATH)/compatibility_matrix.xml
ODM_MANIFEST_SKUS += \
sn100
ODM_MANIFEST_SN100_FILES := \
$(DEVICE_PATH)/manifest_ese.xml
# Kernel
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_IMAGE_NAME := Image
BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_SEPARATED_DTBO := true
BOARD_BOOT_HEADER_VERSION := 3
BOARD_MKBOOTIMG_ARGS := --header_version $(BOARD_BOOT_HEADER_VERSION)
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
BOARD_RAMDISK_USE_LZ4 := true
BOARD_USES_GENERIC_KERNEL_IMAGE := true
BOARD_KERNEL_CMDLINE := \
console=ttyMSM0,115200n8 \
earlycon=msm_geni_serial,0x04C8C000 \
androidboot.hardware=qcom \
androidboot.console=ttyMSM0 \
androidboot.memcg=1 \
lpm_levels.sleep_disabled=1 \
video=vfb:640x400,bpp=32,memsize=3072000 \
msm_rtb.filter=0x237 \
service_locator.enable=1 \
androidboot.usbcontroller=4e00000.dwc3 \
swiotlb=0 \
loop.max_part=7 \
cgroup.memory=nokmem,nosocket \
iptable_raw.raw_before_defrag=1 \
ip6table_raw.raw_before_defrag=1 \
firmware_class.path=/vendor/firmware
TARGET_KERNEL_CONFIG := veux_defconfig
TARGET_KERNEL_SOURCE := kernel/xiaomi/sm6375
TARGET_KERNEL_NO_GCC := true
# Lineage Health
TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS := false
# OTA assert
TARGET_OTA_ASSERT_DEVICE := peux,veux
# Partitions
BOARD_BOOTIMAGE_PARTITION_SIZE := 134217728
BOARD_DTBOIMG_PARTITION_SIZE := 8388608
BOARD_SUPER_PARTITION_SIZE := 9126805504
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 100663296
BOARD_FLASH_BLOCK_SIZE := 131072
BOARD_USES_METADATA_PARTITION := true
BOARD_VEUX_DYNAMIC_PARTITIONS_PARTITION_LIST := odm product system system_ext vendor
BOARD_VEUX_DYNAMIC_PARTITIONS_SIZE := 9122611200 # BOARD_SUPER_PARTITION_SIZE - 4MB
BOARD_SUPER_PARTITION_GROUPS := veux_dynamic_partitions
BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
ifneq ($(WITH_GMS),true)
BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT := -1
BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE := 1073741824
BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT := -1
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 1073741824
BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT := -1
BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE := 1073741824
else
BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE := 25165824
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 25165824
BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE := 25165824
endif
BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE := 25165824
BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE := 25165824
TARGET_COPY_OUT_ODM := odm
TARGET_COPY_OUT_PRODUCT := product
TARGET_COPY_OUT_SYSTEM_EXT := system_ext
TARGET_COPY_OUT_VENDOR := vendor
# Platform
BOARD_USES_QCOM_HARDWARE := true
BOARD_VENDOR := xiaomi
TARGET_BOARD_PLATFORM := holi
# Properties
TARGET_ODM_PROP += $(DEVICE_PATH)/configs/properties/odm.prop
TARGET_PRODUCT_PROP += $(DEVICE_PATH)/configs/properties/product.prop
TARGET_SYSTEM_EXT_PROP += $(DEVICE_PATH)/configs/properties/system_ext.prop
TARGET_SYSTEM_PROP += $(DEVICE_PATH)/configs/properties/system.prop
TARGET_VENDOR_PROP += $(DEVICE_PATH)/configs/properties/vendor.prop
# Recovery
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT := true
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/rootdir/etc/fstab.default
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_USERIMAGES_USE_F2FS := true
# RIL
ENABLE_VENDOR_RIL_SERVICE := true
# Security patch
BOOT_SECURITY_PATCH := 2024-10-01
VENDOR_SECURITY_PATCH := $(BOOT_SECURITY_PATCH)
# SELinux
include device/qcom/sepolicy_vndr/SEPolicy.mk
include vendor/xiaomi/miuicamera-veux/SEPolicy-veux.mk
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/private
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/public
BOARD_VENDOR_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
# Verified Boot
BOARD_AVB_ENABLE := true
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3
BOARD_AVB_VBMETA_SYSTEM := product system system_ext
BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA4096
BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 2
# WiFi
BOARD_WLAN_DEVICE := qcwcn
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
BOARD_WPA_SUPPLICANT_PRIVATE_LIB_EVENT := "ON"
QC_WIFI_HIDL_FEATURE_DUAL_AP := true
WIFI_DRIVER_DEFAULT := qca_cld3
WIFI_DRIVER_STATE_CTRL_PARAM := "/dev/wlan"
WIFI_DRIVER_STATE_OFF := "OFF"
WIFI_DRIVER_STATE_ON := "ON"
WIFI_HIDL_FEATURE_AWARE := true
WIFI_HIDL_FEATURE_DUAL_INTERFACE := true
WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY := true
WPA_SUPPLICANT_VERSION := VER_0_8_X

View File

@@ -1,9 +1,24 @@
# Device configuration for Redmi Note 11 Pro 5G
# Device Tree for POCO X4 Pro 5G/Redmi Note 11E Pro/Redmi Note 11 Pro 5G/Redmi Note 11 Pro+ 5G (peux/veux)
```
#
# Copyright (C) 2023-2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
```
## Spec Sheet
| Feature | Specification |
| :--------------- | :-------------------------------------------------------------- |
| CPU | Octa-core (2x2.2 GHz Kryo 660 Gold & 6x1.7 GHz Kryo 660 Silver) |
| Chipset | Qualcomm SM6375 Snapdragon 695G (6 nm) |
| GPU | Adreno 619 |
| Memory | 6 GB / 8 GB |
| Shipped Software | Android 11, MIUI 13 |
| Storage | 128 GB / 256 GB |
| Battery | 5000 mAh |
| Dimensions | 165.1 x 76.4 x 9.3 mm (6.5 x 3.01 x 0.37 in) |
| Display | 6.67 inches, 107.4 cm2 (~86.0% screen-to-body ratio) |
| Rear Camera | 108 MP, f/1.9, 26mm (wide), 1/1.52", 0.7µm, PDAF |
| | 8 MP, f/2.2, 118˚ (ultrawide) |
| | 2 MP, f/2.4, (macro) |
| Front Camera | 16 MP, f/2.5, (wide), 1/3.06" 1.0µm |
| Release Date | February 2022 |
## Device Picture
![POCO X4 Pro 5G/Redmi Note 11E Pro/Redmi Note 11 Pro 5G/Redmi Note 11 Pro+ 5G](https://i.ibb.co/4syxpfw/330608dc148bfa50f6326d996d6c8e8b.png "POCO X4 Pro 5G/Redmi Note 11E Pro/Redmi Note 11 Pro 5G/Redmi Note 11 Pro+ 5G")

49
RemovePackages/Android.mk Normal file
View File

@@ -0,0 +1,49 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := RemovePackages
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_OVERRIDES_PACKAGES := \
AmbientSensePrebuilt \
Aperture \
arcore \
Chrome \
Chrome-Stub \
ConnMO \
ConnMetrics \
DCMO \
DevicePolicyPrebuilt \
DMService \
GCS \
GoogleTTS \
Maps \
MyVerizonServices \
OBDM_Permissions \
obdm_stub \
OdadPrebuilt \
OemDmTrigger \
OPScreenRecord \
Ornament \
PixelBuds \
PixelLiveWallpaperPrebuilt \
RecorderPrebuilt \
SafetyHubPrebuilt \
SCONE \
ScribePrebuilt \
Showcase \
SoundAmplifierPrebuilt \
SprintDM \
SprintHM \
Tycho \
USCCDM \
Via \
Videos \
VZWAPNLib \
VzwOmaTrigger \
YouTube \
YouTubeMusicPrebuilt
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := /dev/null
include $(BUILD_PREBUILT)

367
audio/audio_effects.conf Normal file
View File

@@ -0,0 +1,367 @@
# List of effect libraries to load. Each library element must contain a "path" element
# giving the full path of the library .so file.
# libraries {
# <lib name> {
# path <lib path>
# }
# }
libraries {
bundle {
path /vendor/lib/soundfx/libbundlewrapper.so
}
reverb {
path /vendor/lib/soundfx/libreverbwrapper.so
}
qcbassboost {
path /vendor/lib/soundfx/libqcbassboost.so
}
qcvirt {
path /vendor/lib/soundfx/libqcvirt.so
}
qcreverb {
path /vendor/lib/soundfx/libqcreverb.so
}
visualizer_sw {
path /vendor/lib/soundfx/libvisualizer.so
}
visualizer_hw {
path /vendor/lib/soundfx/libqcomvisualizer.so
}
downmix {
path /vendor/lib/soundfx/libdownmix.so
}
loudness_enhancer {
path /vendor/lib/soundfx/libldnhncr.so
}
dynamics_processing {
path /vendor/lib/soundfx/libdynproc.so
}
proxy {
path /vendor/lib/soundfx/libeffectproxy.so
}
offload_bundle {
path /vendor/lib/soundfx/libqcompostprocbundle.so
}
audio_pre_processing {
path /vendor/lib/soundfx/libqcomvoiceprocessing.so
}
volume_listener {
path /vendor/lib/soundfx/libvolumelistener.so
}
audiosphere {
path /vendor/lib/soundfx/libasphere.so
}
shoebox {
path /vendor/lib/soundfx/libshoebox.so
}
}
# Default pre-processing library. Add to audio_effect.conf "libraries" section if
# audio HAL implements support for default software audio pre-processing effects
#
# pre_processing {
# path /vendor/lib/soundfx/libaudiopreprocessing.so
# }
# list of effects to load. Each effect element must contain a "library" and a "uuid" element.
# The value of the "library" element must correspond to the name of one library element in the
# "libraries" element.
# The name of the effect element is indicative, only the value of the "uuid" element
# designates the effect.
# The uuid is the implementation specific UUID as specified by the effect vendor. This is not the
# generic effect type UUID.
# effects {
# <fx name> {
# library <lib name>
# uuid <effect uuid>
# }
# ...
# }
effects {
# additions for the proxy implementation
# Proxy implementation
#effectname {
#library proxy
#uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# SW implemetation of the effect. Added as a node under the proxy to
# indicate this as a sub effect.
#libsw {
#library libSW
#uuid yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
#} End of SW effect
# HW implementation of the effect. Added as a node under the proxy to
# indicate this as a sub effect.
#libhw {
#library libHW
#uuid zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
#}End of HW effect
#} End of effect proxy
bassboost {
library proxy
uuid 14804144-a5ee-4d24-aa88-0002a5d5c51b
libsw {
library qcbassboost
uuid 23aca180-44bd-11e2-bcfd-0800200c9a66
}
libhw {
library offload_bundle
uuid 2c4a8c24-1581-487f-94f6-0002a5d5c51b
}
}
virtualizer {
library proxy
uuid d3467faa-acc7-4d34-acaf-0002a5d5c51b
libsw {
library qcvirt
uuid e6c98a16-22a3-11e2-b87b-f23c91aec05e
}
libhw {
library offload_bundle
uuid 509a4498-561a-4bea-b3b1-0002a5d5c51b
}
}
equalizer {
library proxy
uuid c8e70ecd-48ca-456e-8a4f-0002a5d5c51b
libsw {
library bundle
uuid ce772f20-847d-11df-bb17-0002a5d5c51b
}
libhw {
library offload_bundle
uuid a0dac280-401c-11e3-9379-0002a5d5c51b
}
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library proxy
uuid 48404ac9-d202-4ccc-bf84-0002a5d5c51b
libsw {
library qcreverb
uuid a8c1e5f3-293d-43cd-95ec-d5e26c02e217
}
libhw {
library offload_bundle
uuid 79a18026-18fd-4185-8233-0002a5d5c51b
}
}
reverb_env_ins {
library proxy
uuid b707403a-a1c1-4291-9573-0002a5d5c51b
libsw {
library qcreverb
uuid 791fff8b-8129-4655-83a4-59bc61034c3a
}
libhw {
library offload_bundle
uuid eb64ea04-973b-43d2-8f5e-0002a5d5c51b
}
}
reverb_pre_aux {
library proxy
uuid 1b78f587-6d1c-422e-8b84-0002a5d5c51b
libsw {
library qcreverb
uuid 53ef1db5-c0c0-445b-b060-e34d20ebb70a
}
libhw {
library offload_bundle
uuid 6987be09-b142-4b41-9056-0002a5d5c51b
}
}
reverb_pre_ins {
library proxy
uuid f3e178d2-ebcb-408e-8357-0002a5d5c51b
libsw {
library qcreverb
uuid b08a0e38-22a5-11e2-b87b-f23c91aec05e
}
libhw {
library offload_bundle
uuid aa2bebf6-47cf-4613-9bca-0002a5d5c51b
}
}
visualizer {
library proxy
uuid 1d0a1a53-7d5d-48f2-8e71-27fbd10d842c
libsw {
library visualizer_sw
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
libhw {
library visualizer_hw
uuid 7a8044a0-1a71-11e3-a184-0002a5d5c51b
}
}
downmix {
library downmix
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
}
hw_acc {
library offload_bundle
uuid 7d1580bd-297f-4683-9239-e475b6d1d69f
}
loudness_enhancer {
library loudness_enhancer
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
}
dynamics_processing {
library dynamics_processing
uuid e0e6539b-1781-7261-676f-6d7573696340
}
aec {
library audio_pre_processing
uuid 0f8d0d2a-59e5-45fe-b6e4-248c8a799109
}
ns {
library audio_pre_processing
uuid 1d97bb0b-9e2f-4403-9ae3-58c2554306f8
}
music_helper {
library volume_listener
uuid 08b8b058-0590-11e5-ac71-0025b32654a0
}
ring_helper {
library volume_listener
uuid 0956df94-0590-11e5-bdbe-0025b32654a0
}
alarm_helper {
library volume_listener
uuid 09f303e2-0590-11e5-8fdb-0025b32654a0
}
# voice_helper is called when stream type is voice_call in VoIP usecase
voice_helper {
library volume_listener
uuid 0ace5c08-0590-11e5-ae9e-0025b32654a0
}
notification_helper {
library volume_listener
uuid 0b776dde-0590-11e5-81ba-0025b32654a0
}
audiosphere {
library audiosphere
uuid 184e62ab-2d19-4364-9d1b-c0a40733866c
}
shoebox {
library shoebox
uuid 1eab784c-1a36-4b2a-b7fc-e34c44cab89e
}
}
# additional effect from vendor
# UUID generated using version 1
output_session_processing {
music {
music_helper {
}
}
ring {
ring_helper {
}
}
alarm {
alarm_helper {
}
}
# stream type voice_call is used for VoIP call
voice_call {
voice_helper {
}
}
notification {
notification_helper {
}
}
}
# Added aec, ns effects for voice_communication, which are supported by the board
pre_processing {
voice_communication {
aec {
}
ns {
}
}
}
# Default pre-processing effects. Add to audio_effect.conf "effects" section if
# audio HAL implements support for them.
#
# agc {
# library pre_processing
# uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
# }
# aec {
# library pre_processing
# uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b
# }
# ns {
# library pre_processing
# uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b
# }
# Audio preprocessor configurations.
# The pre processor configuration consists in a list of elements each describing
# pre processor settings for a given input source. Valid input source names are:
# "mic", "camcorder", "voice_recognition", "voice_communication"
# Each input source element contains a list of effects elements. The name of the effect
# element must be the name of one of the effects in the "effects" list of the file.
# Each effect element may optionally contain a list of parameters and their
# default value to apply when the pre processor effect is created.
# A parameter is defined by a "param" element and a "value" element. Each of these elements
# consists in one or more elements specifying a type followed by a value.
# The types defined are: "int", "short", "float", "bool" and "string"
# When both "param" and "value" are a single int, a simple form is allowed where just
# the param and value pair is present in the parameter description
# pre_processing {
# <input source name> {
# <fx name> {
# <param 1 name> {
# param {
# int|short|float|bool|string <value>
# [ int|short|float|bool|string <value> ]
# ...
# }
# value {
# int|short|float|bool|string <value>
# [ int|short|float|bool|string <value> ]
# ...
# }
# }
# <param 2 name > {<param> <value>}
# ...
# }
# ...
# }
# ...
# }
#
# TODO: add default audio pre processor configurations after debug and tuning phase
#

122
audio/audio_effects.xml Normal file
View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--- Copyright (c) 2018-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 -->
<!--- 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. -->
<audio_effects_conf version="2.0" xmlns="http://schemas.android.com/audio/audio_effects_conf/v2_0">
<libraries>
<library name="bundle" path="libbundlewrapper.so"/>
<library name="reverb" path="libreverbwrapper.so"/>
<library name="qcbassboost" path="libqcbassboost.so"/>
<library name="qcvirt" path="libqcvirt.so"/>
<library name="qcreverb" path="libqcreverb.so"/>
<library name="visualizer_sw" path="libvisualizer.so"/>
<library name="visualizer_hw" path="libqcomvisualizer.so"/>
<library name="spatializer" path="libspatialaudio.so"/>
<library name="downmix" path="libdownmix.so"/>
<library name="loudness_enhancer" path="libldnhncr.so"/>
<library name="dynamics_processing" path="libdynproc.so"/>
<library name="proxy" path="libeffectproxy.so"/>
<library name="offload_bundle" path="libqcompostprocbundle.so"/>
<library name="audio_pre_processing" path="libqcomvoiceprocessing.so"/>
<library name="volume_listener" path="libvolumelistener.so"/>
<library name="audiosphere" path="libasphere.so"/>
<library name="shoebox" path="libshoebox.so"/>
</libraries>
<effects>
<effectProxy name="bassboost" library="proxy" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
<libsw library="qcbassboost" uuid="23aca180-44bd-11e2-bcfd-0800200c9a66"/>
<libhw library="offload_bundle" uuid="2c4a8c24-1581-487f-94f6-0002a5d5c51b"/>
</effectProxy>
<effectProxy name="virtualizer" library="proxy" uuid="d3467faa-acc7-4d34-acaf-0002a5d5c51b">
<libsw library="qcvirt" uuid="e6c98a16-22a3-11e2-b87b-f23c91aec05e"/>
<libhw library="offload_bundle" uuid="509a4498-561a-4bea-b3b1-0002a5d5c51b"/>
</effectProxy>
<effectProxy name="equalizer" library="proxy" uuid="c8e70ecd-48ca-456e-8a4f-0002a5d5c51b">
<libsw library="bundle" uuid="ce772f20-847d-11df-bb17-0002a5d5c51b"/>
<libhw library="offload_bundle" uuid="a0dac280-401c-11e3-9379-0002a5d5c51b"/>
</effectProxy>
<effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
<effectProxy name="reverb_env_aux" library="proxy" uuid="48404ac9-d202-4ccc-bf84-0002a5d5c51b">
<libsw library="qcreverb" uuid="a8c1e5f3-293d-43cd-95ec-d5e26c02e217"/>
<libhw library="offload_bundle" uuid="79a18026-18fd-4185-8233-0002a5d5c51b"/>
</effectProxy>
<effectProxy name="reverb_env_ins" library="proxy" uuid="b707403a-a1c1-4291-9573-0002a5d5c51b">
<libsw library="qcreverb" uuid="791fff8b-8129-4655-83a4-59bc61034c3a"/>
<libhw library="offload_bundle" uuid="eb64ea04-973b-43d2-8f5e-0002a5d5c51b"/>
</effectProxy>
<effectProxy name="reverb_pre_aux" library="proxy" uuid="1b78f587-6d1c-422e-8b84-0002a5d5c51b">
<libsw library="qcreverb" uuid="53ef1db5-c0c0-445b-b060-e34d20ebb70a"/>
<libhw library="offload_bundle" uuid="6987be09-b142-4b41-9056-0002a5d5c51b"/>
</effectProxy>
<effectProxy name="reverb_pre_ins" library="proxy" uuid="f3e178d2-ebcb-408e-8357-0002a5d5c51b">
<libsw library="qcreverb" uuid="b08a0e38-22a5-11e2-b87b-f23c91aec05e"/>
<libhw library="offload_bundle" uuid="aa2bebf6-47cf-4613-9bca-0002a5d5c51b"/>
</effectProxy>
<effectProxy name="visualizer" library="proxy" uuid="1d0a1a53-7d5d-48f2-8e71-27fbd10d842c">
<libsw library="visualizer_sw" uuid="d069d9e0-8329-11df-9168-0002a5d5c51b"/>
<libhw library="visualizer_hw" uuid="7a8044a0-1a71-11e3-a184-0002a5d5c51b"/>
</effectProxy>
<effect name="downmix" library="downmix" uuid="93f04452-e4fe-41cc-91f9-e475b6d1d69f"/>
<effect name="hw_acc" library="offload_bundle" uuid="7d1580bd-297f-4683-9239-e475b6d1d69f"/>
<effect name="loudness_enhancer" library="loudness_enhancer" uuid="fa415329-2034-4bea-b5dc-5b381c8d1e2c"/>
<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="music_helper" library="volume_listener" uuid="08b8b058-0590-11e5-ac71-0025b32654a0"/>
<effect name="ring_helper" library="volume_listener" uuid="0956df94-0590-11e5-bdbe-0025b32654a0"/>
<effect name="alarm_helper" library="volume_listener" uuid="09f303e2-0590-11e5-8fdb-0025b32654a0"/>
<effect name="voice_helper" library="volume_listener" uuid="0ace5c08-0590-11e5-ae9e-0025b32654a0"/>
<effect name="notification_helper" library="volume_listener" uuid="0b776dde-0590-11e5-81ba-0025b32654a0"/>
<effect name="audiosphere" library="audiosphere" uuid="184e62ab-2d19-4364-9d1b-c0a40733866c"/>
<effect name="shoebox" library="shoebox" uuid="1eab784c-1a36-4b2a-b7fc-e34c44cab89e"/>
<effect name="misoundfx" library="misoundfx" uuid="5b8e36a5-144a-4c38-b1d7-0002a5d5c51b"/>
<effect name="spatializer" library="spatializer" uuid="cc4677de-ff72-11eb-9a03-0242ac130003"/>
</effects>
<postprocess>
<stream type="music">
<apply effect="music_helper"/>
</stream>
<stream type="ring">
<apply effect="ring_helper"/>
</stream>
<stream type="alarm">
<apply effect="alarm_helper"/>
</stream>
<stream type="voice_call">
<apply effect="voice_helper"/>
</stream>
<stream type="notification">
<apply effect="notification_helper"/>
</stream>
</postprocess>
<preprocess>
<stream type="voice_communication">
<apply effect="aec"/>
<apply effect="ns"/>
</stream>
</preprocess>
</audio_effects_conf>

140
audio/audio_io_policy.conf Normal file
View File

@@ -0,0 +1,140 @@
# List of profiles for the output device session where stream is routed.
# A stream opened with the inputs attributes which match the "flags" and
# "formats" as specified in the profile is routed to a device at
# sample rate specified under "sampling_rates" and bit width under
# "bit_width" and the topology extracted from the acdb data against
# the "app_type".
#
# the flags and formats are specified using the strings corresponding to
# enums in audio.h and audio_policy.h. They are concatenated with "|"
# without space or "\n".
# the flags and formats should match the ones in "audio_policy.conf"
outputs {
default {
flags AUDIO_OUTPUT_FLAG_PRIMARY
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 48000
bit_width 16
app_type 69937
}
proaudio {
flags AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_RAW
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 48000
bit_width 16
app_type 69943
}
voip_rx {
flags AUDIO_OUTPUT_FLAG_VOIP_RX|AUDIO_OUTPUT_FLAG_DIRECT
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 8000|16000|32000|48000
bit_width 16
app_type 69946
}
deep_buffer {
flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 48000
bit_width 16
app_type 69936
}
direct_pcm_16 {
flags AUDIO_OUTPUT_FLAG_DIRECT
formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT|AUDIO_FORMAT_PCM_32_BIT
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 16
app_type 69936
}
direct_pcm_24 {
flags AUDIO_OUTPUT_FLAG_DIRECT
formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT|AUDIO_FORMAT_PCM_32_BIT
sampling_rates 44100|48000|88200|96000|176400|192000|352800|384000
bit_width 24
app_type 69940
}
direct_pcm_32 {
flags AUDIO_OUTPUT_FLAG_DIRECT
formats AUDIO_FORMAT_PCM_32_BIT
sampling_rates 44100|48000|88200|96000|176400|192000|352800|384000
bit_width 32
app_type 69942
}
compress_passthrough {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING|AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH
formats AUDIO_FORMAT_DTS|AUDIO_FORMAT_DTS_HD|AUDIO_FORMAT_DSD
sampling_rates 32000|44100|48000|88200|96000|176400|192000|352800
bit_width 16
app_type 69941
}
compress_offload_16 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING
formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_PCM_16_BIT_OFFLOAD|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|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|AUDIO_FORMAT_AAC_LATM_LC|AUDIO_FORMAT_AAC_LATM_HE_V1|AUDIO_FORMAT_AAC_LATM_HE_V2
sampling_rates 44100|48000|88200|96000|176400|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_MP3|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|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_PRO|AUDIO_FORMAT_VORBIS|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2|AUDIO_FORMAT_AAC_LATM_LC|AUDIO_FORMAT_AAC_LATM_HE_V1|AUDIO_FORMAT_AAC_LATM_HE_V2
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 24
app_type 69940
}
}
inputs {
record_16bit {
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 8000|16000|32000|44100|48000|88200|96000|176400|192000
bit_width 16
app_type 69938
}
record_24bit {
formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_24_BIT
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 24
app_type 69948
}
record_32bit {
formats AUDIO_FORMAT_PCM_32_BIT|AUDIO_FORMAT_PCM_FLOAT
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 32
app_type 69949
}
record_compress_16 {
flags AUDIO_INPUT_FLAG_COMPRESS
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 8000|16000|32000|44100|48000|88200|96000|176400|192000
bit_width 16
app_type 69938
}
record_compress_24 {
flags AUDIO_INPUT_FLAG_COMPRESS
formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_24_BIT
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 24
app_type 69948
}
record_compress_32 {
flags AUDIO_INPUT_FLAG_COMPRESS
formats AUDIO_FORMAT_PCM_32_BIT|AUDIO_FORMAT_PCM_FLOAT
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 32
app_type 69949
}
voip_tx {
flags AUDIO_INPUT_FLAG_VOIP_TX
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 8000|16000|32000|48000
bit_width 16
app_type 69946
}
low_latency_voip_tx {
flags AUDIO_INPUT_FLAG_FAST|AUDIO_INPUT_FLAG_VOIP_TX
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 48000
bit_width 16
app_type
}
}

View File

@@ -0,0 +1,534 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Copyright (c) 2014, 2016-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 -->
<!-- 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, -->
<!-- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -->
<!-- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -->
<audio_platform_info>
<bit_width_configs>
<device name="SND_DEVICE_OUT_SPEAKER" bit_width="24"/>
</bit_width_configs>
<interface_names>
<device name="AUDIO_DEVICE_IN_BUILTIN_MIC" interface="TX_CDC_DMA_TX_3" codec_type="internal"/>
<device name="AUDIO_DEVICE_IN_BACK_MIC" interface="TX_CDC_DMA_TX_3" codec_type="internal"/>
</interface_names>
<module_ids>
<aec>
<device name="SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS" module_id="0x10F35" instance_id="0x0" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE" module_id="0x10F34" instance_id="0x0" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS" module_id="0x10F33" instance_id="0x0" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS" module_id="0x10F31" instance_id="0x0" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS" module_id="0x10F33" instance_id="0x0" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS" module_id="0x10F31" instance_id="0x0" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_SB" module_id="0x10F39" instance_id="0x8000" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS_SB" module_id="0x10F38" instance_id="0x8000" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS_SB" module_id="0x10F39" instance_id="0x8000" param_id="0x10EAF" param_value="0x01"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS_SB" module_id="0x10F38" instance_id="0x8000" param_id="0x10EAF" param_value="0x01"/>
</aec>
<ns>
<device name="SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS" module_id="0x10F35" instance_id="0x0" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE" module_id="0x10F34" instance_id="0x0" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS" module_id="0x10F33" instance_id="0x0" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS" module_id="0x10F31" instance_id="0x0" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS" module_id="0x10F33" instance_id="0x0" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS" module_id="0x10F31" instance_id="0x0" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_SB" module_id="0x10F39" instance_id="0x8000" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS_SB" module_id="0x10F38" instance_id="0x8000" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS_SB" module_id="0x10F39" instance_id="0x8000" param_id="0x10EAF" param_value="0x02"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS_SB" module_id="0x10F38" instance_id="0x8000" param_id="0x10EAF" param_value="0x02"/>
</ns>
</module_ids>
<pcm_ids>
<usecase name="USECASE_AUDIO_PLAYBACK_LOW_LATENCY" type="out" id="9"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD" type="out" id="7"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD2" type="out" id="11"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD3" type="out" id="43"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD4" type="out" id="24"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD5" type="out" id="25"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD6" type="out" id="26"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD7" type="out" id="27"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD8" type="out" id="28"/>
<usecase name="USECASE_VOICEMMODE1_CALL" type="in" id="2"/>
<usecase name="USECASE_VOICEMMODE1_CALL" type="out" id="2"/>
<usecase name="USECASE_VOICEMMODE2_CALL" type="in" id="15"/>
<usecase name="USECASE_VOICEMMODE2_CALL" type="out" id="15"/>
<usecase name="USECASE_VOWLAN_CALL" type="in" id="-1"/>
<usecase name="USECASE_VOWLAN_CALL" type="out" id="-1"/>
<usecase name="USECASE_AUDIO_PLAYBACK_FM" type="out" id="30"/>
<usecase name="USECASE_AUDIO_PLAYBACK_FM" type="in" id="40"/>
<usecase name="USECASE_AUDIO_SPKR_CALIB_RX" type="out" id="30"/>
<usecase name="USECASE_AUDIO_SPKR_CALIB_TX" type="in" id="33"/>
<usecase name="USECASE_AUDIO_PLAYBACK_AFE_PROXY" type="out" id="5"/>
<usecase name="USECASE_AUDIO_RECORD_AFE_PROXY" type="in" id="6"/>
<usecase name="USECASE_AUDIO_RECORD_AFE_PROXY2" type="in" id="42"/>
<usecase name="USECASE_AUDIO_RECORD_LOW_LATENCY" type="in" id="13" />
<usecase name="USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY" type="in" id="13" />
<usecase name="USECASE_AUDIO_PLAYBACK_ULL" type="out" id="13" />
<usecase name="USECASE_AUDIO_PLAYBACK_SILENCE" type="out" id="23" />
<usecase name="USECASE_AUDIO_PLAYBACK_VOIP" type="out" id="12" />
<usecase name="USECASE_AUDIO_RECORD_VOIP" type="in" id="12" />
<usecase name="USECASE_AUDIO_HFP_SCO" type="in" id="12" />
<usecase name="USECASE_AUDIO_HFP_SCO_WB" type="in" id="12" />
<usecase name="USECASE_AUDIO_PLAYBACK_MMAP" type="out" id="29" />
<usecase name="USECASE_AUDIO_RECORD_MMAP" type="in" id="29" />
<usecase name="USECASE_AUDIO_A2DP_ABR_FEEDBACK" type="in" id="38" />
<usecase name="USECASE_AUDIO_A2DP_ABR_FEEDBACK" type="out" id="38" />
<usecase name="USECASE_INCALL_MUSIC_UPLINK" type="out" id="23" />
<usecase name="USECASE_INCALL_MUSIC_UPLINK2" type="out" id="23" />
<usecase name="USECASE_AUDIO_RECORD_COMPRESS2" type="in" id="39" />
<usecase name="USECASE_INCALL_REC_UPLINK" type="in" id="23" />
<usecase name="USECASE_INCALL_REC_DOWNLINK" type="in" id="23" />
<usecase name="USECASE_INCALL_REC_UPLINK_AND_DOWNLINK" type="in" id="23" />
</pcm_ids>
<config_params>
<!-- In the below value string, the value indicates default mono -->
<!-- speaker. It can be set to either left or right -->
<param key="mono_speaker" value="right"/>
<param key="true_32_bit" value="true"/>
<param key="hifi_filter" value="false"/>
<param key="native_audio_mode" value="multiple_mix_dsp"/>
<param key="hfp_pcm_dev_id" value="39"/>
<param key="input_mic_max_count" value="2"/>
<!-- In the below value string, the value indicates whether the -->
<!-- target does not supports speaker and headphone working on -->
<!-- different fractional and integer sampling rate -->
<param key="spkr_hph_single_be_native_concurrency" value="true"/>
</config_params>
<gain_db_to_level_mapping>
<gain_level_map db="-59" level="5"/>
<gain_level_map db="-17.4" level="4"/>
<gain_level_map db="-13.8" level="3"/>
<gain_level_map db="-10.2" level="2"/>
<gain_level_map db="0" level="1"/>
</gain_db_to_level_mapping>
<acdb_ids>
<device name="SND_DEVICE_OUT_SPEAKER" acdb_id="421"/>
<device name="SND_DEVICE_OUT_SPEAKER_CALI" acdb_id="15"/>
<device name="SND_DEVICE_OUT_SPEAKER_REVERSE" acdb_id="15"/>
<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED" acdb_id="124"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED" acdb_id="101"/>
<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT" acdb_id="124"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT" acdb_id="101"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK" acdb_id="102"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED" acdb_id="150"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED_VBAT" acdb_id="150"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_1" acdb_id="151"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_2" acdb_id="152"/>
<device name="SND_DEVICE_OUT_SPEAKER_EXTERNAL_1" acdb_id="14"/>
<device name="SND_DEVICE_OUT_SPEAKER_EXTERNAL_2" acdb_id="14"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1" acdb_id="10"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2" acdb_id="10"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET" acdb_id="45"/>
<device name="SND_DEVICE_IN_UNPROCESSED_MIC" acdb_id="143"/>
<device name="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC" acdb_id="144"/>
<device name="SND_DEVICE_IN_UNPROCESSED_THREE_MIC" acdb_id="145"/>
<device name="SND_DEVICE_IN_UNPROCESSED_QUAD_MIC" acdb_id="146"/>
<device name="SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC" acdb_id="147"/>
<device name="SND_DEVICE_IN_HANDSET_GENERIC_QMIC" acdb_id="191"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_MIC" acdb_id="43"/>
<device name="SND_DEVICE_IN_VOICE_RECORD_SPEAKER_MIC" acdb_id="11"/>
<device name="SND_DEVICE_IN_VOICE_HANDSET_MIC" acdb_id="41"/>
<device name="SND_DEVICE_IN_VOICE_RECORD_HANDSET_MIC" acdb_id="19"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2" acdb_id="15"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES" acdb_id="421"/>
<device name="SND_DEVICE_OUT_HEADPHONES" acdb_id="10012"/>
<device name="SND_DEVICE_IN_HEADSET_MIC" acdb_id="10008"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_STEREO_MIUI" acdb_id="4"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_STEREO_CTS" acdb_id="35"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_STEREO" acdb_id="4"/>
<!-- MIUI patch for karaoke start -->
<device name="SND_DEVICE_IN_USB_REALIME_LOOPBACK_MIC" acdb_id="10019"/>
<device name="SND_DEVICE_OUT_USB_HEADSET_KARA" acdb_id="10020"/>
<device name="SND_DEVICE_IN_REALIME_LOOPBACK_MIC" acdb_id="10019"/>
<device name="SND_DEVICE_OUT_HEADPHONES_KARA" acdb_id="10020"/>
<!-- MIUI patch for karaoke end -->
</acdb_ids>
<backend_names>
<!-- wt audio mmi-->
<device name="SND_DEVICE_IN_FIRST_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SECOND_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_FIRST_MIC_ATA" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SECOND_MIC_ATA" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_OUT_HANDSET_MMI" backend="handset-ata" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_HANDSET_SPK_MODE" backend="handset-ata" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_HANDSET_SPK_MODE_ATA" backend="handset-ata" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_MMI" backend="speaker-mmi" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_HANDSET_ATA" backend="handset-ata" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_ATA" backend="speaker-mmi" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKERLEFT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKERRIGHT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_CALI" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_HEADPHONE_ATA" backend="headphones-ata" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_IN_HEADSET_MIC_ATA" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<!-- wt audio mmi-->
<device name="SND_DEVICE_CAPTURE_VI_FEEDBACK" interface="SEC_MI2S_TX"/>
<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_GAME_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_HEADPHONES_44_1" backend="headphones-44.1" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_BT_SCO_WB" backend="bt-sco-wb" interface="SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_BT_SCO" backend="bt-sco" interface="SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_BT_A2DP" backend="bt-a2dp" interface="SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_LINE" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_ANC_HEADSET" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES" backend="speaker-and-headphones" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_HIFI_FILTER" backend="speaker-and-headphones" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_LINE" backend="speaker-and-headphones" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET" backend="speaker-and-headphones" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_HEADSET" backend="headset" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_ANC_HEADSET" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_LINE" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_TTY_FULL_HEADSET" backend="headset" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_TTY_VCO_HEADSET" backend="headset" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_HANDSET" backend="handset" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_EXTERNAL_1" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_EXTERNAL_2" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_REVERSE" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_VBAT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET" backend="handset" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" backend="handset" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_IN_HANDSET_GENERIC_QMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_GAME_SPEAKER" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_STEREO" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_VBAT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_HDMI" interface="SEC_MI2S_RX-and-HDMI"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_DISPLAY_PORT" interface="SEC_MI2S_RX-and-DISPLAY_PORT"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP" interface="SEC_MI2S_RX-and-SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET" interface="RX_CDC_DMA_RX_1"/>
<device name="SND_DEVICE_OUT_ANC_FB_HEADSET" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET" interface="RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_ANC_HANDSET" interface="RX_CDC_DMA_RX_1"/>
<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED_VBAT" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_WSA" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_WSA" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA" interface="SEC_MI2S_RX"/>
<device name="SND_DEVICE_IN_HANDSET_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_RECORD_HANDSET_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_EXTERNAL" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_NS_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_STEREO" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_STEREO_MIUI" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_DMIC_STEREO_CTS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_NS_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS_NN" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_GAME_SPEAKER_DMIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_HEADSET_MIC_FLUENCE" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_GAME_HEADSET_MIC_FLUENCE" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_RECORD_SPEAKER_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_VOICE_REC_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_HEADSET_MIC_AEC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_MIC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HDMI_MIC" interface="HDMI"/>
<device name="SND_DEVICE_IN_BT_SCO_MIC" interface="SLIMBUS_7_TX"/>
<device name="SND_DEVICE_IN_BT_SCO_MIC_NREC" interface="SLIMBUS_7_TX"/>
<device name="SND_DEVICE_IN_BT_SCO_MIC_WB" interface="SLIMBUS_7_TX"/>
<device name="SND_DEVICE_IN_BT_SCO_MIC_WB_NREC" interface="SLIMBUS_7_TX"/>
<device name="SND_DEVICE_IN_CAMCORDER_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_CAMCORDER_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_DMIC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC_SB" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_QMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_REC_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_REC_MIC_CTS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_REC_MIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_REC_DMIC_STEREO" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_AANC_HANDSET_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_QUAD_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_STEREO_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_STEREO_DMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK" interface="WSA_CDC_DMA_TX_0"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_1" interface="WSA_CDC_DMA_TX_0"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_2" interface="WSA_CDC_DMA_TX_0"/>
<device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_BROADSIDE" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_QMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_QMIC_AEC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_QMIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_THREE_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_TMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_TMIC_AEC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_TMIC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_HANDSET_TMIC_AEC_NS" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_VOICE_REC_TMIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_UNPROCESSED_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_UNPROCESSED_THREE_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_UNPROCESSED_QUAD_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC" interface="TX_CDC_DMA_TX_3"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_AND_VOICE_HEADPHONES" backend="speaker-and-headphones" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_AND_VOICE_ANC_HEADSET" backend="speaker-and-headphones" interface="SEC_MI2S_RX-and-RX_CDC_DMA_RX_0"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_BT_SCO" backend="speaker-and-bt-sco" interface="SEC_MI2S_RX-and-SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_WB" backend="speaker-and-bt-sco-wb" interface="SEC_MI2S_RX-and-SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_SWB" backend="speaker-and-bt-sco-swb" interface="SEC_MI2S_RX-and-SLIMBUS_7_RX"/>
<device name="SND_DEVICE_OUT_HEADPHONES_DSD" backend="headphones-dsd" interface="RX_CDC_DMA_RX_5"/>
<device name="SND_DEVICE_IN_ULTRASOUND" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_OUT_ULTRASOUND" interface="SEC_MI2S_RX"/>
<!-- MIUI patch for karaoke start -->
<device name="SND_DEVICE_IN_REALIME_LOOPBACK_MIC" backend="headset-mic" interface="TX_CDC_DMA_TX_4"/>
<device name="SND_DEVICE_OUT_HEADPHONES_KARA" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
<!-- MIUI patch for karaoke end -->
</backend_names>
<!-- below values are for ref purpose to OEM, doesn't contain actual hardware info on MTP -->
<microphone_characteristics>
<microphone valid_mask="31" device_id="builtin_mic_1" type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="bottom" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
group="0" index_in_the_group="0" directionality="AUDIO_MICROPHONE_DIRECTIONALITY_OMNI" num_frequency_responses="93"
frequencies="100.00 106.00 112.00 118.00 125.00 132.00 140.00 150.00 160.00 170.00 180.00 190.00 200.00 212.00 224.00 236.00 250.00 265.00 280.00 300.00 315.00 335.00 355.00 375.00 400.00 425.00 450.00 475.00 500.00 530.00 560.00 600.00 630.00 670.00 710.00 750.00 800.00 850.00 900.00 950.00 1000.00 1060.00 1120.00 1180.00 1250.00 1320.00 1400.00 1500.00 1600.00 1700.00 1800.00 1900.00 2000.00 2120.00 2240.00 2360.00 2500.00 2650.00 2800.00 3000.00 3150.00 3350.00 3550.00 3750.00 4000.00 4250.00 4500.00 4750.00 5000.00 5300.00 5600.00 6000.00 6300.00 6700.00 7100.00 7500.00 8000.00 8500.00 9000.00 9500.00 10000.00 10600.00 11200.00 11800.00 12500.00 13200.00 14000.00 15000.00 16000.00 17000.00 18000.00 19000.00 20000.00"
responses="-0.78 -0.71 -0.64 -0.60 -0.55 -0.50 -0.47 -0.42 -0.39 -0.36 -0.34 -0.33 -0.32 -0.29 -0.28 -0.28 -0.27 -0.25 -0.25 -0.24 -0.23 -0.23 -0.22 -0.22 -0.19 -0.17 -0.15 -0.15 -0.14 -0.14 -0.12 -0.11 -0.10 -0.10 -0.08 -0.07 -0.07 -0.04 -0.03 -0.01 0.00 0.04 0.06 0.07 0.08 0.13 0.09 0.14 0.19 0.23 0.28 0.29 0.31 0.37 0.88 0.86 0.77 0.78 0.84 0.86 1.05 1.12 1.18 1.25 1.43 1.66 1.83 2.02 2.23 2.59 2.84 3.35 4.01 6.82 6.62 6.42 7.30 8.23 7.54 12.68 13.76 18.69 19.68 20.90 23.70 25.10 21.65 16.18 18.84 25.44 23.48 23.22 24.89"
sensitivity="-37.0" max_spl="132.5" min_spl="28.5" orientation="0.0 0.0 1.0" geometric_location="0.0269 0.0058 0.0079" />
<microphone valid_mask="31" device_id="builtin_mic_2" type="AUDIO_DEVICE_IN_BACK_MIC" address="back" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
group="0" index_in_the_group="1" directionality="AUDIO_MICROPHONE_DIRECTIONALITY_OMNI" num_frequency_responses="92"
frequencies="106.00 112.00 118.00 125.00 132.00 140.00 150.00 160.00 170.00 180.00 190.00 200.00 212.00 224.00 236.00 250.00 265.00 280.00 300.00 315.00 335.00 355.00 375.00 400.00 425.00 450.00 475.00 500.00 530.00 560.00 600.00 630.00 670.00 710.00 750.00 800.00 850.00 900.00 950.00 1000.00 1060.00 1120.00 1180.00 1250.00 1320.00 1400.00 1500.00 1600.00 1700.00 1800.00 1900.00 2000.00 2120.00 2240.00 2360.00 2500.00 2650.00 2800.00 3000.00 3150.00 3350.00 3550.00 3750.00 4000.00 4250.00 4500.00 4750.00 5000.00 5300.00 5600.00 6000.00 6300.00 6700.00 7100.00 7500.00 8000.00 8500.00 9000.00 9500.00 10000.00 10600.00 11200.00 11800.00 12500.00 13200.00 14000.00 15000.00 16000.00 17000.00 18000.00 19000.00 20000.00"
responses="-0.75 -0.74 -0.69 -0.65 -0.62 -0.61 -0.56 -0.53 -0.50 -0.47 -0.43 -0.40 -0.37 -0.36 -0.33 -0.30 -0.28 -0.25 -0.24 -0.24 -0.24 -0.25 -0.24 -0.12 -0.10 -0.08 -0.09 -0.07 -0.07 -0.06 -0.06 -0.06 -0.05 -0.04 -0.05 -0.04 -0.01 0.02 0.02 0.00 0.02 0.03 0.07 0.10 0.10 0.13 0.01 0.01 0.10 0.11 0.19 0.24 0.38 0.46 0.26 0.27 0.43 0.76 0.75 1.09 1.09 0.94 1.06 1.21 1.47 1.45 1.36 2.07 2.85 2.90 3.85 4.65 5.84 5.46 6.15 7.50 8.30 10.62 12.70 16.65 20.95 25.41 26.32 20.20 16.60 11.24 7.85 7.62 20.19 7.32 2.87 5.18"
sensitivity="-37.0" max_spl="132.5" min_spl="28.5" orientation="0.0 1.0 0.0" geometric_location="0.0546 0.1456 0.00415" />
<microphone valid_mask="31" device_id="builtin_mic_3" type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="top" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
group="0" index_in_the_group="2" directionality="AUDIO_MICROPHONE_DIRECTIONALITY_OMNI" num_frequency_responses="92"
frequencies="100.00 106.00 112.00 118.00 125.00 132.00 140.00 150.00 160.00 170.00 180.00 190.00 200.00 212.00 224.00 236.00 250.00 265.00 280.00 300.00 315.00 335.00 355.00 375.00 400.00 425.00 450.00 475.00 500.00 530.00 560.00 600.00 630.00 670.00 710.00 750.00 800.00 850.00 900.00 950.00 1000.00 1060.00 1120.00 1180.00 1250.00 1320.00 1400.00 1500.00 1600.00 1700.00 1800.00 1900.00 2000.00 2120.00 2240.00 2360.00 2500.00 2650.00 2800.00 3000.00 3150.00 3350.00 3550.00 3750.00 4000.00 4250.00 4500.00 4750.00 5000.00 5300.00 5600.00 6000.00 6300.00 6700.00 7100.00 7500.00 8000.00 8500.00 9000.00 9500.00 10000.00 10600.00 11200.00 11800.00 12500.00 13200.00 14000.00 15000.00 16000.00 17000.00 18000.00 19000.00"
responses="-9.24 -9.31 -9.39 -9.45 -9.46 -9.47 -9.50 -9.52 -9.51 -9.52 -9.51 -9.50 -9.49 -9.47 -9.48 -9.49 -9.48 -9.50 -9.51 -9.53 -9.55 -9.59 -9.63 -9.67 -9.58 -9.57 -9.65 -9.68 -9.71 -9.75 -9.79 -9.84 -9.87 -9.87 -9.90 -9.90 -9.91 -9.97 -10.01 -10.05 -9.85 -9.93 -9.94 -9.98 -10.04 -10.12 -10.28 -10.25 -10.01 -9.86 -9.81 -9.82 -9.61 -9.46 -8.27 -8.42 -8.98 -8.99 -8.82 -9.21 -8.92 -8.97 -9.30 -9.44 -9.52 -9.28 -9.09 -8.81 -7.02 -5.72 -5.30 -7.26 -8.39 -12.28 -8.23 -6.99 -5.52 -4.87 -3.82 -6.09 0.00 -2.15 -0.26 1.48 5.22 10.92 6.41 9.55 12.96 3.35 22.00 19.75"
sensitivity="-37.0" max_spl="132.5" min_spl="28.5" orientation="0.0 0.0 1.0" geometric_location="0.0274 0.14065 0.0079" />
</microphone_characteristics>
<snd_devices>
<input_snd_device>
<input_snd_device_mic_mapping>
<snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_DMIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_REC_MIC_AEC_NS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_REC_MIC_AEC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_REC_MIC_NS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_REC_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_REC_MIC_CTS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_HANDSET_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_DMIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_DMIC_TMUS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_VOICE_SPEAKER_DMIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_HANDSET_DMIC_AEC_NS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_HANDSET_DMIC_AEC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_HANDSET_DMIC_NS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_HANDSET_DMIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_SPEAKER_DMIC_AEC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_SPEAKER_DMIC_NS">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_SPEAKER_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_UNPROCESSED_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_UNPROCESSED_THREE_MIC">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_HANDSET_DMIC_STEREO">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
<snd_dev in_snd_device="SND_DEVICE_IN_SPEAKER_DMIC_STEREO">
<mic_info mic_device_id="builtin_mic_1"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_2"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
<mic_info mic_device_id="builtin_mic_3"
channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/>
</snd_dev>
</input_snd_device_mic_mapping>
</input_snd_device>
</snd_devices>
</audio_platform_info>

View File

@@ -0,0 +1,386 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) 2016-2020, The Linux Foundation. All rights reserved
Not a Contribution.
-->
<!-- Copyright (C) 2015 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.
-->
<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
<!-- Global configuration Decalaration -->
<globalConfiguration speaker_drc_enabled="false" call_screen_mode_supported="true"/>
<!-- Modules section:
There is one section per audio HW module present on the platform.
Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
The module names are the same as in current .conf file:
“primary”, “A2DP”, “remote_submix”, “USB”
Each module will contain the following sections:
“devicePorts”: a list of device descriptors for all input and output devices accessible via this
module.
This contains both permanently attached devices and removable devices.
“mixPorts”: listing all output and input streams exposed by the audio HAL
“routes”: list of possible connections between input and output devices or between stream and
devices.
"route": is defined by an attribute:
-"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
-"sink": the sink involved in this route
-"sources": all the sources than can be connected to the sink via vis route
“attachedDevices”: permanently attached devices.
The attachedDevices section is a list of devices names. The names correspond to device names
defined in <devicePorts> section.
“defaultOutputDevice”: device to be used by default when no policy rule applies
-->
<modules>
<!-- Primary Audio HAL -->
<module name="primary" halVersion="2.0">
<attachedDevices>
<item>Earpiece</item>
<item>Speaker</item>
<item>Telephony Tx</item>
<item>Built-In Mic</item>
<item>Built-In Back Mic</item>
<item>Telephony Rx</item>
</attachedDevices>
<defaultOutputDevice>Speaker</defaultOutputDevice>
<mixPorts>
<mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
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_24_BIT_PACKED"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="mmap_no_irq_out" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_MMAP_NOIRQ">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="hifi_playback" role="source" />
<mixPort name="compress_passthrough" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
</mixPort>
<mixPort name="direct_pcm" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
</mixPort>
<mixPort name="compressed_offload" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
<profile name="" format="AUDIO_FORMAT_MP3"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_FLAC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_ALAC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_APE"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_LC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_HE_V1"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_HE_V2"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_DTS"
samplingRates="32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1"/>
<profile name="" format="AUDIO_FORMAT_DTS_HD"
samplingRates="32000,44100,48000,64000,88200,96000,128000,176400,192000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_WMA"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_WMA_PRO"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_HE_V1"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_HE_V2"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
</mixPort>
<mixPort name="voice_tx" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="voip_rx" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,32000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
</mixPort>
<mixPort name="incall_music_uplink" role="source"
flags="AUDIO_OUTPUT_FLAG_INCALL_MUSIC">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="primary input" role="sink" maxOpenCount="2" maxActiveCount="2">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
</mixPort>
<mixPort name="fast input" role="sink"
flags="AUDIO_INPUT_FLAG_FAST">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
</mixPort>
<mixPort name="quad mic" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_INDEX_MASK_4"/>
</mixPort>
<mixPort name="voip_tx" role="sink"
flags="AUDIO_INPUT_FLAG_VOIP_TX">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,32000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
</mixPort>
<mixPort name="usb_surround_sound" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,88200,96000,176400,192000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4,AUDIO_CHANNEL_IN_5POINT1,AUDIO_CHANNEL_INDEX_MASK_6,AUDIO_CHANNEL_IN_7POINT1,AUDIO_CHANNEL_INDEX_MASK_8"/>
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,88200,96000,176400,192000"
channelMasks="AUDIO_CHANNEL_IN_5POINT1,AUDIO_CHANNEL_INDEX_MASK_6,AUDIO_CHANNEL_IN_7POINT1,AUDIO_CHANNEL_INDEX_MASK_8"/>
<profile name="" format="AUDIO_FORMAT_PCM_FLOAT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,88200,96000,176400,192000"
channelMasks="AUDIO_CHANNEL_IN_5POINT1,AUDIO_CHANNEL_INDEX_MASK_6,AUDIO_CHANNEL_IN_7POINT1,AUDIO_CHANNEL_INDEX_MASK_8"/>
</mixPort>
<mixPort name="record_24" role="sink" maxOpenCount="2" maxActiveCount="2">
<profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
<profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
<profile name="" format="AUDIO_FORMAT_PCM_FLOAT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
</mixPort>
<mixPort name="voice_rx" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="mmap_no_irq_in" role="sink" flags="AUDIO_INPUT_FLAG_MMAP_NOIRQ">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
</mixPort>
<mixPort name="hifi_input" role="sink" />
</mixPorts>
<devicePorts>
<!-- Output devices declaration, i.e. Sink DEVICE PORT -->
<devicePort tagName="Earpiece" type="AUDIO_DEVICE_OUT_EARPIECE" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
</devicePort>
<devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address="">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Line" type="AUDIO_DEVICE_OUT_LINE" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
</devicePort>
<devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
</devicePort>
<devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
</devicePort>
<devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="HDMI" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000"/>
</devicePort>
<devicePort tagName="Proxy" type="AUDIO_DEVICE_OUT_PROXY" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000"/>
</devicePort>
<devicePort tagName="FM" type="AUDIO_DEVICE_OUT_FM" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="USB Device Out" type="AUDIO_DEVICE_OUT_USB_DEVICE" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100,48000,64000,88200,96000,128000,176400,192000"/>
</devicePort>
<devicePort tagName="USB Headset Out" type="AUDIO_DEVICE_OUT_USB_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100,48000,64000,88200,96000,128000,176400,192000"/>
</devicePort>
<!-- Input devices declaration, i.e. Source DEVICE PORT -->
<devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
</devicePort>
<devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
</devicePort>
<devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
</devicePort>
<devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
</devicePort>
<devicePort tagName="Telephony Rx" type="AUDIO_DEVICE_IN_TELEPHONY_RX" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
</devicePort>
<devicePort tagName="USB Device In" type="AUDIO_DEVICE_IN_USB_DEVICE" role="source">
</devicePort>
<devicePort tagName="USB Headset In" type="AUDIO_DEVICE_IN_USB_HEADSET" role="source">
</devicePort>
</devicePorts>
<!-- 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,mmap_no_irq_out"/>
<route type="mix" sink="Speaker"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
<route type="mix" sink="Wired Headset"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
<route type="mix" sink="Wired Headphones"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
<route type="mix" sink="Line"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
<route type="mix" sink="HDMI"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,compress_passthrough,voip_rx"/>
<route type="mix" sink="Proxy"
sources="primary output,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"/>
<route type="mix" sink="BT SCO Headset"
sources="primary output,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"/>
<route type="mix" sink="USB Device Out"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out,hifi_playback"/>
<route type="mix" sink="USB Headset Out"
sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out,hifi_playback"/>
<route type="mix" sink="Telephony Tx"
sources="voice_tx,incall_music_uplink"/>
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="primary input"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,Telephony Rx"/>
<route type="mix" sink="usb_surround_sound"
sources="USB Device In,USB Headset In"/>
<route type="mix" sink="fast input"
sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In,Wired Headset Mic"/>
<route type="mix" sink="quad mic"
sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In,Wired Headset Mic"/>
<route type="mix" sink="voip_tx"
sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In,Wired Headset Mic,Telephony Rx"/>
<route type="mix" sink="record_24"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic"/>
<route type="mix" sink="mmap_no_irq_in"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In"/>
<route type="mix" sink="hifi_input" sources="USB Device In,USB Headset In" />
</routes>
</module>
<!-- Usb Audio HAL -->
<module name="usb" halVersion="2.0">
<mixPorts>
<mixPort name="usb_accessory output" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
</mixPorts>
<devicePorts>
<devicePort tagName="USB Host Out" type="AUDIO_DEVICE_OUT_USB_ACCESSORY" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
</devicePorts>
<routes>
<route type="mix" sink="USB Host Out"
sources="usb_accessory output"/>
</routes>
</module>
<!-- Remote Submix Audio HAL -->
<xi:include href="/vendor/etc/audio/sku_holi/r_submix_audio_policy_configuration.xml"/>
<!-- Bluetooth Audio HAL -->
<xi:include href="/vendor/etc/audio/sku_holi/bluetooth_audio_policy_configuration.xml"/>
</modules>
<!-- End of Modules section -->
<!-- Volume section -->
<xi:include href="/vendor/etc/audio/sku_holi/audio_policy_volumes.xml"/>
<xi:include href="/vendor/etc/audio/sku_holi/default_volume_tables.xml"/>
<!-- End of Volume section -->
</audioPolicyConfiguration>

View File

@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2015 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.
-->
<!-- Volume section defines a volume curve for a given use case and device category.
It contains a list of points of this curve expressing the attenuation in Millibels for a given
volume index from 0 to 100.
<volume stream=”AUDIO_STREAM_MUSIC” deviceCategory=””>
<point>0,-9600</point>
<point>100,0</point>
</volume>
-->
<volumes>
<volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_HEADSET">
<point>0,-4200</point>
<point>33,-2800</point>
<point>66,-1400</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_SPEAKER">
<point>0,-2400</point>
<point>33,-1600</point>
<point>66,-800</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_EARPIECE">
<point>0,-2400</point>
<point>33,-1600</point>
<point>66,-800</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_NON_MUTABLE_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_SYSTEM" deviceCategory="DEVICE_CATEGORY_HEADSET">
<point>1,-3000</point>
<point>33,-2600</point>
<point>66,-2200</point>
<point>100,-1800</point>
</volume>
<volume stream="AUDIO_STREAM_SYSTEM" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="DEFAULT_SYSTEM_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_SYSTEM" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_SYSTEM_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_SYSTEM" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_SYSTEM" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_RING" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_RING" deviceCategory="DEVICE_CATEGORY_SPEAKER">
<point>1,-2970</point>
<point>33,-2010</point>
<point>66,-1020</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_RING" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_DEVICE_CATEGORY_EARPIECE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_RING" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_RING" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_HEADSET">
<point>1,-6400</point>
<point>6,-5900</point>
<point>13,-5400</point>
<point>20,-4900</point>
<point>26,-4400</point>
<point>33,-3900</point>
<point>40,-3400</point>
<point>46,-3000</point>
<point>53,-2600</point>
<point>60,-2200</point>
<point>66,-1800</point>
<point>73,-1400</point>
<point>80,-1050</point>
<point>86,-700</point>
<point>93,-350</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER">
<point>1,-5800</point>
<point>6,-5200</point>
<point>13,-4450</point>
<point>20,-3850</point>
<point>26,-3250</point>
<point>33,-2650</point>
<point>40,-2150</point>
<point>46,-1800</point>
<point>53,-1500</point>
<point>60,-1200</point>
<point>66,-900</point>
<point>73,-600</point>
<point>80,-300</point>
<point>86,-200</point>
<point>93,-100</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_EARPIECE">
<point>1,-6400</point>
<point>6,-5900</point>
<point>13,-5400</point>
<point>20,-4900</point>
<point>26,-4400</point>
<point>33,-3900</point>
<point>40,-3400</point>
<point>46,-3000</point>
<point>53,-2600</point>
<point>60,-2200</point>
<point>66,-1800</point>
<point>73,-1400</point>
<point>80,-1050</point>
<point>86,-700</point>
<point>93,-350</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ALARM" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="DEFAULT_NON_MUTABLE_HEADSET_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ALARM" deviceCategory="DEVICE_CATEGORY_SPEAKER">
<point>0,-2970</point>
<point>33,-2010</point>
<point>66,-1020</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_ALARM" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_NON_MUTABLE_EARPIECE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ALARM" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_NON_MUTABLE_EXT_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ALARM" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_NON_MUTABLE_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_NOTIFICATION" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_NOTIFICATION" deviceCategory="DEVICE_CATEGORY_SPEAKER">
<point>1,-2970</point>
<point>33,-2010</point>
<point>66,-1020</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_NOTIFICATION" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_DEVICE_CATEGORY_EARPIECE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_NOTIFICATION" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_NOTIFICATION" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_BLUETOOTH_SCO" deviceCategory="DEVICE_CATEGORY_HEADSET">
<point>0,-4200</point>
<point>33,-2800</point>
<point>66,-1400</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_BLUETOOTH_SCO" deviceCategory="DEVICE_CATEGORY_SPEAKER">
<point>0,-2400</point>
<point>33,-1600</point>
<point>66,-800</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_BLUETOOTH_SCO" deviceCategory="DEVICE_CATEGORY_EARPIECE">
<point>0,-4200</point>
<point>33,-2800</point>
<point>66,-1400</point>
<point>100,0</point>
</volume>
<volume stream="AUDIO_STREAM_BLUETOOTH_SCO" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_BLUETOOTH_SCO" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ENFORCED_AUDIBLE" deviceCategory="DEVICE_CATEGORY_HEADSET">
<point>1,-3000</point>
<point>33,-2600</point>
<point>66,-2200</point>
<point>100,-1800</point>
</volume>
<volume stream="AUDIO_STREAM_ENFORCED_AUDIBLE" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="DEFAULT_SYSTEM_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ENFORCED_AUDIBLE" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_SYSTEM_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ENFORCED_AUDIBLE" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ENFORCED_AUDIBLE" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_DTMF" deviceCategory="DEVICE_CATEGORY_HEADSET">
<point>1,-3000</point>
<point>33,-2600</point>
<point>66,-2200</point>
<point>100,-1800</point>
</volume>
<volume stream="AUDIO_STREAM_DTMF" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="DEFAULT_SYSTEM_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_DTMF" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_SYSTEM_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_DTMF" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_DTMF" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_TTS" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="SILENT_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_TTS" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_TTS" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="SILENT_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_TTS" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="SILENT_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_TTS" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="SILENT_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ACCESSIBILITY" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="DEFAULT_NON_MUTABLE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ACCESSIBILITY" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="DEFAULT_NON_MUTABLE_SPEAKER_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ACCESSIBILITY" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_NON_MUTABLE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ACCESSIBILITY" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_NON_MUTABLE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ACCESSIBILITY" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_NON_MUTABLE_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ASSISTANT" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ASSISTANT" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="DEFAULT_DEVICE_CATEGORY_SPEAKER_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ASSISTANT" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ASSISTANT" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_ASSISTANT" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_REROUTING" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_REROUTING" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_REROUTING" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_REROUTING" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_REROUTING" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_PATCH" deviceCategory="DEVICE_CATEGORY_HEADSET"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_PATCH" deviceCategory="DEVICE_CATEGORY_SPEAKER"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_PATCH" deviceCategory="DEVICE_CATEGORY_EARPIECE"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_PATCH" deviceCategory="DEVICE_CATEGORY_EXT_MEDIA"
ref="FULL_SCALE_VOLUME_CURVE"/>
<volume stream="AUDIO_STREAM_PATCH" deviceCategory="DEVICE_CATEGORY_HEARING_AID"
ref="FULL_SCALE_VOLUME_CURVE"/>
</volumes>

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2015 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.
-->
<!-- Default Volume Tables included by Audio Policy Configuration file -->
<!-- Full Default Volume table for all device category -->
<volumes>
<reference name="FULL_SCALE_VOLUME_CURVE">
<!-- Full Scale reference Volume Curve -->
<point>0,0</point>
<point>100,0</point>
</reference>
<reference name="SILENT_VOLUME_CURVE">
<point>0,-9600</point>
<point>100,-9600</point>
</reference>
<reference name="DEFAULT_SYSTEM_VOLUME_CURVE">
<!-- Default System reference Volume Curve -->
<point>1,-2400</point>
<point>33,-1800</point>
<point>66,-1200</point>
<point>100,-600</point>
</reference>
<reference name="DEFAULT_MEDIA_VOLUME_CURVE">
<!-- Default Media reference Volume Curve -->
<point>1,-6400</point>
<point>6,-5900</point>
<point>13,-5400</point>
<point>20,-4900</point>
<point>26,-4400</point>
<point>33,-3900</point>
<point>40,-3400</point>
<point>46,-3000</point>
<point>53,-2600</point>
<point>60,-2200</point>
<point>66,-1800</point>
<point>73,-1400</point>
<point>80,-1050</point>
<point>86,-700</point>
<point>93,-350</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE">
<!--Default Volume Curve -->
<point>1,-4950</point>
<point>33,-3350</point>
<point>66,-1700</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_DEVICE_CATEGORY_SPEAKER_VOLUME_CURVE">
<!-- Default is Speaker Media Volume Curve -->
<point>1,-5800</point>
<point>6,-5200</point>
<point>13,-4450</point>
<point>20,-3850</point>
<point>26,-3250</point>
<point>33,-2650</point>
<point>40,-2150</point>
<point>46,-1800</point>
<point>53,-1500</point>
<point>60,-1200</point>
<point>66,-900</point>
<point>73,-600</point>
<point>80,-300</point>
<point>86,-200</point>
<point>93,-100</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_DEVICE_CATEGORY_EARPIECE_VOLUME_CURVE">
<!--Default Volume Curve -->
<point>1,-4950</point>
<point>33,-3350</point>
<point>66,-1700</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE">
<!-- Default is Ext Media System Volume Curve -->
<point>1,-5800</point>
<point>20,-4000</point>
<point>60,-2100</point>
<point>100,-1000</point>
</reference>
<reference name="DEFAULT_HEARING_AID_VOLUME_CURVE">
<!-- Default Hearing Aid Volume Curve -->
<point>1,-12700</point>
<point>20,-8000</point>
<point>60,-4000</point>
<point>100,0</point>
</reference>
<!-- **************************************************************** -->
<!-- Non-mutable default volume curves: -->
<!-- * first point is always for index 0 -->
<!-- * attenuation is small enough that stream can still be heard -->
<reference name="DEFAULT_NON_MUTABLE_VOLUME_CURVE">
<!-- Default non-mutable reference Volume Curve -->
<!-- based on DEFAULT_MEDIA_VOLUME_CURVE -->
<point>0,-5800</point>
<point>20,-4000</point>
<point>60,-1700</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_NON_MUTABLE_HEADSET_VOLUME_CURVE">
<!--Default non-mutable Volume Curve for headset -->
<!-- based on DEFAULT_DEVICE_CATEGORY_HEADSET_VOLUME_CURVE -->
<point>0,-4950</point>
<point>33,-3350</point>
<point>66,-1700</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_NON_MUTABLE_SPEAKER_VOLUME_CURVE">
<!-- Default non-mutable Speaker Volume Curve -->
<!-- based on DEFAULT_DEVICE_CATEGORY_SPEAKER_VOLUME_CURVE -->
<point>0,-5800</point>
<point>20,-4000</point>
<point>60,-1700</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_NON_MUTABLE_EARPIECE_VOLUME_CURVE">
<!--Default non-mutable Volume Curve -->
<!-- based on DEFAULT_DEVICE_CATEGORY_EARPIECE_VOLUME_CURVE -->
<point>0,-4950</point>
<point>33,-3350</point>
<point>66,-1700</point>
<point>100,0</point>
</reference>
<reference name="DEFAULT_NON_MUTABLE_EXT_VOLUME_CURVE">
<!-- Default non-mutable Ext Media System Volume Curve -->
<!-- based on DEFAULT_DEVICE_CATEGORY_EXT_MEDIA_VOLUME_CURVE -->
<point>0,-5800</point>
<point>20,-4000</point>
<point>60,-2100</point>
<point>100,-1000</point>
</reference>
<reference name="DEFAULT_NON_MUTABLE_HEARING_AID_VOLUME_CURVE">
<!-- Default non-mutable Hearing Aid Volume Curve -->
<!-- based on DEFAULT_HEARING_AID_VOLUME_CURVE -->
<point>0,-12700</point>
<point>20,-8000</point>
<point>60,-4000</point>
<point>100,0</point>
</reference>
</volumes>

4047
audio/mixer_paths.xml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,343 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--- Copyright (c) 2014-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 -->
<!--- 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. -->
<mixer>
<!-- These are the initial mixer settings -->
<ctl name="LSM1 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM2 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM3 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM4 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM5 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM6 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM7 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM8 Mixer VA_CDC_DMA_TX_0" value="0" />
<ctl name="LSM1 Port" value="None" />
<ctl name="LSM2 Port" value="None" />
<ctl name="LSM3 Port" value="None" />
<ctl name="LSM4 Port" value="None" />
<ctl name="LSM5 Port" value="None" />
<ctl name="LSM6 Port" value="None" />
<ctl name="LSM7 Port" value="None" />
<ctl name="LSM8 Port" value="None" />
<ctl name="VA_CDC_DMA_TX_0 Channels" value="One" />
<ctl name="VA_CDC_DMA_TX_0 SampleRate" value="KHZ_16" />
<ctl name="VA_AIF1_CAP Mixer DEC0" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC1" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC2" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC3" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC4" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC5" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC6" value="0" />
<ctl name="VA_AIF1_CAP Mixer DEC7" value="0" />
<ctl name="VA DEC0 MUX" value="MSM_DMIC" />
<ctl name="VA DEC1 MUX" value="MSM_DMIC" />
<ctl name="VA DMIC MUX0" value="ZERO" />
<ctl name="VA DMIC MUX1" value="ZERO" />
<ctl name="VA DMIC MUX2" value="ZERO" />
<ctl name="VA DMIC MUX3" value="ZERO" />
<ctl name="VA DMIC MUX4" value="ZERO" />
<ctl name="VA DMIC MUX5" value="ZERO" />
<ctl name="VA DMIC MUX6" value="ZERO" />
<ctl name="VA DMIC MUX7" value="ZERO" />
<ctl name="VA SMIC MUX0" value="ZERO" />
<ctl name="VA SMIC MUX1" value="ZERO" />
<ctl name="VA SMIC MUX2" value="ZERO" />
<ctl name="VA SMIC MUX3" value="ZERO" />
<ctl name="VA SMIC MUX4" value="ZERO" />
<ctl name="VA SMIC MUX5" value="ZERO" />
<ctl name="VA SMIC MUX6" value="ZERO" />
<ctl name="VA SMIC MUX7" value="ZERO" />
<ctl name="EC Reference Bit Format" value="0"/>
<ctl name="EC Reference SampleRate" value="0"/>
<ctl name="ADC1_MIXER Switch" value="1" />
<ctl name="ADC2_MIXER Switch" value="1" />
<ctl name="ADC2 MUX" value="INP3" />
<ctl name="LPI Enable" value="0" />
<ctl name="VA_DEC0 MODE" value="ADC_DEFAULT" />
<ctl name="ADC2_BCS Disable" value="0" />
<ctl name="ADC1 ChMap" value="SWRM_TX1_CH1" />
<ctl name="ADC2 ChMap" value="SWRM_TX2_CH1" />
<ctl name="ADC1 Volume" value="8" />
<ctl name="ADC2 Volume" value="8" />
<path name="listen-voice-wakeup-1">
<ctl name="LSM1 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-2">
<ctl name="LSM2 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-3">
<ctl name="LSM3 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-4">
<ctl name="LSM4 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-5">
<ctl name="LSM5 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-6">
<ctl name="LSM6 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-7">
<ctl name="LSM7 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-8">
<ctl name="LSM8 Mixer VA_CDC_DMA_TX_0" value="1" />
</path>
<path name="listen-voice-wakeup-1 preproc">
<path name="listen-voice-wakeup-1" />
</path>
<path name="listen-voice-wakeup-2 preproc">
<path name="listen-voice-wakeup-2" />
</path>
<path name="listen-voice-wakeup-3 preproc">
<path name="listen-voice-wakeup-3" />
</path>
<path name="listen-voice-wakeup-4 preproc">
<path name="listen-voice-wakeup-4" />
</path>
<path name="listen-voice-wakeup-5 preproc">
<path name="listen-voice-wakeup-5" />
</path>
<path name="listen-voice-wakeup-6 preproc">
<path name="listen-voice-wakeup-6" />
</path>
<path name="listen-voice-wakeup-7 preproc">
<path name="listen-voice-wakeup-7" />
</path>
<path name="listen-voice-wakeup-8 preproc">
<path name="listen-voice-wakeup-8" />
</path>
<path name="listen-voice-wakeup-1 port">
<ctl name="LSM1 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-2 port">
<ctl name="LSM2 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-3 port">
<ctl name="LSM3 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-4 port">
<ctl name="LSM4 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-5 port">
<ctl name="LSM5 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-6 port">
<ctl name="LSM6 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-7 port">
<ctl name="LSM7 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-8 port">
<ctl name="LSM8 Port" value="VA_CDC_DMA_TX_0" />
<ctl name="LPI Enable" value="1" />
<ctl name="ADC2_BCS Disable" value="1" />
</path>
<path name="listen-voice-wakeup-1 preproc port">
<ctl name="LSM1 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-2 preproc port">
<ctl name="LSM2 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-3 preproc port">
<ctl name="LSM3 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-4 preproc port">
<ctl name="LSM4 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-5 preproc port">
<ctl name="LSM5 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-6 preproc port">
<ctl name="LSM6 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-7 preproc port">
<ctl name="LSM7 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-voice-wakeup-8 preproc port">
<ctl name="LSM8 Port" value="ADM_LSM_TX" />
<ctl name="LPI Enable" value="0" />
<ctl name="ADC2_BCS Disable" value="0" />
</path>
<path name="listen-ape-handset-mic">
<ctl name="VA_CDC_DMA_TX_0 Channels" value="One" />
<ctl name="VA_AIF1_CAP Mixer DEC0" value="1" />
<ctl name="VA DEC0 MUX" value="SWR_MIC" />
<ctl name="VA SMIC MUX0" value="SWR_MIC4" />
<ctl name="VA_DEC0 MODE" value="ADC_LOW_PWR" />
<ctl name="ADC2 ChMap" value="SWRM_TX2_CH1" />
<ctl name="ADC2_MIXER Switch" value="1" />
<ctl name="ADC2 MUX" value="INP3" />
<ctl name="VA_DEC0 Volume" value="96" />
</path>
<path name="listen-ape-handset-mic-preproc">
<path name="listen-ape-handset-mic" />
</path>
<path name="listen-ape-handset-dmic-lpi">
<ctl name="VA_CDC_DMA_TX_0 Channels" value="Two" />
<ctl name="VA_AIF1_CAP Mixer DEC0" value="1" />
<ctl name="VA_AIF1_CAP Mixer DEC1" value="1" />
<ctl name="VA DEC0 MUX" value="SWR_MIC" />
<ctl name="VA DEC1 MUX" value="SWR_MIC" />
<ctl name="VA_DEC0 MODE" value="ADC_LOW_PWR" />
<ctl name="VA_DEC1 MODE" value="ADC_LOW_PWR" />
<ctl name="VA SMIC MUX0" value="SWR_MIC0" />
<ctl name="VA SMIC MUX1" value="SWR_MIC4" />
<ctl name="ADC1 ChMap" value="SWRM_TX1_CH1" />
<ctl name="ADC2 ChMap" value="SWRM_TX2_CH1" />
<ctl name="ADC1_MIXER Switch" value="1" />
<ctl name="ADC2_MIXER Switch" value="1" />
<ctl name="ADC2 MUX" value="INP3" />
</path>
<path name="listen-ape-handset-dmic">
<ctl name="VA_CDC_DMA_TX_0 Channels" value="Two" />
<ctl name="VA_AIF1_CAP Mixer DEC0" value="1" />
<ctl name="VA_AIF1_CAP Mixer DEC1" value="1" />
<ctl name="VA DEC0 MUX" value="SWR_MIC" />
<ctl name="VA DEC1 MUX" value="SWR_MIC" />
<ctl name="VA_DEC0 MODE" value="ADC_LOW_PWR" />
<ctl name="VA_DEC1 MODE" value="ADC_LOW_PWR" />
<ctl name="VA SMIC MUX0" value="SWR_MIC4" />
<ctl name="VA SMIC MUX1" value="SWR_MIC0" />
<ctl name="ADC2 ChMap" value="SWRM_TX2_CH1" />
<ctl name="ADC1 ChMap" value="SWRM_TX1_CH1" />
<ctl name="ADC1_MIXER Switch" value="1" />
<ctl name="ADC2_MIXER Switch" value="1" />
<ctl name="ADC2 MUX" value="INP3" />
</path>
<path name="listen-ape-headset-mic">
<ctl name="VA_CDC_DMA_TX_0 Channels" value="One" />
<ctl name="VA_AIF1_CAP Mixer DEC0" value="1" />
<ctl name="VA DEC0 MUX" value="SWR_MIC" />
<ctl name="VA SMIC MUX0" value="SWR_MIC4" />
<ctl name="ADC2_MIXER Switch" value="1" />
<ctl name="ADC2 MUX" value="INP2" />
<ctl name="VA_DEC0 MODE" value="ADC_LOW_PWR" />
<ctl name="ADC2 ChMap" value="SWRM_TX2_CH1" />
</path>
<path name="echo-reference">
<ctl name="AUDIO_REF_EC_UL1 MUX" value="SEC_MI2S_TX" />
<ctl name="SEC_MI2S_RX Channels" value="Two" />
<ctl name="EC Reference Channels" value="Two"/>
<ctl name="EC Reference Bit Format" value="S32_LE"/>
<ctl name="EC Reference SampleRate" value="96000"/>
</path>
<path name="echo-reference handset">
<ctl name="AUDIO_REF_EC_UL1 MUX" value="SEC_MI2S_TX" />
<ctl name="SEC_MI2S_RX Channels" value="Two" />
<ctl name="EC Reference Channels" value="Two"/>
<ctl name="EC Reference Bit Format" value="S32_LE"/>
<ctl name="EC Reference SampleRate" value="96000"/>
</path>
<path name="echo-reference headphones">
<ctl name="AUDIO_REF_EC_UL1 MUX" value="RX_CDC_DMA_RX_0" />
<ctl name="EC Reference Channels" value="One"/>
<ctl name="EC Reference Bit Format" value="S16_LE"/>
<ctl name="EC Reference SampleRate" value="48000"/>
</path>
<path name="echo-reference headset">
<path name="echo-reference headphones" />
</path>
<path name="echo-reference a2dp">
<ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_7_RX"/>
<ctl name="EC Reference Channels" value="Two"/>
<ctl name="EC Reference Bit Format" value="S16_LE"/>
<ctl name="EC Reference SampleRate" value="48000"/>
</path>
</mixer>

View File

@@ -0,0 +1,801 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--- Copyright (c) 2013-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 -->
<!--- 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. -->
<sound_trigger_platform_info>
<param version="0x0106" /> <!-- this must be the first param -->
<!--- Version History: -->
<!--- 0x0101: Legacy version. -->
<!--- 0x0102: Includes acdb_ids param with the gcs_usecase tag. This matches -->
<!--- the gcs_usecase with the acdb device that uses it. -->
<!--- 0x0103: app_type and in_channels added to <lsm usecase> and out_channels -->
<!--- added to <adm_config> -->
<!--- 0x0104: instance id support for both WDSP<CPE> and ADSP lsm usecases -->
<!--- 0x0105: Select <lsm_usecase> based on capture device -->
<!--- 0x0106: Add module_params tag to support multiple module and param ids -->
<!--- per <lsm_usecase> -->
<common_config>
<param implementer_version="0x0102" />
<param max_ape_sessions="8" />
<param enable_failure_detection="false" />
<param support_device_switch="true" />
<param transit_to_non_lpi_on_battery_charging="false" />
<!-- Below backend params must match with port used in mixer path file -->
<!-- param used to configure backend sample rate, format and channels -->
<param backend_port_name="VA_CDC_DMA_TX_0" />
<!-- Param used to match and obtain device backend index -->
<param backend_dai_name="VA_CDC_DMA_TX_0" />
<!-- Param used to indicate if SVA has dedicated SLIM ports -->
<param dedicated_sva_path="false" />
<param dedicated_headset_path="false" />
<param platform_lpi_enable="true" />
<param enable_debug_dumps="false" />
<param support_non_lpi_without_ec="false" />
<param concurrent_capture="false" />
<param concurrent_voip_call="false" />
<param concurrent_voice_call="false" />
</common_config>
<acdb_ids>
<param DEVICE_HANDSET_MIC_APE="100" />
<param DEVICE_HANDSET_MIC_PP_APE="135" />
<param DEVICE_HANDSET_DMIC_APE="149" />
<param DEVICE_HANDSET_DMIC_LPI_APE="179" />
<param DEVICE_HANDSET_TMIC_APE="157" />
<param DEVICE_HANDSET_TMIC_LPI_APE="180" />
<param DEVICE_HANDSET_QMIC_APE="137" />
<param DEVICE_HANDSET_QMIC_LPI_APE="181" />
<param DEVICE_HEADSET_MIC_APE="141" />
<param DEVICE_HEADSET_MIC_APE_LPI="182" />
</acdb_ids>
<!-- Multiple sound_model_config tags can be listed, each with unique -->
<!-- vendor_uuid. The below tag represents QTI SVA engine sound model -->
<!-- configuration. ISV must use their own unique vendor_uuid. -->
<!-- QTI SVA -->
<sound_model_config>
<param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
<param execution_type="ADSP" />
<param merge_first_stage_sound_models="false"/>
<param max_ape_phrases="20" />
<param max_ape_users="10" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
<param dam_token_id="1"/>
<arm_ss_usecase>
<!-- Options are "KEYWORD_DETECTION", "USER_VERIFICATION", "CUSTOM_DETECTION" -->
<param sm_detection_type= "KEYWORD_DETECTION" />
<param sm_id="0x2" />
<param module_lib="libcapiv2svacnn.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
</arm_ss_usecase>
<arm_ss_usecase>
<param sm_detection_type= "USER_VERIFICATION" />
<param sm_id="0x4" />
<param module_lib="libcapiv2vop.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
</arm_ss_usecase>
<arm_ss_usecase>
<param sm_detection_type= "KEYWORD_DETECTION" />
<param sm_id="0x8" />
<param module_lib="libcapiv2svarnn.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
</arm_ss_usecase>
<!-- Module and param ids with which the algorithm is integrated
in non-graphite firmware (note these must come after gcs params)
Extends flexibility to have different ids based on execution type.
valid execution_type values: "WDSP" "ADSP" -->
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="FFECNS" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="FLUENCE_DMIC" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="NON_LPI_BARGE_IN" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="DEFAULT" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="LPI" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HEADSET" />
<param adm_cfg_profile="FFECNS" />
<param fluence_type="FLUENCE_MIC" />
<param execution_mode="ADSP" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<!-- format: "ADPCM_packet" or "PCM_packet" !-->
<!-- transfer_mode: "FTRT" or "RT" -->
<!-- kw_duration is in milli seconds. It is valid only for FTRT
transfer mode -->
<param capture_keyword="PCM_packet, RT, 2000" />
<param client_capture_read_delay="2000" />
</sound_model_config>
<!-- QTI SVA -->
<sound_model_config>
<param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51c" />
<param execution_type="ADSP" />
<param merge_first_stage_sound_models="false"/>
<param max_ape_phrases="20" />
<param max_ape_users="10" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
<param dam_token_id="1"/>
<param kw_start_tolerance="360"/>
<param kw_end_tolerance="240"/>
<arm_ss_usecase>
<!-- Options are "KEYWORD_DETECTION", "USER_VERIFICATION", "CUSTOM_DETECTION" -->
<param sm_detection_type= "KEYWORD_DETECTION" />
<param sm_id="0x2" />
<param module_lib="libcapiv2svacnn.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
<param data_after_kw_end="480"/>
</arm_ss_usecase>
<arm_ss_usecase>
<param sm_detection_type= "USER_VERIFICATION" />
<param sm_id="0x4" />
<param module_lib="libcapiv2vop.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
</arm_ss_usecase>
<arm_ss_usecase>
<param sm_detection_type= "KEYWORD_DETECTION" />
<param sm_id="0x8" />
<param module_lib="libcapiv2svarnn.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
<param data_after_kw_end="480"/>
</arm_ss_usecase>
<!-- Module and param ids with which the algorithm is integrated
in non-graphite firmware (note these must come after gcs params)
Extends flexibility to have different ids based on execution type.
valid execution_type values: "WDSP" "ADSP" -->
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="FFECNS" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="FLUENCE_DMIC" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="NON_LPI_BARGE_IN" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="3"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="FFECNS" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="FLUENCE_DMIC" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="LPI" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HEADSET" />
<param adm_cfg_profile="FFECNS" />
<param fluence_type="FLUENCE_MIC" />
<param execution_mode="ADSP" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<!-- format: "ADPCM_packet" or "PCM_packet" !-->
<!-- transfer_mode: "FTRT" or "RT" -->
<!-- kw_duration is in milli seconds. It is valid only for FTRT
transfer mode -->
<param capture_keyword="PCM_packet, RT, 2000" />
<param client_capture_read_delay="2000" />
</sound_model_config>
<!-- QTI SVA -->
<sound_model_config>
<param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51d" />
<param execution_type="ADSP" />
<param merge_first_stage_sound_models="false"/>
<param max_ape_phrases="20" />
<param max_ape_users="10" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
<param dam_token_id="1"/>
<param kw_start_tolerance="700"/>
<param kw_end_tolerance="600"/>
<arm_ss_usecase>
<!-- Options are "KEYWORD_DETECTION", "USER_VERIFICATION", "CUSTOM_DETECTION" -->
<param sm_detection_type= "KEYWORD_DETECTION" />
<param sm_id="0x2" />
<param module_lib="libcapiv2svacnn.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
<param data_after_kw_end="1000"/>
</arm_ss_usecase>
<arm_ss_usecase>
<param sm_detection_type= "USER_VERIFICATION" />
<param sm_id="0x4" />
<param module_lib="libcapiv2vop.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
</arm_ss_usecase>
<arm_ss_usecase>
<param sm_detection_type= "KEYWORD_DETECTION" />
<param sm_id="0x8" />
<param module_lib="libcapiv2svarnn.so"/>
<param sample_rate="16000"/>
<param bit_wdith="16"/>
<param channel_count="1"/>
<param data_after_kw_end="1000"/>
</arm_ss_usecase>
<!-- Module and param ids with which the algorithm is integrated
in non-graphite firmware (note these must come after gcs params)
Extends flexibility to have different ids based on execution type.
valid execution_type values: "WDSP" "ADSP" -->
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="FFECNS" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="FLUENCE_DMIC" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="NON_LPI_BARGE_IN" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="3"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="FFECNS" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="FLUENCE_DMIC" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="LPI" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HEADSET" />
<param adm_cfg_profile="FFECNS" />
<param fluence_type="FLUENCE_MIC" />
<param execution_mode="ADSP" />
<param app_type="2" /> <!-- app type used in ACDB -->
<param pdk5_app_type="5" />
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param module_type="GMM" />
<param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
<param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
<param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
<param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
<module_params>
<param module_type="PDK5" />
<param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
<param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
<param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
<param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
<param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
</module_params>
</lsm_usecase>
<!-- format: "ADPCM_packet" or "PCM_packet" !-->
<!-- transfer_mode: "FTRT" or "RT" -->
<!-- kw_duration is in milli seconds. It is valid only for FTRT
transfer mode -->
<param capture_keyword="PCM_packet, RT, 2000" />
<param client_capture_read_delay="2000" />
</sound_model_config>
<!-- QTI Music Detection !-->
<sound_model_config>
<param vendor_uuid="876c1b46-9d4d-40cc-a4fd-4d5ec7a80e47" />
<param execution_type="ADSP" />
<param max_ape_phrases="1" />
<param max_ape_users="1" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
<!-- Module and param ids with which the algorithm is integrated
in non-graphite firmware (note these must come after gcs params)
Extends flexibility to have different ids based on execution type.
valid execution_type values: only "ADSP" -->
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="DEFAULT" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<param app_type="4" /> <!-- app type for MD used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x00012C22, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C22, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C22, 0x0, 0x00012C07" />
<param det_event_type_ids="0x00012C22, 0x0, 0x00012C2C" />
<param custom_config_ids="0x00012C22, 0x0, 0x00012C30" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HEADSET" />
<param adm_cfg_profile="DEFAULT" />
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<param app_type="4" /> <!-- app type for MD used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x00012C22, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x00012C22, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x00012C22, 0x0, 0x00012C07" />
<param det_event_type_ids="0x00012C22, 0x0, 0x00012C2C" />
<param custom_config_ids="0x00012C22, 0x0, 0x00012C30" />
</module_params>
</lsm_usecase>
<!-- format: "ADPCM_packet" or "PCM_packet" !-->
<!-- transfer_mode: "FTRT" or "RT" -->
<!-- kw_duration is in milli seconds. It is valid only for FTRT
transfer mode -->
<param capture_keyword="PCM_packet, FTRT, 1500" />
<param client_capture_read_delay="2000" />
</sound_model_config>
<!-- Google Hotword -->
<sound_model_config>
<param vendor_uuid="7038ddc8-30f2-11e6-b0ac-40a8f03d3f15" />
<param execution_type="ADSP" />
<param max_ape_phrases="1" />
<param max_ape_users="1" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
<param dam_token_id="1"/>
<param get_module_version="true"/>
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="DEFAULT" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="NON_LPI_BARGE_IN" />
<param app_type="3" /> <!-- app type used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
<param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
<param version_ids="0x18000001, 0x0, 0x18000101" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="DEFAULT" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
<!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
<!-- must be present with this mode type to handle barge-in. -->
<!-- NON_LPI: If another lsm_usecase is present with this mode -->
<!-- type, it will be used for non-LPI non-barge-in usecases. -->
<!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
<!-- LPI: This mode type will be used for LPI usecases. -->
<param lpi_mode="LPI" />
<param app_type="3" /> <!-- app type used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
<param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
<param version_ids="0x18000001, 0x0, 0x18000101" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HEADSET" />
<param adm_cfg_profile="DEFAULT" />
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<param app_type="3" /> <!-- app type used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
<param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
<param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
<param version_ids="0x18000001, 0x0, 0x18000101" />
</module_params>
</lsm_usecase>
<!-- format: "ADPCM_packet" or "PCM_packet" !-->
<!-- transfer_mode: "FTRT" or "RT" -->
<!-- kw_duration is in milli seconds. It is valid only for FTRT
transfer mode -->
<param capture_keyword="PCM_raw, FTRT, 2000" />
<param client_capture_read_delay="2000" />
</sound_model_config>
<!-- Google Music Detection -->
<sound_model_config>
<param vendor_uuid="9f6ad62a-1f0b-11e7-87c5-40a8f03d3f15" />
<param execution_type="ADSP" />
<param max_ape_phrases="1" />
<param max_ape_users="1" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/> <!-- Module output channels -->
<lsm_usecase>
<param capture_device="HANDSET" />
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="DEFAULT" />
<!-- fluence_type: "FLUENCE_MIC", "FLUENCE_DMIC", "FLUENCE_TMIC" -->
<!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
<!-- is FFECNS -->
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<param app_type="3" /> <!-- app type used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x18000001, 0x0, 0x00012C07" />
<param operation_mode_ids="0x18000001, 0x0, 0x00012C02" />
<param polling_enable_ids="0x18000001, 0x0, 0x00012C1B" />
<param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
</module_params>
</lsm_usecase>
<lsm_usecase>
<param capture_device="HEADSET" />
<param adm_cfg_profile="DEFAULT" />
<param fluence_type="NONE" />
<param execution_mode="ADSP" />
<param app_type="3" /> <!-- app type used in ACDB -->
<param in_channels="1"/> <!-- Module input channels -->
<module_params>
<param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
<param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
<param confidence_levels_ids="0x18000001, 0x0, 0x00012C07" />
<param operation_mode_ids="0x18000001, 0x0, 0x00012C02" />
<param polling_enable_ids="0x18000001, 0x0, 0x00012C1B" />
<param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
</module_params>
</lsm_usecase>
<!-- format: "ADPCM_packet" or "PCM_packet" !-->
<!-- transfer_mode: "FTRT" or "RT" -->
<!-- kw_duration is in milli seconds. It is valid only for FTRT
transfer mode -->
<param capture_keyword="PCM_raw, FTRT, 5000" />
<param client_capture_read_delay="2000" />
</sound_model_config>
<!-- Multiple adm_config tags can be listed, each with unique profile name. -->
<!-- app_type to match corresponding value from ACDB -->
<adm_config>
<param adm_cfg_profile="FFECNS" />
<param app_type="69947" />
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/>
</adm_config>
<adm_config>
<param adm_cfg_profile="DEFAULT" />
<param app_type="69938" />
<param sample_rate="16000" />
<param bit_width="16" />
<param out_channels="1"/>
</adm_config>
</sound_trigger_platform_info>

11
biometrics/Android.bp Normal file
View File

@@ -0,0 +1,11 @@
//
// Copyright (C) 2023 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library_shared {
name: "libvendor.goodix.hardware.biometrics.fingerprint@2.1",
shared_libs: ["vendor.goodix.hardware.biometrics.fingerprint@2.1"],
vendor_available: true,
}

11
bootctrl/Android.bp Normal file
View File

@@ -0,0 +1,11 @@
//
// Copyright (C) 2022 The Android Open Source Project
// SPDX-License-Identifier: Apache-2.0
//
cc_library_shared {
name: "android.hardware.boot@1.2-impl-qti",
stem: "android.hardware.boot@1.0-impl-1.2-qti",
defaults: ["android.hardware.boot@1.2-impl-qti_defaults"],
static_libs: ["libgptutils.veux"],
}

View File

@@ -0,0 +1,34 @@
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<displayConfiguration>
<!-- Global Brightness-Nit mapping -->
<screenBrightnessMap>
<point>
<value>0.003421310</value>
<nits>2.0</nits>
</point>
<point>
<value>1.0</value>
<nits>450.0</nits>
</point>
</screenBrightnessMap>
<screenBrightnessRampIncreaseMaxMillis>2000</screenBrightnessRampIncreaseMaxMillis>
<ambientBrightnessChangeThresholds>
<brighteningThresholds>
<minimum>10</minimum>
</brighteningThresholds>
<darkeningThresholds>
<minimum>0</minimum>
</darkeningThresholds>
</ambientBrightnessChangeThresholds>
<ambientLightHorizonLong>5000</ambientLightHorizonLong>
<ambientLightHorizonShort>50</ambientLightHorizonShort>
<screenBrightnessRampFastDecrease>0.7047244</screenBrightnessRampFastDecrease>
<screenBrightnessRampFastIncrease>0.7047244</screenBrightnessRampFastIncrease>
<screenBrightnessRampSlowDecrease>0.05</screenBrightnessRampSlowDecrease>
<screenBrightnessRampSlowIncrease>0.05</screenBrightnessRampSlowIncrease>
</displayConfiguration>

View File

@@ -0,0 +1,292 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2018-2021 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
Not a Contribution.
Copyright (C) 2012-2018 The Linux Foundation. All rights reserved.
Copyright (C) 2012-2013 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.
-->
<!--
"performance-point"
Vendor-guaranteed performance advertised to the applications
<Limit name="performance-point-widthxheight" value="fps" />
-For each of the resolutions, the advertised fps is the max supported,
with HW-friendly color format and considering video-only.
-Performance for any intermediate resolution will be that of the
next-higher-advertised-resolution.
standard sizes: 480p/576p (SD), 720p (HD), 1080p (FHD), 2160p (UHD)
standard frame rates: 24, 25, 30, 48+, 50, 60, 100*, 120*, 200*, 240* fps
* HD+ only
+ SD only
- All supported standard performance points are listed (unless they are
covered by another listed standard performance point)
- Non-standard performance points are listed along with all the standard
performance points covered by them.
-->
<!--
Holi Non-Secure decoder capabilities
(MB is defined as 16x16)
_______________________________________________________
| Codec | W H fps Mbps MB/s |
|_____________|_________________________________________|
| h264 | 1920 1088 60 60 489600 |
| hevc | 1920 1080 60 60 489600 |
| vp9 | 1920 1088 60 60 489600 |
|_____________|_________________________________________|
Secure decoder capabilities
(MB is defined as 16x16)
_____________________________________________________
| Codec | W H fps Mbps MB/s |
|__________|_________________________________________|
| h264 | 1920 1088 60 35 489600 |
| vp9 | 1920 1088 60 35 489600 |
| hevc | 1920 1088 60 35 489600 |
|__________|_________________________________________|
Non-Secure encoder capabilities (Secure not supported)
(MB is defined as 16x16)
______________________________________________________
| Codec | W H fps Mbps MB/s |
|__________|_________________________________________|
| h264 | 1920 1088 60 60 489600 |
| hevc | 1920 1088 60 60 489600 |
|__________|_________________________________________|
-->
<MediaCodecs>
<Include href="media_codecs_dolby_audio.xml" />
<Settings>
<Domain name="telephony" enabled="true" />
<Setting name="max-video-encoder-input-buffers" value="11" />
</Settings>
<Settings>
<Variant name="slow-cpu" enabled="true" />
</Settings>
<Decoders>
<!-- C2 decoders -->
<MediaCodec name="c2.qti.avc.decoder" type="video/avc">
<Alias name="OMX.qcom.video.decoder.avc"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" range="36-489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Limit name="concurrent-instances" max="16" />
<Feature name="adaptive-playback" />
<Limit name="concurrent-instances" max="16" />
<Limit name="performance-point-1920x1080" value="60" />
<Limit name="performance-point-1280x720" value="120" />
</MediaCodec>
<MediaCodec name="c2.qti.avc.decoder.low_latency" type="video/avc">
<Alias name="OMX.qcom.video.decoder.avc.low_latency"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" range="36-489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Limit name="concurrent-instances" max="16" />
<Feature name="adaptive-playback" />
<Feature name="low-latency" />
<Limit name="concurrent-instances" max="16" />
<Limit name="performance-point-1920x1080" value="60" />
<Limit name="performance-point-1280x720" value="120" />
</MediaCodec>
<MediaCodec name="c2.qti.avc.decoder.secure" type="video/avc" >
<Alias name="OMX.qcom.video.decoder.avc.secure"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="36" max="489600" />
<Limit name="bitrate" range="1-35000000" />
<Limit name="frame-rate" range="1-60" />
<Feature name="adaptive-playback" />
<Feature name="low-latency" />
<Feature name="secure-playback" required="true" />
<Limit name="concurrent-instances" max="3" />
<Limit name="concurrent-instances" max="3" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.decoder" type="video/hevc" >
<Alias name="OMX.qcom.video.decoder.hevc"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="36" max="489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Feature name="adaptive-playback" />
<Limit name="concurrent-instances" max="16" />
<Limit name="performance-point-1920x1080" value="60" />
<Limit name="performance-point-1280x720" value="120" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.decoder.low_latency" type="video/hevc" >
<Alias name="OMX.qcom.video.decoder.hevc.low_latency"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="36" max="489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Feature name="adaptive-playback" />
<Feature name="low-latency" />
<Limit name="concurrent-instances" max="16" />
<Limit name="performance-point-1920x1080" value="60" />
<Limit name="performance-point-1280x720" value="120" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.decoder.secure" type="video/hevc" >
<Alias name="OMX.qcom.video.decoder.hevc.secure"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="36" max="489600" />
<Limit name="bitrate" range="1-35000000" />
<Limit name="frame-rate" range="1-60" />
<Feature name="adaptive-playback" />
<Feature name="low-latency" />
<Feature name="secure-playback" required="true" />
<Limit name="concurrent-instances" max="3" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.qti.vp9.decoder" type="video/x-vnd.on2.vp9" >
<Alias name="OMX.qcom.video.decoder.vp9"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="36" max="489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-60" />
<Feature name="adaptive-playback" />
<Limit name="concurrent-instances" max="3" />
<Limit name="performance-point-1920x1080" value="60" />
</MediaCodec>
<MediaCodec name="c2.qti.vp9.decoder.secure" type="video/x-vnd.on2.vp9" >
<Alias name="OMX.qcom.video.decoder.vp9.secure"/>
<Limit name="size" min="96x96" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="36" max="489600" />
<Limit name="bitrate" range="1-35000000" />
<Limit name="frame-rate" range="1-60" />
<Feature name="adaptive-playback" />
<Feature name="secure-playback" required="true" />
<Limit name="concurrent-instances" max="3" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.android.av1.decoder" type="video/av01" update="true" variant="slow-cpu">
<Limit name="size" min="96x96" max="1920x1080" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="24" max="2073600" />
<Limit name="bitrate" range="1-120000000" />
<Limit name="frame-rate" range="1-60" />
<Feature name="adaptive-playback" />
</MediaCodec>
</Decoders>
<Encoders>
<!-- C2 encoders -->
<MediaCodec name="c2.qti.avc.encoder" type="video/avc">
<Alias name="OMX.qcom.video.encoder.avc"/>
<Limit name="size" min="128x128" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="64" max="489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Limit name="concurrent-instances" max="16" />
<Feature name="intra-refresh" />
<Feature name="bitrate-modes" value="VBR,CBR" />
<Limit name="performance-point-1920x1080" value="60" />
<Limit name="performance-point-1280x720" value="120" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.encoder" type="video/hevc">
<Alias name="OMX.qcom.video.encoder.hevc"/>
<Limit name="size" min="128x128" max="1920x1088" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="64" max="489600" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Limit name="concurrent-instances" max="16" />
<Feature name="bitrate-modes" value="VBR,CBR" />
<Feature name="intra-refresh" />
<Limit name="performance-point-1920x1080" value="60" />
<Limit name="performance-point-1280x720" value="120" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.encoder.cq" type="video/hevc">
<Alias name="OMX.qcom.video.encoder.hevc.cq"/>
<Limit name="size" min="128x128" max="512x512" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="64" max="786432" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-120" />
<Limit name="concurrent-instances" max="16" />
<Limit name="quality" range="0-100" default="80" />
<Feature name="bitrate-modes" value="CQ" />
<Limit name="performance-point-512x512" value="3825" />
</MediaCodec>
<MediaCodec name="c2.qti.heic.encoder" type="image/vnd.android.heic">
<Alias name="OMX.qcom.video.encoder.heic"/>
<Limit name="size" min="512x512" max="8192x8192" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="64" max="786432" />
<Limit name="bitrate" range="1-60000000" />
<Limit name="frame-rate" range="1-20" />
<Limit name="concurrent-instances" max="16" />
<Limit name="quality" range="0-100" default="80" />
<Feature name="bitrate-modes" value="CQ" />
<Limit name="performance-point-8192x4320" value="3" />
<Limit name="performance-point-1920x1080" value="6" />
</MediaCodec>
<MediaCodec name="c2.android.hevc.encoder" type="video/hevc" update="true" variant="slow-cpu">
<!-- profiles and levels: ProfileMain : MainTierLevel51 -->
<Limit name="size" min="2x2" max="512x512" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="8x8" />
<Limit name="block-count" range="1-4096" /> <!-- max 512x512 -->
<Limit name="blocks-per-second" range="1-122880" />
<Limit name="frame-rate" range="1-120" />
<Limit name="bitrate" range="1-10000000" />
<Limit name="complexity" range="0-10" default="0" />
<Limit name="quality" range="0-100" default="80" />
<Feature name="bitrate-modes" value="VBR,CBR,CQ" />
</MediaCodec>
<MediaCodec name="c2.android.vp9.encoder" type="video/x-vnd.on2.vp9" update="true" variant="slow-cpu">
<!-- profiles and levels: ProfileMain : Level_Version0-3 -->
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
<!-- 2016 devices can encode at about 8fps at this block count -->
<Limit name="block-count" range="1-3600" /> <!-- max 1280x720 -->
<Limit name="bitrate" range="1-40000000" />
<Feature name="bitrate-modes" value="VBR,CBR" />
</MediaCodec>
</Encoders>
</MediaCodecs>

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2018-2021 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
Not a Contribution.
Copyright (C) 2012-2017 The Linux Foundation. All rights reserved.
Copyright (C) 2012-2013 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.
-->
<MediaCodecs>
<Encoders>
<MediaCodec name="c2.qti.avc.encoder" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="238-238" />
<Limit name="measured-frame-rate-720x480" range="123-123" />
<Limit name="measured-frame-rate-1280x720" range="50-50" />
<Limit name="measured-frame-rate-1920x1080" range="13-50" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.encoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-320x240" range="226-226" />
<Limit name="measured-frame-rate-720x480" range="121-121" />
<Limit name="measured-frame-rate-1280x720" range="49-49" />
<Limit name="measured-frame-rate-1920x1080" range="12-45" />
</MediaCodec>
<MediaCodec name="c2.android.avc.encoder" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="400-420" />
<Limit name="measured-frame-rate-720x480" range="126-178" />
<Limit name="measured-frame-rate-1280x720" range="35-50" />
<Limit name="measured-frame-rate-1920x1080" range="19-28" />
</MediaCodec>
<MediaCodec name="c2.android.hevc.encoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-320x240" range="90-100" />
<Limit name="measured-frame-rate-720x480" range="7-10" />
<Limit name="measured-frame-rate-1280x720" range="3-6" />
<Limit name="measured-frame-rate-1920x1080" range="2-3" />
</MediaCodec>
<MediaCodec name="c2.android.h263.encoder" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="256-349" />
</MediaCodec>
<MediaCodec name="c2.android.mpeg4.encoder" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="250-377" />
</MediaCodec>
<MediaCodec name="c2.android.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
<Limit name="measured-frame-rate-320x180" range="85-119" />
<Limit name="measured-frame-rate-640x360" range="94-133" />
<Limit name="measured-frame-rate-1280x720" range="21-30" />
<Limit name="measured-frame-rate-1920x1080" range="10-15" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.encoder.cq" type="video/hevc" update="true">
<Limit name="measured-frame-rate-320x240" range="190-300"/>
</MediaCodec>
</Encoders>
<Decoders>
<MediaCodec name="c2.qti.avc.decoder" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="480-510" />
<Limit name="measured-frame-rate-720x480" range="460-490" />
<Limit name="measured-frame-rate-1280x720" range="350-400" />
<Limit name="measured-frame-rate-1920x1088" range="180-190" />
</MediaCodec>
<MediaCodec name="c2.qti.avc.decoder.low_latency" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="320-517" />
<Limit name="measured-frame-rate-720x480" range="101-221" />
<Limit name="measured-frame-rate-1280x720" range="200-420" />
<Limit name="measured-frame-rate-1920x1080" range="76-167" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.decoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-352x288" range="510-530" />
<Limit name="measured-frame-rate-720x480" range="465-620" />
<Limit name="measured-frame-rate-1280x720" range="200-390" />
<Limit name="measured-frame-rate-1920x1080" range="210-230" />
</MediaCodec>
<MediaCodec name="c2.qti.hevc.decoder.low_latency" type="video/hevc" update="true">
<Limit name="measured-frame-rate-352x288" range="273-562" />
<Limit name="measured-frame-rate-720x480" range="440-600" />
<Limit name="measured-frame-rate-1280x720" range="215-425" />
<Limit name="measured-frame-rate-1920x1080" range="118-259" />
</MediaCodec>
<MediaCodec name="c2.qti.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
<Limit name="measured-frame-rate-320x240" range="377-377" />
<Limit name="measured-frame-rate-640x360" range="323-323" />
<Limit name="measured-frame-rate-1280x720" range="262-262" />
<Limit name="measured-frame-rate-1920x1080" range="220-220" />
</MediaCodec>
<MediaCodec name="c2.android.avc.decoder" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="300-320" />
<Limit name="measured-frame-rate-720x480" range="42-59" />
<Limit name="measured-frame-rate-1280x720" range="17-24" />
<Limit name="measured-frame-rate-1920x1080" range="25-35" />
</MediaCodec>
<MediaCodec name="c2.android.hevc.decoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-352x288" range="500-570" />
<Limit name="measured-frame-rate-640x360" range="57-89" />
<Limit name="measured-frame-rate-720x480" range="69-99" />
<Limit name="measured-frame-rate-1280x720" range="35-51" />
<Limit name="measured-frame-rate-1920x1080" range="20-29" />
</MediaCodec>
<MediaCodec name="c2.android.h263.decoder" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="1220-1280" />
<Limit name="measured-frame-rate-352x288" range="940-990" />
</MediaCodec>
<MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="1230-1290" />
<Limit name="measured-frame-rate-480x360" range="800-960" />
<Limit name="measured-frame-rate-1080x720" range="420-490" />
</MediaCodec>
<MediaCodec name="c2.android.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
<Limit name="measured-frame-rate-320x180" range="570-665" />
<Limit name="measured-frame-rate-640x360" range="267-378" />
<Limit name="measured-frame-rate-1280x720" range="75-107" />
<Limit name="measured-frame-rate-1920x1080" range="30-43" />
</MediaCodec>
<MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
<Limit name="measured-frame-rate-320x180" range="850-890" />
<Limit name="measured-frame-rate-640x360" range="85-200" />
<Limit name="measured-frame-rate-1280x720" range="35-49" />
<Limit name="measured-frame-rate-1920x1080" range="23-33" />
</MediaCodec>
</Decoders>
</MediaCodecs>

File diff suppressed because it is too large Load Diff

336
configs/powerhint.json Normal file
View File

@@ -0,0 +1,336 @@
{
"Nodes": [
{
"Name": "CPULittleClusterMaxFreq",
"Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq",
"Values": [
"9999999",
"1651200"
],
"DefaultIndex": 0,
"ResetOnInit": true
},
{
"Name": "CPULittleClusterMinFreq",
"Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq",
"Values": [
"9999999",
"1651200",
"576000"
],
"ResetOnInit": true
},
{
"Name": "CPUBigClusterMaxFreq",
"Path": "/sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq",
"Values": [
"9999999",
"1401600"
],
"DefaultIndex": 0,
"ResetOnInit": true
},
{
"Name": "CPUBigClusterMinFreq",
"Path": "/sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq",
"Values": [
"9999999",
"1228800",
"691200"
],
"ResetOnInit": true
},
{
"Name": "GPUMaxFreq",
"Path": "/sys/class/kgsl/kgsl-3d0/max_pwrlevel",
"Values": [
"0",
"1"
],
"DefaultIndex": 0,
"ResetOnInit": true
},
{
"Name": "GPUMinFreq",
"Path": "/sys/class/kgsl/kgsl-3d0/min_pwrlevel",
"Values": [
"0",
"1",
"5"
],
"ResetOnInit": true
},
{
"Name": "GPUForceRailOn",
"Path": "/sys/class/kgsl/kgsl-3d0/force_rail_on",
"Values": [
"1",
"0"
],
"ResetOnInit": true
},
{
"Name": "GPUForceClkOn",
"Path": "/sys/class/kgsl/kgsl-3d0/force_clk_on",
"Values": [
"1",
"0"
],
"ResetOnInit": true
},
{
"Name": "GPUIdleTimer",
"Path": "/sys/class/kgsl/kgsl-3d0/idle_timer",
"Values": [
"10000",
"80"
],
"ResetOnInit": true
},
{
"Name": "CPUBWHystTriggerCount",
"Path": "/sys/class/devfreq/soc:qcom,cpu-cpu-ddr-bw/bw_hwmon/hyst_trigger_count",
"Values": [
"0",
"3"
],
"ResetOnInit": true
},
{
"Name": "CPUBWHistMemory",
"Path": "/sys/class/devfreq/soc:qcom,cpu-cpu-ddr-bw/bw_hwmon/hist_memory",
"Values": [
"0",
"20"
],
"ResetOnInit": true
},
{
"Name": "CPUBWHystLength",
"Path": "/sys/class/devfreq/soc:qcom,cpu-cpu-ddr-bw/bw_hwmon/hyst_length",
"Values": [
"0",
"10"
],
"ResetOnInit": true
},
{
"Name": "CPUBWMinFreq",
"Path": "/sys/class/devfreq/soc:qcom,cpu-cpu-ddr-bw/min_freq",
"Values": [
"7980",
"5161",
"2929",
"762"
],
"ResetOnInit": true
},
{
"Name": "L3LittleClusterMinFreq",
"Path": "/sys/class/devfreq/fd90100.qcom,cpu0-cpu-l3-lat/min_freq",
"Values": [
"1497600000",
"300000000"
],
"ResetOnInit": true
},
{
"Name": "L3BigClusterMinFreq",
"Path": "/sys/class/devfreq/fd90100.qcom,cpu6-cpu-l3-lat/min_freq",
"Values": [
"1497600000",
"300000000"
],
"ResetOnInit": true
},
{
"Name": "PowerHALRenderingState",
"Path": "vendor.powerhal.rendering",
"Values": [
"EXPENSIVE_RENDERING",
""
],
"Type": "Property"
},
{
"Name": "DoubleTapToWake",
"Path": "/proc/tp_gesture",
"Values": [
"0",
"1"
],
"DefaultIndex": 0,
"ResetOnInit": true
}
],
"Actions": [
{
"PowerHint": "INTERACTION",
"Node": "CPUBigClusterMinFreq",
"Duration": 0,
"Value": "1228800"
},
{
"PowerHint": "INTERACTION",
"Node": "CPULittleClusterMinFreq",
"Duration": 0,
"Value": "1651200"
},
{
"PowerHint": "INTERACTION",
"Node": "CPUBWHystTriggerCount",
"Duration": 0,
"Value": "0"
},
{
"PowerHint": "INTERACTION",
"Node": "CPUBWHystLength",
"Duration": 0,
"Value": "0"
},
{
"PowerHint": "INTERACTION",
"Node": "CPUBWHistMemory",
"Duration": 0,
"Value": "0"
},
{
"PowerHint": "INTERACTION",
"Node": "CPUBWMinFreq",
"Duration": 0,
"Value": "2929"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBigClusterMaxFreq",
"Duration": 3000,
"Value": "9999999"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBigClusterMinFreq",
"Duration": 3000,
"Value": "9999999"
},
{
"PowerHint": "LAUNCH",
"Node": "CPULittleClusterMinFreq",
"Duration": 3000,
"Value": "9999999"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBWHystTriggerCount",
"Duration": 3000,
"Value": "0"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBWHystLength",
"Duration": 3000,
"Value": "0"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBWHistMemory",
"Duration": 3000,
"Value": "0"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBWMinFreq",
"Duration": 3000,
"Value": "7980"
},
{
"PowerHint": "LAUNCH",
"Node": "GPUForceClkOn",
"Duration": 3000,
"Value": "1"
},
{
"PowerHint": "LAUNCH",
"Node": "GPUForceRailOn",
"Duration": 3000,
"Value": "1"
},
{
"PowerHint": "LAUNCH",
"Node": "GPUIdleTimer",
"Duration": 3000,
"Value": "10000"
},
{
"PowerHint": "LAUNCH",
"Node": "L3LittleClusterMinFreq",
"Duration": 3000,
"Value": "1497600000"
},
{
"PowerHint": "LAUNCH",
"Node": "L3BigClusterMinFreq",
"Duration": 3000,
"Value": "1497600000"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "PowerHALRenderingState",
"Duration": 0,
"Value": "EXPENSIVE_RENDERING"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "GPUMinFreq",
"Duration": 0,
"Value": "1"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "GPUMaxFreq",
"Duration": 0,
"Value": "0"
},
{
"PowerHint": "FIXED_PERFORMANCE",
"Node": "CPUBigClusterMaxFreq",
"Duration": 0,
"Value": "9999999"
},
{
"PowerHint": "FIXED_PERFORMANCE",
"Node": "CPUBigClusterMinFreq",
"Duration": 0,
"Value": "9999999"
},
{
"PowerHint": "FIXED_PERFORMANCE",
"Node": "CPULittleClusterMaxFreq",
"Duration": 0,
"Value": "9999999"
},
{
"PowerHint": "FIXED_PERFORMANCE",
"Node": "CPULittleClusterMinFreq",
"Duration": 0,
"Value": "9999999"
},
{
"PowerHint": "FIXED_PERFORMANCE",
"Node": "GPUMaxFreq",
"Duration": 0,
"Value": "0"
},
{
"PowerHint": "FIXED_PERFORMANCE",
"Node": "GPUMinFreq",
"Duration": 0,
"Value": "0"
},
{
"PowerHint": "DOUBLE_TAP_TO_WAKE",
"Node": "DoubleTapToWake",
"Duration": 0,
"Value": "1"
}
]
}

View File

@@ -0,0 +1,6 @@
# Fwk detect
ro.vendor.qti.va_odm.support=1
# SKU properties
ro.product.property_source_order=odm,product,vendor,system_ext,system
import /odm/etc/build_${ro.boot.board_id}.prop

View File

@@ -0,0 +1,18 @@
# Audio
af.fast_track_multiplier=1
audio.deep_buffer.media=true
audio.offload.min.duration.secs=30
audio.offload.video=true
ro.af.client_heap_size_kbyte=7168
# FUSE
persist.sys.fuse.passthrough.enable=true
# Seamless transfer
sys.fflag.override.settings_seamless_transfer=true
# Logs
persist.log.tag.OpenGLRenderer=S
# Declare use of spatial audio
ro.audio.spatializer_enabled=true

View File

@@ -0,0 +1,13 @@
# Brightness Curve
persist.sys.brightness.low.gamma=true
# Disable vsync for cpu rendered apps
debug.cpurend.vsync=false
# Logs
persist.log.tag.ACDB-LOADER=S
# Radio VoNR Calling
persist.radio.is_vonr_enabled_0=true
persist.radio.is_vonr_enabled_1=true
persist.vendor.vonr_setting_support=1

View File

@@ -0,0 +1,26 @@
# Audio
audio.offload.min.duration.secs=30
# CNE
persist.vendor.cne.feature=1
# Display
debug.sf.enable_hwc_vds=1
# DPM
persist.vendor.dpm.feature=11
persist.vendor.dpm.idletimer.mode=default
# Fwk detect
ro.vendor.qti.va_aosp.support=1
# Media
media.stagefright.thumbnail.prefer_hw_codecs=true
ro.media.recorder-max-base-layer-fps=60
vendor.mm.enable.qcom_parser=16777215
# Netmgr
persist.vendor.data.mode=concurrent
# WFD
persist.debug.wfd.enable=1

View File

@@ -0,0 +1,257 @@
# Audio
aaudio.hw_burst_min_usec=2000
aaudio.mmap_exclusive_policy=2
aaudio.mmap_policy=2
persist.vendor.audio.ambisonic.auto.profile=false
persist.vendor.audio.ambisonic.capture=false
persist.vendor.audio.apptype.multirec.enabled=false
persist.vendor.audio.avs.afe_api_version=2
persist.vendor.audio.delta.refresh=true
persist.vendor.audio.fluence.speaker=true
persist.vendor.audio.fluence.tmic.enabled=false
persist.vendor.audio.fluence.voicecall=true
persist.vendor.audio.fluence.voicerec=true
persist.vendor.audio.ha_proxy.enabled=true
persist.vendor.audio.ras.enabled=false
persist.vendor.audio.ring.filter.mask=0
persist.vendor.audio.spv3.enable=true
persist.vendor.audio.voicecall.speaker.stereo=true
ro.audio.monitorRotation=true
ro.config.vc_call_vol_steps=11
ro.vendor.audio.sdk.fluencetype=fluence
ro.vendor.audio.sdk.ssr=false
vendor.audio.adm.buffering.ms=2
vendor.audio.chk.cal.spk=2
vendor.audio.chk.cal.us=2
vendor.audio.dolby.ds2.enabled=false
vendor.audio.dolby.ds2.hardbypass=false
vendor.audio.feature.a2dp_offload.enable=true
vendor.audio.feature.afe_proxy.enable=true
vendor.audio.feature.anc_headset.enable=false
vendor.audio.feature.audiozoom.enable=false
vendor.audio.feature.battery_listener.enable=true
vendor.audio.feature.compr_cap.enable=false
vendor.audio.feature.compress_in.enable=true
vendor.audio.feature.compress_meta_data.enable=true
vendor.audio.feature.compr_voip.enable=false
vendor.audio.feature.concurrent_capture.enable=true
vendor.audio.feature.custom_stereo.enable=true
vendor.audio.feature.deepbuffer_as_primary.enable=false
vendor.audio.feature.display_port.enable=true
vendor.audio.feature.dsm_feedback.enable=false
vendor.audio.feature.dynamic_ecns.enable=true
vendor.audio.feature.external_dsp.enable=false
vendor.audio.feature.external_speaker.enable=false
vendor.audio.feature.external_speaker_tfa.enable=false
vendor.audio.feature.ext_hw_plugin.enable=false
vendor.audio.feature.fluence.enable=true
vendor.audio.feature.fm.enable=true
vendor.audio.feature.hdmi_edid.enable=true
vendor.audio.feature.hdmi_passthrough.enable=true
vendor.audio.feature.hfp.enable=true
vendor.audio.feature.hifi_audio.enable=false
vendor.audio.feature.hwdep_cal.enable=false
vendor.audio.feature.incall_music.enable=true
vendor.audio.feature.keep_alive.enable=true
vendor.audio.feature.kpi_optimize.enable=true
vendor.audio.feature.maxx_audio.enable=false
vendor.audio.feature.multi_voice_session.enable=true
vendor.audio.feature.ras.enable=true
vendor.audio.feature.record_play_concurency.enable=false
vendor.audio.feature.snd_mon.enable=true
vendor.audio.feature.spkr_prot.enable=true
vendor.audio.feature.src_trkn.enable=true
vendor.audio.feature.ssrec.enable=true
vendor.audio.feature.usb_offload_burst_mode.enable=true
vendor.audio.feature.usb_offload.enable=true
vendor.audio.feature.usb_offload_sidetone_volume.enable=false
vendor.audio.feature.vbat.enable=true
vendor.audio.feature.wsa.enable=false
vendor.audio.hal.boot.timeout.ms=20000
vendor.audio_hal.in_period_size=144
vendor.audio.hal.output.suspend.supported=true
vendor.audio_hal.period_multiplier=3
vendor.audio_hal.period_size=192
vendor.audio.hw.aac.encoder=true
vendor.audio.offload.buffer.size.kb=32
vendor.audio.offload.gapless.enabled=true
vendor.audio.offload.multiaac.enable=true
vendor.audio.offload.multiple.enabled=false
vendor.audio.offload.passthrough=false
vendor.audio.offload.track.enable=true
vendor.audio.safx.pbe.enabled=false
vendor.audio.use.sw.alac.decoder=true
vendor.audio.use.sw.ape.decoder=true
vendor.audio.use.sw.mpegh.decoder=true
vendor.audio.volume.headset.gain.depcal=true
vendor.voice.path.for.pcm.voip=true
# Audio hardware
ro.hardware.audio.primary=veux
# Bluetooth
bluetooth.profile.a2dp.source.enabled=true
bluetooth.profile.asha.central.enabled=false
bluetooth.profile.avrcp.target.enabled=true
bluetooth.profile.avrcp.controller.enabled=false
bluetooth.profile.hfp.ag.enabled=true
bluetooth.profile.gatt.enabled=true
bluetooth.profile.hid.device.enabled=true
bluetooth.profile.hid.host.enabled=true
bluetooth.profile.map.server.enabled=true
bluetooth.profile.opp.enabled=true
bluetooth.profile.pan.nap.enabled=true
bluetooth.profile.pan.panu.enabled=true
bluetooth.profile.pbap.server.enabled=true
bluetooth.profile.sap.server.enabled=false
persist.bluetooth.a2dp_offload.disabled=false
persist.vendor.bluetooth.modem_nv_support=true
persist.vendor.bt.aac_frm_ctl.enabled=true
persist.vendor.bt.aac_vbr_frm_ctl.enabled=true
persist.vendor.qcom.bluetooth.a2dp_offload_cap=sbc-aac-aptx-aptxhd-ldac
persist.vendor.qcom.bluetooth.aac_vbr_ctl.enabled=false
persist.vendor.qcom.bluetooth.enable.splita2dp=true
persist.vendor.qcom.bluetooth.scram.enabled=false
persist.vendor.qcom.bluetooth.twsp_state.enabled=false
ro.bluetooth.a2dp_offload.supported=true
ro.vendor.bluetooth.wipower=false
vendor.qcom.bluetooth.soc=cherokee
persist.vendor.btstack.enable.twsplus=true
persist.vendor.btstack.enable.twsplussho=true
# Camera
camera.disable_zsl_mode=true
vendor.camera.aux.packagelist=org.codeaurora.snapcam,com.android.camera
persist.vendor.camera.perflock.enable=0
# Dalvik
dalvik.vm.dex2oat64.enabled=true
# Display
ro.surface_flinger.enable_frame_rate_override=false
ro.surface_flinger.force_hwc_copy_for_virtual_displays=true
ro.surface_flinger.has_wide_color_display=false
ro.surface_flinger.max_frame_buffer_acquired_buffers=3
ro.surface_flinger.max_virtual_display_dimension=4096
ro.surface_flinger.protected_contents=true
ro.surface_flinger.use_color_management=true
ro.surface_flinger.wcg_composition_dataspace=143261696
ro.vendor.display.sensortype=2
ro.vendor.display.svi=1
vendor.display.comp_mask=0
vendor.display.disable_excl_rect=0
vendor.display.disable_excl_rect_partial_fb=1
vendor.display.disable_hw_recovery_dump=1
vendor.display.disable_offline_rotator=0
vendor.display.disable_rotator_ubwc=1
vendor.display.disable_rounded_corner_thread=0
vendor.display.disable_scaler=0
vendor.display.enable_allow_idle_fallback=1
vendor.display.enable_async_powermode=1
vendor.display.enable_camera_smooth=1
vendor.display.enable_early_wakeup=1
vendor.display.enable_optimize_refresh=1
vendor.display.enable_perf_hint_large_comp_cycle=1
vendor.display.enable_posted_start_dyn=1
vendor.display.enable_rc_support=1
vendor.display.enable_rounded_corner=0
vendor.display.idle_time=0
vendor.display.override_doze_mode=1
vendor.display.svi.config=1
vendor.display.svi.config_path=/vendor/etc/SVIConfig.xml
vendor.display.target.version=3
vendor.display.use_smooth_motion=1
# DPM
persist.vendor.dpmhalservice.enable=1
# DRM
drm.service.enabled=true
# FRP
ro.frp.pst=/dev/block/bootdevice/by-name/frp
# Graphics
debug.sf.auto_latch_unsignaled=0
debug.sf.disable_backpressure=1
debug.sf.disable_client_composition_cache=1
debug.sf.enable_advanced_sf_phase_offset=1
debug.sf.enable_gl_backpressure=0
debug.sf.enable_transaction_tracing=false
debug.sf.high_fps_early_gl_phase_offset_ns=-4000000
debug.sf.high_fps_early_phase_offset_ns=-4000000
debug.sf.high_fps_late_app_phase_offset_ns=1000000
debug.sf.high_fps_late_sf_phase_offset_ns=-4000000
debug.sf.predict_hwc_composition_strategy=0
debug.sf.treat_170m_as_sRGB=1
persist.sys.sf.color_mode=7
persist.sys.sf.color_saturation=1.0
persist.sys.sf.native_mode=258
ro.hardware.egl=adreno
ro.hardware.vulkan=adreno
ro.opengles.version=196610
vendor.gralloc.disable_ubwc=0
vendor.gralloc.secure_preview_buffer_format=420_sp
vendor.gralloc.secure_preview_only=1
# HWUI
ro.hwui.render_ahead=2
# Incremental FS
ro.incremental.enable=true
# Media
debug.stagefright.c2inputsurface=-1
vendor.media.target_variant=_blair
vendor.netflix.bsp_rev=Q4350-32962-1
# Perf
ro.vendor.extension_library=libqti-perfd-client.so
# Radio
persist.dbg.ims_volte_enable=1
persist.dbg.volte_avail_ovr=1
persist.dbg.vt_avail_ovr=1
persist.dbg.wfc_avail_ovr=1
persist.vendor.data.iwlan.enable=true
# RIL
persist.radio.multisim.config=dsds
persist.vendor.radio.add_power_save=1
persist.vendor.radio.apm_sim_not_pwdn=1
persist.vendor.radio.custom_ecc=1
persist.vendor.radio.enableadvancedscan=true
persist.vendor.radio.enable_temp_dds=true
persist.vendor.radio.procedure_bytes=SKIP
persist.vendor.radio.rat_on=combine
persist.vendor.radio.sib16_support=1
ro.telephony.default_network=33,33
persist.cust.tel.eons=1
# Sensors
persist.vendor.sensors.enable.bypass_worker=true
persist.vendor.sensors.enable.mag_filter=true
persist.vendor.sensors.enable.rt_task=false
persist.vendor.sensors.hal_trigger_ssr=false
persist.vendor.sensors.support_direct_channel=false
persist.vendor.sensors.sync_request=true
# SoC
ro.boot.product.vendor.sku=holi
ro.soc.manufacturer=QTI
ro.soc.model=SM6375
# USB
sys.usb.mtp.batchcancel=1
vendor.usb.controller=4e00000.dwc3
vendor.usb.diag.func.name=ffs
vendor.usb.dpl.inst.name=dpl
vendor.usb.qdss.inst.name=qdss_sw
vendor.usb.rmnet.func.name=gsi
vendor.usb.rmnet.inst.name=rmnet
vendor.usb.rndis.func.name=gsi
vendor.usb.use_ffs_mtp=1
vendor.usb.use_gadget_hal=0
# WiFi
wifi.aware.interface=wifi-aware0

512
device.mk
View File

@@ -4,18 +4,522 @@
# SPDX-License-Identifier: Apache-2.0
#
# Add common definitions for Qualcomm
$(call inherit-product, hardware/qcom-caf/common/common.mk)
# Enable project quotas and casefolding for emulated storage without sdcardfs
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
# Enable updating of APEXes
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
# Setup dalvik vm configs
$(call inherit-product, frameworks/native/build/phone-xhdpi-6144-dalvik-heap.mk)
# A/B
$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/launch_with_vendor_ramdisk.mk)
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_system=true \
POSTINSTALL_PATH_system=system/bin/otapreopt_script \
FILESYSTEM_TYPE_system=ext4 \
POSTINSTALL_OPTIONAL_system=true
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_vendor=true \
POSTINSTALL_PATH_vendor=bin/checkpoint_gc \
FILESYSTEM_TYPE_vendor=ext4 \
POSTINSTALL_OPTIONAL_vendor=true
PRODUCT_PACKAGES += \
checkpoint_gc \
otapreopt_script
# AAPT
PRODUCT_AAPT_CONFIG := normal
PRODUCT_AAPT_PREF_CONFIG := xxhdpi
# Audio
PRODUCT_PACKAGES += \
android.hardware.audio@6.0-impl \
android.hardware.audio.effect@6.0-impl \
android.hardware.audio.service \
android.hardware.bluetooth.audio-impl \
android.hardware.soundtrigger@2.3-impl
PRODUCT_PACKAGES += \
audio.bluetooth.default \
audio.primary.default \
audio.primary.holi \
audio.r_submix.default \
audio.usb.default \
PRODUCT_PACKAGES += \
audioadsprpcd \
liba2dpoffload \
libbatterylistener \
libcomprcapture \
libexthwplugin \
libhdmiedid \
libhfp \
libqcompostprocbundle \
libqcomvisualizer \
libqcomvoiceprocessing \
libsndmonitor \
libspkrprot \
libvolumelistener \
sound_trigger.primary.holi:32
AUDIO_HAL_DIR := hardware/qcom-caf/sm8350/audio
AUDIO_SKU_DIR := sku_holi
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,$(LOCAL_PATH)/audio,$(TARGET_COPY_OUT_VENDOR)/etc/audio/$(AUDIO_SKU_DIR))
PRODUCT_COPY_FILES += \
$(AUDIO_HAL_DIR)/configs/holi/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/$(AUDIO_SKU_DIR)/bluetooth_audio_policy_configuration.xml \
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/$(AUDIO_SKU_DIR)/r_submix_audio_policy_configuration.xml
# Bluetooth
PRODUCT_PACKAGES += \
android.hardware.bluetooth@1.1.vendor \
com.dsi.ant@1.0.vendor \
vendor.qti.hardware.bluetooth_audio@2.1.vendor \
vendor.qti.hardware.btconfigstore@1.0.vendor \
vendor.qti.hardware.btconfigstore@2.0.vendor
# Boot control
PRODUCT_PACKAGES += \
android.hardware.boot@1.2-impl-qti \
android.hardware.boot@1.2-impl-qti.recovery \
android.hardware.boot@1.2-service
# Camera
PRODUCT_PACKAGES += \
android.hardware.camera.provider@2.4-impl \
android.hardware.camera.provider@2.4-service_64
PRODUCT_PACKAGES += \
vendor.qti.hardware.camera.device@1.0.vendor \
vendor.qti.hardware.camera.postproc@1.0.vendor
PRODUCT_PACKAGES += \
libpiex_shim
PRODUCT_PACKAGES += \
liblz4.vendor \
libpng.vendor
# DebugFS
PRODUCT_SET_DEBUGFS_RESTRICTIONS := true
# Device-specific settings
PRODUCT_PACKAGES += \
XiaomiParts
# Display
PRODUCT_PACKAGES += \
vendor.qti.hardware.display.composer-service
PRODUCT_PACKAGES += \
android.hardware.graphics.mapper@3.0-impl-qti-display \
android.hardware.graphics.mapper@4.0-impl-qti-display \
vendor.qti.hardware.display.allocator-service
PRODUCT_PACKAGES += \
vendor.qti.hardware.memtrack-service
PRODUCT_PACKAGES += \
libdisplayconfig.qti \
libdisplayconfig.system.qti \
libqdMetaData.system \
vendor.display.config@1.15.vendor \
vendor.display.config@2.0.vendor \
vendor.qti.hardware.display.mapper@1.1.vendor \
vendor.qti.hardware.display.mapper@2.0.vendor
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/display_id_4630947081618265473.xml:$(TARGET_COPY_OUT_VENDOR)/etc/displayconfig/display_id_4630947081618265473.xml
# DRM
PRODUCT_PACKAGES += \
android.hardware.drm-service.clearkey \
android.hardware.drm@1.3.vendor \
# Fastbootd
PRODUCT_PACKAGES += \
fastbootd
# Fingerprint
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.3-service.xiaomi
PRODUCT_PACKAGES += \
com.fingerprints.extension@1.0.vendor \
libvendor.goodix.hardware.biometrics.fingerprint@2.1.vendor
# FM
PRODUCT_PACKAGES += \
FM2 \
qcom.fmradio
# Gatekeeper
PRODUCT_PACKAGES += \
android.hardware.gatekeeper@1.0.vendor
# GPS
PRODUCT_PACKAGES += \
android.hardware.gnss@2.1-impl-qti \
android.hardware.gnss@2.1-service-qti
PRODUCT_PACKAGES += \
libbatching \
libgeofencing \
libgnss
PRODUCT_PACKAGES += \
flp.conf \
gnss_antenna_info.conf \
gps.conf \
izat.conf
PRODUCT_PACKAGES += \
libcurl.vendor
# Health
PRODUCT_PACKAGES += \
android.hardware.health-service.qti \
android.hardware.health-service.qti_recovery
PRODUCT_PACKAGES += \
vendor.lineage.health-service.default
# HIDL
PRODUCT_PACKAGES += \
libhidltransport.vendor \
libhwbinder.vendor
# Hotword enrollment
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/permissions/privapp-permissions-hotword.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-hotword.xml
# IFAA manager
PRODUCT_PACKAGES += \
IFAAService
# IPACM
PRODUCT_PACKAGES += \
ipacm \
IPACM_cfg.xml
# IR
PRODUCT_PACKAGES += \
android.hardware.ir@1.0-impl \
android.hardware.ir@1.0-service
# Kernel
OVERRIDE_ENABLE_UFFD_GC := false
# Keymaster
PRODUCT_PACKAGES += \
android.hardware.keymaster@4.1.vendor
# Light
PRODUCT_PACKAGES += \
android.hardware.light-service.xiaomi
# Media
PRODUCT_PACKAGES += \
libOmxAacEnc \
libOmxAmrEnc \
libOmxCore \
libOmxEvrcEnc \
libOmxG711Enc \
libOmxQcelp13Enc \
libavservices_minijail \
libavservices_minijail.vendor \
libcodec2_hidl@1.0.vendor \
libcodec2_vndk.vendor \
libmm-omxcore \
libstagefright_softomx.vendor \
libstagefrighthw
PRODUCT_PACKAGES += \
libstagefright_softomx_plugin.vendor
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/media/media_codecs_blair.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_blair.xml \
$(LOCAL_PATH)/configs/media/media_codecs_performance_blair.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance_blair.xml \
$(LOCAL_PATH)/configs/media/media_profiles_blair.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_blair.xml
# Net
PRODUCT_PACKAGES += \
android.system.net.netd@1.1.vendor
PRODUCT_PACKAGES += \
libnetutils.vendor
# Neural networks
PRODUCT_PACKAGES += \
android.hardware.neuralnetworks@1.3.vendor
# Mlipay
PRODUCT_PACKAGES += \
vendor.xiaomi.hardware.mlipay@1.1.vendor \
vendor.xiaomi.hardware.mtdservice@1.0.vendor
# NFC
PRODUCT_PACKAGES += \
android.hardware.nfc-service.nxp
PRODUCT_PACKAGES += \
libchrome.vendor
PRODUCT_PACKAGES += \
com.android.nfc_extras \
Tag
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_pn557/android.hardware.nfc.hce.xml \
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_pn557/android.hardware.nfc.hcef.xml \
frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_pn557/android.hardware.nfc.uicc.xml \
frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_pn557/android.hardware.nfc.xml \
frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_pn557/android.hardware.se.omapi.uicc.xml \
frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_pn557/com.nxp.mifare.xml
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.nfc.ese.xml \
frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.nfc.hce.xml \
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.nfc.hcef.xml \
frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.nfc.uicc.xml \
frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.nfc.xml \
frameworks/native/data/etc/android.hardware.se.omapi.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.se.omapi.ese.xml \
frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/android.hardware.se.omapi.uicc.xml \
frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sn100/com.nxp.mifare.xml
# Overlays
PRODUCT_ENFORCE_RRO_TARGETS := *
PRODUCT_PACKAGES += \
CarrierConfigOverlayCOMMON \
DialerOverlayCOMMON \
TelephonyOverlayCOMMON
PRODUCT_PACKAGES += \
FrameworkOverlayVEUX \
LineageSDKOverlayVEUX \
SettingsOverlayVEUX \
SystemUIOverlayVEUX \
WifiOverlayVEUX
PRODUCT_PACKAGES += \
SettingsProviderOverlay2201116SG \
SettingsProviderOverlay2201116SC \
SettingsProviderOverlay2201116SI \
SettingsProviderOverlay2201116SR \
SettingsProviderOverlay2201116PG \
SettingsProviderOverlay2201116PI
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/overlay/config-odm.xml:$(TARGET_COPY_OUT_ODM)/overlay/config/config.xml \
$(LOCAL_PATH)/overlay/config-vendor.xml:$(TARGET_COPY_OUT_VENDOR)/overlay/config/config.xml
# Partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true
# Perf
PRODUCT_PACKAGES += \
libqti-perfd-client
PRODUCT_COPY_FILES += \
system/core/libprocessgroup/profiles/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json
# Permissions
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \
frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml \
frameworks/native/data/etc/android.hardware.consumerir.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.consumerir.xml \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \
frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml \
frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepcounter.xml \
frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepdetector.xml \
frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.uicc.xml \
frameworks/native/data/etc/android.hardware.telephony.cdma.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.cdma.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \
frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml \
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \
frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute-0.xml \
frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level-1.xml \
frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version-1_1.xml \
frameworks/native/data/etc/android.hardware.wifi.aware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.aware.xml \
frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \
frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \
frameworks/native/data/etc/android.hardware.wifi.rtt.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.rtt.xml \
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \
frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \
frameworks/native/data/etc/android.software.midi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.midi.xml \
frameworks/native/data/etc/android.software.opengles.deqp.level-2020-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml \
frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \
frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml \
frameworks/native/data/etc/android.software.vulkan.deqp.level-2020-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
# Power
PRODUCT_PACKAGES += \
android.hardware.power-service.lineage-libperfmgr
PRODUCT_PACKAGES += \
libssl.vendor
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
# Protobuf
PRODUCT_PACKAGES += \
libprotobuf-cpp-full-3.9.1-vendorcompat \
libprotobuf-cpp-lite-3.9.1-vendorcompat
# QMI
PRODUCT_PACKAGES += \
libjson \
libqti_vndfwk_detect.vendor \
libvndfwk_detect_jni.qti.vendor
PRODUCT_PACKAGES += \
libsqlite \
libjsoncpp.vendor \
libsqlite.vendor
# RIL
PRODUCT_PACKAGES += \
librmnetctl
PRODUCT_PACKAGES += \
android.hardware.radio@1.5.vendor \
android.hardware.radio.config@1.2.vendor \
android.hardware.radio.deprecated@1.0.vendor \
android.hardware.secure_element@1.2.vendor
PRODUCT_PACKAGES += \
libutilscallstack.vendor
# Rootdir
PRODUCT_PACKAGES += \
fstab.default \
fstab.default.vendor_ramdisk \
fstab.zram \
init.device.rc \
init.kernel.post_boot-blair.sh \
init.qcom.rc \
init.qti.kernel.rc \
init.recovery.qcom.rc \
init.target.rc \
ueventd.qcom.rc
# Sensors
PRODUCT_PACKAGES += \
android.hardware.sensors-service.xiaomi-multihal
PRODUCT_PACKAGES += \
android.frameworks.sensorservice@1.0 \
android.frameworks.sensorservice@1.0.vendor
# Shipping API level
PRODUCT_SHIPPING_API_LEVEL := 30
# Soong
PRODUCT_SOONG_NAMESPACES += \
$(LOCAL_PATH)
$(LOCAL_PATH) \
hardware/google/interfaces \
hardware/google/pixel \
hardware/lineage/interfaces/power-libperfmgr \
hardware/qcom-caf/common/libqti-perfd-client \
hardware/xiaomi \
vendor/qcom/opensource/usb/etc
# Speed profile services and wifi-service to reduce RAM and storage
PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := everything
# Telephony
PRODUCT_PACKAGES += \
ims-ext-common \
ims_ext_common.xml \
qti-telephony-hidl-wrapper \
qti_telephony_hidl_wrapper.xml \
qti-telephony-utils \
qti_telephony_utils.xml \
telephony-ext \
xiaomi-telephony-stub
PRODUCT_BOOT_JARS += \
telephony-ext \
xiaomi-telephony-stub
# Thermal
PRODUCT_PACKAGES += \
android.hardware.thermal-service.qti
# Update engine
PRODUCT_PACKAGES += \
update_engine \
update_engine_sideload \
update_verifier
# USB
PRODUCT_PACKAGES += \
android.hardware.usb-service.qti
PRODUCT_PACKAGES += \
init.qcom.usb.rc \
init.qcom.usb.sh
# Vendor service manager
PRODUCT_PACKAGES += \
vndservicemanager
# Vibrator
$(call inherit-product, vendor/qcom/opensource/vibrator/vibrator-vendor-product.mk)
# WiFi
PRODUCT_PACKAGES += \
android.hardware.wifi-service \
hostapd \
libwifi-hal-qcom \
libwpa_client \
wpa_supplicant \
wpa_supplicant.conf
PRODUCT_PACKAGES += \
android.hardware.wifi.hostapd@1.0.vendor
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,$(LOCAL_PATH)/wifi,$(TARGET_COPY_OUT_VENDOR)/etc/wifi)
# WiFi firmware symlink
PRODUCT_PACKAGES += \
firmware_WCNSS_qcom_cfg.ini_symlink
# Inherit from proprietary targets
$(call inherit-product, vendor/xiaomi/veux/veux-vendor.mk)
# Remove unwanted packages
PRODUCT_PACKAGES += \
RemovePackages
# AGC CAMERA
$(call inherit-product, vendor/xiaomi/AGC-Camera/config.mk)
# MiuiCamera
$(call inherit-product, vendor/xiaomi/miuicamera-veux/MiuiCamera-veux.mk)

View File

@@ -3,6 +3,13 @@
SPDX-License-Identifier: Apache-2.0
-->
<compatibility-matrix version="2.0" type="framework">
<hal format="aidl" optional="true">
<name>vendor.lineage.health</name>
<interface>
<name>IChargingControl</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.goodix.hardware.biometrics.fingerprint</name>
<version>2.0-1</version>

View File

@@ -1,8 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
@@ -17,6 +16,10 @@ if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.."
# If XML files don't have comments before the XML header, use this flag
# Can still be used with broken XML files by using blob_fixup
export TARGET_DISABLE_XML_FIXING=true
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
@@ -27,24 +30,29 @@ source "${HELPER}"
# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true
ONLY_FIRMWARE=
KANG=
SECTION=
while [ "${#}" -gt 0 ]; do
case "${1}" in
-n | --no-cleanup )
CLEAN_VENDOR=false
;;
-k | --kang )
KANG="--kang"
;;
-s | --section )
SECTION="${2}"; shift
CLEAN_VENDOR=false
;;
* )
SRC="${1}"
;;
--only-firmware)
ONLY_FIRMWARE=true
;;
-n | --no-cleanup)
CLEAN_VENDOR=false
;;
-k | --kang)
KANG="--kang"
;;
-s | --section)
SECTION="${2}"
shift
CLEAN_VENDOR=false
;;
*)
SRC="${1}"
;;
esac
shift
done
@@ -53,9 +61,64 @@ if [ -z "${SRC}" ]; then
SRC="adb"
fi
function blob_fixup() {
case "${1}" in
odm/etc/build_*.prop)
[ "$2" = "" ] && return 0
sed -i "/marketname/d" "${2}"
sed -i "s/cert/model/" "${2}"
;;
system_ext/etc/init/wfdservice.rc)
[ "$2" = "" ] && return 0
sed -i "/^service/! s/wfdservice$/wfdservice64/g" "${2}"
;;
system_ext/lib64/libwfdnative.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --remove-needed "android.hidl.base@1.0.so" "${2}"
;;
vendor/etc/camera/camxoverridesettings.txt)
[ "$2" = "" ] && return 0
sed -i "s/0x10080/0/g" "${2}"
sed -i "s/0x1F/0x0/g" "${2}"
;;
vendor/etc/init/init.batterysecret.rc)
[ "$2" = "" ] && return 0
sed -i "s/on charger/on property:init.svc.vendor.charger=running/g" "${2}"
;;
vendor/etc/libnfc-pn557.conf)
[ "$2" = "" ] && return 0
grep -q "NXP RF" "${2}" || cat "${SRC}/vendor/libnfc-nxp_RF.conf" >> "${2}"
;;
vendor/lib/hw/audio.primary.veux.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --replace-needed "liba2dpoffload.so" "liba2dpoffload_veux.so" "${2}"
;;
vendor/lib64/android.hardware.secure_element@1.0-impl.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --remove-needed "android.hidl.base@1.0.so" "${2}"
;;
vendor/lib64/camera/components/com.qti.node.mialgocontrol.so)
[ "$2" = "" ] && return 0
llvm-strip --strip-debug "${2}"
grep -q "libpiex_shim.so" "${2}" || "${PATCHELF}" --add-needed "libpiex_shim.so" "${2}"
;;
*)
return 1
;;
esac
return 0
}
function blob_fixup_dry() {
blob_fixup "$1" ""
}
# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
if [ -z "${ONLY_FIRMWARE}" ]; then
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi
"${MY_DIR}/setup-makefiles.sh"

20
gps/Android.bp Normal file
View File

@@ -0,0 +1,20 @@
GNSS_CFLAGS = [
"-Werror",
"-Wno-undefined-bool-conversion",
]
/* Activate the following for debug purposes only,
comment out for production */
GNSS_SANITIZE_DIAG = {
/*
diag: {
cfi: true,
misc_undefined: [
"bounds",
"null",
"unreachable",
"integer",
],
},
*/
}

28
gps/Android.mk Normal file
View File

@@ -0,0 +1,28 @@
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
# Set required flags
GNSS_CFLAGS := \
-Werror \
-Wno-undefined-bool-conversion
GNSS_HIDL_VERSION = 2.1
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
LOCAL_PATH := $(call my-dir)
include $(call all-makefiles-under,$(LOCAL_PATH))
GNSS_SANITIZE_DIAG := cfi bounds null unreachable integer address
endif # ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)

50
gps/CleanSpec.mk Normal file
View File

@@ -0,0 +1,50 @@
# Copyright (C) 2007 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.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libloc_api*)

214
gps/android/2.1/AGnss.cpp Normal file
View File

@@ -0,0 +1,214 @@
/*
* Copyright (c) 2017-2020, 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 V2_1 {
namespace implementation {
static AGnss* spAGnss = nullptr;
AGnss::AGnss(Gnss* gnss) : mGnss(gnss), mType(LOC_AGPS_TYPE_INVALID) {
spAGnss = this;
}
AGnss::~AGnss() {
spAGnss = nullptr;
}
void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status) {
if (nullptr != spAGnss) {
spAGnss->statusCb(status.type, status.status);
}
}
void AGnss::statusCb(AGpsExtType type, LocAGpsStatusValue status) {
V2_0::IAGnssCallback::AGnssType aType;
IAGnssCallback::AGnssStatusValue aStatus;
// cache the AGps Type
mType = type;
switch (type) {
case LOC_AGPS_TYPE_SUPL:
aType = IAGnssCallback::AGnssType::SUPL;
break;
case LOC_AGPS_TYPE_SUPL_ES:
aType = IAGnssCallback::AGnssType::SUPL_EIMS;
break;
default:
LOC_LOGE("invalid type: %d", type);
return;
}
switch (status) {
case LOC_GPS_REQUEST_AGPS_DATA_CONN:
aStatus = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
break;
case LOC_GPS_RELEASE_AGPS_DATA_CONN:
aStatus = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
break;
case LOC_GPS_AGPS_DATA_CONNECTED:
aStatus = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
break;
case LOC_GPS_AGPS_DATA_CONN_DONE:
aStatus = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
break;
case LOC_GPS_AGPS_DATA_CONN_FAILED:
aStatus = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
break;
default:
LOC_LOGE("invalid status: %d", status);
return;
}
if (mAGnssCbIface != nullptr) {
auto r = mAGnssCbIface->agnssStatusCb(aType, aStatus);
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<V2_0::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(uint64_t /*networkHandle*/, const hidl_string& apn,
V2_0::IAGnss::ApnIpType apnIpType) {
if (mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
std::string apnString(apn.c_str());
// During Emergency SUPL, an apn name of "sos" means that no
// apn was found, like in the simless case, so apn is cleared
if (LOC_AGPS_TYPE_SUPL_ES == mType && "sos" == apnString) {
LOC_LOGD("dataConnOpen APN name = [sos] cleared");
apnString.clear();
}
LOC_LOGD("dataConnOpen APN name = [%s]", apnString.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, apnString.c_str(), apnString.size(), (int)bearerType);
return true;
}
Return<bool> AGnss::setServer(V2_0::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::SUPL) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
} else if (type == IAGnssCallback::AGnssType::C2K) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
} else if (type == IAGnssCallback::AGnssType::SUPL_EIMS) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL_EIMS;
} else if (type == IAGnssCallback::AGnssType::SUPL_IMS) {
config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL_IMS;
} else {
LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<uint8_t>(type));
return false;
}
config.assistanceServer.hostName = strdup(hostname.c_str());
config.assistanceServer.port = port;
return mGnss->updateConfiguration(config);
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

80
gps/android/2.1/AGnss.h Normal file
View File

@@ -0,0 +1,80 @@
/*
* Copyright (c) 2017-2020, 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_V2_0_AGNSS_H
#define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
#include <android/hardware/gnss/2.0/IAGnss.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
using ::android::hardware::gnss::V2_0::IAGnssCallback;
struct Gnss;
struct AGnss : public V2_0::IAGnss {
AGnss(Gnss* gnss);
~AGnss();
/*
* Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow.
* These declarations were generated from IAGnss.hal.
*/
Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override;
Return<bool> dataConnClosed() override;
Return<bool> dataConnFailed() override;
Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn,
V2_0::IAGnss::ApnIpType apnIpType) override;
Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type,
const hidl_string& hostname, int32_t port) override;
void statusCb(AGpsExtType type, LocAGpsStatusValue status);
/* Data call setup callback passed down to GNSS HAL implementation */
static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
private:
Gnss* mGnss = nullptr;
sp<V2_0::IAGnssCallback> mAGnssCbIface = nullptr;
AGpsExtType mType;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H

View File

@@ -0,0 +1,135 @@
/*
* Copyright (c) 2017-2020, 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 V2_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;
std::string apn("");
// for XTRA
if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
int8_t typeout = loc_core::TYPE_UNKNOWN;
switch(type)
{
case IAGnssRil::NetworkType::MOBILE:
typeout = loc_core::TYPE_MOBILE;
break;
case IAGnssRil::NetworkType::WIFI:
typeout = loc_core::TYPE_WIFI;
break;
case IAGnssRil::NetworkType::MMS:
typeout = loc_core::TYPE_MMS;
break;
case IAGnssRil::NetworkType::SUPL:
typeout = loc_core::TYPE_SUPL;
break;
case IAGnssRil::NetworkType::DUN:
typeout = loc_core::TYPE_DUN;
break;
case IAGnssRil::NetworkType::HIPRI:
typeout = loc_core::TYPE_HIPRI;
break;
case IAGnssRil::NetworkType::WIMAX:
typeout = loc_core::TYPE_WIMAX;
break;
default:
{
int networkType = (int) type;
// Handling network types not available in IAgnssRil
switch(networkType)
{
case NetworkType_BLUETOOTH:
typeout = loc_core::TYPE_BLUETOOTH;
break;
case NetworkType_ETHERNET:
typeout = loc_core::TYPE_ETHERNET;
break;
case NetworkType_PROXY:
typeout = loc_core::TYPE_PROXY;
break;
default:
typeout = loc_core::TYPE_UNKNOWN;
}
}
break;
}
mGnss->getGnssInterface()->updateConnectionStatus(connected, typeout, false, 0, apn);
}
return true;
}
Return<bool> AGnssRil::updateNetworkState_2_0(const V2_0::IAGnssRil::NetworkAttributes& attributes) {
ENTRY_LOG_CALLFLOW();
std::string apn = attributes.apn;
if (nullptr != mGnss && (nullptr != mGnss->getGnssInterface())) {
int8_t typeout = loc_core::TYPE_UNKNOWN;
bool roaming = false;
if (attributes.capabilities & IAGnssRil::NetworkCapability::NOT_METERED) {
typeout = loc_core::TYPE_WIFI;
} else {
typeout = loc_core::TYPE_MOBILE;
}
if (attributes.capabilities & IAGnssRil::NetworkCapability::NOT_ROAMING) {
roaming = false;
}
LOC_LOGd("apn string received is: %s", apn.c_str());
mGnss->getGnssInterface()->updateConnectionStatus(attributes.isConnected,
typeout, roaming, (NetworkHandle) attributes.networkHandle, apn);
}
return true;
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2017-2020, 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_V2_0_AGNSSRIL_H_
#define ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_
#include <android/hardware/gnss/2.0/IAGnssRil.h>
#include <hidl/Status.h>
#include <location_interface.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
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 V2_0::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<V1_0::IAGnssRilCallback>& /*callback*/) override {
return Void();
}
Return<void> setRefLocation(const V1_0::IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override {
return Void();
}
Return<bool> setSetId(V1_0::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, V1_0::IAGnssRil::NetworkType type, bool roaming) override;
// Methods from ::android::hardware::gnss::V2_0::IAGnssRil follow
Return<bool> updateNetworkState_2_0(const V2_0::IAGnssRil::NetworkAttributes& attributes) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_

115
gps/android/2.1/Android.mk Normal file
View File

@@ -0,0 +1,115 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.1-impl-qti
# 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 \
GnssAntennaInfo.cpp \
MeasurementCorrections.cpp \
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_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
liblocation_api_headers \
liblocbatterylistener_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
libhidlbase \
libcutils \
libutils \
android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
android.hardware.gnss@2.0 \
android.hardware.gnss@2.1 \
android.hardware.gnss.measurement_corrections@1.0 \
android.hardware.gnss.measurement_corrections@1.1 \
android.hardware.gnss.visibility_control@1.0 \
android.hardware.health@1.0 \
android.hardware.health@2.0 \
android.hardware.health@2.1 \
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.1-service-qti
# 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.1-service-qti.xml
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.gnss@2.1-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 += \
libhidlbase \
android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
android.hardware.gnss@2.0 \
android.hardware.gnss@2.1 \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE)

800
gps/android/2.1/Gnss.cpp Normal file
View File

@@ -0,0 +1,800 @@
/*
* Copyright (c) 2017-2020, 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"
#include "loc_misc_utils.h"
typedef const GnssInterface* (getLocationInterface)();
#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
#define DELIMITER ";"
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::visibility_control::V1_0::implementation::GnssVisibilityControl;
using ::android::hardware::gnss::measurement_corrections::V1_1::
implementation::MeasurementCorrections;
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->getGnssInterface()->resetNetworkInfo();
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;
// initilize gnss interface at first in case needing notify battery status
sGnss->getGnssInterface()->initialize();
// 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) {
mApi->destroy();
mApi = nullptr;
}
sGnss = nullptr;
}
GnssAPIClient* Gnss::getApi() {
if (mApi != nullptr) {
return mApi;
}
if (mGnssCbIface_2_1 != nullptr) {
mApi = new GnssAPIClient(mGnssCbIface_2_1);
} else if (mGnssCbIface_2_0 != nullptr) {
mApi = new GnssAPIClient(mGnssCbIface_2_0);
} else if (mGnssCbIface_1_1 != nullptr) {
mApi = new GnssAPIClient(mGnssCbIface_1_1, mGnssNiCbIface);
} else if (mGnssCbIface != nullptr) {
mApi = new GnssAPIClient(mGnssCbIface, mGnssNiCbIface);
} else {
LOC_LOGW("%s] GnssAPIClient is not ready", __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);
}
}
return mApi;
}
const GnssInterface* Gnss::getGnssInterface() {
static bool getGnssInterfaceFailed = false;
if (mGnssInterface == nullptr && !getGnssInterfaceFailed) {
void * libHandle = nullptr;
getLocationInterface* getter = (getLocationInterface*)
dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
if (NULL == getter) {
getGnssInterfaceFailed = true;
} else {
mGnssInterface = (GnssInterface*)(*getter)();
}
}
return mGnssInterface;
}
Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
// In case where previous call to setCallback_1_1/setCallback_2_0/setCallback_2_1, then
// we need to cleanup these interfaces/callbacks here since we no longer
// do so in cleanup() function to keep callbacks around after cleanup()
if (mApi != nullptr) {
mApi->gnssUpdateCallbacks_2_0(nullptr);
mApi->gnssUpdateCallbacks_2_1(nullptr);
}
if (mGnssCbIface_1_1 != nullptr) {
mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_1_1 = nullptr;
}
if (mGnssCbIface_2_0 != nullptr) {
mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_2_0 = nullptr;
}
if (mGnssCbIface_2_1 != nullptr) {
mGnssCbIface_2_1->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_2_1 = nullptr;
}
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.lppProfileMask = gnssConfig.lppProfileMask;
}
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;
}
if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT) {
mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT;
mPendingConfig.emergencyExtensionSeconds = gnssConfig.emergencyExtensionSeconds;
}
}
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->gnssStop();
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 __unused, int64_t timeReferenceMs __unused,
int32_t uncertaintyMs __unused) {
return true;
}
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();
// deprecated function. Must return nullptr to pass VTS
return nullptr;
}
Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
ENTRY_LOG_CALLFLOW();
// deprecated function. Must return nullptr to pass VTS
return nullptr;
}
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();
if (mGnssConfig == nullptr) {
mGnssConfig = new GnssConfiguration(this);
}
return mGnssConfig;
}
Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
ENTRY_LOG_CALLFLOW();
if (mGnssGeofencingIface == nullptr) {
mGnssGeofencingIface = new GnssGeofencing();
}
return mGnssGeofencingIface;
}
Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
ENTRY_LOG_CALLFLOW();
if (mGnssBatching == nullptr) {
mGnssBatching = new GnssBatching();
}
return mGnssBatching;
}
Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
ENTRY_LOG_CALLFLOW();
if (mGnssDebug == nullptr) {
mGnssDebug = new GnssDebug(this);
}
return mGnssDebug;
}
Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
ENTRY_LOG_CALLFLOW();
if (mGnssRil == nullptr) {
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();
auto r = callback->gnssNameCb(getVersionString());
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNameCb description=%s",
__func__, r.description().c_str());
}
// In case where previous call to setCallback/setCallback_2_0/setCallback_2_1, then
// we need to cleanup these interfaces/callbacks here since we no longer
// do so in cleanup() function to keep callbacks around after cleanup()
if (mApi != nullptr) {
mApi->gnssUpdateCallbacks_2_0(nullptr);
mApi->gnssUpdateCallbacks_2_1(nullptr);
}
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface = nullptr;
}
if (mGnssCbIface_2_0 != nullptr) {
mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_2_0 = nullptr;
}
if (mGnssCbIface_2_1 != nullptr) {
mGnssCbIface_2_1->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_2_1 = nullptr;
}
if (mGnssCbIface_1_1 != nullptr) {
mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
}
mGnssCbIface_1_1 = callback;
if (mGnssCbIface_1_1 != nullptr) {
mGnssCbIface_1_1->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
}
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest);
};
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
}
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks(mGnssCbIface_1_1, mGnssNiCbIface);
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
api->requestCapabilities();
}
return true;
}
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();
#ifdef GNSS_HIDL_LEGACY_MEASURMENTS
return nullptr;
#else
if (mGnssMeasurement == nullptr)
mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
#endif
}
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 (ODCPI_REQUEST_TYPE_STOP == request.type) {
return;
}
if (mGnssCbIface_2_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) {
LOC_LOGd("gnssRequestLocationCb_2_1 isUserEmergency = %d", request.isEmergencyMode);
auto r = mGnssCbIface_2_1->gnssRequestLocationCb_2_0(!request.isEmergencyMode,
request.isEmergencyMode);
if (!r.isOk()) {
LOC_LOGe("Error invoking gnssRequestLocationCb_2_0 %s", r.description().c_str());
}
} else {
LOC_LOGv("Unsupported ODCPI request type: %d", request.type);
}
} else if (mGnssCbIface_2_0 != nullptr) {
// For emergency mode, request DBH (Device based hybrid) location
// Mark Independent from GNSS flag to false.
if (ODCPI_REQUEST_TYPE_START == request.type) {
LOC_LOGd("gnssRequestLocationCb_2_0 isUserEmergency = %d", request.isEmergencyMode);
auto r = mGnssCbIface_2_0->gnssRequestLocationCb_2_0(!request.isEmergencyMode,
request.isEmergencyMode);
if (!r.isOk()) {
LOC_LOGe("Error invoking gnssRequestLocationCb_2_0 %s", r.description().c_str());
}
} else {
LOC_LOGv("Unsupported ODCPI request type: %d", request.type);
}
} else 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.");
}
}
// Methods from ::android::hardware::gnss::V2_0::IGnss follow.
Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
auto r = callback->gnssNameCb(getVersionString());
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNameCb description=%s",
__func__, r.description().c_str());
}
// In case where previous call to setCallback/setCallback_1_1/setCallback_2_1, then
// we need to cleanup these interfaces/callbacks here since we no longer
// do so in cleanup() function to keep callbacks around after cleanup()
if (mApi != nullptr) {
mApi->gnssUpdateCallbacks(nullptr, nullptr);
mApi->gnssUpdateCallbacks_2_1(nullptr);
}
mGnssNiCbIface = nullptr;
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface = nullptr;
}
if (mGnssCbIface_1_1 != nullptr) {
mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_1_1 = nullptr;
}
if (mGnssCbIface_2_1 != nullptr) {
mGnssCbIface_2_1->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_2_1 = nullptr;
}
if (mGnssCbIface_2_0 != nullptr) {
mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
}
mGnssCbIface_2_0 = callback;
if (mGnssCbIface_2_0 != nullptr) {
mGnssCbIface_2_0->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
}
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest);
};
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
}
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks_2_0(mGnssCbIface_2_0);
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
api->requestCapabilities();
}
return true;
}
Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
ENTRY_LOG_CALLFLOW();
if (mAGnssIface_2_0 == nullptr) {
mAGnssIface_2_0 = new AGnss(this);
}
return mAGnssIface_2_0;
}
Return<sp<V2_0::IAGnssRil>> Gnss::getExtensionAGnssRil_2_0() {
if (mGnssRil == nullptr) {
mGnssRil = new AGnssRil(this);
}
return mGnssRil;
}
Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() {
ENTRY_LOG_CALLFLOW();
if (mGnssConfig == nullptr) {
mGnssConfig = new GnssConfiguration(this);
}
return mGnssConfig;
}
Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
ENTRY_LOG_CALLFLOW();
#ifdef GNSS_HIDL_LEGACY_MEASURMENTS
return nullptr;
#else
if (mGnssMeasurement == nullptr)
mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
#endif
}
Return<sp<IMeasurementCorrectionsV1_0>>
Gnss::getExtensionMeasurementCorrections() {
ENTRY_LOG_CALLFLOW();
if (mGnssMeasCorr == nullptr) {
mGnssMeasCorr = new MeasurementCorrections(this);
}
return mGnssMeasCorr;
}
Return<sp<IMeasurementCorrectionsV1_1>>
Gnss::getExtensionMeasurementCorrections_1_1() {
ENTRY_LOG_CALLFLOW();
if (mGnssMeasCorr == nullptr) {
mGnssMeasCorr = new MeasurementCorrections(this);
}
return mGnssMeasCorr;
}
Return<sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl>>
Gnss::getExtensionVisibilityControl() {
ENTRY_LOG_CALLFLOW();
if (mVisibCtrl == nullptr) {
mVisibCtrl = new GnssVisibilityControl(this);
}
return mVisibCtrl;
}
Return<bool> Gnss::injectBestLocation_2_0(const V2_0::GnssLocation& gnssLocation) {
ENTRY_LOG_CALLFLOW();
const GnssInterface* gnssInterface = getGnssInterface();
if (nullptr != gnssInterface) {
Location location = {};
convertGnssLocation(gnssLocation, location);
gnssInterface->odcpiInject(location);
}
return true;
}
Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() {
ENTRY_LOG_CALLFLOW();
if (mGnssDebug == nullptr) {
mGnssDebug = new GnssDebug(this);
}
return mGnssDebug;
}
Return<sp<V2_0::IGnssBatching>> Gnss::getExtensionGnssBatching_2_0() {
return nullptr;
}
// Methods from ::android::hardware::gnss::V2_1::IGnss follow.
Return<bool> Gnss::setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
auto r = callback->gnssNameCb(getVersionString());
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNameCb description=%s",
__func__, r.description().c_str());
}
// In case where previous call to setCallback/setCallback_1_1/setCallback_2_0, then
// we need to cleanup these interfaces/callbacks here since we no longer
// do so in cleanup() function to keep callbacks around after cleanup()
if (mApi != nullptr) {
mApi->gnssUpdateCallbacks(nullptr, nullptr);
mApi->gnssUpdateCallbacks_2_0(nullptr);
}
mGnssNiCbIface = nullptr;
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface = nullptr;
}
if (mGnssCbIface_1_1 != nullptr) {
mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_1_1 = nullptr;
}
if (mGnssCbIface_2_0 != nullptr) {
mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
mGnssCbIface_2_0 = nullptr;
}
if (mGnssCbIface_2_1 != nullptr) {
mGnssCbIface_2_1->unlinkToDeath(mGnssDeathRecipient);
}
mGnssCbIface_2_1 = callback;
if (mGnssCbIface_2_1 != nullptr) {
mGnssCbIface_2_1->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
}
const GnssInterface* gnssInterface = getGnssInterface();
if (gnssInterface != nullptr) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest);
};
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
}
GnssAPIClient* api = getApi();
if (api != nullptr) {
api->gnssUpdateCallbacks_2_1(mGnssCbIface_2_1);
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
api->requestCapabilities();
}
return true;
}
Return<sp<V2_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_1() {
ENTRY_LOG_CALLFLOW();
if (mGnssMeasurement == nullptr) {
mGnssMeasurement = new GnssMeasurement();
}
return mGnssMeasurement;
}
Return<sp<V2_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_1() {
ENTRY_LOG_CALLFLOW();
if (mGnssConfig == nullptr) {
mGnssConfig = new GnssConfiguration(this);
}
return mGnssConfig;
}
Return<sp<V2_1::IGnssAntennaInfo>> Gnss::getExtensionGnssAntennaInfo() {
ENTRY_LOG_CALLFLOW();
if (mGnssAntennaInfo == nullptr) {
mGnssAntennaInfo = new GnssAntennaInfo(this);
}
return mGnssAntennaInfo;
}
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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

193
gps/android/2.1/Gnss.h Normal file
View File

@@ -0,0 +1,193 @@
/*
* Copyright (c) 2017-2020, 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_V2_1_GNSS_H
#define ANDROID_HARDWARE_GNSS_V2_1_GNSS_H
#include <AGnss.h>
#include <AGnssRil.h>
#include <GnssConfiguration.h>
#include <GnssMeasurement.h>
#include <GnssBatching.h>
#include <GnssGeofencing.h>
#include <GnssNi.h>
#include <GnssDebug.h>
#include <GnssAntennaInfo.h>
#include <android/hardware/gnss/2.1/IGnss.h>
#include <android/hardware/gnss/measurement_corrections/1.1/IMeasurementCorrections.h>
#include <MeasurementCorrections.h>
#include <GnssVisibilityControl.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include "GnssAPIClient.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V2_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;
using IMeasurementCorrectionsV1_0 =
::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
using IMeasurementCorrectionsV1_1 =
::android::hardware::gnss::measurement_corrections::V1_1::IMeasurementCorrections;
using ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
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;
// Methods from ::android::hardware::gnss::V2_0::IGnss follow.
Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override;
Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override;
Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override;
Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override;
Return<sp<IMeasurementCorrectionsV1_0>> getExtensionMeasurementCorrections() override;
Return<sp<IMeasurementCorrectionsV1_1>> getExtensionMeasurementCorrections_1_1() override;
Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
Return<bool> injectBestLocation_2_0(
const ::android::hardware::gnss::V2_0::GnssLocation& location) override;
Return<sp<V2_0::IGnssBatching>> getExtensionGnssBatching_2_0() override;
Return<sp<V2_0::IGnssDebug>> getExtensionGnssDebug_2_0() override;
Return<sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl>>
getExtensionVisibilityControl() override;
// Methods from ::android::hardware::gnss::V2_1::IGnss follow.
Return<bool> setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) override;
Return<sp<V2_1::IGnssMeasurement>> getExtensionGnssMeasurement_2_1() override;
Return<sp<V2_1::IGnssConfiguration>> getExtensionGnssConfiguration_2_1() override;
Return<sp<V2_1::IGnssAntennaInfo>> getExtensionGnssAntennaInfo() 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<V1_0::IGnssNi> mGnssNi = nullptr;
sp<V1_0::IGnssGeofencing> mGnssGeofencingIface = nullptr;
sp<V1_0::IAGnss> mAGnssIface = nullptr;
sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr;
sp<V2_0::IAGnss> mAGnssIface_2_0 = nullptr;
sp<V2_0::IAGnssRil> mGnssRil = nullptr;
sp<V2_0::IGnssBatching> mGnssBatching = nullptr;
sp<V2_0::IGnssDebug> mGnssDebug = nullptr;
sp<V2_0::IGnssCallback> mGnssCbIface_2_0 = nullptr;
sp<V2_1::IGnssCallback> mGnssCbIface_2_1 = nullptr;
sp<V2_1::IGnssMeasurement> mGnssMeasurement = nullptr;
sp<V2_1::IGnssConfiguration> mGnssConfig = nullptr;
sp<V2_1::IGnssAntennaInfo> mGnssAntennaInfo = nullptr;
sp<IMeasurementCorrectionsV1_1> mGnssMeasCorr = nullptr;
sp<IGnssVisibilityControl> mVisibCtrl = nullptr;
GnssAPIClient* mApi = nullptr;
GnssConfig mPendingConfig;
const GnssInterface* mGnssInterface = nullptr;
};
extern "C" V1_0::IGnss* HIDL_FETCH_IGnss(const char* name);
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_1_GNSS_H

View File

@@ -0,0 +1,202 @@
/*
* Copyright (c) 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
* 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_TAG "LocSvc_GnssAntennaInfoInterface"
#include <log_util.h>
#include "Gnss.h"
#include "GnssAntennaInfo.h"
#include <android/hardware/gnss/1.0/types.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
static GnssAntennaInfo* spGnssAntennaInfo = nullptr;
static void convertGnssAntennaInfo(std::vector<GnssAntennaInformation>& in,
hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& antennaInfos);
void GnssAntennaInfo::GnssAntennaInfoDeathRecipient::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
// However, we need to inform the adapter that the service has died
if (nullptr == spGnssAntennaInfo) {
LOC_LOGE("%s]: spGnssAntennaInfo is nullptr", __FUNCTION__);
return;
}
if (nullptr == spGnssAntennaInfo->mGnss) {
LOC_LOGE("%s]: spGnssAntennaInfo->mGnss is nullptr", __FUNCTION__);
return;
}
spGnssAntennaInfo->mGnss->getGnssInterface()->antennaInfoClose();
}
static void convertGnssAntennaInfo(std::vector<GnssAntennaInformation>& in,
hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& out) {
uint32_t vecSize, numberOfRows, numberOfColumns;
vecSize = in.size();
out.resize(vecSize);
for (uint32_t i = 0; i < vecSize; i++) {
out[i].carrierFrequencyMHz = in[i].carrierFrequencyMHz;
out[i].phaseCenterOffsetCoordinateMillimeters.x =
in[i].phaseCenterOffsetCoordinateMillimeters.x;
out[i].phaseCenterOffsetCoordinateMillimeters.xUncertainty =
in[i].phaseCenterOffsetCoordinateMillimeters.xUncertainty;
out[i].phaseCenterOffsetCoordinateMillimeters.y =
in[i].phaseCenterOffsetCoordinateMillimeters.y;
out[i].phaseCenterOffsetCoordinateMillimeters.yUncertainty =
in[i].phaseCenterOffsetCoordinateMillimeters.yUncertainty;
out[i].phaseCenterOffsetCoordinateMillimeters.z =
in[i].phaseCenterOffsetCoordinateMillimeters.z;
out[i].phaseCenterOffsetCoordinateMillimeters.zUncertainty =
in[i].phaseCenterOffsetCoordinateMillimeters.zUncertainty;
numberOfRows = in[i].phaseCenterVariationCorrectionMillimeters.size();
out[i].phaseCenterVariationCorrectionMillimeters.resize(numberOfRows);
for (uint32_t j = 0; j < numberOfRows; j++) {
numberOfColumns = in[i].phaseCenterVariationCorrectionMillimeters[j].size();
out[i].phaseCenterVariationCorrectionMillimeters[j].row.resize(numberOfColumns);
for (uint32_t k = 0; k < numberOfColumns; k++) {
out[i].phaseCenterVariationCorrectionMillimeters[j].row[k] =
in[i].phaseCenterVariationCorrectionMillimeters[j][k];
}
}
numberOfRows = in[i].phaseCenterVariationCorrectionUncertaintyMillimeters.size();
out[i].phaseCenterVariationCorrectionUncertaintyMillimeters.resize(numberOfRows);
for (uint32_t j = 0; j < numberOfRows; j++) {
numberOfColumns = in[i].phaseCenterVariationCorrectionUncertaintyMillimeters[j].size();
out[i].phaseCenterVariationCorrectionUncertaintyMillimeters[j].
row.resize(numberOfColumns);
for (uint32_t k = 0; k < numberOfColumns; k++) {
out[i].phaseCenterVariationCorrectionUncertaintyMillimeters[j].row[k] =
in[i].phaseCenterVariationCorrectionUncertaintyMillimeters[j][k];
}
}
numberOfRows = in[i].signalGainCorrectionDbi.size();
out[i].signalGainCorrectionDbi.resize(numberOfRows);
for (uint32_t j = 0; j < numberOfRows; j++) {
numberOfColumns = in[i].signalGainCorrectionDbi[j].size();
out[i].signalGainCorrectionDbi[j].row.resize(numberOfColumns);
for (uint32_t k = 0; k < numberOfColumns; k++) {
out[i].signalGainCorrectionDbi[j].row[k] = in[i].signalGainCorrectionDbi[j][k];
}
}
numberOfRows = in[i].signalGainCorrectionUncertaintyDbi.size();
out[i].signalGainCorrectionUncertaintyDbi.resize(numberOfRows);
for (uint32_t j = 0; j < numberOfRows; j++) {
numberOfColumns = in[i].signalGainCorrectionUncertaintyDbi[j].size();
out[i].signalGainCorrectionUncertaintyDbi[j].row.resize(numberOfColumns);
for (uint32_t k = 0; k < numberOfColumns; k++) {
out[i].signalGainCorrectionUncertaintyDbi[j].row[k] =
in[i].signalGainCorrectionUncertaintyDbi[j][k];
}
}
}
}
GnssAntennaInfo::GnssAntennaInfo(Gnss* gnss) : mGnss(gnss) {
mGnssAntennaInfoDeathRecipient = new GnssAntennaInfoDeathRecipient(this);
spGnssAntennaInfo = this;
}
GnssAntennaInfo::~GnssAntennaInfo() {
spGnssAntennaInfo = nullptr;
}
// Methods from ::android::hardware::gnss::V2_1::IGnssAntennaInfo follow.
Return<GnssAntennaInfo::GnssAntennaInfoStatus>
GnssAntennaInfo::setCallback(const sp<IGnssAntennaInfoCallback>& callback) {
uint32_t retValue;
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return GnssAntennaInfoStatus::ERROR_GENERIC;
}
mGnssAntennaInfoCbIface = callback;
retValue = mGnss->getGnssInterface()->antennaInfoInit(aiGnssAntennaInfoCb);
switch (retValue) {
case ANTENNA_INFO_SUCCESS: return GnssAntennaInfoStatus::SUCCESS;
case ANTENNA_INFO_ERROR_ALREADY_INIT: return GnssAntennaInfoStatus::ERROR_ALREADY_INIT;
case ANTENNA_INFO_ERROR_GENERIC:
default: return GnssAntennaInfoStatus::ERROR_GENERIC;
}
}
Return<void> GnssAntennaInfo::close(void) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return Void();
}
mGnss->getGnssInterface()->antennaInfoClose();
return Void();
}
void GnssAntennaInfo::aiGnssAntennaInfoCb
(std::vector<GnssAntennaInformation> gnssAntennaInformations) {
if (nullptr != spGnssAntennaInfo) {
spGnssAntennaInfo->gnssAntennaInfoCb(gnssAntennaInformations);
}
}
void GnssAntennaInfo::gnssAntennaInfoCb
(std::vector<GnssAntennaInformation> gnssAntennaInformations) {
if (mGnssAntennaInfoCbIface != nullptr) {
hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo> antennaInfos;
// Convert from one structure to another
convertGnssAntennaInfo(gnssAntennaInformations, antennaInfos);
auto r = mGnssAntennaInfoCbIface->gnssAntennaInfoCb(antennaInfos);
if (!r.isOk()) {
LOC_LOGw("Error antenna info cb %s", r.description().c_str());
}
} else {
LOC_LOGw("setCallback has not been called yet");
}
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 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
* 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 ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H
#define ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H
#include <android/hardware/gnss/2.1/IGnssAntennaInfo.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_1::IGnssAntennaInfo;
using ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss;
struct GnssAntennaInfo : public IGnssAntennaInfo {
GnssAntennaInfo(Gnss* gnss);
~GnssAntennaInfo();
/*
* Methods from ::android::hardware::gnss::V1_1::IGnssAntennaInfo follow.
* These declarations were generated from IGnssAntennaInfo.hal.
*/
Return<GnssAntennaInfoStatus>
setCallback(const sp<IGnssAntennaInfoCallback>& callback) override;
Return<void> close(void) override;
void gnssAntennaInfoCb(std::vector<GnssAntennaInformation> gnssAntennaInformations);
static void aiGnssAntennaInfoCb(std::vector<GnssAntennaInformation> gnssAntennaInformations);
private:
struct GnssAntennaInfoDeathRecipient : hidl_death_recipient {
GnssAntennaInfoDeathRecipient(sp<GnssAntennaInfo> gnssAntennaInfo) :
mGnssAntennaInfo(gnssAntennaInfo) {
}
~GnssAntennaInfoDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<GnssAntennaInfo> mGnssAntennaInfo;
};
private:
sp<GnssAntennaInfoDeathRecipient> mGnssAntennaInfoDeathRecipient = nullptr;
sp<IGnssAntennaInfoCallback> mGnssAntennaInfoCbIface = nullptr;
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H

View File

@@ -0,0 +1,163 @@
/*
* Copyright (c) 2017-2020, 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 V2_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) {
mApi->destroy();
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
Return<bool> GnssBatching::init(const sp<V1_0::IGnssBatchingCallback>& callback) {
if (mApi != nullptr) {
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
mApi->destroy();
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 (mApi != nullptr) {
mApi->stopSession();
}
if (mGnssBatchingCbIface != nullptr) {
mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
mGnssBatchingCbIface = nullptr;
}
if (mGnssBatchingCbIface_2_0 != nullptr) {
mGnssBatchingCbIface_2_0->unlinkToDeath(mGnssBatchingDeathRecipient);
mGnssBatchingCbIface_2_0 = nullptr;
}
return Void();
}
// Methods from ::android::hardware::gnss::V2_0::IGnssBatching follow.
Return<bool> GnssBatching::init_2_0(const sp<V2_0::IGnssBatchingCallback>& callback) {
if (mApi != nullptr) {
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
mApi->destroy();
mApi = nullptr;
}
mApi = new BatchingAPIClient(callback);
if (mApi == nullptr) {
LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
return false;
}
if (mGnssBatchingCbIface_2_0 != nullptr) {
mGnssBatchingCbIface_2_0->unlinkToDeath(mGnssBatchingDeathRecipient);
}
mGnssBatchingCbIface_2_0 = callback;
if (mGnssBatchingCbIface_2_0 != nullptr) {
mGnssBatchingCbIface_2_0->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
}
return true;
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2017-2020, 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_V2_0_GNSSBATCHING_H
#define ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H
#include <android/hardware/gnss/2.0/IGnssBatching.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_0::IGnssBatching;
using ::android::hardware::gnss::V2_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<V1_0::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;
// Methods from ::android::hardware::gnss::V2_0::IGnssBatching follow.
Return<bool> init_2_0(const sp<V2_0::IGnssBatchingCallback>& callback) 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<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
BatchingAPIClient* mApi = nullptr;
sp<V2_0::IGnssBatchingCallback> mGnssBatchingCbIface_2_0 = nullptr;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H

View File

@@ -0,0 +1,408 @@
/*
* Copyright (c) 2017-2020, 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 "ContextBase.h"
#include <android/hardware/gnss/1.0/types.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_0::GnssConstellationType;
using namespace loc_core;
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
}
// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setSuplEs(bool enabled __unused) {
// deprecated function. Must return false to pass VTS
return false;
}
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 0x00020004:
config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_4;
break;
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;
}
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;
}
return mGnss->updateConfiguration(config);
}
Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfileMask) {
if (mGnss == nullptr) {
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
return false;
}
GnssConfig config = {};
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
config.lppProfileMask = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE; //default
if (lppProfileMask & (1<<0)) {
config.lppProfileMask |= GNSS_CONFIG_LPP_PROFILE_USER_PLANE_BIT;
}
if (lppProfileMask & (1<<1)) {
config.lppProfileMask |= GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE_BIT;
}
if (lppProfileMask & (1<<2)) {
config.lppProfileMask |= GNSS_CONFIG_LPP_PROFILE_USER_PLANE_OVER_NR5G_SA_BIT;
}
if (lppProfileMask & (1<<3)) {
config.lppProfileMask |= GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE_OVER_NR5G_SA_BIT;
}
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 = {};
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;
}
mGnss->updateConfiguration(config);
// Must return false to pass VTS
return false;
}
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<V1_1::IGnssConfiguration::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, (GnssConstellationType)blacklist[idx].constellation,
blacklist[idx].svid) || 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 GnssConstellationType& constellation,
const int16_t svid) {
bool retVal = true;
uint16_t svIdOffset = 0;
copyToSource.size = sizeof(GnssSvIdSource);
copyToSource.svId = svid;
switch(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;
case GnssConstellationType::IRNSS:
copyToSource.constellation = GNSS_SV_TYPE_NAVIC;
svIdOffset = 0;
break;
default:
copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
LOC_LOGe("Invalid constellation %hhu", constellation);
retVal = false;
break;
}
if (copyToSource.svId > 0 && svIdOffset > 0) {
copyToSource.svId += svIdOffset;
}
return retVal;
}
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 = GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID - 1;
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;
case GnssConstellationType::IRNSS:
copyToSource.constellation = GNSS_SV_TYPE_NAVIC;
svIdOffset = GNSS_SV_CONFIG_NAVIC_INITIAL_SV_ID - 1;
break;
default:
copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
LOC_LOGe("Invalid constellation %hhu", copyFromSource.constellation);
retVal = false;
break;
}
if (copyToSource.svId > 0 && svIdOffset > 0) {
copyToSource.svId += svIdOffset;
}
return retVal;
}
// Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setEsExtensionSec(uint32_t emergencyExtensionSeconds) {
ENTRY_LOG_CALLFLOW();
if (mGnss == nullptr) {
LOC_LOGe("mGnss is nullptr");
return false;
}
GnssConfig config;
memset(&config, 0, sizeof(GnssConfig));
config.size = sizeof(GnssConfig);
config.flags = GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT;
config.emergencyExtensionSeconds = emergencyExtensionSeconds;
return mGnss->updateConfiguration(config);
}
// Methods from ::android::hardware::gnss::V2_1::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setBlacklist_2_1(
const hidl_vec<V2_1::IGnssConfiguration::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));
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2017-2020, 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_V2_1_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H
#include <android/hardware/gnss/2.1/IGnssConfiguration.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::hardware::gnss::V2_0::GnssConstellationType;
using ::android::sp;
/*
* Interface for passing GNSS configuration info from platform to HAL.
*/
struct Gnss;
struct GnssConfiguration : public V2_1::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 lppProfileMask) 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<V1_1::IGnssConfiguration::BlacklistedSource>& blacklist) override;
// Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow.
Return<bool> setEsExtensionSec(uint32_t emergencyExtensionSeconds) override;
// Methods from ::android::hardware::gnss::V2_1::IGnssConfiguration follow.
Return<bool> setBlacklist_2_1(
const hidl_vec<V2_1::IGnssConfiguration::BlacklistedSource>& blacklist) override;
private:
Gnss* mGnss = nullptr;
bool setBlacklistedSource(
GnssSvIdSource& copyToSource,
const GnssConfiguration::BlacklistedSource& copyFromSource);
bool setBlacklistedSource(
GnssSvIdSource& copyToSource, const GnssConstellationType& constellation,
const int16_t svid);
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H

View File

@@ -0,0 +1,299 @@
/*
* Copyright (c) 2017-2020, 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_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 V2_1 {
namespace implementation {
using ::android::hardware::hidl_vec;
using ::android::hardware::gnss::V2_0::IGnssDebug;
#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__);
V1_0::IGnssDebug::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
V1_0::IGnssDebug::SatelliteData s = { };
std::vector<V1_0::IGnssDebug::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();
}
Return<void> GnssDebug::getDebugData_2_0(getDebugData_2_0_cb _hidl_cb)
{
LOC_LOGD("%s]: ", __func__);
V2_0::IGnssDebug::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
V2_0::IGnssDebug::SatelliteData s = { };
std::vector<V2_0::IGnssDebug::SatelliteData> s_array;
for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
memset(&s, 0, sizeof(s));
s.v1_0.svid = reports.mSatelliteInfo[i].svid;
convertGnssConstellationType(
reports.mSatelliteInfo[i].constellation, s.constellation);
convertGnssEphemerisType(
reports.mSatelliteInfo[i].mEphemerisType, s.v1_0.ephemerisType);
convertGnssEphemerisSource(
reports.mSatelliteInfo[i].mEphemerisSource, s.v1_0.ephemerisSource);
convertGnssEphemerisHealth(
reports.mSatelliteInfo[i].mEphemerisHealth, s.v1_0.ephemerisHealth);
s.v1_0.ephemerisAgeSeconds =
reports.mSatelliteInfo[i].ephemerisAgeSeconds;
s.v1_0.serverPredictionIsAvailable =
reports.mSatelliteInfo[i].serverPredictionIsAvailable;
s.v1_0.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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 2017-2020, 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_V2_0_GNSSDEBUG_H
#define ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H
#include <android/hardware/gnss/2.0/IGnssDebug.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_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
Return<void> getDebugData(getDebugData_cb _hidl_cb) override;
// Methods from ::android::hardware::gnss::V2_0::IGnssDebug follow.
Return<void> getDebugData_2_0(getDebugData_2_0_cb _hidl_cb) override;
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H

View File

@@ -0,0 +1,141 @@
/*
* Copyright (c) 2017-2020, 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 V2_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) {
mApi->destroy();
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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2017-2020, 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_V2_0_GNSSGEOFENCING_H
#define ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H
#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H

View File

@@ -0,0 +1,211 @@
/*
* Copyright (c) 2017-2020, 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 "GnssMeasurement.h"
#include "MeasurementAPIClient.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V2_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) {
mApi->destroy();
mApi = nullptr;
}
}
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) {
Return<GnssMeasurement::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;
}
clearInterfaces();
mGnssMeasurementCbIface = callback;
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback(callback);
}
void GnssMeasurement::clearInterfaces() {
if (mGnssMeasurementCbIface != nullptr) {
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr;
}
if (mGnssMeasurementCbIface_1_1 != nullptr) {
mGnssMeasurementCbIface_1_1->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface_1_1 = nullptr;
}
if (mGnssMeasurementCbIface_2_0 != nullptr) {
mGnssMeasurementCbIface_2_0->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface_2_0 = nullptr;
}
if (mGnssMeasurementCbIface_2_1 != nullptr) {
mGnssMeasurementCbIface_2_1->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface_2_1 = nullptr;
}
}
Return<void> GnssMeasurement::close() {
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return Void();
}
clearInterfaces();
mApi->measurementClose();
return Void();
}
// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
const sp<V1_1::IGnssMeasurementCallback>& callback, bool enableFullTracking) {
Return<GnssMeasurement::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;
}
clearInterfaces();
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);
}
// Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow.
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_0(
const sp<V2_0::IGnssMeasurementCallback>& callback,
bool enableFullTracking) {
Return<GnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mGnssMeasurementCbIface_2_0 != 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;
}
clearInterfaces();
mGnssMeasurementCbIface_2_0 = callback;
mGnssMeasurementCbIface_2_0->linkToDeath(mGnssMeasurementDeathRecipient, 0);
GnssPowerMode powerMode = enableFullTracking ?
GNSS_POWER_MODE_M1 : GNSS_POWER_MODE_M2;
return mApi->measurementSetCallback_2_0(callback, powerMode);
}
// Methods from ::android::hardware::gnss::V2_1::IGnssMeasurement follow.
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_1(
const sp<::android::hardware::gnss::V2_1::IGnssMeasurementCallback>& callback,
bool enableFullTracking) {
Return<GnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mGnssMeasurementCbIface_2_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;
}
clearInterfaces();
mGnssMeasurementCbIface_2_1 = callback;
mGnssMeasurementCbIface_2_1->linkToDeath(mGnssMeasurementDeathRecipient, 0);
GnssPowerMode powerMode = enableFullTracking ?
GNSS_POWER_MODE_M1 : GNSS_POWER_MODE_M2;
return mApi->measurementSetCallback_2_1(callback, powerMode);
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 2017-2020, 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_V2_1_GNSSMEASUREMENT_H
#define ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H
#include <android/hardware/gnss/2.1/IGnssMeasurement.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
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 V2_1::IGnssMeasurement {
GnssMeasurement();
~GnssMeasurement();
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
* These declarations were generated from IGnssMeasurement.hal.
*/
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) override;
Return<void> close() override;
// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
const sp<V1_1::IGnssMeasurementCallback>& callback,
bool enableFullTracking) override;
// Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow.
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_0(
const sp<V2_0::IGnssMeasurementCallback>& callback,
bool enableFullTracking) override;
// Methods from ::android::hardware::gnss::V2_1::IGnssMeasurement follow.
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_1(
const sp<::android::hardware::gnss::V2_1::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<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
sp<V2_0::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_0 = nullptr;
sp<V2_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_1 = nullptr;
MeasurementAPIClient* mApi;
void clearInterfaces();
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2017-2020, 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 V2_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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

75
gps/android/2.1/GnssNi.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) 2017-2020, 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_V2_0_GNSSNI_H
#define ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H
#include <android/hardware/gnss/1.0/IGnssNi.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H

View File

@@ -0,0 +1,169 @@
/*
* 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.
*/
#include <android/hardware/gnss/visibility_control/1.0/IGnssVisibilityControl.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include "GnssVisibilityControl.h"
#include <location_interface.h>
namespace android {
namespace hardware {
namespace gnss {
namespace visibility_control {
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;
static GnssVisibilityControl* spGnssVisibilityControl = nullptr;
static void convertGnssNfwNotification(GnssNfwNotification& in,
IGnssVisibilityControlCallback::NfwNotification& out);
GnssVisibilityControl::GnssVisibilityControl(Gnss* gnss) : mGnss(gnss) {
spGnssVisibilityControl = this;
}
GnssVisibilityControl::~GnssVisibilityControl() {
spGnssVisibilityControl = nullptr;
}
void GnssVisibilityControl::nfwStatusCb(GnssNfwNotification notification) {
if (nullptr != spGnssVisibilityControl) {
spGnssVisibilityControl->statusCb(notification);
}
}
bool GnssVisibilityControl::isInEmergencySession() {
if (nullptr != spGnssVisibilityControl) {
return spGnssVisibilityControl->isE911Session();
}
return false;
}
static void convertGnssNfwNotification(GnssNfwNotification& in,
IGnssVisibilityControlCallback::NfwNotification& out)
{
memset(&out, 0, sizeof(IGnssVisibilityControlCallback::NfwNotification));
out.proxyAppPackageName = in.proxyAppPackageName;
out.protocolStack = (IGnssVisibilityControlCallback::NfwProtocolStack)in.protocolStack;
out.otherProtocolStackName = in.otherProtocolStackName;
out.requestor = (IGnssVisibilityControlCallback::NfwRequestor)in.requestor;
out.requestorId = in.requestorId;
out.responseType = (IGnssVisibilityControlCallback::NfwResponseType)in.responseType;
out.inEmergencyMode = in.inEmergencyMode;
out.isCachedLocation = in.isCachedLocation;
}
void GnssVisibilityControl::statusCb(GnssNfwNotification notification) {
if (mGnssVisibilityControlCbIface != nullptr) {
IGnssVisibilityControlCallback::NfwNotification nfwNotification;
// Convert from one structure to another
convertGnssNfwNotification(notification, nfwNotification);
auto r = mGnssVisibilityControlCbIface->nfwNotifyCb(nfwNotification);
if (!r.isOk()) {
LOC_LOGw("Error invoking NFW status cb %s", r.description().c_str());
}
} else {
LOC_LOGw("setCallback has not been called yet");
}
}
bool GnssVisibilityControl::isE911Session() {
if (mGnssVisibilityControlCbIface != nullptr) {
auto r = mGnssVisibilityControlCbIface->isInEmergencySession();
if (!r.isOk()) {
LOC_LOGw("Error invoking NFW status cb %s", r.description().c_str());
return false;
} else {
return (r);
}
} else {
LOC_LOGw("setCallback has not been called yet");
return false;
}
}
// Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow.
Return<bool> GnssVisibilityControl::enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) {
if (nullptr == mGnss || nullptr == mGnss->getGnssInterface()) {
LOC_LOGe("Null GNSS interface");
return false;
}
/* If the vector is empty we need to disable all NFW clients
If there is at least one app in the vector we need to enable
all NFW clients */
if (0 == proxyApps.size()) {
mGnss->getGnssInterface()->enableNfwLocationAccess(false);
} else {
mGnss->getGnssInterface()->enableNfwLocationAccess(true);
}
return true;
}
/**
* Registers the callback for HAL implementation to use.
*
* @param callback Handle to IGnssVisibilityControlCallback interface.
*/
Return<bool> GnssVisibilityControl::setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) {
if (nullptr == mGnss || nullptr == mGnss->getGnssInterface()) {
LOC_LOGe("Null GNSS interface");
return false;
}
mGnssVisibilityControlCbIface = callback;
NfwCbInfo cbInfo = {};
cbInfo.visibilityControlCb = (void*)nfwStatusCb;
cbInfo.isInEmergencySession = (void*)isInEmergencySession;
mGnss->getGnssInterface()->nfwInit(cbInfo);
return true;
}
} // namespace implementation
} // namespace V1_0
} // namespace visibility_control
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,90 @@
/*
* 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.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H
#define ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H
#include <android/hardware/gnss/visibility_control/1.0/IGnssVisibilityControl.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
#include <location_interface.h>
#include "Gnss.h"
namespace android {
namespace hardware {
namespace gnss {
namespace visibility_control {
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::V2_1::implementation::Gnss;
struct GnssVisibilityControl : public IGnssVisibilityControl {
GnssVisibilityControl(Gnss* gnss);
~GnssVisibilityControl();
// Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow.
Return<bool> enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) override;
/**
* Registers the callback for HAL implementation to use.
*
* @param callback Handle to IGnssVisibilityControlCallback interface.
*/
Return<bool> setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) override;
void statusCb(GnssNfwNotification notification);
bool isE911Session();
/* Data call setup callback passed down to GNSS HAL implementation */
static void nfwStatusCb(GnssNfwNotification notification);
static bool isInEmergencySession();
private:
Gnss* mGnss = nullptr;
sp<IGnssVisibilityControlCallback> mGnssVisibilityControlCbIface = nullptr;
};
} // namespace implementation
} // namespace V1_0
} // namespace visibility_control
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H

View File

@@ -0,0 +1,199 @@
/*
* Copyright (c) 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
* 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_TAG "LocSvc_MeasurementCorrectionsInterface"
#include <log_util.h>
#include "MeasurementCorrections.h"
namespace android {
namespace hardware {
namespace gnss {
namespace measurement_corrections {
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::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
using ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
using MeasurementCorrectionsV1_0 =
::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections;
using MeasurementCorrectionsV1_1 =
::android::hardware::gnss::measurement_corrections::V1_1::MeasurementCorrections;
static MeasurementCorrections* spMeasurementCorrections = nullptr;
void MeasurementCorrections::GnssMeasurementCorrectionsDeathRecipient::serviceDied(uint64_t cookie,
const wp<IBase>& who) {
LOC_LOGe("service died. cookie: %llu, who: %p", static_cast<unsigned long long>(cookie), &who);
// Gnss::GnssDeathrecipient will stop the session
// we inform the adapter that service has died
if (nullptr == spMeasurementCorrections) {
LOC_LOGe("spMeasurementCorrections is nullptr");
return;
}
if (nullptr == spMeasurementCorrections->mGnss ||
nullptr == spMeasurementCorrections->mGnss->getGnssInterface()) {
LOC_LOGe("Null GNSS interface");
return;
}
spMeasurementCorrections->mGnss->getGnssInterface()->measCorrClose();
}
MeasurementCorrections::MeasurementCorrections(Gnss* gnss) : mGnss(gnss) {
mGnssMeasurementCorrectionsDeathRecipient = new GnssMeasurementCorrectionsDeathRecipient(this);
spMeasurementCorrections = this;
}
MeasurementCorrections::~MeasurementCorrections() {
spMeasurementCorrections = nullptr;
}
void MeasurementCorrections::measCorrSetCapabilitiesCb(
GnssMeasurementCorrectionsCapabilitiesMask capabilities) {
if (nullptr != spMeasurementCorrections) {
spMeasurementCorrections->setCapabilitiesCb(capabilities);
}
}
void MeasurementCorrections::setCapabilitiesCb(
GnssMeasurementCorrectionsCapabilitiesMask capabilities) {
if (mMeasurementCorrectionsCbIface != nullptr) {
uint32_t measCorrCapabilities = 0;
// Convert from one enum to another
if (capabilities & GNSS_MEAS_CORR_LOS_SATS) {
measCorrCapabilities |=
IMeasurementCorrectionsCallback::Capabilities::LOS_SATS;
}
if (capabilities & GNSS_MEAS_CORR_EXCESS_PATH_LENGTH) {
measCorrCapabilities |=
IMeasurementCorrectionsCallback::Capabilities::EXCESS_PATH_LENGTH;
}
if (capabilities & GNSS_MEAS_CORR_REFLECTING_PLANE) {
measCorrCapabilities |=
IMeasurementCorrectionsCallback::Capabilities::REFLECTING_PLANE;
}
auto r = mMeasurementCorrectionsCbIface->setCapabilitiesCb(measCorrCapabilities);
if (!r.isOk()) {
LOC_LOGw("Error invoking setCapabilitiesCb %s", r.description().c_str());
}
} else {
LOC_LOGw("setCallback has not been called yet");
}
}
Return<bool> MeasurementCorrections::setCorrections(
const MeasurementCorrectionsV1_0& corrections) {
GnssMeasurementCorrections gnssMeasurementCorrections = {};
V2_1::implementation::convertMeasurementCorrections(corrections, gnssMeasurementCorrections);
return mGnss->getGnssInterface()->measCorrSetCorrections(gnssMeasurementCorrections);
}
Return<bool> MeasurementCorrections::setCorrections_1_1(
const MeasurementCorrectionsV1_1& corrections) {
GnssMeasurementCorrections gnssMeasurementCorrections = {};
V2_1::implementation::convertMeasurementCorrections(
corrections.v1_0, gnssMeasurementCorrections);
gnssMeasurementCorrections.hasEnvironmentBearing = corrections.hasEnvironmentBearing;
gnssMeasurementCorrections.environmentBearingDegrees =
corrections.environmentBearingDegrees;
gnssMeasurementCorrections.environmentBearingUncertaintyDegrees =
corrections.environmentBearingUncertaintyDegrees;
for (int i = 0; i < corrections.satCorrections.size(); i++) {
GnssSingleSatCorrection gnssSingleSatCorrection = {};
V2_1::implementation::convertSingleSatCorrections(
corrections.satCorrections[i].v1_0, gnssSingleSatCorrection);
switch (corrections.satCorrections[i].constellation) {
case (::android::hardware::gnss::V2_0::GnssConstellationType::GPS):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_GPS;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::SBAS):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_SBAS;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::GLONASS):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_GLONASS;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::QZSS):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_QZSS;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::BEIDOU):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_BEIDOU;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::GALILEO):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_GALILEO;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::IRNSS):
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_NAVIC;
break;
case (::android::hardware::gnss::V2_0::GnssConstellationType::UNKNOWN):
default:
gnssSingleSatCorrection.svType = GNSS_SV_TYPE_UNKNOWN;
break;
}
gnssMeasurementCorrections.satCorrections.push_back(gnssSingleSatCorrection);
}
return mGnss->getGnssInterface()->measCorrSetCorrections(gnssMeasurementCorrections);
}
Return<bool> MeasurementCorrections::setCallback(
const sp<V1_0::IMeasurementCorrectionsCallback>& callback) {
if (nullptr == mGnss || nullptr == mGnss->getGnssInterface()) {
LOC_LOGe("Null GNSS interface");
return false;
}
mMeasurementCorrectionsCbIface = callback;
return mGnss->getGnssInterface()->measCorrInit(measCorrSetCapabilitiesCb);
}
} // namespace implementation
} // namespace V1_1
} // namespace measurement_corrections
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 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
* 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 ANDROID_HARDWARE_GNSS_V1_1_MeasurementCorrections_H
#define ANDROID_HARDWARE_GNSS_V1_1_MeasurementCorrections_H
#include <android/hardware/gnss/measurement_corrections/1.1/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrectionsCallback.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
#include <location_interface.h>
#include "Gnss.h"
#include <LocationUtil.h>
namespace android {
namespace hardware {
namespace gnss {
namespace measurement_corrections {
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;
using ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
using ::android::hardware::gnss::V2_1::implementation::Gnss;
using MeasurementCorrectionsV1_0 =
::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections;
using MeasurementCorrectionsV1_1 =
::android::hardware::gnss::measurement_corrections::V1_1::MeasurementCorrections;
struct MeasurementCorrections : public V1_1::IMeasurementCorrections {
MeasurementCorrections(Gnss* gnss);
~MeasurementCorrections();
Return<bool> setCorrections(const MeasurementCorrectionsV1_0& corrections) override;
// Methods from
// ::android::hardware::gnss::measurement_corrections::V1_1::IMeasurementCorrections follow.
Return<bool> setCorrections_1_1(const MeasurementCorrectionsV1_1& corrections);
Return<bool> setCallback(const sp<IMeasurementCorrectionsCallback>& callback) override;
void setCapabilitiesCb(GnssMeasurementCorrectionsCapabilitiesMask capabilities);
/* Data call setup callback passed down to GNSS HAL implementation */
static void measCorrSetCapabilitiesCb(GnssMeasurementCorrectionsCapabilitiesMask capabilities);
private:
struct GnssMeasurementCorrectionsDeathRecipient : hidl_death_recipient {
GnssMeasurementCorrectionsDeathRecipient(
sp<MeasurementCorrections> gnssMeasurementCorrections) :
mGnssMeasurementCorrections(gnssMeasurementCorrections) {
}
~GnssMeasurementCorrectionsDeathRecipient() = default;
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
sp<MeasurementCorrections> mGnssMeasurementCorrections;
};
Gnss* mGnss = nullptr;
sp<GnssMeasurementCorrectionsDeathRecipient> mGnssMeasurementCorrectionsDeathRecipient =
nullptr;
sp<IMeasurementCorrectionsCallback> mMeasurementCorrectionsCbIface = nullptr;
};
} // namespace implementation
} // namespace V1_1
} // namespace measurement_corrections
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_MeasurementCorrections_H

View File

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

View File

@@ -0,0 +1,36 @@
<!-- Copyright (c) 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
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>
<fqname>@2.1::IGnss/default</fqname>
</hal>
</manifest>

View File

@@ -0,0 +1,292 @@
/* Copyright (c) 2017-2021, 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 <inttypes.h>
#include <log_util.h>
#include <loc_cfg.h>
#include <thread>
#include "LocationUtil.h"
#include "BatchingAPIClient.h"
#include "limits.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_0::IGnssBatching;
using ::android::hardware::gnss::V2_0::IGnssBatchingCallback;
using ::android::hardware::gnss::V2_0::GnssLocation;
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask);
BatchingAPIClient::BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback) :
LocationAPIClientBase(),
mGnssBatchingCbIface(nullptr),
mDefaultId(UINT_MAX),
mLocationCapabilitiesMask(0),
mGnssBatchingCbIface_2_0(nullptr)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
gnssUpdateCallbacks(callback);
}
BatchingAPIClient::BatchingAPIClient(const sp<V2_0::IGnssBatchingCallback>& callback) :
LocationAPIClientBase(),
mGnssBatchingCbIface(nullptr),
mDefaultId(UINT_MAX),
mLocationCapabilitiesMask(0),
mGnssBatchingCbIface_2_0(nullptr)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
gnssUpdateCallbacks_2_0(callback);
}
BatchingAPIClient::~BatchingAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
int BatchingAPIClient::getBatchSize() {
int batchSize = locAPIGetBatchSize();
LOC_LOGd("batchSize: %d", batchSize);
return batchSize;
}
void BatchingAPIClient::setCallbacks()
{
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.batchingCb = 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);
}
void BatchingAPIClient::gnssUpdateCallbacks(const sp<V1_0::IGnssBatchingCallback>& callback)
{
mMutex.lock();
mGnssBatchingCbIface = callback;
mMutex.unlock();
if (mGnssBatchingCbIface != nullptr) {
setCallbacks();
}
}
void BatchingAPIClient::gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCallback>& callback)
{
mMutex.lock();
mGnssBatchingCbIface_2_0 = callback;
mMutex.unlock();
if (mGnssBatchingCbIface_2_0 != nullptr) {
setCallbacks();
}
}
int BatchingAPIClient::startSession(const IGnssBatching::Options& opts) {
mMutex.lock();
mState = STARTED;
mMutex.unlock();
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() {
mMutex.lock();
mState = STOPPING;
mMutex.unlock();
LOC_LOGD("%s]: ", __FUNCTION__);
int retVal = -1;
locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
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__);
uint32_t retVal = locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
// when flush a stopped session or one doesn't exist, just report an empty batch.
if (LOCATION_ERROR_ID_UNKNOWN == retVal) {
BatchingOptions opt = {};
::std::thread thd(&BatchingAPIClient::onBatchingCb, this, 0, nullptr, opt);
thd.detach();
}
}
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
{
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
}
void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
BatchingOptions /*batchOptions*/) {
bool processReport = false;
LOC_LOGd("(count: %zu)", count);
mMutex.lock();
// back to back stop() and flush() could bring twice onBatchingCb(). Each one might come first.
// Combine them both (the first goes to cache, the second in location*) before report to FW
switch (mState) {
case STOPPING:
mState = STOPPED;
for (size_t i = 0; i < count; i++) {
mBatchedLocationInCache.push_back(location[i]);
}
break;
case STARTED:
case STOPPED: // flush() always trigger report, even on a stopped session
processReport = true;
break;
default:
break;
}
// report location batch when in STARTED state or flush(), combined with cache in last stop()
if (processReport) {
auto gnssBatchingCbIface(mGnssBatchingCbIface);
auto gnssBatchingCbIface_2_0(mGnssBatchingCbIface_2_0);
size_t batchCacheCnt = mBatchedLocationInCache.size();
LOC_LOGd("(batchCacheCnt: %zu)", batchCacheCnt);
if (gnssBatchingCbIface_2_0 != nullptr) {
hidl_vec<V2_0::GnssLocation> locationVec;
if (count+batchCacheCnt > 0) {
locationVec.resize(count+batchCacheCnt);
for (size_t i = 0; i < batchCacheCnt; ++i) {
convertGnssLocation(mBatchedLocationInCache[i], locationVec[i]);
}
for (size_t i = 0; i < count; i++) {
convertGnssLocation(location[i], locationVec[i+batchCacheCnt]);
}
}
auto r = gnssBatchingCbIface_2_0->gnssLocationBatchCb(locationVec);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationBatchCb 2_0 description=%s",
__func__, r.description().c_str());
}
} else if (gnssBatchingCbIface != nullptr) {
hidl_vec<V1_0::GnssLocation> locationVec;
if (count+batchCacheCnt > 0) {
locationVec.resize(count+batchCacheCnt);
for (size_t i = 0; i < batchCacheCnt; ++i) {
convertGnssLocation(mBatchedLocationInCache[i], locationVec[i]);
}
for (size_t i = 0; i < count; i++) {
convertGnssLocation(location[i], locationVec[i+batchCacheCnt]);
}
}
auto r = gnssBatchingCbIface->gnssLocationBatchCb(locationVec);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationBatchCb 1.0 description=%s",
__func__, r.description().c_str());
}
}
mBatchedLocationInCache.clear();
}
mMutex.unlock();
}
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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,88 @@
/* Copyright (c) 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
* 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 <mutex>
#include <android/hardware/gnss/2.0/IGnssBatching.h>
#include <android/hardware/gnss/2.0/IGnssBatchingCallback.h>
#include <pthread.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
enum BATCHING_STATE { STARTED, STOPPING, STOPPED };
class BatchingAPIClient : public LocationAPIClientBase
{
public:
BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
BatchingAPIClient(const sp<V2_0::IGnssBatchingCallback>& callback);
void gnssUpdateCallbacks(const sp<V1_0::IGnssBatchingCallback>& callback);
void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCallback>& callback);
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:
~BatchingAPIClient();
void setCallbacks();
std::mutex mMutex;
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
uint32_t mDefaultId;
LocationCapabilitiesMask mLocationCapabilitiesMask;
sp<V2_0::IGnssBatchingCallback> mGnssBatchingCbIface_2_0;
volatile BATCHING_STATE mState = STOPPED;
std::vector<Location> mBatchedLocationInCache;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // BATCHING_API_CLINET_H

View File

@@ -0,0 +1,275 @@
/* Copyright (c) 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
* 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 V2_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]: (%d)", __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 V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,77 @@
/* Copyright (c) 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
* 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 V2_1 {
namespace implementation {
using ::android::sp;
class GeofenceAPIClient : public LocationAPIClientBase
{
public:
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
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:
virtual ~GeofenceAPIClient() = default;
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // GEOFENCE_API_CLINET_H

View File

@@ -0,0 +1,864 @@
/* Copyright (c) 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
* 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 <inttypes.h>
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
#include "GnssAPIClient.h"
#include <LocContext.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_1::IGnss;
using ::android::hardware::gnss::V2_1::IGnssCallback;
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
using ::android::hardware::gnss::V2_0::GnssLocation;
static void convertGnssSvStatus(GnssSvNotification& in, V1_0::IGnssCallback::GnssSvStatus& out);
static void convertGnssSvStatus(GnssSvNotification& in,
hidl_vec<V2_0::IGnssCallback::GnssSvInfo>& out);
static void convertGnssSvStatus(GnssSvNotification& in,
hidl_vec<V2_1::IGnssCallback::GnssSvInfo>& out);
GnssAPIClient::GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<V1_0::IGnssNiCallback>& niCb) :
LocationAPIClientBase(),
mGnssCbIface(nullptr),
mGnssNiCbIface(nullptr),
mControlClient(new LocationAPIControlClient()),
mLocationCapabilitiesMask(0),
mLocationCapabilitiesCached(false),
mTracking(false),
mGnssCbIface_2_0(nullptr)
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
initLocationOptions();
gnssUpdateCallbacks(gpsCb, niCb);
}
GnssAPIClient::GnssAPIClient(const sp<V2_0::IGnssCallback>& gpsCb) :
LocationAPIClientBase(),
mGnssCbIface(nullptr),
mGnssNiCbIface(nullptr),
mControlClient(new LocationAPIControlClient()),
mLocationCapabilitiesMask(0),
mLocationCapabilitiesCached(false),
mTracking(false),
mGnssCbIface_2_0(nullptr)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &gpsCb);
initLocationOptions();
gnssUpdateCallbacks_2_0(gpsCb);
}
GnssAPIClient::GnssAPIClient(const sp<V2_1::IGnssCallback>& gpsCb) :
LocationAPIClientBase(),
mGnssCbIface(nullptr),
mGnssNiCbIface(nullptr),
mControlClient(new LocationAPIControlClient()),
mLocationCapabilitiesMask(0),
mLocationCapabilitiesCached(false),
mTracking(false),
mGnssCbIface_2_1(nullptr)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &gpsCb);
initLocationOptions();
gnssUpdateCallbacks_2_1(gpsCb);
}
GnssAPIClient::~GnssAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
if (mControlClient) {
delete mControlClient;
mControlClient = nullptr;
}
}
void GnssAPIClient::initLocationOptions()
{
// set default LocationOptions.
memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
mTrackingOptions.size = sizeof(TrackingOptions);
mTrackingOptions.minInterval = 1000;
mTrackingOptions.minDistance = 0;
mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
}
void GnssAPIClient::setCallbacks()
{
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
locationCallbacks.trackingCb = nullptr;
locationCallbacks.trackingCb = [this](Location location) {
onTrackingCb(location);
};
locationCallbacks.batchingCb = nullptr;
locationCallbacks.geofenceBreachCb = nullptr;
locationCallbacks.geofenceStatusCb = nullptr;
locationCallbacks.gnssLocationInfoCb = nullptr;
locationCallbacks.gnssNiCb = nullptr;
if (mGnssNiCbIface != nullptr) {
loc_core::ContextBase* context =
loc_core::LocContext::getLocContext(loc_core::LocContext::mLocationHalName);
if (!context->hasAgpsExtendedCapabilities()) {
LOC_LOGD("Registering NI CB");
locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotify) {
onGnssNiCb(id, gnssNiNotify);
};
}
}
locationCallbacks.gnssSvCb = nullptr;
locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
onGnssSvCb(gnssSvNotification);
};
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
onGnssNmeaCb(gnssNmeaNotification);
};
locationCallbacks.gnssMeasurementsCb = nullptr;
locAPISetCallbacks(locationCallbacks);
}
// for GpsInterface
void GnssAPIClient::gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb)
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
mMutex.lock();
mGnssCbIface = gpsCb;
mGnssNiCbIface = niCb;
mMutex.unlock();
if (mGnssCbIface != nullptr || mGnssNiCbIface != nullptr) {
setCallbacks();
}
}
void GnssAPIClient::gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssCallback>& gpsCb)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &gpsCb);
mMutex.lock();
mGnssCbIface_2_0 = gpsCb;
mMutex.unlock();
if (mGnssCbIface_2_0 != nullptr) {
setCallbacks();
}
}
void GnssAPIClient::gnssUpdateCallbacks_2_1(const sp<V2_1::IGnssCallback>& gpsCb)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &gpsCb);
mMutex.lock();
mGnssCbIface_2_1 = gpsCb;
mMutex.unlock();
if (mGnssCbIface_2_1 != nullptr) {
setCallbacks();
}
}
bool GnssAPIClient::gnssStart()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
mMutex.lock();
mTracking = true;
mMutex.unlock();
bool retVal = true;
locAPIStartTracking(mTrackingOptions);
return retVal;
}
bool GnssAPIClient::gnssStop()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
mMutex.lock();
mTracking = false;
mMutex.unlock();
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;
}
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 |
GNSS_AIDING_DATA_SV_TYPE_NAVIC_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]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
mLocationCapabilitiesCached = true;
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
auto gnssCbIface_2_0(mGnssCbIface_2_0);
auto gnssCbIface_2_1(mGnssCbIface_2_1);
mMutex.unlock();
if (gnssCbIface_2_1 != nullptr ||gnssCbIface_2_0 != nullptr || gnssCbIface != nullptr) {
uint32_t antennaInfoVectorSize = 0;
uint32_t data = 0;
loc_param_s_type ant_info_vector_table[] =
{
{ "ANTENNA_INFO_VECTOR_SIZE", &antennaInfoVectorSize, NULL, 'n' }
};
UTIL_READ_CONF(LOC_PATH_ANT_CORR, ant_info_vector_table);
if (0 != antennaInfoVectorSize) {
data |= V2_1::IGnssCallback::Capabilities::ANTENNA_INFO;
}
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 |= V1_0::IGnssCallback::Capabilities::GEOFENCING;
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT)
data |= V1_0::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;
if (capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT)
data |= IGnssCallback::Capabilities::LOW_POWER_MODE;
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT)
data |= IGnssCallback::Capabilities::SATELLITE_BLACKLIST;
if (capabilitiesMask & LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT)
data |= V2_0::IGnssCallback::Capabilities::MEASUREMENT_CORRECTIONS;
IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
gnssInfo.yearOfHw++; // 2016
if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
gnssInfo.yearOfHw++; // 2017
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
gnssInfo.yearOfHw++; // 2018
if (capabilitiesMask & LOCATION_CAPABILITIES_PRIVACY_BIT) {
gnssInfo.yearOfHw++; // 2019
if (capabilitiesMask & LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT) {
gnssInfo.yearOfHw++; // 2020
}
}
}
}
}
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
if (gnssCbIface_2_1 != nullptr) {
auto r = gnssCbIface_2_1->gnssSetCapabilitiesCb_2_1(data);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetCapabilitiesCb_2_1 description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface_2_1->gnssSetSystemInfoCb(gnssInfo);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface_2_0 != nullptr) {
auto r = gnssCbIface_2_0->gnssSetCapabilitiesCb_2_0(data);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetCapabilitiesCb_2_0 description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface_2_0->gnssSetSystemInfoCb(gnssInfo);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssSetCapabilitesCb(data);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
__func__, r.description().c_str());
}
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)
{
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
auto gnssCbIface_2_0(mGnssCbIface_2_0);
auto gnssCbIface_2_1(mGnssCbIface_2_1);
bool isTracking = mTracking;
mMutex.unlock();
LOC_LOGD("%s]: (flags: %02x isTracking: %d)", __FUNCTION__, location.flags, isTracking);
if (!isTracking) {
return;
}
if (gnssCbIface_2_1 != nullptr) {
V2_0::GnssLocation gnssLocation;
convertGnssLocation(location, gnssLocation);
auto r = gnssCbIface_2_1->gnssLocationCb_2_0(gnssLocation);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationCb_2_0 description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface_2_0 != nullptr) {
V2_0::GnssLocation gnssLocation;
convertGnssLocation(location, gnssLocation);
auto r = gnssCbIface_2_0->gnssLocationCb_2_0(gnssLocation);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationCb_2_0 description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface != nullptr) {
V1_0::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());
}
} else {
LOC_LOGW("%s] No GNSS Interface ready for gnssLocationCb ", __FUNCTION__);
}
}
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: %u)", __FUNCTION__, gnssSvNotification.count);
mMutex.lock();
auto gnssCbIface(mGnssCbIface);
auto gnssCbIface_2_0(mGnssCbIface_2_0);
auto gnssCbIface_2_1(mGnssCbIface_2_1);
mMutex.unlock();
if (gnssCbIface_2_1 != nullptr) {
hidl_vec<V2_1::IGnssCallback::GnssSvInfo> svInfoList;
convertGnssSvStatus(gnssSvNotification, svInfoList);
auto r = gnssCbIface_2_1->gnssSvStatusCb_2_1(svInfoList);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSvStatusCb_2_1 description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface_2_0 != nullptr) {
hidl_vec<V2_0::IGnssCallback::GnssSvInfo> svInfoList;
convertGnssSvStatus(gnssSvNotification, svInfoList);
auto r = gnssCbIface_2_0->gnssSvStatusCb_2_0(svInfoList);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssSvStatusCb_2_0 description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface != nullptr) {
V1_0::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);
auto gnssCbIface_2_0(mGnssCbIface_2_0);
auto gnssCbIface_2_1(mGnssCbIface_2_1);
mMutex.unlock();
if (gnssCbIface != nullptr || gnssCbIface_2_0 != nullptr || gnssCbIface_2_1 != 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());
if (gnssCbIface_2_1 != nullptr) {
auto r = gnssCbIface_2_1->gnssNmeaCb(
static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssCbIface_2_1 nmea=%s length=%u description=%s",
__func__, gnssNmeaNotification.nmea, gnssNmeaNotification.length,
r.description().c_str());
}
} else if (gnssCbIface_2_0 != nullptr) {
auto r = gnssCbIface_2_0->gnssNmeaCb(
static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssCbIface_2_0 nmea=%s length=%u description=%s",
__func__, gnssNmeaNotification.nmea, gnssNmeaNotification.length,
r.description().c_str());
}
} else if (gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssNmeaCb(
static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%u 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);
auto gnssCbIface_2_0(mGnssCbIface_2_0);
auto gnssCbIface_2_1(mGnssCbIface_2_1);
mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS) {
if (gnssCbIface_2_1 != nullptr) {
auto r = gnssCbIface_2_1->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 ENGINE_ON description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface_2_1->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 SESSION_BEGIN description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface_2_0 != nullptr) {
auto r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 ENGINE_ON description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 SESSION_BEGIN description=%s",
__func__, r.description().c_str());
}
} else if (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);
auto gnssCbIface_2_0(mGnssCbIface_2_0);
auto gnssCbIface_2_1(mGnssCbIface_2_1);
mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS) {
if (gnssCbIface_2_1 != nullptr) {
auto r = gnssCbIface_2_1->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 SESSION_END description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface_2_1->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 ENGINE_OFF description=%s",
__func__, r.description().c_str());
}
} else if (gnssCbIface_2_0 != nullptr) {
auto r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 SESSION_END description=%s",
__func__, r.description().c_str());
}
r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssStatusCb 2_0 ENGINE_OFF description=%s",
__func__, r.description().c_str());
}
} else if (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, V1_0::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++) {
convertGnssSvid(in.gnssSvs[i], out.gnssSvList[i].svid);
convertGnssConstellationType(in.gnssSvs[i].type, out.gnssSvList[i].constellation);
out.gnssSvList[i].cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
out.gnssSvList[i].elevationDegrees = in.gnssSvs[i].elevation;
out.gnssSvList[i].azimuthDegrees = in.gnssSvs[i].azimuth;
out.gnssSvList[i].carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
out.gnssSvList[i].svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
}
}
static void convertGnssSvStatus(GnssSvNotification& in,
hidl_vec<V2_0::IGnssCallback::GnssSvInfo>& out)
{
out.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
convertGnssSvid(in.gnssSvs[i], out[i].v1_0.svid);
out[i].v1_0.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
out[i].v1_0.elevationDegrees = in.gnssSvs[i].elevation;
out[i].v1_0.azimuthDegrees = in.gnssSvs[i].azimuth;
out[i].v1_0.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
out[i].v1_0.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
convertGnssConstellationType(in.gnssSvs[i].type, out[i].constellation);
}
}
static void convertGnssSvStatus(GnssSvNotification& in,
hidl_vec<V2_1::IGnssCallback::GnssSvInfo>& out)
{
out.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
convertGnssSvid(in.gnssSvs[i], out[i].v2_0.v1_0.svid);
out[i].v2_0.v1_0.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
out[i].v2_0.v1_0.elevationDegrees = in.gnssSvs[i].elevation;
out[i].v2_0.v1_0.azimuthDegrees = in.gnssSvs[i].azimuth;
out[i].v2_0.v1_0.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
out[i].v2_0.v1_0.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
out[i].v2_0.v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
out[i].v2_0.v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
out[i].v2_0.v1_0.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
out[i].v2_0.v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
convertGnssConstellationType(in.gnssSvs[i].type, out[i].v2_0.constellation);
out[i].basebandCN0DbHz = in.gnssSvs[i].basebandCarrierToNoiseDbHz;
}
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,118 @@
/* Copyright (c) 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
* 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/2.1/IGnss.h>
#include <android/hardware/gnss/2.1/IGnssCallback.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::sp;
class GnssAPIClient : public LocationAPIClientBase
{
public:
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<V1_0::IGnssNiCallback>& niCb);
GnssAPIClient(const sp<V2_0::IGnssCallback>& gpsCb);
GnssAPIClient(const sp<V2_1::IGnssCallback>& gpsCb);
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);
void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssCallback>& gpsCb);
void gnssUpdateCallbacks_2_1(const sp<V2_1::IGnssCallback>& gpsCb);
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:
virtual ~GnssAPIClient();
void setCallbacks();
void initLocationOptions();
sp<V1_0::IGnssCallback> mGnssCbIface;
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
std::mutex mMutex;
LocationAPIControlClient* mControlClient;
LocationCapabilitiesMask mLocationCapabilitiesMask;
bool mLocationCapabilitiesCached;
TrackingOptions mTrackingOptions;
bool mTracking;
sp<V2_0::IGnssCallback> mGnssCbIface_2_0;
sp<V2_1::IGnssCallback> mGnssCbIface_2_1;
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // GNSS_API_CLINET_H

View File

@@ -0,0 +1,405 @@
/* Copyright (c) 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
* 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>
#include <log_util.h>
#include <inttypes.h>
#include <loc_misc_utils.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V2_0::GnssLocation;
using ::android::hardware::gnss::V2_0::ElapsedRealtimeFlags;
using ::android::hardware::gnss::V2_0::GnssConstellationType;
using ::android::hardware::gnss::V1_0::GnssLocationFlags;
using ::android::hardware::gnss::measurement_corrections::V1_0::GnssSingleSatCorrectionFlags;
void convertGnssLocation(Location& in, V1_0::GnssLocation& out)
{
memset(&out, 0, sizeof(V1_0::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(Location& in, V2_0::GnssLocation& out)
{
memset(&out, 0, sizeof(V2_0::GnssLocation));
convertGnssLocation(in, out.v1_0);
if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
out.elapsedRealtime.timestampNs = in.elapsedRealTime;
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
out.elapsedRealtime.timeUncertaintyNs = in.elapsedRealTimeUnc;
LOC_LOGd("out.elapsedRealtime.timestampNs=%" PRIi64 ""
" out.elapsedRealtime.timeUncertaintyNs=%" PRIi64 ""
" out.elapsedRealtime.flags=0x%X",
out.elapsedRealtime.timestampNs,
out.elapsedRealtime.timeUncertaintyNs, out.elapsedRealtime.flags);
}
}
void convertGnssLocation(const V1_0::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 convertGnssLocation(const V2_0::GnssLocation& in, Location& out)
{
memset(&out, 0, sizeof(out));
convertGnssLocation(in.v1_0, out);
}
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out)
{
switch(in) {
case GNSS_SV_TYPE_GPS:
out = V1_0::GnssConstellationType::GPS;
break;
case GNSS_SV_TYPE_SBAS:
out = V1_0::GnssConstellationType::SBAS;
break;
case GNSS_SV_TYPE_GLONASS:
out = V1_0::GnssConstellationType::GLONASS;
break;
case GNSS_SV_TYPE_QZSS:
out = V1_0::GnssConstellationType::QZSS;
break;
case GNSS_SV_TYPE_BEIDOU:
out = V1_0::GnssConstellationType::BEIDOU;
break;
case GNSS_SV_TYPE_GALILEO:
out = V1_0::GnssConstellationType::GALILEO;
break;
case GNSS_SV_TYPE_UNKNOWN:
default:
out = V1_0::GnssConstellationType::UNKNOWN;
break;
}
}
void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out)
{
switch(in) {
case GNSS_SV_TYPE_GPS:
out = V2_0::GnssConstellationType::GPS;
break;
case GNSS_SV_TYPE_SBAS:
out = V2_0::GnssConstellationType::SBAS;
break;
case GNSS_SV_TYPE_GLONASS:
out = V2_0::GnssConstellationType::GLONASS;
break;
case GNSS_SV_TYPE_QZSS:
out = V2_0::GnssConstellationType::QZSS;
break;
case GNSS_SV_TYPE_BEIDOU:
out = V2_0::GnssConstellationType::BEIDOU;
break;
case GNSS_SV_TYPE_GALILEO:
out = V2_0::GnssConstellationType::GALILEO;
break;
case GNSS_SV_TYPE_NAVIC:
out = V2_0::GnssConstellationType::IRNSS;
break;
case GNSS_SV_TYPE_UNKNOWN:
default:
out = V2_0::GnssConstellationType::UNKNOWN;
break;
}
}
void convertGnssSvid(GnssSv& in, int16_t& out)
{
switch (in.type) {
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
if (!isGloSlotUnknown(in.svId)) { // OSN is known
out = in.svId - GLO_SV_PRN_MIN + 1;
} else { // OSN is not known, report FCN
out = in.gloFrequency + 92;
}
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_NAVIC:
out = in.svId - NAVIC_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
{
switch (in.svType) {
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
if (!isGloSlotUnknown(in.svId)) { // OSN is known
out = in.svId - GLO_SV_PRN_MIN + 1;
} else { // OSN is not known, report FCN
out = in.gloFrequency + 92;
}
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_NAVIC:
out = in.svId - NAVIC_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
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;
}
}
void convertSingleSatCorrections(const SingleSatCorrection& in, GnssSingleSatCorrection& out)
{
out.flags = GNSS_MEAS_CORR_UNKNOWN_BIT;
if (in.singleSatCorrectionFlags & (GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY)) {
out.flags |= GNSS_MEAS_CORR_HAS_SAT_IS_LOS_PROBABILITY_BIT;
}
if (in.singleSatCorrectionFlags & (GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH)) {
out.flags |= GNSS_MEAS_CORR_HAS_EXCESS_PATH_LENGTH_BIT;
}
if (in.singleSatCorrectionFlags & (GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC)) {
out.flags |= GNSS_MEAS_CORR_HAS_EXCESS_PATH_LENGTH_UNC_BIT;
}
if (in.singleSatCorrectionFlags & (GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE)) {
out.flags |= GNSS_MEAS_CORR_HAS_REFLECTING_PLANE_BIT;
}
switch (in.constellation) {
case (::android::hardware::gnss::V1_0::GnssConstellationType::GPS):
out.svType = GNSS_SV_TYPE_GPS;
break;
case (::android::hardware::gnss::V1_0::GnssConstellationType::SBAS):
out.svType = GNSS_SV_TYPE_SBAS;
break;
case (::android::hardware::gnss::V1_0::GnssConstellationType::GLONASS):
out.svType = GNSS_SV_TYPE_GLONASS;
break;
case (::android::hardware::gnss::V1_0::GnssConstellationType::QZSS):
out.svType = GNSS_SV_TYPE_QZSS;
break;
case (::android::hardware::gnss::V1_0::GnssConstellationType::BEIDOU):
out.svType = GNSS_SV_TYPE_BEIDOU;
break;
case (::android::hardware::gnss::V1_0::GnssConstellationType::GALILEO):
out.svType = GNSS_SV_TYPE_GALILEO;
break;
case (::android::hardware::gnss::V1_0::GnssConstellationType::UNKNOWN):
default:
out.svType = GNSS_SV_TYPE_UNKNOWN;
break;
}
out.svId = in.svid;
out.carrierFrequencyHz = in.carrierFrequencyHz;
out.probSatIsLos = in.probSatIsLos;
out.excessPathLengthMeters = in.excessPathLengthMeters;
out.excessPathLengthUncertaintyMeters = in.excessPathLengthUncertaintyMeters;
out.reflectingPlane.latitudeDegrees = in.reflectingPlane.latitudeDegrees;
out.reflectingPlane.longitudeDegrees = in.reflectingPlane.longitudeDegrees;
out.reflectingPlane.altitudeMeters = in.reflectingPlane.altitudeMeters;
out.reflectingPlane.azimuthDegrees = in.reflectingPlane.azimuthDegrees;
}
void convertMeasurementCorrections(const MeasurementCorrectionsV1_0& in,
GnssMeasurementCorrections& out)
{
memset(&out, 0, sizeof(GnssMeasurementCorrections));
out.latitudeDegrees = in.latitudeDegrees;
out.longitudeDegrees = in.longitudeDegrees;
out.altitudeMeters = in.altitudeMeters;
out.horizontalPositionUncertaintyMeters = in.horizontalPositionUncertaintyMeters;
out.verticalPositionUncertaintyMeters = in.verticalPositionUncertaintyMeters;
out.toaGpsNanosecondsOfWeek = in.toaGpsNanosecondsOfWeek;
for (int i = 0; i < in.satCorrections.size(); i++) {
GnssSingleSatCorrection gnssSingleSatCorrection = {};
convertSingleSatCorrections(in.satCorrections[i], gnssSingleSatCorrection);
out.satCorrections.push_back(gnssSingleSatCorrection);
}
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,68 @@
/* Copyright (c) 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
* 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/2.0/types.h>
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
#include <LocationAPI.h>
#include <GnssDebug.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using MeasurementCorrectionsV1_0 =
::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections;
using ::android::hardware::gnss::measurement_corrections::V1_0::SingleSatCorrection;
void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
void convertGnssLocation(Location& in, V2_0::GnssLocation& out);
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
void convertGnssLocation(const V2_0::GnssLocation& in, Location& out);
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out);
void convertGnssSvid(GnssSv& in, int16_t& out);
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
void convertSingleSatCorrections(const SingleSatCorrection& in, GnssSingleSatCorrection& out);
void convertMeasurementCorrections(const MeasurementCorrectionsV1_0& in,
GnssMeasurementCorrections& out);
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // LOCATION_UTIL_H

View File

@@ -0,0 +1,642 @@
/* Copyright (c) 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
* 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 <inttypes.h>
#include "LocationUtil.h"
#include "MeasurementAPIClient.h"
#include <loc_misc_utils.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::hardware::gnss::V2_0::IGnssMeasurementCallback;
static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out);
static void convertGnssData_1_1(GnssMeasurementsNotification& in,
V1_1::IGnssMeasurementCallback::GnssData& out);
static void convertGnssData_2_0(GnssMeasurementsNotification& in,
V2_0::IGnssMeasurementCallback::GnssData& out);
static void convertGnssData_2_1(GnssMeasurementsNotification& in,
V2_1::IGnssMeasurementCallback::GnssData& out);
static void convertGnssMeasurement(GnssMeasurementsData& in,
V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
static void convertGnssClock_2_1(GnssMeasurementsClock& in,
V2_1::IGnssMeasurementCallback::GnssClock& out);
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& inCodeType,
char* inOtherCodeTypeName,
::android::hardware::hidl_string& out);
static void convertGnssMeasurementsAccumulatedDeltaRangeState(GnssMeasurementsAdrStateMask& in,
::android::hardware::hidl_bitfield
<V1_1::IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState>& out);
static void convertGnssMeasurementsState(GnssMeasurementsStateMask& in,
::android::hardware::hidl_bitfield
<V2_0::IGnssMeasurementCallback::GnssMeasurementState>& out);
static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtimeNanos);
MeasurementAPIClient::MeasurementAPIClient() :
mGnssMeasurementCbIface(nullptr),
mGnssMeasurementCbIface_1_1(nullptr),
mGnssMeasurementCbIface_2_0(nullptr),
mGnssMeasurementCbIface_2_1(nullptr),
mTracking(false)
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
MeasurementAPIClient::~MeasurementAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
void MeasurementAPIClient::clearInterfaces()
{
mGnssMeasurementCbIface = nullptr;
mGnssMeasurementCbIface_1_1 = nullptr;
mGnssMeasurementCbIface_2_0 = nullptr;
mGnssMeasurementCbIface_2_1 = nullptr;
}
// for GpsInterface
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
mMutex.lock();
clearInterfaces();
mGnssMeasurementCbIface = callback;
mMutex.unlock();
return startTracking();
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback_1_1(
const sp<V1_1::IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
{
LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
__FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
mMutex.lock();
clearInterfaces();
mGnssMeasurementCbIface_1_1 = callback;
mMutex.unlock();
return startTracking(powerMode, timeBetweenMeasurement);
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback_2_0(
const sp<V2_0::IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
{
LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
__FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
mMutex.lock();
clearInterfaces();
mGnssMeasurementCbIface_2_0 = callback;
mMutex.unlock();
return startTracking(powerMode, timeBetweenMeasurement);
}
Return<IGnssMeasurement::GnssMeasurementStatus> MeasurementAPIClient::measurementSetCallback_2_1(
const sp<V2_1::IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode, uint32_t timeBetweenMeasurement) {
LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
__FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
mMutex.lock();
clearInterfaces();
mGnssMeasurementCbIface_2_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_2_1 != nullptr ||
mGnssMeasurementCbIface_2_0 != nullptr ||
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: %u active: %d)",
__FUNCTION__, gnssMeasurementsNotification.count, mTracking);
if (mTracking) {
mMutex.lock();
sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
sp<V1_1::IGnssMeasurementCallback> gnssMeasurementCbIface_1_1 = nullptr;
sp<V2_0::IGnssMeasurementCallback> gnssMeasurementCbIface_2_0 = nullptr;
sp<V2_1::IGnssMeasurementCallback> gnssMeasurementCbIface_2_1 = nullptr;
if (mGnssMeasurementCbIface_2_1 != nullptr) {
gnssMeasurementCbIface_2_1 = mGnssMeasurementCbIface_2_1;
} else if (mGnssMeasurementCbIface_2_0 != nullptr) {
gnssMeasurementCbIface_2_0 = mGnssMeasurementCbIface_2_0;
} else if (mGnssMeasurementCbIface_1_1 != nullptr) {
gnssMeasurementCbIface_1_1 = mGnssMeasurementCbIface_1_1;
} else if (mGnssMeasurementCbIface != nullptr) {
gnssMeasurementCbIface = mGnssMeasurementCbIface;
}
mMutex.unlock();
if (gnssMeasurementCbIface_2_1 != nullptr) {
V2_1::IGnssMeasurementCallback::GnssData gnssData;
convertGnssData_2_1(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface_2_1->gnssMeasurementCb_2_1(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssMeasurementCb description=%s",
__func__, r.description().c_str());
}
} else if (gnssMeasurementCbIface_2_0 != nullptr) {
V2_0::IGnssMeasurementCallback::GnssData gnssData;
convertGnssData_2_0(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface_2_0->gnssMeasurementCb_2_0(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssMeasurementCb description=%s",
__func__, r.description().c_str());
}
} else if (gnssMeasurementCbIface_1_1 != nullptr) {
V1_1::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(out));
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;
convertGnssSvid(in, out.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(out));
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 convertGnssClock_2_1(GnssMeasurementsClock& in,
V2_1::IGnssMeasurementCallback::GnssClock& out)
{
memset(&out, 0, sizeof(out));
convertGnssClock(in, out.v1_0);
convertGnssConstellationType(in.referenceSignalTypeForIsb.svType,
out.referenceSignalTypeForIsb.constellation);
out.referenceSignalTypeForIsb.carrierFrequencyHz =
in.referenceSignalTypeForIsb.carrierFrequencyHz;
convertGnssMeasurementsCodeType(in.referenceSignalTypeForIsb.codeType,
in.referenceSignalTypeForIsb.otherCodeTypeName,
out.referenceSignalTypeForIsb.codeType);
}
static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out)
{
memset(&out, 0, sizeof(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,
V1_1::IGnssMeasurementCallback::GnssData& out)
{
memset(&out, 0, sizeof(out));
out.measurements.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_0);
convertGnssMeasurementsAccumulatedDeltaRangeState(in.measurements[i].adrStateMask,
out.measurements[i].accumulatedDeltaRangeState);
}
convertGnssClock(in.clock, out.clock);
}
static void convertGnssData_2_0(GnssMeasurementsNotification& in,
V2_0::IGnssMeasurementCallback::GnssData& out)
{
memset(&out, 0, sizeof(out));
out.measurements.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_1.v1_0);
convertGnssConstellationType(in.measurements[i].svType, out.measurements[i].constellation);
convertGnssMeasurementsCodeType(in.measurements[i].codeType,
in.measurements[i].otherCodeTypeName,
out.measurements[i].codeType);
convertGnssMeasurementsAccumulatedDeltaRangeState(in.measurements[i].adrStateMask,
out.measurements[i].v1_1.accumulatedDeltaRangeState);
convertGnssMeasurementsState(in.measurements[i].stateMask, out.measurements[i].state);
}
convertGnssClock(in.clock, out.clock);
convertElapsedRealtimeNanos(in, out.elapsedRealtime);
}
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& inCodeType,
char* inOtherCodeTypeName, ::android::hardware::hidl_string& out)
{
memset(&out, 0, sizeof(out));
switch(inCodeType) {
case GNSS_MEASUREMENTS_CODE_TYPE_A:
out = "A";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_B:
out = "B";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_C:
out = "C";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_I:
out = "I";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_L:
out = "L";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_M:
out = "M";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_P:
out = "P";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_Q:
out = "Q";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_S:
out = "S";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_W:
out = "W";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_X:
out = "X";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_Y:
out = "Y";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_Z:
out = "Z";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_N:
out = "N";
break;
case GNSS_MEASUREMENTS_CODE_TYPE_OTHER:
default:
out = inOtherCodeTypeName;
break;
}
}
static void convertGnssMeasurementsAccumulatedDeltaRangeState(GnssMeasurementsAdrStateMask& in,
::android::hardware::hidl_bitfield
<V1_1::IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState>& out)
{
memset(&out, 0, sizeof(out));
if (in & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
out |= IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
if (in & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
out |= IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
if (in & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
out |= IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
if (in & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT)
out |= IGnssMeasurementCallback::
GnssAccumulatedDeltaRangeState::ADR_STATE_HALF_CYCLE_RESOLVED;
}
static void convertGnssMeasurementsState(GnssMeasurementsStateMask& in,
::android::hardware::hidl_bitfield
<V2_0::IGnssMeasurementCallback::GnssMeasurementState>& out)
{
memset(&out, 0, sizeof(out));
if (in & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
if (in & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
if (in & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
if (in & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
if (in & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
if (in & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
if (in & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
if (in & GNSS_MEASUREMENTS_STATE_TOW_KNOWN_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_KNOWN;
if (in & GNSS_MEASUREMENTS_STATE_GLO_TOD_KNOWN_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_KNOWN;
if (in & GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT)
out |= IGnssMeasurementCallback::GnssMeasurementState::STATE_2ND_CODE_LOCK;
}
static void convertGnssData_2_1(GnssMeasurementsNotification& in,
V2_1::IGnssMeasurementCallback::GnssData& out)
{
memset(&out, 0, sizeof(out));
out.measurements.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
out.measurements[i].flags = 0;
convertGnssMeasurement(in.measurements[i], out.measurements[i].v2_0.v1_1.v1_0);
convertGnssConstellationType(in.measurements[i].svType,
out.measurements[i].v2_0.constellation);
convertGnssMeasurementsCodeType(in.measurements[i].codeType,
in.measurements[i].otherCodeTypeName,
out.measurements[i].v2_0.codeType);
convertGnssMeasurementsAccumulatedDeltaRangeState(in.measurements[i].adrStateMask,
out.measurements[i].v2_0.v1_1.accumulatedDeltaRangeState);
convertGnssMeasurementsState(in.measurements[i].stateMask,
out.measurements[i].v2_0.state);
out.measurements[i].basebandCN0DbHz = in.measurements[i].basebandCarrierToNoiseDbHz;
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT) {
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT) {
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_FREQUENCY;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT) {
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_CYCLES;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT) {
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT) {
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::
GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT) {
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_FULL_ISB_BIT) {
out.measurements[i].fullInterSignalBiasNs = in.measurements[i].fullInterSignalBiasNs;
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_FULL_ISB;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_FULL_ISB_UNCERTAINTY_BIT) {
out.measurements[i].fullInterSignalBiasUncertaintyNs =
in.measurements[i].fullInterSignalBiasUncertaintyNs;
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::
GnssMeasurementFlags::HAS_FULL_ISB_UNCERTAINTY;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_SATELLITE_ISB_BIT) {
out.measurements[i].satelliteInterSignalBiasNs =
in.measurements[i].satelliteInterSignalBiasNs;
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SATELLITE_ISB;
}
if (in.measurements[i].flags & GNSS_MEASUREMENTS_DATA_SATELLITE_ISB_UNCERTAINTY_BIT) {
out.measurements[i].satelliteInterSignalBiasUncertaintyNs =
in.measurements[i].satelliteInterSignalBiasUncertaintyNs;
out.measurements[i].flags |=
V2_1::IGnssMeasurementCallback::
GnssMeasurementFlags::HAS_SATELLITE_ISB_UNCERTAINTY;
}
}
convertGnssClock_2_1(in.clock, out.clock);
convertElapsedRealtimeNanos(in, out.elapsedRealtime);
}
static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtime)
{
if (in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT) {
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
elapsedRealtime.timestampNs = in.clock.elapsedRealTime;
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
LOC_LOGd("elapsedRealtime.timestampNs=%" PRIi64 ""
" elapsedRealtime.timeUncertaintyNs=%" PRIi64 " elapsedRealtime.flags=0x%X",
elapsedRealtime.timestampNs,
elapsedRealtime.timeUncertaintyNs, elapsedRealtime.flags);
}
}
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,96 @@
/* Copyright (c) 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
* 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/2.1/IGnssMeasurement.h>
//#include <android/hardware/gnss/1.1/IGnssMeasurementCallback.h>
#include <android/hardware/gnss/2.1/IGnssMeasurementCallback.h>
#include <LocationAPIClientBase.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V2_1 {
namespace implementation {
using ::android::sp;
class MeasurementAPIClient : public LocationAPIClientBase
{
public:
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<V1_1::IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_2_0(
const sp<V2_0::IGnssMeasurementCallback>& callback,
GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_2_1(
const sp<V2_1::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:
virtual ~MeasurementAPIClient();
std::mutex mMutex;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
sp<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
sp<V2_0::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_0;
sp<V2_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_1;
bool mTracking;
void clearInterfaces();
};
} // namespace implementation
} // namespace V2_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // MEASUREMENT_API_CLINET_H

81
gps/android/2.1/service.cpp Executable file
View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2017-2020, 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@2.1-service-qti"
#include <android/hardware/gnss/2.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::V2_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) {
#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
ALOGI("LOC_HIDL_VERSION not defined.");
#endif
joinRpcThreadpool();
} else {
ALOGE("Error while registering IGnss 2.1 service: %d", status);
}
return 0;
}

2
gps/android/Android.mk Normal file
View File

@@ -0,0 +1,2 @@
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles)

View File

@@ -0,0 +1,37 @@
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.health@2.1",
"android.hardware.power@1.2",
"libbase",
],
static_libs: ["libhealthhalutils"],
header_libs: [
"libgps.utils_headers",
"libloc_pla_headers",
],
}
cc_library_headers {
name: "liblocbatterylistener_headers",
export_include_dirs: ["."],
}

View File

@@ -0,0 +1,285 @@
/*
* Copyright (c) 2019-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
* 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 "battery_listener.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "LocSvc_BatteryListener"
#define LOG_NDEBUG 0
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <android/hardware/health/2.1/IHealth.h>
#include <android/hardware/health/2.1/IHealthInfoCallback.h>
#include <healthhalutils/HealthHalUtils.h>
#include <hidl/HidlTransportSupport.h>
#include <thread>
#include <log_util.h>
using android::hardware::interfacesEqual;
using android::hardware::Return;
using android::hardware::Void;
using android::hardware::health::V1_0::BatteryStatus;
using android::hardware::health::V2_1::HealthInfo;
using android::hardware::health::V2_1::IHealthInfoCallback;
using android::hardware::health::V2_1::IHealth;
using android::hardware::health::V2_0::Result;
using android::hidl::manager::V1_0::IServiceManager;
using namespace std::literals::chrono_literals;
static bool sIsBatteryListened = false;
namespace android {
#define GET_HEALTH_SVC_RETRY_CNT 5
#define GET_HEALTH_SVC_WAIT_TIME_MS 500
struct BatteryListenerImpl : public hardware::health::V2_1::IHealthInfoCallback,
public hardware::hidl_death_recipient {
typedef std::function<void(bool)> cb_fn_t;
BatteryListenerImpl(cb_fn_t cb);
virtual ~BatteryListenerImpl ();
virtual hardware::Return<void> healthInfoChanged(
const hardware::health::V2_0::HealthInfo& info);
virtual hardware::Return<void> healthInfoChanged_2_1(
const hardware::health::V2_1::HealthInfo& info);
virtual void serviceDied(uint64_t cookie,
const wp<hidl::base::V1_0::IBase>& who);
bool isCharging() {
std::lock_guard<std::mutex> _l(mLock);
return statusToBool(mStatus);
}
private:
sp<hardware::health::V2_1::IHealth> mHealth;
status_t init();
BatteryStatus mStatus;
cb_fn_t mCb;
std::mutex mLock;
std::condition_variable mCond;
std::unique_ptr<std::thread> mThread;
bool mDone;
bool statusToBool(const BatteryStatus &s) const {
return (s == BatteryStatus::CHARGING) ||
(s == BatteryStatus::FULL);
}
};
status_t BatteryListenerImpl::init()
{
int tries = 0;
if (mHealth != NULL)
return INVALID_OPERATION;
do {
mHealth = IHealth::getService();
if (mHealth != NULL)
break;
usleep(GET_HEALTH_SVC_WAIT_TIME_MS * 1000);
tries++;
} while(tries < GET_HEALTH_SVC_RETRY_CNT);
if (mHealth == NULL) {
LOC_LOGe("no health service found, retries %d", tries);
return NO_INIT;
} else {
LOC_LOGi("Get health service in %d tries", tries);
}
mStatus = BatteryStatus::UNKNOWN;
auto ret = mHealth->getChargeStatus([&](Result r, BatteryStatus status) {
if (r != Result::SUCCESS) {
LOC_LOGe("batterylistener: cannot get battery status");
return;
}
mStatus = status;
});
if (!ret.isOk()) {
LOC_LOGe("batterylistener: get charge status transaction error");
}
if (mStatus == BatteryStatus::UNKNOWN) {
LOC_LOGw("batterylistener: init: invalid battery status");
}
mDone = false;
mThread = std::make_unique<std::thread>([this]() {
std::unique_lock<std::mutex> l(mLock);
BatteryStatus local_status = mStatus;
while (!mDone) {
if (local_status == mStatus) {
mCond.wait(l);
continue;
}
local_status = mStatus;
switch (local_status) {
// NOT_CHARGING is a special event that indicates, a battery is connected,
// but not charging. This is seen for approx a second
// after charger is plugged in. A charging event is eventually received.
// We must try to avoid an unnecessary cb to HAL
// only to call it again shortly.
// An option to deal with this transient event would be to ignore this.
// Or process this event with a slight delay (i.e cancel this event
// if a different event comes in within a timeout
case BatteryStatus::NOT_CHARGING : {
auto mStatusnot_ncharging =
[this, local_status]() { return mStatus != local_status; };
mCond.wait_for(l, 3s, mStatusnot_ncharging);
if (mStatusnot_ncharging()) // i.e event changed
break;
[[clang::fallthrough]]; //explicit fall-through between switch labels
}
default:
bool c = statusToBool(local_status);
LOC_LOGi("healthInfo cb thread: cb %s", c ? "CHARGING" : "NOT CHARGING");
l.unlock();
mCb(c);
l.lock();
break;
}
}
});
auto reg = mHealth->registerCallback(this);
if (!reg.isOk()) {
LOC_LOGe("Transaction error in registeringCb to HealthHAL death: %s",
reg.description().c_str());
}
auto linked = mHealth->linkToDeath(this, 0 /* cookie */);
if (!linked.isOk() || linked == false) {
LOC_LOGe("Transaction error in linking to HealthHAL death: %s",
linked.description().c_str());
}
return NO_ERROR;
}
BatteryListenerImpl::BatteryListenerImpl(cb_fn_t cb) :
mCb(cb)
{
init();
}
BatteryListenerImpl::~BatteryListenerImpl()
{
{
std::lock_guard<std::mutex> _l(mLock);
if (mHealth != NULL) {
mHealth->unregisterCallback(this);
auto r = mHealth->unlinkToDeath(this);
if (!r.isOk() || r == false) {
LOC_LOGe("Transaction error in unregister to HealthHAL death: %s",
r.description().c_str());
}
}
}
mDone = true;
if (NULL != mThread) {
mThread->join();
}
}
void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
const wp<hidl::base::V1_0::IBase>& who)
{
{
std::lock_guard<std::mutex> _l(mLock);
if (mHealth == NULL || !interfacesEqual(mHealth, who.promote())) {
LOC_LOGe("health not initialized or unknown interface died");
return;
}
LOC_LOGi("health service died, reinit");
mDone = true;
}
mHealth = NULL;
mCond.notify_one();
if (NULL != mThread) {
mThread->join();
}
std::lock_guard<std::mutex> _l(mLock);
init();
}
// this callback seems to be a SYNC callback and so
// waits for return before next event is issued.
// therefore we need not have a queue to process
// NOT_CHARGING and CHARGING concurrencies.
// Replace single var by a list if this assumption is broken
Return<void> BatteryListenerImpl::healthInfoChanged(
const hardware::health::V2_0::HealthInfo& info) {
LOC_LOGv("healthInfoChanged: %d", info.legacy.batteryStatus);
std::unique_lock<std::mutex> l(mLock);
if (info.legacy.batteryStatus != mStatus) {
mStatus = info.legacy.batteryStatus;
mCond.notify_one();
}
return Void();
}
Return<void> BatteryListenerImpl::healthInfoChanged_2_1(
const hardware::health::V2_1::HealthInfo& info) {
LOC_LOGv("healthInfoChanged_2_1: %d", info.legacy.legacy.batteryStatus);
healthInfoChanged(info.legacy);
return Void();
}
static sp<BatteryListenerImpl> batteryListener;
bool batteryPropertiesListenerIsCharging() {
return batteryListener->isCharging();
}
status_t batteryPropertiesListenerInit(BatteryListenerImpl::cb_fn_t cb) {
batteryListener = new BatteryListenerImpl(cb);
bool isCharging = batteryPropertiesListenerIsCharging();
LOC_LOGv("charging status: %s charging", isCharging ? "" : "not");;
if (isCharging) {
cb(isCharging);
}
return NO_ERROR;
}
status_t batteryPropertiesListenerDeinit() {
batteryListener.clear();
return OK;
}
} // namespace android
void loc_extn_battery_properties_listener_init(battery_status_change_fn_t fn) {
LOC_LOGv("loc_extn_battery_properties_listener_init entry");
if (!sIsBatteryListened) {
std::thread t1(android::batteryPropertiesListenerInit,
[=](bool charging) { fn(charging); });
t1.detach();
sIsBatteryListened = true;
}
}
void loc_extn_battery_properties_listener_deinit() {
android::batteryPropertiesListenerDeinit();
}
bool loc_extn_battery_properties_is_charging() {
return android::batteryPropertiesListenerIsCharging();
}

View File

@@ -0,0 +1,32 @@
/*
* 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.
*/
typedef void (* battery_status_change_fn_t)(bool);
void loc_extn_battery_properties_listener_init(battery_status_change_fn_t fn);
void loc_extn_battery_properties_listener_deinit();
bool loc_extn_battery_properties_is_charging();

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

@@ -0,0 +1,31 @@
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,
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,152 @@
/* 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.
*
*/
#ifndef BATCHING_ADAPTER_H
#define BATCHING_ADAPTER_H
#include <LocAdapterBase.h>
#include <LocContext.h>
#include <LocationAPI.h>
#include <map>
using namespace loc_core;
class BatchingAdapter : public LocAdapterBase {
/* ==== BATCHING ======================================================================= */
typedef struct {
uint32_t accumulatedDistanceOngoingBatch;
uint32_t accumulatedDistanceThisTrip;
uint32_t accumulatedDistanceOnTripRestart;
uint32_t tripDistance;
uint32_t tripTBFInterval;
} TripSessionStatus;
typedef std::map<uint32_t, TripSessionStatus> TripSessionStatusMap;
typedef std::map<LocationSessionKey, BatchingOptions> BatchingSessionMap;
BatchingSessionMap mBatchingSessions;
TripSessionStatusMap mTripSessions;
uint32_t mOngoingTripDistance;
uint32_t mOngoingTripTBFInterval;
bool mTripWithOngoingTBFDropped;
bool mTripWithOngoingTripDistanceDropped;
void startTripBatchingMultiplex(LocationAPI* client, uint32_t sessionId,
const BatchingOptions& batchingOptions);
void stopTripBatchingMultiplex(LocationAPI* client, uint32_t sessionId,
bool restartNeeded,
const BatchingOptions& batchOptions);
inline void stopTripBatchingMultiplex(LocationAPI* client, uint32_t id) {
BatchingOptions batchOptions;
stopTripBatchingMultiplex(client, id, false, batchOptions);
};
void stopTripBatchingMultiplexCommon(LocationError err,
LocationAPI* client,
uint32_t sessionId,
bool restartNeeded,
const BatchingOptions& batchOptions);
void restartTripBatching(bool queryAccumulatedDistance, uint32_t accDist = 0,
uint32_t numbatchedPos = 0);
void printTripReport();
/* ==== CONFIGURATION ================================================================== */
uint32_t mBatchingTimeout;
uint32_t mBatchingAccuracy;
size_t mBatchSize;
size_t mTripBatchSize;
protected:
/* ==== CLIENT ========================================================================= */
virtual void updateClientsEventMask();
virtual void stopClientSessions(LocationAPI* client);
public:
BatchingAdapter();
virtual ~BatchingAdapter() {}
/* ==== SSR ============================================================================ */
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
virtual void handleEngineUpEvent();
/* ======== UTILITIES ================================================================== */
void restartSessions();
/* ==== BATCHING ======================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
uint32_t startBatchingCommand(LocationAPI* client, BatchingOptions &batchOptions);
void updateBatchingOptionsCommand(
LocationAPI* client, uint32_t id, BatchingOptions& batchOptions);
void stopBatchingCommand(LocationAPI* client, uint32_t id);
void getBatchedLocationsCommand(LocationAPI* client, uint32_t id, size_t count);
/* ======== RESPONSES ================================================================== */
void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
/* ======== UTILITIES ================================================================== */
bool hasBatchingCallback(LocationAPI* client);
bool isBatchingSession(LocationAPI* client, uint32_t sessionId);
bool isTripSession(uint32_t sessionId);
void saveBatchingSession(LocationAPI* client, uint32_t sessionId,
const BatchingOptions& batchingOptions);
void eraseBatchingSession(LocationAPI* client, uint32_t sessionId);
uint32_t autoReportBatchingSessionsCount();
void startBatching(LocationAPI* client, uint32_t sessionId,
const BatchingOptions& batchingOptions);
void stopBatching(LocationAPI* client, uint32_t sessionId, bool restartNeeded,
const BatchingOptions& batchOptions);
void stopBatching(LocationAPI* client, uint32_t sessionId) {
BatchingOptions batchOptions;
stopBatching(client, sessionId, false, batchOptions);
};
/* ==== REPORTS ======================================================================== */
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
void reportLocationsEvent(const Location* locations, size_t count,
BatchingMode batchingMode);
void reportCompletedTripsEvent(uint32_t accumulatedDistance);
void reportBatchStatusChangeEvent(BatchingStatus batchStatus);
/* ======== UTILITIES ================================================================== */
void reportLocations(Location* locations, size_t count, BatchingMode batchingMode);
void reportBatchStatusChange(BatchingStatus batchStatus,
std::list<uint32_t> & completedTripsList);
/* ==== CONFIGURATION ================================================================== */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
void readConfigCommand();
void setConfigCommand();
/* ======== UTILITIES ================================================================== */
void setBatchSize(size_t batchSize) { mBatchSize = batchSize; }
size_t getBatchSize() { return mBatchSize; }
void setTripBatchSize(size_t batchSize) { mTripBatchSize = batchSize; }
size_t getTripBatchSize() { return mTripBatchSize; }
void setBatchingTimeout(uint32_t batchingTimeout) { mBatchingTimeout = batchingTimeout; }
uint32_t getBatchingTimeout() { return mBatchingTimeout; }
void setBatchingAccuracy(uint32_t accuracy) { mBatchingAccuracy = accuracy; }
uint32_t getBatchingAccuracy() { return mBatchingAccuracy; }
};
#endif /* BATCHING_ADAPTER_H */

View File

@@ -0,0 +1,134 @@
/* 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.
*
*/
#include "BatchingAdapter.h"
#include "location_interface.h"
static BatchingAdapter* gBatchingAdapter = NULL;
static void initialize();
static void deinitialize();
static void addClient(LocationAPI* client, const LocationCallbacks& callbacks);
static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb);
static void requestCapabilities(LocationAPI* client);
static uint32_t startBatching(LocationAPI* client, BatchingOptions&);
static void stopBatching(LocationAPI* client, uint32_t id);
static void updateBatchingOptions(LocationAPI* client, uint32_t id, BatchingOptions&);
static void getBatchedLocations(LocationAPI* client, uint32_t id, size_t count);
static const BatchingInterface gBatchingInterface = {
sizeof(BatchingInterface),
initialize,
deinitialize,
addClient,
removeClient,
requestCapabilities,
startBatching,
stopBatching,
updateBatchingOptions,
getBatchedLocations
};
#ifndef DEBUG_X86
extern "C" const BatchingInterface* getBatchingInterface()
#else
const BatchingInterface* getBatchingInterface()
#endif // DEBUG_X86
{
return &gBatchingInterface;
}
static void initialize()
{
if (NULL == gBatchingAdapter) {
gBatchingAdapter = new BatchingAdapter();
}
}
static void deinitialize()
{
if (NULL != gBatchingAdapter) {
delete gBatchingAdapter;
gBatchingAdapter = NULL;
}
}
static void addClient(LocationAPI* client, const LocationCallbacks& callbacks)
{
if (NULL != gBatchingAdapter) {
gBatchingAdapter->addClientCommand(client, callbacks);
}
}
static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb)
{
if (NULL != gBatchingAdapter) {
gBatchingAdapter->removeClientCommand(client, rmClientCb);
}
}
static void requestCapabilities(LocationAPI* client)
{
if (NULL != gBatchingAdapter) {
gBatchingAdapter->requestCapabilitiesCommand(client);
}
}
static uint32_t startBatching(LocationAPI* client, BatchingOptions &batchOptions)
{
if (NULL != gBatchingAdapter) {
return gBatchingAdapter->startBatchingCommand(client, batchOptions);
} else {
return 0;
}
}
static void stopBatching(LocationAPI* client, uint32_t id)
{
if (NULL != gBatchingAdapter) {
gBatchingAdapter->stopBatchingCommand(client, id);
}
}
static void updateBatchingOptions(
LocationAPI* client, uint32_t id, BatchingOptions& batchOptions)
{
if (NULL != gBatchingAdapter) {
gBatchingAdapter->updateBatchingOptionsCommand(client, id, batchOptions);
}
}
static void getBatchedLocations(LocationAPI* client, uint32_t id, size_t count)
{
if (NULL != gBatchingAdapter) {
gBatchingAdapter->getBatchedLocationsCommand(client, id, count);
}
}

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

@@ -0,0 +1,56 @@
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",
],
}

384
gps/core/ContextBase.cpp Normal file
View File

@@ -0,0 +1,384 @@
/* Copyright (c) 2011-2014,2016-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
* 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_CtxBase"
#include <dlfcn.h>
#include <unistd.h>
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
#include <loc_pla.h>
#include <loc_log.h>
namespace loc_core {
#define SLL_LOC_API_LIB_NAME "libsynergy_loc_api.so"
#define LOC_APIV2_0_LIB_NAME "libloc_api_v02.so"
#define IS_SS5_HW_ENABLED 1
loc_gps_cfg_s_type ContextBase::mGps_conf {};
loc_sap_cfg_s_type ContextBase::mSap_conf {};
bool ContextBase::sIsEngineCapabilitiesKnown = false;
uint64_t ContextBase::sSupportedMsgMask = 0;
bool ContextBase::sGnssMeasurementSupported = false;
uint8_t ContextBase::sFeaturesSupported[MAX_FEATURE_LENGTH];
GnssNMEARptRate ContextBase::sNmeaReportRate = GNSS_NMEA_REPORT_RATE_NHZ;
LocationCapabilitiesMask ContextBase::sQwesFeatureMask = 0;
const loc_param_s_type ContextBase::mGps_conf_table[] =
{
{"GPS_LOCK", &mGps_conf.GPS_LOCK, NULL, 'n'},
{"SUPL_VER", &mGps_conf.SUPL_VER, NULL, 'n'},
{"LPP_PROFILE", &mGps_conf.LPP_PROFILE, NULL, 'n'},
{"A_GLONASS_POS_PROTOCOL_SELECT", &mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
{"LPPE_CP_TECHNOLOGY", &mGps_conf.LPPE_CP_TECHNOLOGY, NULL, 'n'},
{"LPPE_UP_TECHNOLOGY", &mGps_conf.LPPE_UP_TECHNOLOGY, NULL, 'n'},
{"AGPS_CERT_WRITABLE_MASK", &mGps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
{"SUPL_MODE", &mGps_conf.SUPL_MODE, NULL, 'n'},
{"SUPL_ES", &mGps_conf.SUPL_ES, NULL, 'n'},
{"INTERMEDIATE_POS", &mGps_conf.INTERMEDIATE_POS, NULL, 'n'},
{"ACCURACY_THRES", &mGps_conf.ACCURACY_THRES, NULL, 'n'},
{"NMEA_PROVIDER", &mGps_conf.NMEA_PROVIDER, NULL, 'n'},
{"NMEA_REPORT_RATE", &mGps_conf.NMEA_REPORT_RATE, NULL, 's'},
{"CAPABILITIES", &mGps_conf.CAPABILITIES, 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'},
{"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL",
&mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
{"AGPS_CONFIG_INJECT", &mGps_conf.AGPS_CONFIG_INJECT, NULL, 'n'},
{"EXTERNAL_DR_ENABLED", &mGps_conf.EXTERNAL_DR_ENABLED, NULL, 'n'},
{"SUPL_HOST", &mGps_conf.SUPL_HOST, NULL, 's'},
{"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'},
{"MODEM_TYPE", &mGps_conf.MODEM_TYPE, NULL, 'n' },
{"MO_SUPL_HOST", &mGps_conf.MO_SUPL_HOST, NULL, 's' },
{"MO_SUPL_PORT", &mGps_conf.MO_SUPL_PORT, NULL, 'n' },
{"CONSTRAINED_TIME_UNCERTAINTY_ENABLED",
&mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED, NULL, 'n'},
{"CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD",
&mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD, NULL, 'f'},
{"CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET",
&mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET, NULL, 'n'},
{"POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED",
&mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED, NULL, 'n'},
{"PROXY_APP_PACKAGE_NAME", &mGps_conf.PROXY_APP_PACKAGE_NAME, NULL, 's' },
{"CP_MTLR_ES", &mGps_conf.CP_MTLR_ES, NULL, 'n' },
{"GNSS_DEPLOYMENT", &mGps_conf.GNSS_DEPLOYMENT, NULL, 'n'},
{"CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED",
&mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED, NULL, 'n'},
{"NMEA_TAG_BLOCK_GROUPING_ENABLED", &mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED, NULL, 'n'},
{"NI_SUPL_DENY_ON_NFW_LOCKED", &mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED, NULL, 'n'},
{"ENABLE_NMEA_PRINT", &mGps_conf.ENABLE_NMEA_PRINT, NULL, 'n'}
};
const loc_param_s_type ContextBase::mSap_conf_table[] =
{
{"GYRO_BIAS_RANDOM_WALK", &mSap_conf.GYRO_BIAS_RANDOM_WALK, &mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
{"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
{"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
{"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
{"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
{"SENSOR_ACCEL_BATCHES_PER_SEC", &mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
{"SENSOR_ACCEL_SAMPLES_PER_BATCH", &mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
{"SENSOR_GYRO_BATCHES_PER_SEC", &mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
{"SENSOR_GYRO_SAMPLES_PER_BATCH", &mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
{"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
{"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
{"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
{"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
{"SENSOR_CONTROL_MODE", &mSap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
{"SENSOR_ALGORITHM_CONFIG_MASK", &mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'}
};
void ContextBase::readConfig()
{
static bool confReadDone = false;
if (!confReadDone) {
confReadDone = true;
/*Defaults for gps.conf*/
mGps_conf.INTERMEDIATE_POS = 0;
mGps_conf.ACCURACY_THRES = 0;
mGps_conf.NMEA_PROVIDER = 0;
mGps_conf.GPS_LOCK = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
mGps_conf.SUPL_VER = 0x10000;
mGps_conf.SUPL_MODE = 0x1;
mGps_conf.SUPL_ES = 0;
mGps_conf.CP_MTLR_ES = 0;
mGps_conf.SUPL_HOST[0] = 0;
mGps_conf.SUPL_PORT = 0;
mGps_conf.CAPABILITIES = 0x7;
/* LTE Positioning Profile configuration is disable by default*/
mGps_conf.LPP_PROFILE = 0;
/*By default no positioning protocol is selected on A-GLONASS system*/
mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
/*Use emergency PDN by default*/
mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
/* By default no LPPe CP technology is enabled*/
mGps_conf.LPPE_CP_TECHNOLOGY = 0;
/* By default no LPPe UP technology is enabled*/
mGps_conf.LPPE_UP_TECHNOLOGY = 0;
/* By default we use unknown modem type*/
mGps_conf.MODEM_TYPE = 2;
/*Defaults for sap.conf*/
mSap_conf.GYRO_BIAS_RANDOM_WALK = 0;
mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
mSap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/
/* Values MUST be set by OEMs in configuration for sensor-assisted
navigation to work. There are NO default values */
mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
/* None of the 10 slots for agps certificates are writable by default */
mGps_conf.AGPS_CERT_WRITABLE_MASK = 0;
/* inject supl config to modem with config values from config.xml or gps.conf, default 1 */
mGps_conf.AGPS_CONFIG_INJECT = 1;
/* default configuration value of constrained time uncertainty mode:
feature disabled, time uncertainty threshold defined by modem,
and unlimited power budget */
#ifdef FEATURE_AUTOMOTIVE
mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED = 1;
#else
mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED = 0;
#endif
mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD = 0.0;
mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET = 0;
/* default configuration value of position assisted clock estimator mode */
mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0;
/* default configuration QTI GNSS H/W */
mGps_conf.GNSS_DEPLOYMENT = 0;
mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0;
/* default NMEA Tag Block Grouping is disabled */
mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED = 0;
/* default configuration for NI_SUPL_DENY_ON_NFW_LOCKED */
mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 1;
/* By default NMEA Printing is disabled */
mGps_conf.ENABLE_NMEA_PRINT = 0;
UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
if (strncmp(mGps_conf.NMEA_REPORT_RATE, "1HZ", sizeof(mGps_conf.NMEA_REPORT_RATE)) == 0) {
/* NMEA reporting is configured at 1Hz*/
sNmeaReportRate = GNSS_NMEA_REPORT_RATE_1HZ;
} else {
sNmeaReportRate = GNSS_NMEA_REPORT_RATE_NHZ;
}
LOC_LOGI("%s] GNSS Deployment: %s", __FUNCTION__,
((mGps_conf.GNSS_DEPLOYMENT == 1) ? "SS5" :
((mGps_conf.GNSS_DEPLOYMENT == 2) ? "QFUSION" : "QGNSS")));
switch (getTargetGnssType(loc_get_target())) {
case GNSS_GSS:
case GNSS_AUTO:
// For APQ targets, MSA/MSB capabilities should be reset
mGps_conf.CAPABILITIES &= ~(LOC_GPS_CAPABILITY_MSA | LOC_GPS_CAPABILITY_MSB);
break;
default:
break;
}
}
}
uint32_t ContextBase::getCarrierCapabilities() {
#define carrierMSA (uint32_t)0x2
#define carrierMSB (uint32_t)0x1
#define gpsConfMSA (uint32_t)0x4
#define gpsConfMSB (uint32_t)0x2
uint32_t capabilities = mGps_conf.CAPABILITIES;
if ((mGps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
capabilities &= ~gpsConfMSA;
}
if ((mGps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
capabilities &= ~gpsConfMSB;
}
LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
mGps_conf.CAPABILITIES, mGps_conf.SUPL_MODE, capabilities);
return capabilities;
}
LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
{
LBSProxyBase* proxy = NULL;
LOC_LOGD("%s:%d]: getLBSProxy libname: %s\n", __func__, __LINE__, libName);
void* lib = dlopen(libName, RTLD_NOW);
if ((void*)NULL != lib) {
getLBSProxy_t* getter = (getLBSProxy_t*)dlsym(lib, "getLBSProxy");
if (NULL != getter) {
proxy = (*getter)();
}
}
else
{
LOC_LOGW("%s:%d]: FAILED TO LOAD libname: %s\n", __func__, __LINE__, libName);
}
if (NULL == proxy) {
proxy = new LBSProxyBase();
}
LOC_LOGD("%s:%d]: Exiting\n", __func__, __LINE__);
return proxy;
}
LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
{
LocApiBase* locApi = NULL;
const char* libname = LOC_APIV2_0_LIB_NAME;
// Check the target
if (TARGET_NO_GNSS != loc_get_target()){
if (NULL == (locApi = mLBSProxy->getLocApi(exMask, this))) {
void *handle = NULL;
if (IS_SS5_HW_ENABLED == mGps_conf.GNSS_DEPLOYMENT) {
libname = SLL_LOC_API_LIB_NAME;
}
if ((handle = dlopen(libname, RTLD_NOW)) != NULL) {
LOC_LOGD("%s:%d]: %s is present", __func__, __LINE__, libname);
getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
if (getter != NULL) {
LOC_LOGD("%s:%d]: getter is not NULL of %s", __func__,
__LINE__, libname);
locApi = (*getter)(exMask, this);
}
}
// only RPC is the option now
else {
LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC",
__func__, __LINE__);
handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
if (NULL != handle) {
getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
if (NULL != getter) {
LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__,
__LINE__);
locApi = (*getter)(exMask, this);
}
}
}
}
}
// locApi could still be NULL at this time
// we would then create a dummy one
if (NULL == locApi) {
locApi = new LocApiBase(exMask, this);
}
return locApi;
}
ContextBase::ContextBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
const char* libName) :
mLBSProxy(getLBSProxy(libName)),
mMsgTask(msgTask),
mLocApi(createLocApi(exMask)),
mLocApiProxy(mLocApi->getLocApiProxy())
{
}
void ContextBase::setEngineCapabilities(uint64_t supportedMsgMask,
uint8_t *featureList, bool gnssMeasurementSupported) {
if (ContextBase::sIsEngineCapabilitiesKnown == false) {
ContextBase::sSupportedMsgMask = supportedMsgMask;
ContextBase::sGnssMeasurementSupported = gnssMeasurementSupported;
if (featureList != NULL) {
memcpy((void *)ContextBase::sFeaturesSupported,
(void *)featureList, sizeof(ContextBase::sFeaturesSupported));
}
/* */
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION)) {
static uint8_t isSapModeKnown = 0;
if (!isSapModeKnown) {
/* Check if SAP is PREMIUM_ENV_AIDING in izat.conf */
char conf_feature_sap[LOC_MAX_PARAM_STRING];
loc_param_s_type izat_conf_feature_table[] =
{
{ "SAP", &conf_feature_sap, &isSapModeKnown, 's' }
};
UTIL_READ_CONF(LOC_PATH_IZAT_CONF, izat_conf_feature_table);
/* Disable this feature if SAP is not PREMIUM_ENV_AIDING in izat.conf */
if (strcmp(conf_feature_sap, "PREMIUM_ENV_AIDING") != 0) {
uint8_t arrayIndex = LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION >> 3;
uint8_t bitPos = LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION & 7;
if (arrayIndex < MAX_FEATURE_LENGTH) {
/* To disable the feature we need to reset the bit on the "bitPos"
position, so shift a "1" to the left by "bitPos" */
ContextBase::sFeaturesSupported[arrayIndex] &= ~(1 << bitPos);
}
}
}
}
ContextBase::sIsEngineCapabilitiesKnown = true;
}
}
bool ContextBase::isFeatureSupported(uint8_t featureVal)
{
uint8_t arrayIndex = featureVal >> 3;
uint8_t bitPos = featureVal & 7;
if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
return ((ContextBase::sFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
}
bool ContextBase::gnssConstellationConfig() {
return sGnssMeasurementSupported;
}
}

385
gps/core/ContextBase.h Normal file
View File

@@ -0,0 +1,385 @@
/* 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
* 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 __LOC_CONTEXT_BASE__
#define __LOC_CONTEXT_BASE__
#include <stdbool.h>
#include <ctype.h>
#include <MsgTask.h>
#include <LocApiBase.h>
#include <LBSProxyBase.h>
#include <loc_cfg.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
/* GPS.conf support */
/* NOTE: the implementaiton of the parser casts number
fields to 32 bit. To ensure all 'n' fields working,
they must all be 32 bit fields. */
typedef struct loc_gps_cfg_s
{
uint32_t INTERMEDIATE_POS;
uint32_t ACCURACY_THRES;
uint32_t SUPL_VER;
uint32_t SUPL_MODE;
uint32_t SUPL_ES;
uint32_t CAPABILITIES;
uint32_t LPP_PROFILE;
char XTRA_SERVER_1[LOC_MAX_PARAM_STRING];
char XTRA_SERVER_2[LOC_MAX_PARAM_STRING];
char XTRA_SERVER_3[LOC_MAX_PARAM_STRING];
uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
uint32_t NMEA_PROVIDER;
char NMEA_REPORT_RATE[LOC_MAX_PARAM_NAME];
GnssConfigGpsLock GPS_LOCK;
uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
uint32_t AGPS_CERT_WRITABLE_MASK;
uint32_t AGPS_CONFIG_INJECT;
uint32_t LPPE_CP_TECHNOLOGY;
uint32_t LPPE_UP_TECHNOLOGY;
uint32_t EXTERNAL_DR_ENABLED;
char SUPL_HOST[LOC_MAX_PARAM_STRING];
uint32_t SUPL_PORT;
uint32_t MODEM_TYPE;
char MO_SUPL_HOST[LOC_MAX_PARAM_STRING];
uint32_t MO_SUPL_PORT;
uint32_t CONSTRAINED_TIME_UNCERTAINTY_ENABLED;
double CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD;
uint32_t CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET;
uint32_t POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED;
char PROXY_APP_PACKAGE_NAME[LOC_MAX_PARAM_STRING];
uint32_t CP_MTLR_ES;
uint32_t GNSS_DEPLOYMENT;
uint32_t CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED;
uint32_t NI_SUPL_DENY_ON_NFW_LOCKED;
uint32_t ENABLE_NMEA_PRINT;
uint32_t NMEA_TAG_BLOCK_GROUPING_ENABLED;
} loc_gps_cfg_s_type;
/* NOTE: the implementation of the parser casts number
fields to 32 bit. To ensure all 'n' fields working,
they must all be 32 bit fields. */
/* Meanwhile, *_valid fields are 8 bit fields, and 'f'
fields are double. Rigid as they are, it is the
the status quo, until the parsing mechanism is
changed, that is. */
typedef struct
{
uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
double GYRO_BIAS_RANDOM_WALK;
uint32_t SENSOR_ACCEL_BATCHES_PER_SEC;
uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH;
uint32_t SENSOR_GYRO_BATCHES_PER_SEC;
uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH;
uint32_t SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
uint32_t SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
uint32_t SENSOR_CONTROL_MODE;
uint32_t SENSOR_ALGORITHM_CONFIG_MASK;
uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
} loc_sap_cfg_s_type;
using namespace loc_util;
namespace loc_core {
class LocAdapterBase;
class ContextBase {
static LBSProxyBase* getLBSProxy(const char* libName);
LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
static const loc_param_s_type mGps_conf_table[];
static const loc_param_s_type mSap_conf_table[];
protected:
const LBSProxyBase* mLBSProxy;
const MsgTask* mMsgTask;
LocApiBase* mLocApi;
LocApiProxyBase *mLocApiProxy;
public:
ContextBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
const char* libName);
inline virtual ~ContextBase() {
if (nullptr != mLocApi) {
mLocApi->destroy();
mLocApi = nullptr;
}
if (nullptr != mLBSProxy) {
delete mLBSProxy;
mLBSProxy = nullptr;
}
}
inline const MsgTask* getMsgTask() { return mMsgTask; }
inline LocApiBase* getLocApi() { return mLocApi; }
inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
inline IzatDevId_t getIzatDevId() const {
return mLBSProxy->getIzatDevId();
}
inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
static loc_gps_cfg_s_type mGps_conf;
static loc_sap_cfg_s_type mSap_conf;
static bool sIsEngineCapabilitiesKnown;
static uint64_t sSupportedMsgMask;
static uint8_t sFeaturesSupported[MAX_FEATURE_LENGTH];
static bool sGnssMeasurementSupported;
static GnssNMEARptRate sNmeaReportRate;
static LocationCapabilitiesMask sQwesFeatureMask;
void readConfig();
static uint32_t getCarrierCapabilities();
void setEngineCapabilities(uint64_t supportedMsgMask,
uint8_t *featureList, bool gnssMeasurementSupported);
static inline bool isEngineCapabilitiesKnown() {
return sIsEngineCapabilitiesKnown;
}
static inline bool isMessageSupported(LocCheckingMessagesID msgID) {
// confirm if msgID is not larger than the number of bits in
// mSupportedMsg
if ((uint64_t)msgID > (sizeof(sSupportedMsgMask) << 3)) {
return false;
} else {
uint32_t messageChecker = 1 << msgID;
return (messageChecker & sSupportedMsgMask) == messageChecker;
}
}
/*
Check if a feature is supported
*/
static bool isFeatureSupported(uint8_t featureVal);
/*
Check if gnss measurement is supported
*/
static bool gnssConstellationConfig();
/*
set QWES feature status info
*/
static inline void setQwesFeatureStatus(
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
std::unordered_map<LocationQwesFeatureType, bool>::const_iterator itr;
static LocationQwesFeatureType locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_MAX];
for (itr = featureMap.begin(); itr != featureMap.end(); ++itr) {
LOC_LOGi("Feature : %d isValid: %d", itr->first, itr->second);
locQwesFeatType[itr->first] = itr->second;
switch (itr->first) {
case LOCATION_QWES_FEATURE_TYPE_CARRIER_PHASE:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT;
}
break;
case LOCATION_QWES_FEATURE_TYPE_SV_POLYNOMIAL:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT;
}
break;
case LOCATION_QWES_FEATURE_TYPE_GNSS_SINGLE_FREQUENCY:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY;
}
break;
case LOCATION_QWES_FEATURE_TYPE_SV_EPH:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT;
}
break;
case LOCATION_QWES_FEATURE_TYPE_GNSS_MULTI_FREQUENCY:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY;
}
break;
case LOCATION_QWES_FEATURE_TYPE_PPE:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_PPE;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_PPE;
}
break;
case LOCATION_QWES_FEATURE_TYPE_QDR2:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_QDR2;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_QDR2;
}
break;
case LOCATION_QWES_FEATURE_TYPE_QDR3:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_QDR3;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_QDR3;
}
break;
case LOCATION_QWES_FEATURE_TYPE_VPE:
if (itr->second) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_VPE;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_VPE;
}
break;
}
}
// Set CV2X basic when time freq and tunc is set
// CV2X_BASIC = LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY &
// LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY
// Set CV2X premium when time freq and tunc is set
// CV2X_PREMIUM = CV2X_BASIC & LOCATION_QWES_FEATURE_TYPE_QDR3 &
// LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE
bool cv2xBasicEnabled = (1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY]) &&
(1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY]);
bool cv2xPremiumEnabled = cv2xBasicEnabled &&
(1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_QDR3]) &&
(1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE]);
LOC_LOGd("CV2X_BASIC:%d, CV2X_PREMIUM:%d", cv2xBasicEnabled, cv2xPremiumEnabled);
if (cv2xBasicEnabled) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC;
}
if (cv2xPremiumEnabled) {
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM;
} else {
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM;
}
}
/*
get QWES feature status info
*/
static inline LocationCapabilitiesMask getQwesFeatureStatus() {
return (ContextBase::sQwesFeatureMask);
}
};
struct LocApiResponse: LocMsg {
private:
ContextBase& mContext;
std::function<void (LocationError err)> mProcImpl;
inline virtual void proc() const {
mProcImpl(mLocationError);
}
protected:
LocationError mLocationError;
public:
inline LocApiResponse(ContextBase& context,
std::function<void (LocationError err)> procImpl ) :
mContext(context), mProcImpl(procImpl) {}
void returnToSender(const LocationError err) {
mLocationError = err;
mContext.sendMsg(this);
}
};
struct LocApiCollectiveResponse: LocMsg {
private:
ContextBase& mContext;
std::function<void (std::vector<LocationError> errs)> mProcImpl;
inline virtual void proc() const {
mProcImpl(mLocationErrors);
}
protected:
std::vector<LocationError> mLocationErrors;
public:
inline LocApiCollectiveResponse(ContextBase& context,
std::function<void (std::vector<LocationError> errs)> procImpl ) :
mContext(context), mProcImpl(procImpl) {}
inline virtual ~LocApiCollectiveResponse() {
}
void returnToSender(std::vector<LocationError>& errs) {
mLocationErrors = errs;
mContext.sendMsg(this);
}
};
template <typename DATA>
struct LocApiResponseData: LocMsg {
private:
ContextBase& mContext;
std::function<void (LocationError err, DATA data)> mProcImpl;
inline virtual void proc() const {
mProcImpl(mLocationError, mData);
}
protected:
LocationError mLocationError;
DATA mData;
public:
inline LocApiResponseData(ContextBase& context,
std::function<void (LocationError err, DATA data)> procImpl ) :
mContext(context), mProcImpl(procImpl) {}
void returnToSender(const LocationError err, const DATA data) {
mLocationError = err;
mData = data;
mContext.sendMsg(this);
}
};
} // namespace loc_core
#endif //__LOC_CONTEXT_BASE__

View File

@@ -0,0 +1,160 @@
/* Copyright (c) 2018-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
* 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 ENGINE_HUB_PROXY_BASE_H
#define ENGINE_HUB_PROXY_BASE_H
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
namespace loc_core {
using namespace loc_util;
class EngineHubProxyBase {
public:
inline EngineHubProxyBase() {
}
inline virtual ~EngineHubProxyBase() {}
// gnss session related functions
inline virtual bool gnssStartFix() {
return false;
}
inline virtual bool gnssStopFix() {
return false;
}
inline virtual bool gnssSetFixMode(const LocPosMode &params) {
(void) params;
return false;
}
inline virtual bool gnssDeleteAidingData(const GnssAidingData &aidingData) {
(void) aidingData;
return false;
}
// GNSS reports
inline virtual bool gnssReportPosition(const UlpLocation &location,
const GpsLocationExtended &locationExtended,
enum loc_sess_status status) {
(void) location;
(void) locationExtended;
(void) status;
return false;
}
inline virtual bool gnssReportSv(const GnssSvNotification& svNotify) {
(void) svNotify;
return false;
}
inline virtual bool gnssReportSvMeasurement(const GnssSvMeasurementSet& svMeasurementSet) {
(void) svMeasurementSet;
return false;
}
inline virtual bool gnssReportSvPolynomial(const GnssSvPolynomial& svPolynomial) {
(void) svPolynomial;
return false;
}
inline virtual bool gnssReportSvEphemeris(const GnssSvEphemerisReport& svEphemeris) {
(void) svEphemeris;
return false;
}
inline virtual bool gnssReportSystemInfo(const LocationSystemInfo& systemInfo) {
(void) systemInfo;
return false;
}
inline virtual bool gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel& ionoModel) {
(void) ionoModel;
return false;
}
inline virtual bool gnssReportAdditionalSystemInfo(
const GnssAdditionalSystemInfo& additionalSystemInfo) {
(void) additionalSystemInfo;
return false;
}
inline virtual bool configLeverArm(const LeverArmConfigInfo& configInfo) {
(void) configInfo;
return false;
}
inline virtual bool configDeadReckoningEngineParams(
const DeadReckoningEngineConfig& dreConfig) {
(void) dreConfig;
return false;
}
inline virtual bool configEngineRunState(
PositioningEngineMask engType, LocEngineRunState engState) {
(void) engType;
(void) engState;
return false;
}
};
typedef std::function<void(int count, EngineLocationInfo* locationArr)>
GnssAdapterReportEnginePositionsEventCb;
typedef std::function<void(const GnssSvNotification& svNotify,
bool fromEngineHub)>
GnssAdapterReportSvEventCb;
typedef std::function<void(const GnssAidingDataSvMask& svDataMask)>
GnssAdapterReqAidingDataCb;
typedef std::function<void(bool nHzNeeded, bool nHzMeasNeeded)>
GnssAdapterUpdateNHzRequirementCb;
typedef std::function<void(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)>
GnssAdapterUpdateQwesFeatureStatusCb;
// potential parameters: message queue: MsgTask * msgTask;
// callback function to report back dr and ppe position and sv report
typedef EngineHubProxyBase* (getEngHubProxyFn)(
const MsgTask * msgTask,
IOsObserver* osObserver,
GnssAdapterReportEnginePositionsEventCb positionEventCb,
GnssAdapterReportSvEventCb svEventCb,
GnssAdapterReqAidingDataCb reqAidingDataCb,
GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb,
GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb);
} // namespace loc_core
#endif // ENGINE_HUB_PROXY_BASE_H

70
gps/core/LBSProxyBase.h Normal file
View File

@@ -0,0 +1,70 @@
/* Copyright (c) 2013-2015, 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 IZAT_PROXY_BASE_H
#define IZAT_PROXY_BASE_H
#include <gps_extended.h>
namespace loc_core {
class LocApiBase;
class LocAdapterBase;
class ContextBase;
class LBSProxyBase {
friend class ContextBase;
inline virtual LocApiBase*
getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase* context) const {
(void)exMask;
(void)context;
return NULL;
}
protected:
inline LBSProxyBase() {}
public:
inline virtual ~LBSProxyBase() {}
inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
inline virtual void modemPowerVote(bool power) const {
(void)power;
}
virtual void injectFeatureConfig(ContextBase* context) const {
(void)context;
}
inline virtual bool hasNativeXtraClient() const { return false; }
inline virtual IzatDevId_t getIzatDevId() const { return 0; }
};
typedef LBSProxyBase* (getLBSProxy_t)();
} // namespace loc_core
#endif // IZAT_PROXY_BASE_H

439
gps/core/LocAdapterBase.cpp Normal file
View File

@@ -0,0 +1,439 @@
/* Copyright (c) 2011-2014, 2016-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
* 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_LocAdapterBase"
#include <dlfcn.h>
#include <LocAdapterBase.h>
#include <loc_target.h>
#include <log_util.h>
#include <LocAdapterProxyBase.h>
namespace loc_core {
// This is the top level class, so the constructor will
// always gets called. Here we prepare for the default.
// But if getLocApi(targetEnumType target) is overriden,
// the right locApi should get created.
LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
ContextBase* context, bool isMaster,
LocAdapterProxyBase *adapterProxyBase,
bool waitForDoneInit) :
mIsMaster(isMaster),
mIsEngineCapabilitiesKnown(ContextBase::sIsEngineCapabilitiesKnown),
mEvtMask(mask), mContext(context), mLocApi(context->getLocApi()),
mLocAdapterProxyBase(adapterProxyBase), mMsgTask(context->getMsgTask())
{
LOC_LOGd("waitForDoneInit: %d", waitForDoneInit);
if (!waitForDoneInit) {
mLocApi->addAdapter(this);
mAdapterAdded = true;
} else {
mAdapterAdded = false;
}
}
uint32_t LocAdapterBase::mSessionIdCounter(1);
uint32_t LocAdapterBase::generateSessionId()
{
if (++mSessionIdCounter == 0xFFFFFFFF)
mSessionIdCounter = 1;
return mSessionIdCounter;
}
void LocAdapterBase::handleEngineUpEvent()
{
if (mLocAdapterProxyBase) {
mLocAdapterProxyBase->handleEngineUpEvent();
}
}
void LocAdapterBase::handleEngineDownEvent()
{
if (mLocAdapterProxyBase) {
mLocAdapterProxyBase->handleEngineDownEvent();
}
}
void LocAdapterBase::
reportPositionEvent(const UlpLocation& location,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
GnssDataNotification* pDataNotify __unused,
int msInWeek __unused)
{
if (mLocAdapterProxyBase != NULL) {
mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
(GpsLocationExtended&)locationExtended,
status,
loc_technology_mask);
} else {
DEFAULT_IMPL()
}
}
void LocAdapterBase::
reportSvEvent(const GnssSvNotification& /*svNotify*/,
bool /*fromEngineHub*/)
DEFAULT_IMPL()
void LocAdapterBase::
reportSvPolynomialEvent(GnssSvPolynomial &/*svPolynomial*/)
DEFAULT_IMPL()
void LocAdapterBase::
reportSvEphemerisEvent(GnssSvEphemerisReport &/*svEphemeris*/)
DEFAULT_IMPL()
void LocAdapterBase::
reportStatus(LocGpsStatusValue /*status*/)
DEFAULT_IMPL()
void LocAdapterBase::
reportNmeaEvent(const char* /*nmea*/, size_t /*length*/)
DEFAULT_IMPL()
void LocAdapterBase::
reportDataEvent(const GnssDataNotification& /*dataNotify*/,
int /*msInWeek*/)
DEFAULT_IMPL()
bool LocAdapterBase::
reportXtraServer(const char* /*url1*/, const char* /*url2*/,
const char* /*url3*/, const int /*maxlength*/)
DEFAULT_IMPL(false)
void LocAdapterBase::
reportLocationSystemInfoEvent(const LocationSystemInfo& /*locationSystemInfo*/)
DEFAULT_IMPL()
bool LocAdapterBase::
requestXtraData()
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestTime()
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestLocation()
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/,
LocApnTypeMask /*apn_type_mask*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
releaseATL(int /*connHandle*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestNiNotifyEvent(const GnssNiNotification &/*notify*/,
const void* /*data*/,
const LocInEmergency /*emergencyState*/)
DEFAULT_IMPL(false)
void LocAdapterBase::
reportGnssMeasurementsEvent(const GnssMeasurements& /*gnssMeasurements*/,
int /*msInWeek*/)
DEFAULT_IMPL()
bool LocAdapterBase::
reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportZppBestAvailableFix(LocGpsLocation& /*zppLoc*/,
GpsLocationExtended& /*location_extended*/, LocPosTechMask /*tech_mask*/)
DEFAULT_IMPL(false)
void LocAdapterBase::reportGnssSvIdConfigEvent(const GnssSvIdConfig& /*config*/)
DEFAULT_IMPL()
void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/)
DEFAULT_IMPL()
void LocAdapterBase::reportGnssConfigEvent(uint32_t, /* session id*/
const GnssConfig& /*gnssConfig*/)
DEFAULT_IMPL()
bool LocAdapterBase::
requestOdcpiEvent(OdcpiRequestInfo& /*request*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportGnssEngEnergyConsumedEvent(uint64_t /*energyConsumedSinceFirstBoot*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportDeleteAidingDataEvent(GnssAidingData & /*aidingData*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& /*ionoModel*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportGnssAdditionalSystemInfoEvent(GnssAdditionalSystemInfo& /*additionalSystemInfo*/)
DEFAULT_IMPL(false)
void LocAdapterBase::
reportNfwNotificationEvent(GnssNfwNotification& /*notification*/)
DEFAULT_IMPL()
void
LocAdapterBase::geofenceBreachEvent(size_t /*count*/, uint32_t* /*hwIds*/, Location& /*location*/,
GeofenceBreachType /*breachType*/, uint64_t /*timestamp*/)
DEFAULT_IMPL()
void
LocAdapterBase::geofenceStatusEvent(GeofenceStatusAvailable /*available*/)
DEFAULT_IMPL()
void
LocAdapterBase::reportLocationsEvent(const Location* /*locations*/, size_t /*count*/,
BatchingMode /*batchingMode*/)
DEFAULT_IMPL()
void
LocAdapterBase::reportCompletedTripsEvent(uint32_t /*accumulated_distance*/)
DEFAULT_IMPL()
void
LocAdapterBase::reportBatchStatusChangeEvent(BatchingStatus /*batchStatus*/)
DEFAULT_IMPL()
void
LocAdapterBase::reportPositionEvent(UlpLocation& /*location*/,
GpsLocationExtended& /*locationExtended*/,
enum loc_sess_status /*status*/,
LocPosTechMask /*loc_technology_mask*/)
DEFAULT_IMPL()
void
LocAdapterBase::saveClient(LocationAPI* client, const LocationCallbacks& callbacks)
{
mClientData[client] = callbacks;
updateClientsEventMask();
}
void
LocAdapterBase::eraseClient(LocationAPI* client)
{
auto it = mClientData.find(client);
if (it != mClientData.end()) {
mClientData.erase(it);
}
updateClientsEventMask();
}
LocationCallbacks
LocAdapterBase::getClientCallbacks(LocationAPI* client)
{
LocationCallbacks callbacks = {};
auto it = mClientData.find(client);
if (it != mClientData.end()) {
callbacks = it->second;
}
return callbacks;
}
LocationCapabilitiesMask
LocAdapterBase::getCapabilities()
{
LocationCapabilitiesMask mask = 0;
if (isEngineCapabilitiesKnown()) {
// time based tracking always supported
mask |= LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT;
if (ContextBase::isMessageSupported(
LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)){
mask |= LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT |
LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT;
}
if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING)) {
mask |= LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT;
}
if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING)) {
mask |= LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT;
}
// geofence always supported
mask |= LOCATION_CAPABILITIES_GEOFENCE_BIT;
if (ContextBase::gnssConstellationConfig()) {
mask |= LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT;
}
uint32_t carrierCapabilities = ContextBase::getCarrierCapabilities();
if (carrierCapabilities & LOC_GPS_CAPABILITY_MSB) {
mask |= LOCATION_CAPABILITIES_GNSS_MSB_BIT;
}
if (LOC_GPS_CAPABILITY_MSA & carrierCapabilities) {
mask |= LOCATION_CAPABILITIES_GNSS_MSA_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
mask |= LOCATION_CAPABILITIES_DEBUG_NMEA_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
mask |= LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02)) {
mask |= LOCATION_CAPABILITIES_AGPM_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY)) {
mask |= LOCATION_CAPABILITIES_PRIVACY_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION)) {
mask |= LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ROBUST_LOCATION)) {
mask |= LOCATION_CAPABILITIES_CONFORMITY_INDEX_BIT;
}
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_EDGNSS)) {
mask |= LOCATION_CAPABILITIES_EDGNSS_BIT;
}
} else {
LOC_LOGE("%s]: attempt to get capabilities before they are known.", __func__);
}
return mask;
}
void
LocAdapterBase::broadcastCapabilities(LocationCapabilitiesMask mask)
{
for (auto clientData : mClientData) {
if (nullptr != clientData.second.capabilitiesCb) {
clientData.second.capabilitiesCb(mask);
}
}
}
void
LocAdapterBase::updateClientsEventMask()
DEFAULT_IMPL()
void
LocAdapterBase::stopClientSessions(LocationAPI* /*client*/)
DEFAULT_IMPL()
void
LocAdapterBase::addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks)
{
LOC_LOGD("%s]: client %p", __func__, client);
struct MsgAddClient : public LocMsg {
LocAdapterBase& mAdapter;
LocationAPI* mClient;
const LocationCallbacks mCallbacks;
inline MsgAddClient(LocAdapterBase& adapter,
LocationAPI* client,
const LocationCallbacks& callbacks) :
LocMsg(),
mAdapter(adapter),
mClient(client),
mCallbacks(callbacks) {}
inline virtual void proc() const {
mAdapter.saveClient(mClient, mCallbacks);
}
};
sendMsg(new MsgAddClient(*this, client, callbacks));
}
void
LocAdapterBase::removeClientCommand(LocationAPI* client,
removeClientCompleteCallback rmClientCb)
{
LOC_LOGD("%s]: client %p", __func__, client);
struct MsgRemoveClient : public LocMsg {
LocAdapterBase& mAdapter;
LocationAPI* mClient;
removeClientCompleteCallback mRmClientCb;
inline MsgRemoveClient(LocAdapterBase& adapter,
LocationAPI* client,
removeClientCompleteCallback rmCb) :
LocMsg(),
mAdapter(adapter),
mClient(client),
mRmClientCb(rmCb){}
inline virtual void proc() const {
mAdapter.stopClientSessions(mClient);
mAdapter.eraseClient(mClient);
if (nullptr != mRmClientCb) {
(mRmClientCb)(mClient);
}
}
};
sendMsg(new MsgRemoveClient(*this, client, rmClientCb));
}
void
LocAdapterBase::requestCapabilitiesCommand(LocationAPI* client)
{
LOC_LOGD("%s]: ", __func__);
struct MsgRequestCapabilities : public LocMsg {
LocAdapterBase& mAdapter;
LocationAPI* mClient;
inline MsgRequestCapabilities(LocAdapterBase& adapter,
LocationAPI* client) :
LocMsg(),
mAdapter(adapter),
mClient(client) {}
inline virtual void proc() const {
if (!mAdapter.isEngineCapabilitiesKnown()) {
mAdapter.mPendingMsgs.push_back(new MsgRequestCapabilities(*this));
return;
}
LocationCallbacks callbacks = mAdapter.getClientCallbacks(mClient);
if (callbacks.capabilitiesCb != nullptr) {
callbacks.capabilitiesCb(mAdapter.getCapabilities());
}
}
};
sendMsg(new MsgRequestCapabilities(*this, client));
}
void
LocAdapterBase::reportLatencyInfoEvent(const GnssLatencyInfo& /*gnssLatencyInfo*/)
DEFAULT_IMPL()
bool LocAdapterBase::
reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &/*featureMap*/)
DEFAULT_IMPL(false)
} // namespace loc_core

246
gps/core/LocAdapterBase.h Normal file
View File

@@ -0,0 +1,246 @@
/* Copyright (c) 2011-2014, 2016-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
* 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 LOC_API_ADAPTER_BASE_H
#define LOC_API_ADAPTER_BASE_H
#include <gps_extended.h>
#include <ContextBase.h>
#include <LocationAPI.h>
#include <map>
#define MIN_TRACKING_INTERVAL (100) // 100 msec
typedef struct LocationSessionKey {
LocationAPI* client;
uint32_t id;
inline LocationSessionKey(LocationAPI* _client, uint32_t _id) :
client(_client), id(_id) {}
} LocationSessionKey;
inline bool operator <(LocationSessionKey const& left, LocationSessionKey const& right) {
return left.id < right.id || (left.id == right.id && left.client < right.client);
}
inline bool operator ==(LocationSessionKey const& left, LocationSessionKey const& right) {
return left.id == right.id && left.client == right.client;
}
inline bool operator !=(LocationSessionKey const& left, LocationSessionKey const& right) {
return left.id != right.id || left.client != right.client;
}
typedef void (*removeClientCompleteCallback)(LocationAPI* client);
namespace loc_core {
class LocAdapterProxyBase;
class LocAdapterBase {
private:
static uint32_t mSessionIdCounter;
const bool mIsMaster;
bool mIsEngineCapabilitiesKnown = false;
protected:
LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
ContextBase* mContext;
LocApiBase* mLocApi;
LocAdapterProxyBase* mLocAdapterProxyBase;
const MsgTask* mMsgTask;
bool mAdapterAdded;
inline LocAdapterBase(const MsgTask* msgTask) :
mIsMaster(false), mEvtMask(0), mContext(NULL), mLocApi(NULL),
mLocAdapterProxyBase(NULL), mMsgTask(msgTask), mAdapterAdded(false) {}
/* ==== CLIENT ========================================================================= */
typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap;
ClientDataMap mClientData;
std::vector<LocMsg*> mPendingMsgs; // For temporal storage of msgs before Open is completed
/* ======== UTILITIES ================================================================== */
void saveClient(LocationAPI* client, const LocationCallbacks& callbacks);
void eraseClient(LocationAPI* client);
LocationCallbacks getClientCallbacks(LocationAPI* client);
LocationCapabilitiesMask getCapabilities();
void broadcastCapabilities(LocationCapabilitiesMask mask);
virtual void updateClientsEventMask();
virtual void stopClientSessions(LocationAPI* client);
public:
inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
// When waitForDoneInit is not specified or specified as false,
// handleEngineUpEvent may be called on the child adapter object from
// a different thread before the constructor of the child
// object finishes.
//
// If the handleEngineUpEvent relies on member variables of the constructor
// of the child adapter to be initialized first, we need to specify the
// waitForDoneInit to *TRUE* to delay handleEngineUpEvent to get called
// until when the child adapter finishes its initialization and notify
// LocAdapterBase via doneInit method.
LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
ContextBase* context, bool isMaster = false,
LocAdapterProxyBase *adapterProxyBase = NULL,
bool waitForDoneInit = false);
inline void doneInit() {
if (!mAdapterAdded) {
mLocApi->addAdapter(this);
mAdapterAdded = true;
}
}
inline LOC_API_ADAPTER_EVENT_MASK_T
checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const {
return mEvtMask & mask;
}
inline LOC_API_ADAPTER_EVENT_MASK_T getEvtMask() const {
return mEvtMask;
}
inline void sendMsg(const LocMsg* msg) const {
mMsgTask->sendMsg(msg);
}
inline void sendMsg(const LocMsg* msg) {
mMsgTask->sendMsg(msg);
}
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
loc_registration_mask_status status)
{
switch(status) {
case (LOC_REGISTRATION_MASK_ENABLED):
mEvtMask = mEvtMask | event;
break;
case (LOC_REGISTRATION_MASK_DISABLED):
mEvtMask = mEvtMask &~ event;
break;
case (LOC_REGISTRATION_MASK_SET):
mEvtMask = event;
break;
}
mLocApi->updateEvtMask();
}
inline void updateNmeaMask(uint32_t mask)
{
mLocApi->updateNmeaMask(mask);
}
inline bool isFeatureSupported(uint8_t featureVal) {
return ContextBase::isFeatureSupported(featureVal);
}
static uint32_t generateSessionId();
inline bool isAdapterMaster() {
return mIsMaster;
}
inline bool isEngineCapabilitiesKnown() { return mIsEngineCapabilitiesKnown;}
inline void setEngineCapabilitiesKnown(bool value) { mIsEngineCapabilitiesKnown = value;}
virtual void handleEngineUpEvent();
virtual void handleEngineDownEvent();
virtual void reportPositionEvent(const UlpLocation& location,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
GnssDataNotification* pDataNotify = nullptr,
int msInWeek = -1);
virtual void reportEnginePositionsEvent(unsigned int count,
EngineLocationInfo* locationArr) {
(void)count;
(void)locationArr;
}
virtual void reportSvEvent(const GnssSvNotification& svNotify,
bool fromEngineHub=false);
virtual void reportDataEvent(const GnssDataNotification& dataNotify, int msInWeek);
virtual void reportNmeaEvent(const char* nmea, size_t length);
virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
virtual void reportSvEphemerisEvent(GnssSvEphemerisReport &svEphemeris);
virtual void reportStatus(LocGpsStatusValue status);
virtual bool reportXtraServer(const char* url1, const char* url2,
const char* url3, const int maxlength);
virtual void reportLocationSystemInfoEvent(const LocationSystemInfo& locationSystemInfo);
virtual bool requestXtraData();
virtual bool requestTime();
virtual bool requestLocation();
virtual bool requestATL(int connHandle, LocAGpsType agps_type,
LocApnTypeMask apn_type_mask);
virtual bool releaseATL(int connHandle);
virtual bool requestNiNotifyEvent(const GnssNiNotification &notify, const void* data,
const LocInEmergency emergencyState);
inline virtual bool isInSession() { return false; }
ContextBase* getContext() const { return mContext; }
virtual void reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurements,
int msInWeek);
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
virtual void reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig);
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
virtual bool reportDeleteAidingDataEvent(GnssAidingData &aidingData);
virtual bool reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& ionoModel);
virtual bool reportGnssAdditionalSystemInfoEvent(
GnssAdditionalSystemInfo& additionalSystemInfo);
virtual void reportNfwNotificationEvent(GnssNfwNotification& notification);
virtual void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location,
GeofenceBreachType breachType, uint64_t timestamp);
virtual void geofenceStatusEvent(GeofenceStatusAvailable available);
virtual void reportPositionEvent(UlpLocation &location,
GpsLocationExtended &locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask);
virtual void reportLocationsEvent(const Location* locations, size_t count,
BatchingMode batchingMode);
virtual void reportCompletedTripsEvent(uint32_t accumulated_distance);
virtual void reportBatchStatusChangeEvent(BatchingStatus batchStatus);
/* ==== CLIENT ========================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
void addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks);
void removeClientCommand(LocationAPI* client,
removeClientCompleteCallback rmClientCb);
void requestCapabilitiesCommand(LocationAPI* client);
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
virtual bool reportQwesCapabilities(
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
};
} // namespace loc_core
#endif //LOC_API_ADAPTER_BASE_H

View File

@@ -0,0 +1,77 @@
/* Copyright (c) 2014, 2016-2017 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 LOC_ADAPTER_PROXY_BASE_H
#define LOC_ADAPTER_PROXY_BASE_H
#include <ContextBase.h>
#include <gps_extended.h>
namespace loc_core {
class LocAdapterProxyBase {
private:
LocAdapterBase *mLocAdapterBase;
protected:
inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
ContextBase* context, bool isMaster = false):
mLocAdapterBase(new LocAdapterBase(mask, context, isMaster, this)) {
}
inline virtual ~LocAdapterProxyBase() {
delete mLocAdapterBase;
}
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
loc_registration_mask_status isEnabled) {
mLocAdapterBase->updateEvtMask(event,isEnabled);
}
inline uint32_t generateSessionId() {
return mLocAdapterBase->generateSessionId();
}
public:
inline ContextBase* getContext() const {
return mLocAdapterBase->getContext();
}
inline virtual void handleEngineUpEvent() {};
inline virtual void handleEngineDownEvent() {};
inline virtual void reportPositionEvent(UlpLocation &location,
GpsLocationExtended &locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask) {
(void)location;
(void)locationExtended;
(void)status;
(void)loc_technology_mask;
}
};
} // namespace loc_core
#endif //LOC_ADAPTER_PROXY_BASE_H

1069
gps/core/LocApiBase.cpp Normal file

File diff suppressed because it is too large Load Diff

375
gps/core/LocApiBase.h Normal file
View File

@@ -0,0 +1,375 @@
/* Copyright (c) 2011-2014, 2016-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
* 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 LOC_API_BASE_H
#define LOC_API_BASE_H
#include <stddef.h>
#include <ctype.h>
#include <gps_extended.h>
#include <LocationAPI.h>
#include <MsgTask.h>
#include <LocSharedLock.h>
#include <log_util.h>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <map>
#else
#include <unordered_map>
#endif
#include <inttypes.h>
#include <functional>
using namespace loc_util;
namespace loc_core {
class ContextBase;
struct LocApiResponse;
template <typename> struct LocApiResponseData;
int hexcode(char *hexstring, int string_size,
const char *data, int data_size);
int decodeAddress(char *addr_string, int string_size,
const char *data, int data_size);
#define MAX_ADAPTERS 10
#define MAX_FEATURE_LENGTH 100
#define TO_ALL_ADAPTERS(adapters, call) \
for (int i = 0; i < MAX_ADAPTERS && NULL != (adapters)[i]; i++) { \
call; \
}
#define TO_1ST_HANDLING_ADAPTER(adapters, call) \
for (int i = 0; i <MAX_ADAPTERS && NULL != (adapters)[i] && !(call); i++);
class LocAdapterBase;
struct LocSsrMsg;
struct LocOpenMsg;
typedef struct
{
uint32_t accumulatedDistance;
uint32_t numOfBatchedPositions;
} LocApiBatchData;
typedef struct
{
uint32_t hwId;
} LocApiGeofenceData;
struct LocApiMsg: LocMsg {
private:
std::function<void ()> mProcImpl;
inline virtual void proc() const {
mProcImpl();
}
public:
inline LocApiMsg(std::function<void ()> procImpl ) :
mProcImpl(procImpl) {}
};
class LocApiProxyBase {
public:
inline LocApiProxyBase() {}
inline virtual ~LocApiProxyBase() {}
inline virtual void* getSibling2() { return NULL; }
inline virtual double getGloRfLoss(uint32_t left __unused,
uint32_t center __unused, uint32_t right __unused, uint8_t gloFrequency __unused) { return 0.0; }
};
class LocApiBase {
friend struct LocSsrMsg;
//LocOpenMsg calls open() which makes it necessary to declare
//it as a friend
friend struct LocOpenMsg;
friend struct LocCloseMsg;
friend struct LocKillMsg;
friend class ContextBase;
static MsgTask* mMsgTask;
static volatile int32_t mMsgTaskRefCount;
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
protected:
ContextBase *mContext;
virtual enum loc_api_adapter_err
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
virtual enum loc_api_adapter_err
close();
LOC_API_ADAPTER_EVENT_MASK_T getEvtMask();
LOC_API_ADAPTER_EVENT_MASK_T mMask;
uint32_t mNmeaMask;
LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context = NULL);
inline virtual ~LocApiBase() {
android_atomic_dec(&mMsgTaskRefCount);
if (nullptr != mMsgTask && 0 == mMsgTaskRefCount) {
delete mMsgTask;
mMsgTask = nullptr;
}
}
bool isInSession();
const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
bool isMaster();
public:
inline void sendMsg(const LocMsg* msg) const {
if (nullptr != mMsgTask) {
mMsgTask->sendMsg(msg);
}
}
inline void destroy() {
close();
struct LocKillMsg : public LocMsg {
LocApiBase* mLocApi;
inline LocKillMsg(LocApiBase* locApi) : LocMsg(), mLocApi(locApi) {}
inline virtual void proc() const {
delete mLocApi;
}
};
sendMsg(new LocKillMsg(this));
}
static bool needReport(const UlpLocation& ulpLocation,
enum loc_sess_status status,
LocPosTechMask techMask);
void addAdapter(LocAdapterBase* adapter);
void removeAdapter(LocAdapterBase* adapter);
// upward calls
void handleEngineUpEvent();
void handleEngineDownEvent();
void reportPosition(UlpLocation& location,
GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask =
LOC_POS_TECH_MASK_DEFAULT,
GnssDataNotification* pDataNotify = nullptr,
int msInWeek = -1);
void reportSv(GnssSvNotification& svNotify);
void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
void reportSvEphemeris(GnssSvEphemerisReport &svEphemeris);
void reportStatus(LocGpsStatusValue status);
void reportNmea(const char* nmea, int length);
void reportData(GnssDataNotification& dataNotify, int msInWeek);
void reportXtraServer(const char* url1, const char* url2,
const char* url3, const int maxlength);
void reportLocationSystemInfo(const LocationSystemInfo& locationSystemInfo);
void requestXtraData();
void requestTime();
void requestLocation();
void requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask);
void releaseATL(int connHandle);
void requestNiNotify(GnssNiNotification &notify, const void* data,
const LocInEmergency emergencyState);
void reportGnssMeasurements(GnssMeasurements& gnssMeasurements, int msInWeek);
void reportWwanZppFix(LocGpsLocation &zppLoc);
void reportZppBestAvailableFix(LocGpsLocation &zppLoc, GpsLocationExtended &location_extended,
LocPosTechMask tech_mask);
void reportGnssSvIdConfig(const GnssSvIdConfig& config);
void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
void requestOdcpi(OdcpiRequestInfo& request);
void reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
void reportDeleteAidingDataEvent(GnssAidingData& aidingData);
void reportKlobucharIonoModel(GnssKlobucharIonoModel& ionoModel);
void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
void sendNfwNotification(GnssNfwNotification& notification);
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo);
void reportQwesCapabilities
(
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
);
void geofenceBreach(size_t count, uint32_t* hwIds, Location& location,
GeofenceBreachType breachType, uint64_t timestamp);
void geofenceStatus(GeofenceStatusAvailable available);
void reportDBTPosition(UlpLocation &location,
GpsLocationExtended &locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask);
void reportLocations(Location* locations, size_t count, BatchingMode batchingMode);
void reportCompletedTrips(uint32_t accumulated_distance);
void handleBatchStatusEvent(BatchingStatus batchStatus);
// downward calls
virtual void* getSibling();
virtual LocApiProxyBase* getLocApiProxy();
virtual void startFix(const LocPosMode& fixCriteria, LocApiResponse* adapterResponse);
virtual void stopFix(LocApiResponse* adapterResponse);
virtual void deleteAidingData(const GnssAidingData& data, LocApiResponse* adapterResponse);
virtual void injectPosition(double latitude, double longitude, float accuracy,
bool onDemandCpi);
virtual void injectPosition(const GnssLocationInfoNotification &locationInfo,
bool onDemandCpi=false);
virtual void injectPosition(const Location& location, bool onDemandCpi);
virtual void setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
virtual void atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen,
AGpsBearerType bear, LocAGpsType agpsType, LocApnTypeMask mask);
virtual void atlCloseStatus(int handle, int is_succ);
virtual LocationError setServerSync(const char* url, int len, LocServerType type);
virtual LocationError setServerSync(unsigned int ip, int port, LocServerType type);
virtual void informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
virtual LocationError setLPPConfigSync(GnssConfigLppProfileMask profileMask);
virtual enum loc_api_adapter_err setSensorPropertiesSync(
bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk);
virtual enum loc_api_adapter_err setSensorPerfControlConfigSync(int controlMode,
int accelSamplesPerBatch, int accelBatchesPerSec, int gyroSamplesPerBatch,
int gyroBatchesPerSec, int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
virtual LocationError
setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
virtual LocationError setEmergencyExtensionWindowSync(const uint32_t emergencyExtensionSeconds);
virtual void setMeasurementCorrections(
const GnssMeasurementCorrections& gnssMeasurementCorrections);
virtual void getWwanZppFix();
virtual void getBestAvailableZppFix();
virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
virtual LocationError setXtraVersionCheckSync(uint32_t check);
/* Requests for SV/Constellation Control */
virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
virtual void setBlacklistSv(const GnssSvIdConfig& config,
LocApiResponse *adapterResponse=nullptr);
virtual void getBlacklistSv();
virtual void setConstellationControl(const GnssSvTypeConfig& config,
LocApiResponse *adapterResponse=nullptr);
virtual void getConstellationControl();
virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
virtual void setConstrainedTuncMode(bool enabled,
float tuncConstraint,
uint32_t energyBudget,
LocApiResponse* adapterResponse=nullptr);
virtual void setPositionAssistedClockEstimatorMode(bool enabled,
LocApiResponse* adapterResponse=nullptr);
virtual void getGnssEnergyConsumed();
virtual void addGeofence(uint32_t clientId, const GeofenceOption& options,
const GeofenceInfo& info, LocApiResponseData<LocApiGeofenceData>* adapterResponseData);
virtual void removeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void pauseGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void resumeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void modifyGeofence(uint32_t hwId, uint32_t clientId, const GeofenceOption& options,
LocApiResponse* adapterResponse);
virtual void startTimeBasedTracking(const TrackingOptions& options,
LocApiResponse* adapterResponse);
virtual void stopTimeBasedTracking(LocApiResponse* adapterResponse);
virtual void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
LocApiResponse* adapterResponse);
virtual void stopDistanceBasedTracking(uint32_t sessionId,
LocApiResponse* adapterResponse = nullptr);
virtual void startBatching(uint32_t sessionId, const LocationOptions& options,
uint32_t accuracy, uint32_t timeout, LocApiResponse* adapterResponse);
virtual void stopBatching(uint32_t sessionId, LocApiResponse* adapterResponse);
virtual LocationError startOutdoorTripBatchingSync(uint32_t tripDistance,
uint32_t tripTbf, uint32_t timeout);
virtual void startOutdoorTripBatching(uint32_t tripDistance,
uint32_t tripTbf, uint32_t timeout, LocApiResponse* adapterResponse);
virtual void reStartOutdoorTripBatching(uint32_t ongoingTripDistance,
uint32_t ongoingTripInterval, uint32_t batchingTimeout,
LocApiResponse* adapterResponse);
virtual LocationError stopOutdoorTripBatchingSync(bool deallocBatchBuffer = true);
virtual void stopOutdoorTripBatching(bool deallocBatchBuffer = true,
LocApiResponse* adapterResponse = nullptr);
virtual LocationError getBatchedLocationsSync(size_t count);
virtual void getBatchedLocations(size_t count, LocApiResponse* adapterResponse);
virtual LocationError getBatchedTripLocationsSync(size_t count, uint32_t accumulatedDistance);
virtual void getBatchedTripLocations(size_t count, uint32_t accumulatedDistance,
LocApiResponse* adapterResponse);
virtual LocationError queryAccumulatedTripDistanceSync(uint32_t &accumulated_trip_distance,
uint32_t &numOfBatchedPositions);
virtual void queryAccumulatedTripDistance(
LocApiResponseData<LocApiBatchData>* adapterResponseData);
virtual void setBatchSize(size_t size);
virtual void setTripBatchSize(size_t size);
virtual void addToCallQueue(LocApiResponse* adapterResponse);
void updateEvtMask();
void updateNmeaMask(uint32_t mask);
virtual void updateSystemPowerState(PowerStateType systemPowerState);
virtual void configRobustLocation(bool enable, bool enableForE911,
LocApiResponse* adapterResponse=nullptr);
virtual void getRobustLocationConfig(uint32_t sessionId, LocApiResponse* adapterResponse);
virtual void configMinGpsWeek(uint16_t minGpsWeek,
LocApiResponse* adapterResponse=nullptr);
virtual void getMinGpsWeek(uint32_t sessionId, LocApiResponse* adapterResponse);
virtual LocationError setParameterSync(const GnssConfig & gnssConfig);
virtual void getParameter(uint32_t sessionId, GnssConfigFlagsMask flags,
LocApiResponse* adapterResponse=nullptr);
virtual void configConstellationMultiBand(const GnssSvTypeConfig& secondaryBandConfig,
LocApiResponse* adapterResponse=nullptr);
virtual void getConstellationMultiBandConfig(uint32_t sessionId,
LocApiResponse* adapterResponse=nullptr);
};
class ElapsedRealtimeEstimator {
private:
int64_t mCurrentClockDiff;
int64_t mPrevUtcTimeNanos;
int64_t mPrevBootTimeNanos;
int64_t mFixTimeStablizationThreshold;
int64_t mInitialTravelTime;
int64_t mPrevDataTimeNanos;
public:
ElapsedRealtimeEstimator(int64_t travelTimeNanosEstimate):
mInitialTravelTime(travelTimeNanosEstimate) {reset();}
int64_t getElapsedRealtimeEstimateNanos(int64_t curDataTimeNanos,
bool isCurDataTimeTrustable, int64_t tbf);
inline int64_t getElapsedRealtimeUncNanos() { return 5000000;}
void reset();
static int64_t getElapsedRealtimeQtimer(int64_t qtimerTicksAtOrigin);
static bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos);
};
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context);
} // namespace loc_core
#endif //LOC_API_BASE_H

87
gps/core/LocContext.cpp Normal file
View File

@@ -0,0 +1,87 @@
/* Copyright (c) 2011-2014, 2016-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
* 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_Ctx"
#include <cutils/sched_policy.h>
#include <unistd.h>
#include <LocContext.h>
#include <msg_q.h>
#include <log_util.h>
#include <loc_log.h>
namespace loc_core {
const MsgTask* LocContext::mMsgTask = NULL;
ContextBase* LocContext::mContext = NULL;
// the name must be shorter than 15 chars
const char* LocContext::mLocationHalName = "Loc_hal_worker";
#ifndef USE_GLIB
const char* LocContext::mLBSLibName = "liblbs_core.so";
#else
const char* LocContext::mLBSLibName = "liblbs_core.so.1";
#endif
pthread_mutex_t LocContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
const MsgTask* LocContext::getMsgTask(const char* name)
{
if (NULL == mMsgTask) {
mMsgTask = new MsgTask(name);
}
return mMsgTask;
}
ContextBase* LocContext::getLocContext(const char* name)
{
pthread_mutex_lock(&LocContext::mGetLocContextMutex);
LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
if (NULL == mContext) {
LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
const MsgTask* msgTask = getMsgTask(name);
mContext = new LocContext(msgTask);
}
pthread_mutex_unlock(&LocContext::mGetLocContextMutex);
return mContext;
}
void LocContext :: injectFeatureConfig(ContextBase *curContext)
{
LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
__func__, __LINE__, ((LocContext *)curContext)->mLBSProxy);
((LocContext *)curContext)->mLBSProxy->injectFeatureConfig(curContext);
}
LocContext::LocContext(const MsgTask* msgTask) :
ContextBase(msgTask, 0, mLBSLibName)
{
}
}

60
gps/core/LocContext.h Normal file
View File

@@ -0,0 +1,60 @@
/* Copyright (c) 2011-2014, 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
* 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 __LOC_CONTEXT__
#define __LOC_CONTEXT__
#include <stdbool.h>
#include <ctype.h>
#include <dlfcn.h>
#include <ContextBase.h>
namespace loc_core {
class LocContext : public ContextBase {
static const MsgTask* mMsgTask;
static ContextBase* mContext;
static const MsgTask* getMsgTask(const char* name);
static pthread_mutex_t mGetLocContextMutex;
protected:
LocContext(const MsgTask* msgTask);
inline virtual ~LocContext() {}
public:
static const char* mLBSLibName;
static const char* mLocationHalName;
static ContextBase* getLocContext(const char* name);
static void injectFeatureConfig(ContextBase *context);
};
}
#endif //__LOC_CONTEXT__

1761
gps/core/SystemStatus.cpp Normal file

File diff suppressed because it is too large Load Diff

926
gps/core/SystemStatus.h Normal file
View File

@@ -0,0 +1,926 @@
/* Copyright (c) 2017-2021, 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 __SYSTEM_STATUS__
#define __SYSTEM_STATUS__
#include <stdint.h>
#include <sys/time.h>
#include <vector>
#include <algorithm>
#include <iterator>
#include <loc_pla.h>
#include <log_util.h>
#include <MsgTask.h>
#include <IDataItemCore.h>
#include <IOsObserver.h>
#include <DataItemConcreteTypesBase.h>
#include <SystemStatusOsObserver.h>
#include <gps_extended_c.h>
#define GPS_MIN (1) //1-32
#define SBAS_MIN (33)
#define GLO_MIN (65) //65-88
#define QZSS_MIN (193) //193-197
#define BDS_MIN (201) //201-237
#define GAL_MIN (301) //301-336
#define NAVIC_MIN (401) //401-414
#define GPS_NUM (32)
#define SBAS_NUM (32)
#define GLO_NUM (24)
#define QZSS_NUM (5)
#define BDS_NUM (37)
#define GAL_NUM (36)
#define NAVIC_NUM (14)
#define SV_ALL_NUM_MIN (GPS_NUM + GLO_NUM + QZSS_NUM + BDS_NUM + GAL_NUM) //=134
#define SV_ALL_NUM (SV_ALL_NUM_MIN + NAVIC_NUM) //=148
namespace loc_core
{
/******************************************************************************
SystemStatus report data structure
******************************************************************************/
class SystemStatusItemBase
{
public:
timespec mUtcTime;
timespec mUtcReported;
static const uint32_t maxItem = 5;
SystemStatusItemBase() {
timeval tv;
gettimeofday(&tv, NULL);
mUtcTime.tv_sec = tv.tv_sec;
mUtcTime.tv_nsec = tv.tv_usec*1000ULL;
mUtcReported = mUtcTime;
};
virtual ~SystemStatusItemBase() {};
inline virtual SystemStatusItemBase& collate(SystemStatusItemBase&) {
return *this;
}
virtual void dump(void) {};
inline virtual bool ignore() { return false; };
};
class SystemStatusLocation : public SystemStatusItemBase
{
public:
bool mValid;
UlpLocation mLocation;
GpsLocationExtended mLocationEx;
inline SystemStatusLocation() :
mValid(false) {}
inline SystemStatusLocation(const UlpLocation& location,
const GpsLocationExtended& locationEx) :
mValid(true),
mLocation(location),
mLocationEx(locationEx) {}
bool equals(const SystemStatusLocation& peer);
void dump(void) override;
};
class SystemStatusPQWM1;
class SystemStatusTimeAndClock : public SystemStatusItemBase
{
public:
uint16_t mGpsWeek;
uint32_t mGpsTowMs;
uint8_t mTimeValid;
uint8_t mTimeSource;
int32_t mTimeUnc;
int32_t mClockFreqBias;
int32_t mClockFreqBiasUnc;
int32_t mLeapSeconds;
int32_t mLeapSecUnc;
uint64_t mTimeUncNs;
inline SystemStatusTimeAndClock() :
mGpsWeek(0),
mGpsTowMs(0),
mTimeValid(0),
mTimeSource(0),
mTimeUnc(0),
mClockFreqBias(0),
mClockFreqBiasUnc(0),
mLeapSeconds(0),
mLeapSecUnc(0),
mTimeUncNs(0ULL) {}
inline SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea);
bool equals(const SystemStatusTimeAndClock& peer);
void dump(void) override;
};
class SystemStatusXoState : public SystemStatusItemBase
{
public:
uint8_t mXoState;
inline SystemStatusXoState() :
mXoState(0) {}
inline SystemStatusXoState(const SystemStatusPQWM1& nmea);
bool equals(const SystemStatusXoState& peer);
void dump(void) override;
};
class SystemStatusRfAndParams : public SystemStatusItemBase
{
public:
int32_t mPgaGain;
uint32_t mGpsBpAmpI;
uint32_t mGpsBpAmpQ;
uint32_t mAdcI;
uint32_t mAdcQ;
uint32_t mJammerGps;
uint32_t mJammerGlo;
uint32_t mJammerBds;
uint32_t mJammerGal;
double mAgcGps;
double mAgcGlo;
double mAgcBds;
double mAgcGal;
uint32_t mGloBpAmpI;
uint32_t mGloBpAmpQ;
uint32_t mBdsBpAmpI;
uint32_t mBdsBpAmpQ;
uint32_t mGalBpAmpI;
uint32_t mGalBpAmpQ;
inline SystemStatusRfAndParams() :
mPgaGain(0),
mGpsBpAmpI(0),
mGpsBpAmpQ(0),
mAdcI(0),
mAdcQ(0),
mJammerGps(0),
mJammerGlo(0),
mJammerBds(0),
mJammerGal(0),
mAgcGps(0),
mAgcGlo(0),
mAgcBds(0),
mAgcGal(0),
mGloBpAmpI(0),
mGloBpAmpQ(0),
mBdsBpAmpI(0),
mBdsBpAmpQ(0),
mGalBpAmpI(0),
mGalBpAmpQ(0) {}
inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
bool equals(const SystemStatusRfAndParams& peer);
void dump(void) override;
};
class SystemStatusErrRecovery : public SystemStatusItemBase
{
public:
uint32_t mRecErrorRecovery;
inline SystemStatusErrRecovery() :
mRecErrorRecovery(0) {};
inline SystemStatusErrRecovery(const SystemStatusPQWM1& nmea);
bool equals(const SystemStatusErrRecovery& peer);
inline bool ignore() override { return 0 == mRecErrorRecovery; };
void dump(void) override;
};
class SystemStatusPQWP1;
class SystemStatusInjectedPosition : public SystemStatusItemBase
{
public:
uint8_t mEpiValidity;
float mEpiLat;
float mEpiLon;
float mEpiAlt;
float mEpiHepe;
float mEpiAltUnc;
uint8_t mEpiSrc;
inline SystemStatusInjectedPosition() :
mEpiValidity(0),
mEpiLat(0),
mEpiLon(0),
mEpiAlt(0),
mEpiHepe(0),
mEpiAltUnc(0),
mEpiSrc(0) {}
inline SystemStatusInjectedPosition(const SystemStatusPQWP1& nmea);
bool equals(const SystemStatusInjectedPosition& peer);
void dump(void) override;
};
class SystemStatusPQWP2;
class SystemStatusBestPosition : public SystemStatusItemBase
{
public:
bool mValid;
float mBestLat;
float mBestLon;
float mBestAlt;
float mBestHepe;
float mBestAltUnc;
inline SystemStatusBestPosition() :
mValid(false),
mBestLat(0),
mBestLon(0),
mBestAlt(0),
mBestHepe(0),
mBestAltUnc(0) {}
inline SystemStatusBestPosition(const SystemStatusPQWP2& nmea);
bool equals(const SystemStatusBestPosition& peer);
void dump(void) override;
};
class SystemStatusPQWP3;
class SystemStatusXtra : public SystemStatusItemBase
{
public:
uint8_t mXtraValidMask;
uint32_t mGpsXtraAge;
uint32_t mGloXtraAge;
uint32_t mBdsXtraAge;
uint32_t mGalXtraAge;
uint32_t mQzssXtraAge;
uint32_t mNavicXtraAge;
uint32_t mGpsXtraValid;
uint32_t mGloXtraValid;
uint64_t mBdsXtraValid;
uint64_t mGalXtraValid;
uint8_t mQzssXtraValid;
uint32_t mNavicXtraValid;
inline SystemStatusXtra() :
mXtraValidMask(0),
mGpsXtraAge(0),
mGloXtraAge(0),
mBdsXtraAge(0),
mGalXtraAge(0),
mQzssXtraAge(0),
mNavicXtraAge(0),
mGpsXtraValid(0),
mGloXtraValid(0),
mBdsXtraValid(0ULL),
mGalXtraValid(0ULL),
mQzssXtraValid(0),
mNavicXtraValid(0) {}
inline SystemStatusXtra(const SystemStatusPQWP3& nmea);
bool equals(const SystemStatusXtra& peer);
void dump(void) override;
};
class SystemStatusPQWP4;
class SystemStatusEphemeris : public SystemStatusItemBase
{
public:
uint32_t mGpsEpheValid;
uint32_t mGloEpheValid;
uint64_t mBdsEpheValid;
uint64_t mGalEpheValid;
uint8_t mQzssEpheValid;
inline SystemStatusEphemeris() :
mGpsEpheValid(0),
mGloEpheValid(0),
mBdsEpheValid(0ULL),
mGalEpheValid(0ULL),
mQzssEpheValid(0) {}
inline SystemStatusEphemeris(const SystemStatusPQWP4& nmea);
bool equals(const SystemStatusEphemeris& peer);
void dump(void) override;
};
class SystemStatusPQWP5;
class SystemStatusSvHealth : public SystemStatusItemBase
{
public:
uint32_t mGpsUnknownMask;
uint32_t mGloUnknownMask;
uint64_t mBdsUnknownMask;
uint64_t mGalUnknownMask;
uint8_t mQzssUnknownMask;
uint32_t mNavicUnknownMask;
uint32_t mGpsGoodMask;
uint32_t mGloGoodMask;
uint64_t mBdsGoodMask;
uint64_t mGalGoodMask;
uint8_t mQzssGoodMask;
uint32_t mNavicGoodMask;
uint32_t mGpsBadMask;
uint32_t mGloBadMask;
uint64_t mBdsBadMask;
uint64_t mGalBadMask;
uint8_t mQzssBadMask;
uint32_t mNavicBadMask;
inline SystemStatusSvHealth() :
mGpsUnknownMask(0),
mGloUnknownMask(0),
mBdsUnknownMask(0ULL),
mGalUnknownMask(0ULL),
mQzssUnknownMask(0),
mNavicUnknownMask(0),
mGpsGoodMask(0),
mGloGoodMask(0),
mBdsGoodMask(0ULL),
mGalGoodMask(0ULL),
mQzssGoodMask(0),
mNavicGoodMask(0),
mGpsBadMask(0),
mGloBadMask(0),
mBdsBadMask(0ULL),
mGalBadMask(0ULL),
mQzssBadMask(0),
mNavicBadMask(0) {}
inline SystemStatusSvHealth(const SystemStatusPQWP5& nmea);
bool equals(const SystemStatusSvHealth& peer);
void dump(void) override;
};
class SystemStatusPQWP6;
class SystemStatusPdr : public SystemStatusItemBase
{
public:
uint32_t mFixInfoMask;
inline SystemStatusPdr() :
mFixInfoMask(0) {}
inline SystemStatusPdr(const SystemStatusPQWP6& nmea);
bool equals(const SystemStatusPdr& peer);
void dump(void) override;
};
class SystemStatusPQWP7;
struct SystemStatusNav
{
GnssEphemerisType mType;
GnssEphemerisSource mSource;
int32_t mAgeSec;
};
class SystemStatusNavData : public SystemStatusItemBase
{
public:
SystemStatusNav mNav[SV_ALL_NUM];
inline SystemStatusNavData() {
for (uint32_t i=0; i<SV_ALL_NUM; i++) {
mNav[i].mType = GNSS_EPH_TYPE_UNKNOWN;
mNav[i].mSource = GNSS_EPH_SOURCE_UNKNOWN;
mNav[i].mAgeSec = 0;
}
}
inline SystemStatusNavData(const SystemStatusPQWP7& nmea);
bool equals(const SystemStatusNavData& peer);
void dump(void) override;
};
class SystemStatusPQWS1;
class SystemStatusPositionFailure : public SystemStatusItemBase
{
public:
uint32_t mFixInfoMask;
uint32_t mHepeLimit;
inline SystemStatusPositionFailure() :
mFixInfoMask(0),
mHepeLimit(0) {}
inline SystemStatusPositionFailure(const SystemStatusPQWS1& nmea);
bool equals(const SystemStatusPositionFailure& peer);
void dump(void) override;
};
/******************************************************************************
SystemStatus report data structure - from DataItem observer
******************************************************************************/
class SystemStatusAirplaneMode : public SystemStatusItemBase,
public AirplaneModeDataItemBase
{
public:
inline SystemStatusAirplaneMode(bool mode=false) :
AirplaneModeDataItemBase(mode) {}
inline SystemStatusAirplaneMode(const AirplaneModeDataItemBase& itemBase) :
AirplaneModeDataItemBase(itemBase) {}
inline bool equals(const SystemStatusAirplaneMode& peer) {
return (mMode == peer.mMode);
}
};
class SystemStatusENH : public SystemStatusItemBase,
public ENHDataItemBase
{
public:
inline SystemStatusENH(bool enabled=false) :
ENHDataItemBase(enabled) {}
inline SystemStatusENH(const ENHDataItemBase& itemBase) :
ENHDataItemBase(itemBase) {}
inline bool equals(const SystemStatusENH& peer) {
return (mEnabled == peer.mEnabled);
}
};
class SystemStatusGpsState : public SystemStatusItemBase,
public GPSStateDataItemBase
{
public:
inline SystemStatusGpsState(bool enabled=false) :
GPSStateDataItemBase(enabled) {}
inline SystemStatusGpsState(const GPSStateDataItemBase& itemBase) :
GPSStateDataItemBase(itemBase) {}
inline bool equals(const SystemStatusGpsState& peer) {
return (mEnabled == peer.mEnabled);
}
inline void dump(void) override {
LOC_LOGD("GpsState: state=%u", mEnabled);
}
};
class SystemStatusNLPStatus : public SystemStatusItemBase,
public NLPStatusDataItemBase
{
public:
inline SystemStatusNLPStatus(bool enabled=false) :
NLPStatusDataItemBase(enabled) {}
inline SystemStatusNLPStatus(const NLPStatusDataItemBase& itemBase) :
NLPStatusDataItemBase(itemBase) {}
inline bool equals(const SystemStatusNLPStatus& peer) {
return (mEnabled == peer.mEnabled);
}
};
class SystemStatusWifiHardwareState : public SystemStatusItemBase,
public WifiHardwareStateDataItemBase
{
public:
inline SystemStatusWifiHardwareState(bool enabled=false) :
WifiHardwareStateDataItemBase(enabled) {}
inline SystemStatusWifiHardwareState(const WifiHardwareStateDataItemBase& itemBase) :
WifiHardwareStateDataItemBase(itemBase) {}
inline bool equals(const SystemStatusWifiHardwareState& peer) {
return (mEnabled == peer.mEnabled);
}
};
class SystemStatusNetworkInfo : public SystemStatusItemBase,
public NetworkInfoDataItemBase
{
NetworkInfoDataItemBase* mSrcObjPtr;
public:
inline SystemStatusNetworkInfo(
int32_t type = 0,
std::string typeName = "",
string subTypeName = "",
bool connected = false,
bool roaming = false,
uint64_t networkHandle = NETWORK_HANDLE_UNKNOWN,
string apn = "") :
NetworkInfoDataItemBase(
(NetworkType)type,
type,
typeName,
subTypeName,
connected && (!roaming),
connected,
roaming,
networkHandle, apn),
mSrcObjPtr(nullptr) {}
inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) :
NetworkInfoDataItemBase(itemBase),
mSrcObjPtr((NetworkInfoDataItemBase*)&itemBase) {
mType = (int32_t)itemBase.getType();
}
inline bool equals(const SystemStatusNetworkInfo& peer) {
bool rtv = (peer.mConnected == mConnected);
for (uint8_t i = 0; rtv && i < MAX_NETWORK_HANDLES; ++i) {
rtv &= (mAllNetworkHandles[i] == peer.mAllNetworkHandles[i]);
}
return rtv && !peer.mApn.compare(mApn);
}
inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) {
LOC_LOGv("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x mApn=%s",
mAllTypes, mConnected, mType, mApn.c_str());
uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes;
string& apn = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mApn;
// Replace current with cached table for now and then update
memcpy(mAllNetworkHandles,
(static_cast<SystemStatusNetworkInfo&>(curInfo)).getNetworkHandle(),
sizeof(mAllNetworkHandles));
// Update the apn for non-mobile type connections.
if (TYPE_MOBILE != mType && apn.compare("") != 0) {
mApn = apn;
}
if (mConnected) {
mAllTypes |= allTypes;
for (uint8_t i = 0; i < MAX_NETWORK_HANDLES; ++i) {
if (mNetworkHandle == mAllNetworkHandles[i].networkHandle) {
LOC_LOGD("collate duplicate detected, not updating");
break;
}
if (NETWORK_HANDLE_UNKNOWN == mAllNetworkHandles[i].networkHandle) {
mAllNetworkHandles[i].networkHandle = mNetworkHandle;
mAllNetworkHandles[i].networkType = (loc_core::NetworkType) mType;
break;
}
}
} else if (0 != mAllTypes) {
uint8_t deletedIndex = MAX_NETWORK_HANDLES;
uint8_t lastValidIndex = 0;
uint8_t typeCount = 0;
for (; lastValidIndex < MAX_NETWORK_HANDLES &&
NETWORK_HANDLE_UNKNOWN != mAllNetworkHandles[lastValidIndex].networkHandle;
++lastValidIndex) {
// Maintain count for number of network handles still
// connected for given type
if (mType == (int32_t)mAllNetworkHandles[lastValidIndex].networkType) {
if (mNetworkHandle == mAllNetworkHandles[lastValidIndex].networkHandle) {
deletedIndex = lastValidIndex;
} else {
typeCount++;
}
}
}
if (lastValidIndex > 0) {
--lastValidIndex;
}
if (MAX_NETWORK_HANDLES != deletedIndex) {
LOC_LOGd("deletedIndex:%u, lastValidIndex:%u, typeCount:%u",
deletedIndex, lastValidIndex, typeCount);
mAllNetworkHandles[deletedIndex] = mAllNetworkHandles[lastValidIndex];
mAllNetworkHandles[lastValidIndex].networkHandle = NETWORK_HANDLE_UNKNOWN;
mAllNetworkHandles[lastValidIndex].networkType = TYPE_UNKNOWN;
}
// If no more handles of given type, set bitmask
if (0 == typeCount) {
mAllTypes = (allTypes & (~mAllTypes));
LOC_LOGD("mAllTypes:%" PRIx64, mAllTypes);
}
} // else (mConnected == false && mAllTypes == 0)
// we keep mAllTypes as 0, which means no more connections.
if (nullptr != mSrcObjPtr) {
// this is critical, changing mAllTypes of the original obj
mSrcObjPtr->mAllTypes = mAllTypes;
memcpy(mSrcObjPtr->mAllNetworkHandles,
mAllNetworkHandles,
sizeof(mSrcObjPtr->mAllNetworkHandles));
}
return *this;
}
inline void dump(void) override {
LOC_LOGD("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x mApn=%s",
mAllTypes, mConnected, mType, mApn.c_str());
}
};
class SystemStatusServiceInfo : public SystemStatusItemBase,
public RilServiceInfoDataItemBase
{
public:
inline SystemStatusServiceInfo() :
RilServiceInfoDataItemBase() {}
inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) :
RilServiceInfoDataItemBase(itemBase) {}
inline bool equals(const SystemStatusServiceInfo& peer) {
return static_cast<const RilServiceInfoDataItemBase&>(peer) ==
static_cast<const RilServiceInfoDataItemBase&>(*this);
}
};
class SystemStatusRilCellInfo : public SystemStatusItemBase,
public RilCellInfoDataItemBase
{
public:
inline SystemStatusRilCellInfo() :
RilCellInfoDataItemBase() {}
inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) :
RilCellInfoDataItemBase(itemBase) {}
inline bool equals(const SystemStatusRilCellInfo& peer) {
return static_cast<const RilCellInfoDataItemBase&>(peer) ==
static_cast<const RilCellInfoDataItemBase&>(*this);
}
};
class SystemStatusServiceStatus : public SystemStatusItemBase,
public ServiceStatusDataItemBase
{
public:
inline SystemStatusServiceStatus(int32_t mServiceState=0) :
ServiceStatusDataItemBase(mServiceState) {}
inline SystemStatusServiceStatus(const ServiceStatusDataItemBase& itemBase) :
ServiceStatusDataItemBase(itemBase) {}
inline bool equals(const SystemStatusServiceStatus& peer) {
return (mServiceState == peer.mServiceState);
}
};
class SystemStatusModel : public SystemStatusItemBase,
public ModelDataItemBase
{
public:
inline SystemStatusModel(string name="") :
ModelDataItemBase(name) {}
inline SystemStatusModel(const ModelDataItemBase& itemBase) :
ModelDataItemBase(itemBase) {}
inline bool equals(const SystemStatusModel& peer) {
return (mModel == peer.mModel);
}
};
class SystemStatusManufacturer : public SystemStatusItemBase,
public ManufacturerDataItemBase
{
public:
inline SystemStatusManufacturer(string name="") :
ManufacturerDataItemBase(name) {}
inline SystemStatusManufacturer(const ManufacturerDataItemBase& itemBase) :
ManufacturerDataItemBase(itemBase) {}
inline bool equals(const SystemStatusManufacturer& peer) {
return (mManufacturer == peer.mManufacturer);
}
};
class SystemStatusAssistedGps : public SystemStatusItemBase,
public AssistedGpsDataItemBase
{
public:
inline SystemStatusAssistedGps(bool enabled=false) :
AssistedGpsDataItemBase(enabled) {}
inline SystemStatusAssistedGps(const AssistedGpsDataItemBase& itemBase) :
AssistedGpsDataItemBase(itemBase) {}
inline bool equals(const SystemStatusAssistedGps& peer) {
return (mEnabled == peer.mEnabled);
}
};
class SystemStatusScreenState : public SystemStatusItemBase,
public ScreenStateDataItemBase
{
public:
inline SystemStatusScreenState(bool state=false) :
ScreenStateDataItemBase(state) {}
inline SystemStatusScreenState(const ScreenStateDataItemBase& itemBase) :
ScreenStateDataItemBase(itemBase) {}
inline bool equals(const SystemStatusScreenState& peer) {
return (mState == peer.mState);
}
};
class SystemStatusPowerConnectState : public SystemStatusItemBase,
public PowerConnectStateDataItemBase
{
public:
inline SystemStatusPowerConnectState(bool state=false) :
PowerConnectStateDataItemBase(state) {}
inline SystemStatusPowerConnectState(const PowerConnectStateDataItemBase& itemBase) :
PowerConnectStateDataItemBase(itemBase) {}
inline bool equals(const SystemStatusPowerConnectState& peer) {
return (mState == peer.mState);
}
};
class SystemStatusTimeZoneChange : public SystemStatusItemBase,
public TimeZoneChangeDataItemBase
{
public:
inline SystemStatusTimeZoneChange(
int64_t currTimeMillis=0ULL, int32_t rawOffset=0, int32_t dstOffset=0) :
TimeZoneChangeDataItemBase(currTimeMillis, rawOffset, dstOffset) {}
inline SystemStatusTimeZoneChange(const TimeZoneChangeDataItemBase& itemBase) :
TimeZoneChangeDataItemBase(itemBase) {}
inline bool equals(const SystemStatusTimeZoneChange& peer) {
return ((mCurrTimeMillis == peer.mCurrTimeMillis) &&
(mRawOffsetTZ == peer.mRawOffsetTZ) &&
(mDstOffsetTZ == peer.mDstOffsetTZ));
}
};
class SystemStatusTimeChange : public SystemStatusItemBase,
public TimeChangeDataItemBase
{
public:
inline SystemStatusTimeChange(
int64_t currTimeMillis=0ULL, int32_t rawOffset=0, int32_t dstOffset=0) :
TimeChangeDataItemBase(currTimeMillis, rawOffset, dstOffset) {}
inline SystemStatusTimeChange(const TimeChangeDataItemBase& itemBase) :
TimeChangeDataItemBase(itemBase) {}
inline bool equals(const SystemStatusTimeChange& peer) {
return ((mCurrTimeMillis == peer.mCurrTimeMillis) &&
(mRawOffsetTZ == peer.mRawOffsetTZ) &&
(mDstOffsetTZ == peer.mDstOffsetTZ));
}
};
class SystemStatusWifiSupplicantStatus : public SystemStatusItemBase,
public WifiSupplicantStatusDataItemBase
{
public:
inline SystemStatusWifiSupplicantStatus() :
WifiSupplicantStatusDataItemBase() {}
inline SystemStatusWifiSupplicantStatus(const WifiSupplicantStatusDataItemBase& itemBase) :
WifiSupplicantStatusDataItemBase(itemBase) {}
inline bool equals(const SystemStatusWifiSupplicantStatus& peer) {
return ((mState == peer.mState) &&
(mApMacAddressValid == peer.mApMacAddressValid) &&
(mWifiApSsidValid == peer.mWifiApSsidValid) &&
(mWifiApSsid == peer.mWifiApSsid));
}
};
class SystemStatusShutdownState : public SystemStatusItemBase,
public ShutdownStateDataItemBase
{
public:
inline SystemStatusShutdownState(bool state=false) :
ShutdownStateDataItemBase(state) {}
inline SystemStatusShutdownState(const ShutdownStateDataItemBase& itemBase) :
ShutdownStateDataItemBase(itemBase) {}
inline bool equals(const SystemStatusShutdownState& peer) {
return (mState == peer.mState);
}
};
class SystemStatusTac : public SystemStatusItemBase,
public TacDataItemBase
{
public:
inline SystemStatusTac(std::string value="") :
TacDataItemBase(value) {}
inline SystemStatusTac(const TacDataItemBase& itemBase) :
TacDataItemBase(itemBase) {}
inline bool equals(const SystemStatusTac& peer) {
return (mValue == peer.mValue);
}
inline void dump(void) override {
LOC_LOGD("Tac: value=%s", mValue.c_str());
}
};
class SystemStatusMccMnc : public SystemStatusItemBase,
public MccmncDataItemBase
{
public:
inline SystemStatusMccMnc(std::string value="") :
MccmncDataItemBase(value) {}
inline SystemStatusMccMnc(const MccmncDataItemBase& itemBase) :
MccmncDataItemBase(itemBase) {}
inline bool equals(const SystemStatusMccMnc& peer) {
return (mValue == peer.mValue);
}
inline void dump(void) override {
LOC_LOGD("TacMccMnc value=%s", mValue.c_str());
}
};
class SystemStatusBtDeviceScanDetail : public SystemStatusItemBase,
public BtDeviceScanDetailsDataItemBase
{
public:
inline SystemStatusBtDeviceScanDetail() :
BtDeviceScanDetailsDataItemBase() {}
inline SystemStatusBtDeviceScanDetail(const BtDeviceScanDetailsDataItemBase& itemBase) :
BtDeviceScanDetailsDataItemBase(itemBase) {}
inline bool equals(const SystemStatusBtDeviceScanDetail& peer) {
return ((mApSrnRssi == peer.mApSrnRssi) &&
(0 == memcmp(mApSrnMacAddress, peer.mApSrnMacAddress, sizeof(mApSrnMacAddress))) &&
(mApSrnTimestamp == peer.mApSrnTimestamp) &&
(mRequestTimestamp == peer.mRequestTimestamp) &&
(mReceiveTimestamp == peer.mReceiveTimestamp));
}
};
class SystemStatusBtleDeviceScanDetail : public SystemStatusItemBase,
public BtLeDeviceScanDetailsDataItemBase
{
public:
inline SystemStatusBtleDeviceScanDetail() :
BtLeDeviceScanDetailsDataItemBase() {}
inline SystemStatusBtleDeviceScanDetail(const BtLeDeviceScanDetailsDataItemBase& itemBase) :
BtLeDeviceScanDetailsDataItemBase(itemBase) {}
inline bool equals(const SystemStatusBtleDeviceScanDetail& peer) {
return ((mApSrnRssi == peer.mApSrnRssi) &&
(0 == memcmp(mApSrnMacAddress, peer.mApSrnMacAddress, sizeof(mApSrnMacAddress))) &&
(mApSrnTimestamp == peer.mApSrnTimestamp) &&
(mRequestTimestamp == peer.mRequestTimestamp) &&
(mReceiveTimestamp == peer.mReceiveTimestamp));
}
};
/******************************************************************************
SystemStatusReports
******************************************************************************/
class SystemStatusReports
{
public:
// from QMI_LOC indication
std::vector<SystemStatusLocation> mLocation;
// from ME debug NMEA
std::vector<SystemStatusTimeAndClock> mTimeAndClock;
std::vector<SystemStatusXoState> mXoState;
std::vector<SystemStatusRfAndParams> mRfAndParams;
std::vector<SystemStatusErrRecovery> mErrRecovery;
// from PE debug NMEA
std::vector<SystemStatusInjectedPosition> mInjectedPosition;
std::vector<SystemStatusBestPosition> mBestPosition;
std::vector<SystemStatusXtra> mXtra;
std::vector<SystemStatusEphemeris> mEphemeris;
std::vector<SystemStatusSvHealth> mSvHealth;
std::vector<SystemStatusPdr> mPdr;
std::vector<SystemStatusNavData> mNavData;
// from SM debug NMEA
std::vector<SystemStatusPositionFailure> mPositionFailure;
// from dataitems observer
std::vector<SystemStatusAirplaneMode> mAirplaneMode;
std::vector<SystemStatusENH> mENH;
std::vector<SystemStatusGpsState> mGPSState;
std::vector<SystemStatusNLPStatus> mNLPStatus;
std::vector<SystemStatusWifiHardwareState> mWifiHardwareState;
std::vector<SystemStatusNetworkInfo> mNetworkInfo;
std::vector<SystemStatusServiceInfo> mRilServiceInfo;
std::vector<SystemStatusRilCellInfo> mRilCellInfo;
std::vector<SystemStatusServiceStatus> mServiceStatus;
std::vector<SystemStatusModel> mModel;
std::vector<SystemStatusManufacturer> mManufacturer;
std::vector<SystemStatusAssistedGps> mAssistedGps;
std::vector<SystemStatusScreenState> mScreenState;
std::vector<SystemStatusPowerConnectState> mPowerConnectState;
std::vector<SystemStatusTimeZoneChange> mTimeZoneChange;
std::vector<SystemStatusTimeChange> mTimeChange;
std::vector<SystemStatusWifiSupplicantStatus> mWifiSupplicantStatus;
std::vector<SystemStatusShutdownState> mShutdownState;
std::vector<SystemStatusTac> mTac;
std::vector<SystemStatusMccMnc> mMccMnc;
std::vector<SystemStatusBtDeviceScanDetail> mBtDeviceScanDetail;
std::vector<SystemStatusBtleDeviceScanDetail> mBtLeDeviceScanDetail;
};
/******************************************************************************
SystemStatus
******************************************************************************/
class SystemStatus
{
private:
static SystemStatus *mInstance;
SystemStatusOsObserver mSysStatusObsvr;
// ctor
SystemStatus(const MsgTask* msgTask);
// dtor
inline ~SystemStatus() {}
// Data members
static pthread_mutex_t mMutexSystemStatus;
SystemStatusReports mCache;
template <typename TYPE_REPORT, typename TYPE_ITEM>
bool setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s);
// set default dataitem derived item in report cache
template <typename TYPE_REPORT, typename TYPE_ITEM>
void setDefaultIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s);
template <typename TYPE_REPORT, typename TYPE_ITEM>
void getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) const;
public:
// Static methods
static SystemStatus* getInstance(const MsgTask* msgTask);
static void destroyInstance();
IOsObserver* getOsObserver();
// Helpers
bool eventPosition(const UlpLocation& location,const GpsLocationExtended& locationEx);
bool eventDataItemNotify(IDataItemCore* dataitem);
bool setNmeaString(const char *data, uint32_t len);
bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
bool setDefaultGnssEngineStates(void);
bool eventConnectionStatus(bool connected, int8_t type,
bool roaming, NetworkHandle networkHandle, string& apn);
bool updatePowerConnectState(bool charging);
void resetNetworkInfo();
};
} // namespace loc_core
#endif //__SYSTEM_STATUS__

View File

@@ -0,0 +1,592 @@
/* Copyright (c) 2015-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
* 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_TAG "LocSvc_SystemStatusOsObserver"
#include <algorithm>
#include <SystemStatus.h>
#include <SystemStatusOsObserver.h>
#include <IDataItemCore.h>
#include <DataItemsFactoryProxy.h>
namespace loc_core
{
template <typename CINT, typename COUT>
COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) {
COUT outContainer = {};
for (auto item : inContainer) {
outContainer.insert(outContainer.begin(), item);
}
return outContainer;
}
SystemStatusOsObserver::~SystemStatusOsObserver() {
// Close data-item library handle
DataItemsFactoryProxy::closeDataItemLibraryHandle();
// Destroy cache
for (auto each : mDataItemCache) {
if (nullptr != each.second) {
delete each.second;
}
}
mDataItemCache.clear();
}
void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscriptionObj)
{
struct SetSubsObj : public LocMsg {
ObserverContext& mContext;
IDataItemSubscription* mSubsObj;
inline SetSubsObj(ObserverContext& context, IDataItemSubscription* subscriptionObj) :
mContext(context), mSubsObj(subscriptionObj) {}
void proc() const {
LOC_LOGi("SetSubsObj::enter");
mContext.mSubscriptionObj = mSubsObj;
if (!mContext.mSSObserver->mDataItemToClients.empty()) {
list<DataItemId> dis(
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
mContext.mSSObserver->mDataItemToClients.getKeys()));
mContext.mSubscriptionObj->subscribe(dis, mContext.mSSObserver);
mContext.mSubscriptionObj->requestData(dis, mContext.mSSObserver);
}
LOC_LOGi("SetSubsObj::exit");
}
};
if (nullptr == subscriptionObj) {
LOC_LOGw("subscriptionObj is NULL");
} else {
mContext.mMsgTask->sendMsg(new SetSubsObj(mContext, subscriptionObj));
}
}
/******************************************************************************
IDataItemSubscription Overrides
******************************************************************************/
void SystemStatusOsObserver::subscribe(const list<DataItemId>& l, IDataItemObserver* client,
bool toRequestData)
{
struct HandleSubscribeReq : public LocMsg {
inline HandleSubscribeReq(SystemStatusOsObserver* parent,
list<DataItemId>& l, IDataItemObserver* client, bool requestData) :
mParent(parent), mClient(client),
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)),
diItemlist(l),
mToRequestData(requestData) {}
void proc() const {
unordered_set<DataItemId> dataItemsToSubscribe = {};
mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe);
mParent->mClientToDataItems.add(mClient, mDataItemSet);
mParent->sendCachedDataItems(mDataItemSet, mClient);
// Send subscription set to framework
if (nullptr != mParent->mContext.mSubscriptionObj) {
if (mToRequestData) {
LOC_LOGD("Request Data sent to framework for the following");
mParent->mContext.mSubscriptionObj->requestData(diItemlist, mParent);
} else if (!dataItemsToSubscribe.empty()) {
LOC_LOGD("Subscribe Request sent to framework for the following");
mParent->logMe(dataItemsToSubscribe);
mParent->mContext.mSubscriptionObj->subscribe(
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
std::move(dataItemsToSubscribe)),
mParent);
}
}
}
mutable SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
const unordered_set<DataItemId> mDataItemSet;
const list<DataItemId> diItemlist;
bool mToRequestData;
};
if (l.empty() || nullptr == client) {
LOC_LOGw("Data item set is empty or client is nullptr");
} else {
mContext.mMsgTask->sendMsg(
new HandleSubscribeReq(this, (list<DataItemId>&)l, client, toRequestData));
}
}
void SystemStatusOsObserver::updateSubscription(
const list<DataItemId>& l, IDataItemObserver* client)
{
struct HandleUpdateSubscriptionReq : public LocMsg {
HandleUpdateSubscriptionReq(SystemStatusOsObserver* parent,
list<DataItemId>& l, IDataItemObserver* client) :
mParent(parent), mClient(client),
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
void proc() const {
unordered_set<DataItemId> dataItemsToSubscribe = {};
unordered_set<DataItemId> dataItemsToUnsubscribe = {};
unordered_set<IDataItemObserver*> clients({mClient});
// below removes clients from all entries keyed with the return of the
// mClientToDataItems.update() call. If leaving an empty set of clients as the
// result, the entire entry will be removed. dataItemsToUnsubscribe will be
// populated to keep the keys of the removed entries.
mParent->mDataItemToClients.trimOrRemove(
// this call updates <IDataItemObserver*, DataItemId> map; removes
// the DataItemId's that are not new to the clietn from mDataItemSet;
// and returns a set of mDataItemSet's that are no longer used by client.
// This unused set of mDataItemSet's is passed to trimOrRemove method of
// <DataItemId, IDataItemObserver*> map to remove the client from the
// corresponding entries, and gets a set of the entries that are
// removed from the <DataItemId, IDataItemObserver*> map as a result.
mParent->mClientToDataItems.update(mClient,
(unordered_set<DataItemId>&)mDataItemSet),
clients, &dataItemsToUnsubscribe, nullptr);
// below adds mClient to <DataItemId, IDataItemObserver*> map, and populates
// new keys added to that map, which are DataItemIds to be subscribed.
mParent->mDataItemToClients.add(mDataItemSet, clients, &dataItemsToSubscribe);
// Send First Response
mParent->sendCachedDataItems(mDataItemSet, mClient);
if (nullptr != mParent->mContext.mSubscriptionObj) {
// Send subscription set to framework
if (!dataItemsToSubscribe.empty()) {
LOC_LOGD("Subscribe Request sent to framework for the following");
mParent->logMe(dataItemsToSubscribe);
mParent->mContext.mSubscriptionObj->subscribe(
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
std::move(dataItemsToSubscribe)),
mParent);
}
// Send unsubscribe to framework
if (!dataItemsToUnsubscribe.empty()) {
LOC_LOGD("Unsubscribe Request sent to framework for the following");
mParent->logMe(dataItemsToUnsubscribe);
mParent->mContext.mSubscriptionObj->unsubscribe(
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
std::move(dataItemsToUnsubscribe)),
mParent);
}
}
}
SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
unordered_set<DataItemId> mDataItemSet;
};
if (l.empty() || nullptr == client) {
LOC_LOGw("Data item set is empty or client is nullptr");
} else {
mContext.mMsgTask->sendMsg(
new HandleUpdateSubscriptionReq(this, (list<DataItemId>&)l, client));
}
}
void SystemStatusOsObserver::unsubscribe(
const list<DataItemId>& l, IDataItemObserver* client)
{
struct HandleUnsubscribeReq : public LocMsg {
HandleUnsubscribeReq(SystemStatusOsObserver* parent,
list<DataItemId>& l, IDataItemObserver* client) :
mParent(parent), mClient(client),
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
void proc() const {
unordered_set<DataItemId> dataItemsUnusedByClient = {};
unordered_set<IDataItemObserver*> clientToRemove = {};
unordered_set<DataItemId> dataItemsToUnsubscribe = {};
mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove,
&dataItemsUnusedByClient);
mParent->mDataItemToClients.trimOrRemove(dataItemsUnusedByClient, {mClient},
&dataItemsToUnsubscribe, nullptr);
if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToUnsubscribe.empty()) {
LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
mParent->logMe(dataItemsToUnsubscribe);
// Send unsubscribe to framework
mParent->mContext.mSubscriptionObj->unsubscribe(
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
std::move(dataItemsToUnsubscribe)),
mParent);
}
}
SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
unordered_set<DataItemId> mDataItemSet;
};
if (l.empty() || nullptr == client) {
LOC_LOGw("Data item set is empty or client is nullptr");
} else {
mContext.mMsgTask->sendMsg(new HandleUnsubscribeReq(this, (list<DataItemId>&)l, client));
}
}
void SystemStatusOsObserver::unsubscribeAll(IDataItemObserver* client)
{
struct HandleUnsubscribeAllReq : public LocMsg {
HandleUnsubscribeAllReq(SystemStatusOsObserver* parent,
IDataItemObserver* client) :
mParent(parent), mClient(client) {}
void proc() const {
unordered_set<DataItemId> diByClient = mParent->mClientToDataItems.getValSet(mClient);
if (!diByClient.empty()) {
unordered_set<DataItemId> dataItemsToUnsubscribe;
mParent->mClientToDataItems.remove(mClient);
mParent->mDataItemToClients.trimOrRemove(diByClient, {mClient},
&dataItemsToUnsubscribe, nullptr);
if (!dataItemsToUnsubscribe.empty() &&
nullptr != mParent->mContext.mSubscriptionObj) {
LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
mParent->logMe(dataItemsToUnsubscribe);
// Send unsubscribe to framework
mParent->mContext.mSubscriptionObj->unsubscribe(
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
std::move(dataItemsToUnsubscribe)),
mParent);
}
}
}
SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
};
if (nullptr == client) {
LOC_LOGw("Data item set is empty or client is nullptr");
} else {
mContext.mMsgTask->sendMsg(new HandleUnsubscribeAllReq(this, client));
}
}
/******************************************************************************
IDataItemObserver Overrides
******************************************************************************/
void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
{
struct HandleNotify : public LocMsg {
HandleNotify(SystemStatusOsObserver* parent, vector<IDataItemCore*>& v) :
mParent(parent), mDiVec(std::move(v)) {}
inline virtual ~HandleNotify() {
for (auto item : mDiVec) {
delete item;
}
}
void proc() const {
// Update Cache with received data items and prepare
// list of data items to be sent.
unordered_set<DataItemId> dataItemIdsToBeSent = {};
for (auto item : mDiVec) {
if (mParent->updateCache(item)) {
dataItemIdsToBeSent.insert(item->getId());
}
}
// Send data item to all subscribed clients
unordered_set<IDataItemObserver*> clientSet = {};
for (auto each : dataItemIdsToBeSent) {
auto clients = mParent->mDataItemToClients.getValSetPtr(each);
if (nullptr != clients) {
clientSet.insert(clients->begin(), clients->end());
}
}
for (auto client : clientSet) {
unordered_set<DataItemId> dataItemIdsForThisClient(
mParent->mClientToDataItems.getValSet(client));
for (auto itr = dataItemIdsForThisClient.begin();
itr != dataItemIdsForThisClient.end(); ) {
if (dataItemIdsToBeSent.find(*itr) == dataItemIdsToBeSent.end()) {
itr = dataItemIdsForThisClient.erase(itr);
} else {
itr++;
}
}
mParent->sendCachedDataItems(dataItemIdsForThisClient, client);
}
}
SystemStatusOsObserver* mParent;
const vector<IDataItemCore*> mDiVec;
};
if (!dlist.empty()) {
vector<IDataItemCore*> dataItemVec(dlist.size());
for (auto each : dlist) {
IDataItemCore* di = DataItemsFactoryProxy::createNewDataItem(each->getId());
if (nullptr == di) {
LOC_LOGw("Unable to create dataitem:%d", each->getId());
continue;
}
// Copy contents into the newly created data item
di->copy(each);
// add this dataitem if updated from last one
dataItemVec.push_back(di);
IF_LOC_LOGD {
string dv;
di->stringify(dv);
LOC_LOGd("notify: DataItem In Value:%s", dv.c_str());
}
}
if (!dataItemVec.empty()) {
mContext.mMsgTask->sendMsg(new HandleNotify(this, dataItemVec));
}
}
}
/******************************************************************************
IFrameworkActionReq Overrides
******************************************************************************/
void SystemStatusOsObserver::turnOn(DataItemId dit, int timeOut)
{
if (nullptr == mContext.mFrameworkActionReqObj) {
LOC_LOGE("%s:%d]: Framework action request object is NULL", __func__, __LINE__);
return;
}
// Check if data item exists in mActiveRequestCount
DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
if (citer == mActiveRequestCount.end()) {
// Data item not found in map
// Add reference count as 1 and add dataitem to map
pair<DataItemId, int> cpair(dit, 1);
mActiveRequestCount.insert(cpair);
LOC_LOGD("Sending turnOn request");
// Send action turn on to framework
struct HandleTurnOnMsg : public LocMsg {
HandleTurnOnMsg(IFrameworkActionReq* framework,
DataItemId dit, int timeOut) :
mFrameworkActionReqObj(framework), mDataItemId(dit), mTimeOut(timeOut) {}
virtual ~HandleTurnOnMsg() {}
void proc() const {
mFrameworkActionReqObj->turnOn(mDataItemId, mTimeOut);
}
IFrameworkActionReq* mFrameworkActionReqObj;
DataItemId mDataItemId;
int mTimeOut;
};
mContext.mMsgTask->sendMsg(
new (nothrow) HandleTurnOnMsg(mContext.mFrameworkActionReqObj, dit, timeOut));
}
else {
// Found in map, update reference count
citer->second++;
LOC_LOGD("turnOn - Data item:%d Num_refs:%d", dit, citer->second);
}
}
void SystemStatusOsObserver::turnOff(DataItemId dit)
{
if (nullptr == mContext.mFrameworkActionReqObj) {
LOC_LOGE("%s:%d]: Framework action request object is NULL", __func__, __LINE__);
return;
}
// Check if data item exists in mActiveRequestCount
DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
if (citer != mActiveRequestCount.end()) {
// found
citer->second--;
LOC_LOGD("turnOff - Data item:%d Remaining:%d", dit, citer->second);
if(citer->second == 0) {
// if this was last reference, remove item from map and turn off module
mActiveRequestCount.erase(citer);
// Send action turn off to framework
struct HandleTurnOffMsg : public LocMsg {
HandleTurnOffMsg(IFrameworkActionReq* framework, DataItemId dit) :
mFrameworkActionReqObj(framework), mDataItemId(dit) {}
virtual ~HandleTurnOffMsg() {}
void proc() const {
mFrameworkActionReqObj->turnOff(mDataItemId);
}
IFrameworkActionReq* mFrameworkActionReqObj;
DataItemId mDataItemId;
};
mContext.mMsgTask->sendMsg(
new (nothrow) HandleTurnOffMsg(mContext.mFrameworkActionReqObj, dit));
}
}
}
#ifdef USE_GLIB
bool SystemStatusOsObserver::connectBackhaul(const string& clientName)
{
bool result = false;
if (mContext.mFrameworkActionReqObj != NULL) {
struct HandleConnectBackhaul : public LocMsg {
HandleConnectBackhaul(IFrameworkActionReq* fwkActReq, const string& clientName) :
mClientName(clientName), mFwkActionReqObj(fwkActReq) {}
virtual ~HandleConnectBackhaul() {}
void proc() const {
LOC_LOGi("HandleConnectBackhaul::enter");
mFwkActionReqObj->connectBackhaul(mClientName);
LOC_LOGi("HandleConnectBackhaul::exit");
}
IFrameworkActionReq* mFwkActionReqObj;
string mClientName;
};
mContext.mMsgTask->sendMsg(
new (nothrow) HandleConnectBackhaul(mContext.mFrameworkActionReqObj, clientName));
result = true;
}
else {
LOC_LOGe("Framework action request object is NULL.Caching connect request: %s",
clientName.c_str());
ClientBackhaulReqCache::const_iterator iter = mBackHaulConnReqCache.find(clientName);
if (iter == mBackHaulConnReqCache.end()) {
// not found in set. first time receiving from request from client
LOC_LOGe("Adding client to BackHaulConnReqCache list");
mBackHaulConnReqCache.insert(clientName);
}
result = false;
}
return result;
}
bool SystemStatusOsObserver::disconnectBackhaul(const string& clientName)
{
bool result = false;
if (mContext.mFrameworkActionReqObj != NULL) {
struct HandleDisconnectBackhaul : public LocMsg {
HandleDisconnectBackhaul(IFrameworkActionReq* fwkActReq, const string& clientName) :
mClientName(clientName), mFwkActionReqObj(fwkActReq) {}
virtual ~HandleDisconnectBackhaul() {}
void proc() const {
LOC_LOGi("HandleDisconnectBackhaul::enter");
mFwkActionReqObj->disconnectBackhaul(mClientName);
LOC_LOGi("HandleDisconnectBackhaul::exit");
}
IFrameworkActionReq* mFwkActionReqObj;
string mClientName;
};
mContext.mMsgTask->sendMsg(
new (nothrow) HandleDisconnectBackhaul(mContext.mFrameworkActionReqObj,
clientName));
}
else {
LOC_LOGe("Framework action request object is NULL.Caching disconnect request: %s",
clientName.c_str());
// Check if client has requested for backhaul connection.
ClientBackhaulReqCache::const_iterator iter = mBackHaulConnReqCache.find(clientName);
if (iter != mBackHaulConnReqCache.end()) {
// client found, remove from set.
LOC_LOGd("Removing client from BackHaulConnReqCache list");
mBackHaulConnReqCache.erase(iter);
}
result = false;
}
return result;
}
#endif
/******************************************************************************
Helpers
******************************************************************************/
void SystemStatusOsObserver::sendCachedDataItems(
const unordered_set<DataItemId>& s, IDataItemObserver* to)
{
if (nullptr == to) {
LOC_LOGv("client pointer is NULL.");
} else {
string clientName;
to->getName(clientName);
list<IDataItemCore*> dataItems = {};
for (auto each : s) {
auto citer = mDataItemCache.find(each);
if (citer != mDataItemCache.end()) {
string dv;
citer->second->stringify(dv);
LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str());
dataItems.push_front(citer->second);
}
}
if (dataItems.empty()) {
LOC_LOGv("No items to notify.");
} else {
to->notify(dataItems);
}
}
}
bool SystemStatusOsObserver::updateCache(IDataItemCore* d)
{
bool dataItemUpdated = false;
// Request systemstatus to record this dataitem in its cache
// if the return is false, it means that SystemStatus is not
// handling it, so SystemStatusOsObserver also doesn't.
// So it has to be true to proceed.
if (nullptr != d && mSystemStatus->eventDataItemNotify(d)) {
auto citer = mDataItemCache.find(d->getId());
if (citer == mDataItemCache.end()) {
// New data item; not found in cache
IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(d->getId());
if (nullptr != dataitem) {
// Copy the contents of the data item
dataitem->copy(d);
// Insert in mDataItemCache
mDataItemCache.insert(std::make_pair(d->getId(), dataitem));
dataItemUpdated = true;
}
} else {
// Found in cache; Update cache if necessary
citer->second->copy(d, &dataItemUpdated);
}
if (dataItemUpdated) {
LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated);
}
}
return dataItemUpdated;
}
} // namespace loc_core

View File

@@ -0,0 +1,181 @@
/* Copyright (c) 2015-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
* 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 __SYSTEM_STATUS_OSOBSERVER__
#define __SYSTEM_STATUS_OSOBSERVER__
#include <cinttypes>
#include <string>
#include <list>
#include <map>
#include <new>
#include <vector>
#include <MsgTask.h>
#include <DataItemId.h>
#include <IOsObserver.h>
#include <loc_pla.h>
#include <log_util.h>
#include <LocUnorderedSetMap.h>
namespace loc_core
{
/******************************************************************************
SystemStatusOsObserver
******************************************************************************/
using namespace std;
using namespace loc_util;
// Forward Declarations
class IDataItemCore;
class SystemStatus;
class SystemStatusOsObserver;
typedef map<IDataItemObserver*, list<DataItemId>> ObserverReqCache;
typedef LocUnorderedSetMap<IDataItemObserver*, DataItemId> ClientToDataItems;
typedef LocUnorderedSetMap<DataItemId, IDataItemObserver*> DataItemToClients;
typedef unordered_map<DataItemId, IDataItemCore*> DataItemIdToCore;
typedef unordered_map<DataItemId, int> DataItemIdToInt;
#ifdef USE_GLIB
// Cache details of backhaul client requests
typedef unordered_set<string> ClientBackhaulReqCache;
#endif
struct ObserverContext {
IDataItemSubscription* mSubscriptionObj;
IFrameworkActionReq* mFrameworkActionReqObj;
const MsgTask* mMsgTask;
SystemStatusOsObserver* mSSObserver;
inline ObserverContext(const MsgTask* msgTask, SystemStatusOsObserver* observer) :
mSubscriptionObj(NULL), mFrameworkActionReqObj(NULL),
mMsgTask(msgTask), mSSObserver(observer) {}
};
// Clients wanting to get data from OS/Framework would need to
// subscribe with OSObserver using IDataItemSubscription interface.
// Such clients would need to implement IDataItemObserver interface
// to receive data when it becomes available.
class SystemStatusOsObserver : public IOsObserver {
public:
// ctor
inline SystemStatusOsObserver(SystemStatus* systemstatus, const MsgTask* msgTask) :
mSystemStatus(systemstatus), mContext(msgTask, this),
mAddress("SystemStatusOsObserver"),
mClientToDataItems(MAX_DATA_ITEM_ID), mDataItemToClients(MAX_DATA_ITEM_ID) {}
// dtor
~SystemStatusOsObserver();
template <typename CINT, typename COUT>
static COUT containerTransfer(CINT& s);
template <typename CINT, typename COUT>
inline static COUT containerTransfer(CINT&& s) {
return containerTransfer<CINT, COUT>(s);
}
// To set the subscription object
virtual void setSubscriptionObj(IDataItemSubscription* subscriptionObj);
// To set the framework action request object
inline void setFrameworkActionReqObj(IFrameworkActionReq* frameworkActionReqObj) {
mContext.mFrameworkActionReqObj = frameworkActionReqObj;
#ifdef USE_GLIB
uint32_t numBackHaulClients = mBackHaulConnReqCache.size();
if (numBackHaulClients > 0) {
// For each client, invoke connectbackhaul.
for (auto clientName : mBackHaulConnReqCache) {
LOC_LOGd("Invoke connectBackhaul for client: %s", clientName.c_str());
connectBackhaul(clientName);
}
// Clear the set
mBackHaulConnReqCache.clear();
}
#endif
}
// IDataItemSubscription Overrides
inline virtual void subscribe(const list<DataItemId>& l, IDataItemObserver* client) override {
subscribe(l, client, false);
}
virtual void updateSubscription(const list<DataItemId>& l, IDataItemObserver* client) override;
inline virtual void requestData(const list<DataItemId>& l, IDataItemObserver* client) override {
subscribe(l, client, true);
}
virtual void unsubscribe(const list<DataItemId>& l, IDataItemObserver* client) override;
virtual void unsubscribeAll(IDataItemObserver* client) override;
// IDataItemObserver Overrides
virtual void notify(const list<IDataItemCore*>& dlist) override;
inline virtual void getName(string& name) override {
name = mAddress;
}
// IFrameworkActionReq Overrides
virtual void turnOn(DataItemId dit, int timeOut = 0) override;
virtual void turnOff(DataItemId dit) override;
#ifdef USE_GLIB
virtual bool connectBackhaul(const string& clientName) override;
virtual bool disconnectBackhaul(const string& clientName) override;
#endif
private:
SystemStatus* mSystemStatus;
ObserverContext mContext;
const string mAddress;
ClientToDataItems mClientToDataItems;
DataItemToClients mDataItemToClients;
DataItemIdToCore mDataItemCache;
DataItemIdToInt mActiveRequestCount;
// Cache the subscribe and requestData till subscription obj is obtained
void cacheObserverRequest(ObserverReqCache& reqCache,
const list<DataItemId>& l, IDataItemObserver* client);
#ifdef USE_GLIB
// Cache the framework action request for connect/disconnect
ClientBackhaulReqCache mBackHaulConnReqCache;
#endif
void subscribe(const list<DataItemId>& l, IDataItemObserver* client, bool toRequestData);
// Helpers
void sendCachedDataItems(const unordered_set<DataItemId>& s, IDataItemObserver* to);
bool updateCache(IDataItemCore* d);
inline void logMe(const unordered_set<DataItemId>& l) {
IF_LOC_LOGD {
for (auto id : l) {
LOC_LOGD("DataItem %d", id);
}
}
}
};
} // namespace loc_core
#endif //__SYSTEM_STATUS__

View File

@@ -0,0 +1,555 @@
/* Copyright (c) 2015-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
* 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 __DATAITEMCONCRETEBASETYPES__
#define __DATAITEMCONCRETEBASETYPES__
#include <string>
#include <cstring>
#include <sstream>
#include <DataItemId.h>
#include <IDataItemCore.h>
#include <gps_extended_c.h>
#include <inttypes.h>
#define MAC_ADDRESS_LENGTH 6
// MAC address length in bytes
// QMI_LOC_SRN_MAC_ADDR_LENGTH_V02
#define SRN_MAC_ADDRESS_LENGTH 6
#define WIFI_SUPPLICANT_DEFAULT_STATE 0
static constexpr char sDelimit = ':';
namespace loc_core
{
using namespace std;
enum NetworkType {
TYPE_MOBILE = 0,
TYPE_WIFI,
TYPE_ETHERNET,
TYPE_BLUETOOTH,
TYPE_MMS,
TYPE_SUPL,
TYPE_DUN,
TYPE_HIPRI,
TYPE_WIMAX,
TYPE_PROXY,
TYPE_UNKNOWN,
};
typedef struct NetworkInfoType
{
// Unique network handle ID
uint64_t networkHandle;
// Type of network for corresponding network handle
NetworkType networkType;
NetworkInfoType() : networkHandle(NETWORK_HANDLE_UNKNOWN), networkType(TYPE_UNKNOWN) {}
NetworkInfoType(string strObj) {
size_t posDelimit = strObj.find(sDelimit);
if ( posDelimit != string::npos) {
int32_t type = TYPE_UNKNOWN;
string handleStr = strObj.substr(0, posDelimit);
string typeStr = strObj.substr(posDelimit + 1, strObj.length() - posDelimit - 1);
stringstream(handleStr) >> networkHandle;
stringstream(typeStr) >> type;
networkType = (NetworkType) type;
} else {
networkHandle = NETWORK_HANDLE_UNKNOWN;
networkType = TYPE_UNKNOWN;
}
}
bool operator== (const NetworkInfoType& other) {
return ((networkHandle == other.networkHandle) && (networkType == other.networkType));
}
string toString() {
string valueStr;
valueStr.clear ();
char nethandle [32];
memset (nethandle, 0, 32);
snprintf(nethandle, sizeof(nethandle), "%" PRIu64, networkHandle);
valueStr += string(nethandle);
valueStr += sDelimit;
char type [12];
memset (type, 0, 12);
snprintf (type, 12, "%u", networkType);
valueStr += string (type);
return valueStr;
}
} NetworkInfoType;
class AirplaneModeDataItemBase : public IDataItemCore {
public:
AirplaneModeDataItemBase(bool mode):
mMode(mode),
mId(AIRPLANEMODE_DATA_ITEM_ID) {}
virtual ~AirplaneModeDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mMode;
protected:
DataItemId mId;
};
class ENHDataItemBase : public IDataItemCore {
public:
ENHDataItemBase(bool enabled) :
mEnabled(enabled),
mId(ENH_DATA_ITEM_ID) {}
virtual ~ENHDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mEnabled;
protected:
DataItemId mId;
};
class GPSStateDataItemBase : public IDataItemCore {
public:
GPSStateDataItemBase(bool enabled) :
mEnabled(enabled),
mId(GPSSTATE_DATA_ITEM_ID) {}
virtual ~GPSStateDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mEnabled;
protected:
DataItemId mId;
};
class NLPStatusDataItemBase : public IDataItemCore {
public:
NLPStatusDataItemBase(bool enabled) :
mEnabled(enabled),
mId(NLPSTATUS_DATA_ITEM_ID) {}
virtual ~NLPStatusDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mEnabled;
protected:
DataItemId mId;
};
class WifiHardwareStateDataItemBase : public IDataItemCore {
public:
WifiHardwareStateDataItemBase(bool enabled) :
mEnabled(enabled),
mId(WIFIHARDWARESTATE_DATA_ITEM_ID) {}
virtual ~WifiHardwareStateDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mEnabled;
protected:
DataItemId mId;
};
class ScreenStateDataItemBase : public IDataItemCore {
public:
ScreenStateDataItemBase(bool state) :
mState(state),
mId(SCREEN_STATE_DATA_ITEM_ID) {}
virtual ~ScreenStateDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mState;
protected:
DataItemId mId;
};
class PowerConnectStateDataItemBase : public IDataItemCore {
public:
PowerConnectStateDataItemBase(bool state) :
mState(state),
mId(POWER_CONNECTED_STATE_DATA_ITEM_ID) {}
virtual ~PowerConnectStateDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mState;
protected:
DataItemId mId;
};
class TimeZoneChangeDataItemBase : public IDataItemCore {
public:
TimeZoneChangeDataItemBase(int64_t currTimeMillis, int32_t rawOffset, int32_t dstOffset) :
mCurrTimeMillis (currTimeMillis),
mRawOffsetTZ (rawOffset),
mDstOffsetTZ (dstOffset),
mId(TIMEZONE_CHANGE_DATA_ITEM_ID) {}
virtual ~TimeZoneChangeDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
int64_t mCurrTimeMillis;
int32_t mRawOffsetTZ;
int32_t mDstOffsetTZ;
protected:
DataItemId mId;
};
class TimeChangeDataItemBase : public IDataItemCore {
public:
TimeChangeDataItemBase(int64_t currTimeMillis, int32_t rawOffset, int32_t dstOffset) :
mCurrTimeMillis (currTimeMillis),
mRawOffsetTZ (rawOffset),
mDstOffsetTZ (dstOffset),
mId(TIME_CHANGE_DATA_ITEM_ID) {}
virtual ~TimeChangeDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
int64_t mCurrTimeMillis;
int32_t mRawOffsetTZ;
int32_t mDstOffsetTZ;
protected:
DataItemId mId;
};
class ShutdownStateDataItemBase : public IDataItemCore {
public:
ShutdownStateDataItemBase(bool state) :
mState (state),
mId(SHUTDOWN_STATE_DATA_ITEM_ID) {}
virtual ~ShutdownStateDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mState;
protected:
DataItemId mId;
};
class AssistedGpsDataItemBase : public IDataItemCore {
public:
AssistedGpsDataItemBase(bool enabled) :
mEnabled(enabled),
mId(ASSISTED_GPS_DATA_ITEM_ID) {}
virtual ~AssistedGpsDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
bool mEnabled;
protected:
DataItemId mId;
};
class NetworkInfoDataItemBase : public IDataItemCore {
public:
NetworkInfoDataItemBase(
NetworkType initialType, int32_t type, string typeName, string subTypeName,
bool available, bool connected, bool roaming, uint64_t networkHandle, string apn):
mAllTypes(typeToAllTypes(initialType)),
mType(type),
mTypeName(typeName),
mSubTypeName(subTypeName),
mAvailable(available),
mConnected(connected),
mRoaming(roaming),
mNetworkHandle(networkHandle),
mApn(apn), mId(NETWORKINFO_DATA_ITEM_ID) {
mAllNetworkHandles[0].networkHandle = networkHandle;
mAllNetworkHandles[0].networkType = initialType;
}
virtual ~NetworkInfoDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
inline virtual NetworkType getType(void) const {
return (NetworkType)mType;
}
inline uint64_t getAllTypes() { return mAllTypes; }
inline NetworkInfoType* getNetworkHandle() {
return &mAllNetworkHandles[0];
}
// Data members
uint64_t mAllTypes;
int32_t mType;
string mTypeName;
string mSubTypeName;
bool mAvailable;
bool mConnected;
bool mRoaming;
NetworkInfoType mAllNetworkHandles[MAX_NETWORK_HANDLES];
uint64_t mNetworkHandle;
string mApn;
protected:
DataItemId mId;
inline uint64_t typeToAllTypes(NetworkType type) {
return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ? 0 : (1<<type);
}
};
class ServiceStatusDataItemBase : public IDataItemCore {
public:
ServiceStatusDataItemBase(int32_t serviceState) :
mServiceState (serviceState),
mId(SERVICESTATUS_DATA_ITEM_ID) {}
virtual ~ServiceStatusDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
int32_t mServiceState;
protected:
DataItemId mId;
};
class ModelDataItemBase : public IDataItemCore {
public:
ModelDataItemBase(const string & name) :
mModel (name),
mId(MODEL_DATA_ITEM_ID) {}
virtual ~ModelDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
string mModel;
protected:
DataItemId mId;
};
class ManufacturerDataItemBase : public IDataItemCore {
public:
ManufacturerDataItemBase(const string & name) :
mManufacturer (name),
mId(MANUFACTURER_DATA_ITEM_ID) {}
virtual ~ManufacturerDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
string mManufacturer;
protected:
DataItemId mId;
};
class RilServiceInfoDataItemBase : public IDataItemCore {
public:
inline RilServiceInfoDataItemBase() :
mData(nullptr), mId(RILSERVICEINFO_DATA_ITEM_ID) {}
inline virtual ~RilServiceInfoDataItemBase() { if (nullptr != mData) free(mData); }
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
inline RilServiceInfoDataItemBase(const RilServiceInfoDataItemBase& peer) :
RilServiceInfoDataItemBase() {
peer.setPeerData(*this);
}
inline virtual bool operator==(const RilServiceInfoDataItemBase& other) const {
return other.mData == mData;
}
inline virtual void setPeerData(RilServiceInfoDataItemBase& /*peer*/) const {}
void* mData;
protected:
DataItemId mId;
};
class RilCellInfoDataItemBase : public IDataItemCore {
public:
inline RilCellInfoDataItemBase() :
mData(nullptr), mId(RILCELLINFO_DATA_ITEM_ID) {}
inline virtual ~RilCellInfoDataItemBase() { if (nullptr != mData) free(mData); }
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
inline RilCellInfoDataItemBase(const RilCellInfoDataItemBase& peer) :
RilCellInfoDataItemBase() {
peer.setPeerData(*this);
}
inline virtual bool operator==(const RilCellInfoDataItemBase& other) const {
return other.mData == mData;
}
inline virtual void setPeerData(RilCellInfoDataItemBase& /*peer*/) const {}
void* mData;
protected:
DataItemId mId;
};
class WifiSupplicantStatusDataItemBase : public IDataItemCore {
public:
WifiSupplicantStatusDataItemBase() :
mState((WifiSupplicantState)WIFI_SUPPLICANT_DEFAULT_STATE),
mApMacAddressValid(false),
mWifiApSsidValid(false),
mId(WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID) {
memset (&mApMacAddress, 0, sizeof (mApMacAddress));
mWifiApSsid.clear();
}
virtual ~WifiSupplicantStatusDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
typedef enum WifiSupplicantState {
DISCONNECTED,
INTERFACE_DISABLED,
INACTIVE,
SCANNING,
AUTHENTICATING,
ASSOCIATING,
ASSOCIATED,
FOUR_WAY_HANDSHAKE,
GROUP_HANDSHAKE,
COMPLETED,
DORMANT,
UNINITIALIZED,
INVALID
} WifiSupplicantState;
/* Represents whether access point attach state*/
WifiSupplicantState mState;
/* Represents info on whether ap mac address is valid */
bool mApMacAddressValid;
/* Represents mac address of the wifi access point*/
uint8_t mApMacAddress[MAC_ADDRESS_LENGTH];
/* Represents info on whether ap SSID is valid */
bool mWifiApSsidValid;
/* Represents Wifi SSID string*/
string mWifiApSsid;
protected:
DataItemId mId;
};
class TacDataItemBase : public IDataItemCore {
public:
TacDataItemBase(const string & name) :
mValue (name),
mId(TAC_DATA_ITEM_ID) {}
virtual ~TacDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
string mValue;
protected:
DataItemId mId;
};
class MccmncDataItemBase : public IDataItemCore {
public:
MccmncDataItemBase(const string & name) :
mValue(name),
mId(MCCMNC_DATA_ITEM_ID) {}
virtual ~MccmncDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
// Data members
string mValue;
protected:
DataItemId mId;
};
class SrnDeviceScanDetailsDataItemBase : public IDataItemCore {
public:
SrnDeviceScanDetailsDataItemBase(DataItemId Id) :
mValidSrnData(false),
mApSrnRssi(-1),
mApSrnTimestamp(0),
mRequestTimestamp(0),
mReceiveTimestamp(0),
mErrorCause(-1),
mId(Id) {}
virtual ~SrnDeviceScanDetailsDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
// Data members common to all SRN tech types
/* Represents info on whether SRN data is valid (no error)*/
bool mValidSrnData;
/* SRN device RSSI reported */
int32_t mApSrnRssi;
/* MAC adress of SRN device */
uint8_t mApSrnMacAddress[SRN_MAC_ADDRESS_LENGTH];
/* UTC timestamp at which the scan was requested.for this SRN device*/
int64_t mApSrnTimestamp;
/* UTC timestamp at which the scan was started. */
int64_t mRequestTimestamp;
/* UTC timestamp at which the scan was received.*/
int64_t mReceiveTimestamp;
/* Reason for the error/failure if SRN details are not valid */
int32_t mErrorCause;
protected:
DataItemId mId;
};
class BtDeviceScanDetailsDataItemBase : public SrnDeviceScanDetailsDataItemBase {
public:
BtDeviceScanDetailsDataItemBase() :
SrnDeviceScanDetailsDataItemBase(BT_SCAN_DATA_ITEM_ID) {}
virtual ~BtDeviceScanDetailsDataItemBase() {}
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
};
class BtLeDeviceScanDetailsDataItemBase : public SrnDeviceScanDetailsDataItemBase {
public:
BtLeDeviceScanDetailsDataItemBase() :
SrnDeviceScanDetailsDataItemBase(BTLE_SCAN_DATA_ITEM_ID) {}
virtual ~BtLeDeviceScanDetailsDataItemBase() {}
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
};
class BatteryLevelDataItemBase : public IDataItemCore {
public:
inline BatteryLevelDataItemBase(uint8_t batteryPct) :
mBatteryPct(batteryPct), mId(BATTERY_LEVEL_DATA_ITEM_ID) {}
inline ~BatteryLevelDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
// Data members
uint8_t mBatteryPct;
protected:
DataItemId mId;
};
} // namespace loc_core
#endif //__DATAITEMCONCRETEBASETYPES__

View File

@@ -0,0 +1,79 @@
/* Copyright (c) 2015-2017 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 __DATAITEMID_H__
#define __DATAITEMID_H__
/**
* Enumeration of Data Item types
* When add/remove/update changes are made to Data Items, this file needs to be updated
* accordingly
*/
typedef enum e_DataItemId {
INVALID_DATA_ITEM_ID = -1,
// 0 - 4
AIRPLANEMODE_DATA_ITEM_ID,
ENH_DATA_ITEM_ID,
GPSSTATE_DATA_ITEM_ID,
NLPSTATUS_DATA_ITEM_ID,
WIFIHARDWARESTATE_DATA_ITEM_ID,
// 5 - 9
NETWORKINFO_DATA_ITEM_ID,
RILVERSION_DATA_ITEM_ID,
RILSERVICEINFO_DATA_ITEM_ID,
RILCELLINFO_DATA_ITEM_ID,
SERVICESTATUS_DATA_ITEM_ID,
// 10 - 14
MODEL_DATA_ITEM_ID,
MANUFACTURER_DATA_ITEM_ID,
VOICECALL_DATA_ITEM,
ASSISTED_GPS_DATA_ITEM_ID,
SCREEN_STATE_DATA_ITEM_ID,
// 15 - 19
POWER_CONNECTED_STATE_DATA_ITEM_ID,
TIMEZONE_CHANGE_DATA_ITEM_ID,
TIME_CHANGE_DATA_ITEM_ID,
WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID,
SHUTDOWN_STATE_DATA_ITEM_ID,
// 20 - 24
TAC_DATA_ITEM_ID,
MCCMNC_DATA_ITEM_ID,
BTLE_SCAN_DATA_ITEM_ID,
BT_SCAN_DATA_ITEM_ID,
OEM_GTP_UPLOAD_TRIGGER_READY_ITEM_ID,
MAX_DATA_ITEM_ID,
// 26 -
BATTERY_LEVEL_DATA_ITEM_ID,
MAX_DATA_ITEM_ID_1_1,
} DataItemId;
#endif // #ifndef __DATAITEMID_H__

View File

@@ -0,0 +1,82 @@
/* Copyright (c) 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
* 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_TAG "DataItemsFactoryProxy"
#include <dlfcn.h>
#include <DataItemId.h>
#include <IDataItemCore.h>
#include <DataItemsFactoryProxy.h>
#include <loc_pla.h>
#include <log_util.h>
#include "loc_misc_utils.h"
namespace loc_core
{
void* DataItemsFactoryProxy::dataItemLibHandle = NULL;
get_concrete_data_item_fn* DataItemsFactoryProxy::getConcreteDIFunc = NULL;
IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id)
{
IDataItemCore *mydi = nullptr;
if (NULL != getConcreteDIFunc) {
mydi = (*getConcreteDIFunc)(id);
}
else {
getConcreteDIFunc = (get_concrete_data_item_fn * )
dlGetSymFromLib(dataItemLibHandle, DATA_ITEMS_LIB_NAME, DATA_ITEMS_GET_CONCRETE_DI);
if (NULL != getConcreteDIFunc) {
LOC_LOGd("Loaded function %s : %p", DATA_ITEMS_GET_CONCRETE_DI, getConcreteDIFunc);
mydi = (*getConcreteDIFunc)(id);
}
else {
// dlysm failed.
const char * err = dlerror();
if (NULL == err)
{
err = "Unknown";
}
LOC_LOGe("failed to find symbol %s; error=%s", DATA_ITEMS_GET_CONCRETE_DI, err);
}
}
return mydi;
}
void DataItemsFactoryProxy::closeDataItemLibraryHandle()
{
if (NULL != dataItemLibHandle) {
dlclose(dataItemLibHandle);
dataItemLibHandle = NULL;
}
}
} // namespace loc_core

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