init 16.0
This commit is contained in:
parent
4695aca525
commit
5bb919d197
284 changed files with 4994 additions and 4807 deletions
0
Android.mk
Normal file → Executable file
0
Android.mk
Normal file → Executable file
2
AndroidProducts.mk
Normal file → Executable file
2
AndroidProducts.mk
Normal file → Executable file
|
@ -14,4 +14,4 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
PRODUCT_MAKEFILES := \
|
PRODUCT_MAKEFILES := \
|
||||||
$(LOCAL_DIR)/full_gts3llte.mk
|
$(LOCAL_DIR)/lineage_gts3llte.mk
|
||||||
|
|
104
BoardConfig.mk
104
BoardConfig.mk
|
@ -1,5 +1,6 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 The CyanogenMod Project
|
# Copyright (C) 2016 The CyanogenMod Project
|
||||||
|
# Copyright (C) 2017-2018 The LineageOS Project
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
BOARD_VENDOR := samsung
|
BOARD_VENDOR := samsung
|
||||||
|
|
||||||
|
@ -22,6 +24,9 @@ TARGET_SPECIFIC_HEADER_PATH := $(DEVICE_PATH)/include
|
||||||
# Assert
|
# Assert
|
||||||
TARGET_OTA_ASSERT_DEVICE := gts3llte
|
TARGET_OTA_ASSERT_DEVICE := gts3llte
|
||||||
|
|
||||||
|
# ADB Legacy Interface
|
||||||
|
TARGET_USES_LEGACY_ADB_INTERFACE := true
|
||||||
|
|
||||||
# Architecture
|
# Architecture
|
||||||
TARGET_ARCH := arm64
|
TARGET_ARCH := arm64
|
||||||
TARGET_ARCH_VARIANT := armv8-a
|
TARGET_ARCH_VARIANT := armv8-a
|
||||||
|
@ -30,7 +35,7 @@ TARGET_CPU_ABI2 :=
|
||||||
TARGET_CPU_VARIANT := kryo
|
TARGET_CPU_VARIANT := kryo
|
||||||
|
|
||||||
TARGET_2ND_ARCH := arm
|
TARGET_2ND_ARCH := arm
|
||||||
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
|
TARGET_2ND_ARCH_VARIANT := armv8-a
|
||||||
TARGET_2ND_CPU_ABI := armeabi-v7a
|
TARGET_2ND_CPU_ABI := armeabi-v7a
|
||||||
TARGET_2ND_CPU_ABI2 := armeabi
|
TARGET_2ND_CPU_ABI2 := armeabi
|
||||||
TARGET_2ND_CPU_VARIANT := kryo
|
TARGET_2ND_CPU_VARIANT := kryo
|
||||||
|
@ -43,23 +48,29 @@ TARGET_NO_BOOTLOADER := true
|
||||||
|
|
||||||
# Kernel
|
# Kernel
|
||||||
BOARD_KERNEL_BASE := 0x80000000
|
BOARD_KERNEL_BASE := 0x80000000
|
||||||
BOARD_KERNEL_CMDLINE := console=null androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7464900.sdhci lpm_levels.sleep_disabled=1 rcupdate.rcu_expedited=1 cma=32M@0-0xffffffff
|
BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7464900.sdhci lpm_levels.sleep_disabled=1 rcupdate.rcu_expedited=1 cma=32M@0-0xffffffff
|
||||||
BOARD_KERNEL_IMAGE_NAME := Image.gz
|
BOARD_KERNEL_IMAGE_NAME := Image.gz
|
||||||
BOARD_KERNEL_PAGESIZE := 4096
|
BOARD_KERNEL_PAGESIZE := 4096
|
||||||
BOARD_KERNEL_SEPARATED_DT := true
|
BOARD_KERNEL_SEPARATED_DT := true
|
||||||
BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x02200000 --tags_offset 0x02000000 --board SRPPK08B000KU
|
BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x02200000 --tags_offset 0x02000000
|
||||||
TARGET_KERNEL_SOURCE := kernel/samsung/msm8996
|
TARGET_KERNEL_SOURCE := kernel/samsung/msm8996
|
||||||
BOARD_CUSTOM_BOOTIMG := true
|
BOARD_CUSTOM_BOOTIMG := true
|
||||||
BOARD_CUSTOM_BOOTIMG_MK := hardware/samsung/mkbootimg.mk
|
BOARD_CUSTOM_BOOTIMG_MK := hardware/samsung/mkbootimg.mk
|
||||||
TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-android-
|
TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-android-
|
||||||
TARGET_KERNEL_CONFIG := lineage_gts3llte_defconfig
|
TARGET_KERNEL_CONFIG := lineage_gts3llte_defconfig
|
||||||
|
|
||||||
|
TARGET_COMPILE_WITH_MSM_KERNEL := true
|
||||||
|
#SELINUX_IGNORE_NEVERALLOWS := true
|
||||||
|
|
||||||
# Platform
|
# Platform
|
||||||
TARGET_BOARD_PLATFORM := msm8996
|
TARGET_BOARD_PLATFORM := msm8996
|
||||||
TARGET_BOARD_PLATFORM_GPU := qcom-adreno530
|
TARGET_BOARD_PLATFORM_GPU := qcom-adreno530
|
||||||
|
|
||||||
|
# Properties
|
||||||
|
#BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
|
||||||
|
|
||||||
# ANT+
|
# ANT+
|
||||||
BOARD_ANT_WIRELESS_DEVICE := "qualcomm-uart"
|
BOARD_ANT_WIRELESS_DEVICE := "qualcomm-hidl"
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
#AUDIO_FEATURE_ENABLED_AAC_ADTS_OFFLOAD := true
|
#AUDIO_FEATURE_ENABLED_AAC_ADTS_OFFLOAD := true
|
||||||
|
@ -84,10 +95,11 @@ AUDIO_FEATURE_ENABLED_PCM_OFFLOAD_24 := true
|
||||||
#AUDIO_FEATURE_ENABLED_WMA_OFFLOAD := true
|
#AUDIO_FEATURE_ENABLED_WMA_OFFLOAD := true
|
||||||
AUDIO_USE_LL_AS_PRIMARY_OUTPUT := true
|
AUDIO_USE_LL_AS_PRIMARY_OUTPUT := true
|
||||||
#BOARD_SUPPORTS_SOUND_TRIGGER := true
|
#BOARD_SUPPORTS_SOUND_TRIGGER := true
|
||||||
BOARD_USES_ALSA_AUDIO := true
|
#BOARD_USES_ALSA_AUDIO := true
|
||||||
#USE_CUSTOM_AUDIO_POLICY := 1
|
#USE_CUSTOM_AUDIO_POLICY := 1
|
||||||
|
|
||||||
#AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
|
# Bionic
|
||||||
|
TARGET_NEEDS_LEGACY_MUTEX_HANDLE := true
|
||||||
|
|
||||||
# Bluetooth
|
# Bluetooth
|
||||||
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth
|
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth
|
||||||
|
@ -97,44 +109,66 @@ BOARD_HAVE_BLUETOOTH_QCOM := true
|
||||||
QCOM_BT_USE_BTNV := true
|
QCOM_BT_USE_BTNV := true
|
||||||
BOARD_BLUETOOTH_BDROID_HCILP_INCLUDED := false
|
BOARD_BLUETOOTH_BDROID_HCILP_INCLUDED := false
|
||||||
|
|
||||||
|
# CAF HALs
|
||||||
|
TARGET_QCOM_MEDIA_VARIANT := caf-msm8996
|
||||||
|
TARGET_QCOM_DISPLAY_VARIANT := caf-msm8996
|
||||||
|
|
||||||
|
PRODUCT_SOONG_NAMESPACES += \
|
||||||
|
hardware/qcom/display-$(TARGET_QCOM_DISPLAY_VARIANT) \
|
||||||
|
hardware/qcom/media-$(TARGET_QCOM_MEDIA_VARIANT)
|
||||||
|
|
||||||
# Camera
|
# Camera
|
||||||
USE_CAMERA_STUB := true
|
USE_CAMERA_STUB := true
|
||||||
USE_DEVICE_SPECIFIC_CAMERA := true
|
USE_DEVICE_SPECIFIC_CAMERA := true
|
||||||
TARGET_USES_MEDIA_EXTENSIONS := true
|
TARGET_USES_MEDIA_EXTENSIONS := true
|
||||||
|
|
||||||
# Charger
|
# Charger
|
||||||
#BOARD_CHARGER_ENABLE_SUSPEND := true
|
BOARD_CHARGER_ENABLE_SUSPEND := true
|
||||||
|
|
||||||
# Dex
|
|
||||||
ifeq ($(HOST_OS),linux)
|
|
||||||
ifneq ($(TARGET_BUILD_VARIANT),eng)
|
|
||||||
WITH_DEXPREOPT ?= true
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
|
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
|
BOARD_USES_ADRENO := true
|
||||||
|
|
||||||
MAX_VIRTUAL_DISPLAY_DIMENSION := 4096
|
MAX_VIRTUAL_DISPLAY_DIMENSION := 4096
|
||||||
TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
|
TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
|
||||||
TARGET_USES_C2D_COMPOSITION := true
|
|
||||||
|
TARGET_USES_ION := true
|
||||||
|
TARGET_USES_NEW_ION_API :=true
|
||||||
TARGET_USES_GRALLOC1 := true
|
TARGET_USES_GRALLOC1 := true
|
||||||
TARGET_USES_HWC2 := true
|
TARGET_USES_HWC2 := true
|
||||||
TARGET_USES_ION := true
|
|
||||||
TARGET_USES_OVERLAY := true
|
TARGET_USES_OVERLAY := true
|
||||||
USE_OPENGL_RENDERER := true
|
|
||||||
|
|
||||||
MAX_EGL_CACHE_KEY_SIZE := 12*1024
|
MAX_EGL_CACHE_KEY_SIZE := 12*1024
|
||||||
MAX_EGL_CACHE_SIZE := 2048*1024
|
MAX_EGL_CACHE_SIZE := 2048*1024
|
||||||
|
|
||||||
OVERRIDE_RS_DRIVER := libRSDriver_adreno.so
|
NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
|
||||||
|
|
||||||
VSYNC_EVENT_PHASE_OFFSET_NS := 2000000
|
|
||||||
SF_VSYNC_EVENT_PHASE_OFFSET_NS := 6000000
|
SF_VSYNC_EVENT_PHASE_OFFSET_NS := 6000000
|
||||||
|
VSYNC_EVENT_PHASE_OFFSET_NS := 2000000
|
||||||
|
|
||||||
|
OVERRIDE_RS_DRIVER:= libRSDriver_adreno.so
|
||||||
|
USE_OPENGL_RENDERER := true
|
||||||
|
|
||||||
|
# surfaceflinger orientation
|
||||||
|
SF_PRIMARY_DISPLAY_ORIENTATION := 270
|
||||||
|
|
||||||
|
# DRM
|
||||||
|
TARGET_ENABLE_MEDIADRM_64 := true
|
||||||
|
|
||||||
# Encryption
|
# Encryption
|
||||||
TARGET_HW_DISK_ENCRYPTION := true
|
TARGET_HW_DISK_ENCRYPTION := true
|
||||||
|
|
||||||
# Filesystem
|
# Filesystem
|
||||||
|
TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/config.fs
|
||||||
|
|
||||||
|
# HIDL
|
||||||
|
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := $(DEVICE_PATH)/configs/vendor_framework_compatibility_matrix.xml
|
||||||
|
#DEVICE_FRAMEWORK_MANIFEST_FILE := $(DEVICE_PATH)/configs/framework_manifest.xml
|
||||||
|
DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/configs/manifest.xml
|
||||||
|
DEVICE_MATRIX_FILE := $(DEVICE_PATH)/configs/compatibility_matrix.xml
|
||||||
|
|
||||||
|
# Lineage Hardware
|
||||||
|
JAVA_SOURCE_OVERLAYS := org.lineageos.hardware|$(DEVICE_PATH)/lineagehw|**/*.java
|
||||||
|
|
||||||
|
# Partitions
|
||||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 79691776
|
BOARD_BOOTIMAGE_PARTITION_SIZE := 79691776
|
||||||
BOARD_CACHEIMAGE_PARTITION_SIZE := 209715200
|
BOARD_CACHEIMAGE_PARTITION_SIZE := 209715200
|
||||||
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := f2fs
|
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := f2fs
|
||||||
|
@ -144,24 +178,17 @@ BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3072000000
|
||||||
#BOARD_SYSTEMIMAGE_PARTITION_SIZE := 4194304000
|
#BOARD_SYSTEMIMAGE_PARTITION_SIZE := 4194304000
|
||||||
BOARD_USERDATAIMAGE_PARTITION_SIZE := 26226982912
|
BOARD_USERDATAIMAGE_PARTITION_SIZE := 26226982912
|
||||||
BOARD_FLASH_BLOCK_SIZE := 131072
|
BOARD_FLASH_BLOCK_SIZE := 131072
|
||||||
|
TARGET_USES_MKE2FS := true
|
||||||
# Filesystem
|
|
||||||
TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/config.fs
|
|
||||||
TARGET_EXFAT_DRIVER := exfat
|
|
||||||
|
|
||||||
# Fingerprint
|
# Fingerprint
|
||||||
TARGET_SEC_FP_HAL_VARIANT := bauth
|
TARGET_SEC_FP_HAL_VARIANT := bauth
|
||||||
|
|
||||||
# HIDL
|
|
||||||
DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/configs/manifest.xml
|
|
||||||
DEVICE_MATRIX_FILE := $(DEVICE_PATH)/configs/compatibility_matrix.xml
|
|
||||||
|
|
||||||
TARGET_LD_SHIM_LIBS := \
|
TARGET_LD_SHIM_LIBS := \
|
||||||
/system/vendor/lib/libbauthserver.so|/vendor/lib/libbauthtzcommon_shim.so \
|
/system/vendor/lib/libbauthserver.so|/vendor/lib/libbauthtzcommon_shim.so \
|
||||||
/system/vendor/lib64/libbauthserver.so|/vendor/lib64/libbauthtzcommon_shim.so
|
/system/vendor/lib64/libbauthserver.so|/vendor/lib64/libbauthtzcommon_shim.so
|
||||||
|
|
||||||
TARGET_LD_SHIM_LIBS += \
|
TARGET_LD_SHIM_LIBS += \
|
||||||
/system/vendor/lib/hw/camera.msm8996.so|/system/vendor/lib/libshims_cameraclient.so \
|
/system/vendor/lib/hw/camera.msm8996.so|/system/vendor/lib/libshims_cameraclient.so
|
||||||
|
|
||||||
# Init
|
# Init
|
||||||
TARGET_PLATFORM_DEVICE_BASE := /devices/soc/
|
TARGET_PLATFORM_DEVICE_BASE := /devices/soc/
|
||||||
|
@ -169,17 +196,13 @@ TARGET_PLATFORM_DEVICE_BASE := /devices/soc/
|
||||||
# Keymaster
|
# Keymaster
|
||||||
TARGET_PROVIDES_KEYMASTER := true
|
TARGET_PROVIDES_KEYMASTER := true
|
||||||
|
|
||||||
# Lineage Hardware
|
|
||||||
BOARD_HARDWARE_CLASS += \
|
|
||||||
$(DEVICE_PATH)/lineagehw
|
|
||||||
|
|
||||||
# Power
|
# Power
|
||||||
#TARGET_HAS_NO_WIFI_STATS := true
|
TARGET_HAS_NO_WLAN_STATS := true
|
||||||
TARGET_POWERHAL_VARIANT := qcom
|
TARGET_USES_INTERACTION_BOOST := true
|
||||||
|
|
||||||
# QCOM
|
# QCOM
|
||||||
BOARD_USES_QCOM_HARDWARE := true
|
BOARD_USES_QCOM_HARDWARE := true
|
||||||
TARGET_USE_SDCLANG := true
|
#TARGET_USE_SDCLANG := true
|
||||||
|
|
||||||
# Ramdisk
|
# Ramdisk
|
||||||
BOARD_ROOT_EXTRA_FOLDERS := dsp efs firmware firmware-modem persist
|
BOARD_ROOT_EXTRA_FOLDERS := dsp efs firmware firmware-modem persist
|
||||||
|
@ -194,12 +217,15 @@ TARGET_USERIMAGES_USE_F2FS := true
|
||||||
|
|
||||||
# Treble
|
# Treble
|
||||||
#PRODUCT_FULL_TREBLE_OVERRIDE := true
|
#PRODUCT_FULL_TREBLE_OVERRIDE := true
|
||||||
PRODUCT_VENDOR_MOVE_ENABLED := true
|
#PRODUCT_VENDOR_MOVE_ENABLED := true
|
||||||
|
|
||||||
# RIL
|
# RIL
|
||||||
PROTOBUF_SUPPORTED := true
|
PROTOBUF_SUPPORTED := true
|
||||||
TARGET_RIL_VARIANT := caf
|
TARGET_RIL_VARIANT := caf
|
||||||
|
|
||||||
|
# Security patch level - T825XXU2BRL2
|
||||||
|
VENDOR_SECURITY_PATCH := 2018-12-01
|
||||||
|
|
||||||
# SELinux
|
# SELinux
|
||||||
include device/qcom/sepolicy/sepolicy.mk
|
include device/qcom/sepolicy/sepolicy.mk
|
||||||
BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy
|
BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy
|
||||||
|
@ -221,4 +247,4 @@ WPA_SUPPLICANT_VERSION := VER_0_8_X
|
||||||
BOARD_HAVE_SAMSUNG_WIFI := true
|
BOARD_HAVE_SAMSUNG_WIFI := true
|
||||||
|
|
||||||
# inherit from the proprietary version
|
# inherit from the proprietary version
|
||||||
-include vendor/samsung/gts3llte/BoardConfigVendor.mk
|
-include vendor/samsung/gts3llte/BoardConfigVendor.mk
|
||||||
|
|
78
config.fs
Normal file → Executable file
78
config.fs
Normal file → Executable file
|
@ -1,14 +1,20 @@
|
||||||
[AID_QCOM_DIAG]
|
[AID_VENDOR_QCOM_DIAG]
|
||||||
value:2950
|
value:2950
|
||||||
|
|
||||||
[AID_QTI_DIAG]
|
[AID_VENDOR_QTI_DIAG]
|
||||||
value:2901
|
value:2901
|
||||||
|
|
||||||
[AID_RFS]
|
[AID_VENDOR_QDSS]
|
||||||
value:2951
|
value:2902
|
||||||
|
|
||||||
[AID_RFS_SHARED]
|
[AID_VENDOR_RFS]
|
||||||
value:2952
|
value:2903
|
||||||
|
|
||||||
|
[AID_VENDOR_RFS_SHARED]
|
||||||
|
value:2904
|
||||||
|
|
||||||
|
[AID_VENDOR_ADPL_ODL]
|
||||||
|
value:2905
|
||||||
|
|
||||||
[vendor/bin/wcnss_filter]
|
[vendor/bin/wcnss_filter]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
@ -16,25 +22,19 @@ user: AID_BLUETOOTH
|
||||||
group: AID_BLUETOOTH
|
group: AID_BLUETOOTH
|
||||||
caps: BLOCK_SUSPEND
|
caps: BLOCK_SUSPEND
|
||||||
|
|
||||||
[system/vendor/bin/wcnss_filter]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_BLUETOOTH
|
|
||||||
group: AID_BLUETOOTH
|
|
||||||
caps: BLOCK_SUSPEND
|
|
||||||
|
|
||||||
[vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti]
|
[vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_BLUETOOTH
|
user: AID_BLUETOOTH
|
||||||
group: AID_BLUETOOTH
|
group: AID_BLUETOOTH
|
||||||
caps: BLOCK_SUSPEND NET_ADMIN
|
caps: BLOCK_SUSPEND NET_ADMIN
|
||||||
|
|
||||||
[system/vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti]
|
[vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_SYSTEM
|
user: AID_SYSTEM
|
||||||
group: AID_SYSTEM
|
group: AID_SYSTEM
|
||||||
caps: BLOCK_SUSPEND NET_ADMIN
|
caps: BLOCK_SUSPEND NET_ADMIN
|
||||||
|
|
||||||
[system/bin/cnss-daemon]
|
[vendor/bin/cnss-daemon]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_BLUETOOTH
|
user: AID_BLUETOOTH
|
||||||
group: AID_BLUETOOTH
|
group: AID_BLUETOOTH
|
||||||
|
@ -46,48 +46,18 @@ user: AID_SYSTEM
|
||||||
group: AID_SYSTEM
|
group: AID_SYSTEM
|
||||||
caps: NET_BIND_SERVICE
|
caps: NET_BIND_SERVICE
|
||||||
|
|
||||||
[system/vendor/bin/pm-service]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_SYSTEM
|
|
||||||
caps: NET_BIND_SERVICE
|
|
||||||
|
|
||||||
[system/bin/pm-service]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_SYSTEM
|
|
||||||
caps: NET_BIND_SERVICE
|
|
||||||
|
|
||||||
[vendor/bin/pd-mapper]
|
[vendor/bin/pd-mapper]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_SYSTEM
|
user: AID_SYSTEM
|
||||||
group: AID_SYSTEM
|
group: AID_SYSTEM
|
||||||
caps: NET_BIND_SERVICE
|
caps: NET_BIND_SERVICE
|
||||||
|
|
||||||
[system/vendor/bin/pd-mapper]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_SYSTEM
|
|
||||||
caps: NET_BIND_SERVICE
|
|
||||||
|
|
||||||
[system/bin/pd-mapper]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_SYSTEM
|
|
||||||
caps: NET_BIND_SERVICE
|
|
||||||
|
|
||||||
[vendor/bin/imsdatadaemon]
|
[vendor/bin/imsdatadaemon]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_SYSTEM
|
user: AID_SYSTEM
|
||||||
group: AID_SYSTEM
|
group: AID_SYSTEM
|
||||||
caps: NET_BIND_SERVICE
|
caps: NET_BIND_SERVICE
|
||||||
|
|
||||||
[system/vendor/bin/imsdatadaemon]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_SYSTEM
|
|
||||||
caps: NET_BIND_SERVICE
|
|
||||||
|
|
||||||
[vendor/bin/ims_rtp_daemon]
|
[vendor/bin/ims_rtp_daemon]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_SYSTEM
|
user: AID_SYSTEM
|
||||||
|
@ -104,13 +74,7 @@ caps: NET_BIND_SERVICE
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_SYSTEM
|
user: AID_SYSTEM
|
||||||
group: AID_RADIO
|
group: AID_RADIO
|
||||||
caps: WAKE_ALARM
|
caps: NET_BIND_SERVICE BLOCK_SUSPEND WAKE_ALARM
|
||||||
|
|
||||||
[system/vendor/bin/imsrcsd]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_RADIO
|
|
||||||
caps: WAKE_ALARM
|
|
||||||
|
|
||||||
[vendor/bin/cnd]
|
[vendor/bin/cnd]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
@ -118,23 +82,17 @@ user: AID_SYSTEM
|
||||||
group: AID_SYSTEM
|
group: AID_SYSTEM
|
||||||
caps: NET_BIND_SERVICE BLOCK_SUSPEND NET_ADMIN
|
caps: NET_BIND_SERVICE BLOCK_SUSPEND NET_ADMIN
|
||||||
|
|
||||||
[system/vendor/bin/cnd]
|
|
||||||
mode: 0755
|
|
||||||
user: AID_SYSTEM
|
|
||||||
group: AID_SYSTEM
|
|
||||||
caps: NET_BIND_SERVICE BLOCK_SUSPEND NET_ADMIN
|
|
||||||
|
|
||||||
[vendor/bin/slim_daemon]
|
[vendor/bin/slim_daemon]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_GPS
|
user: AID_GPS
|
||||||
group: AID_GPS
|
group: AID_GPS
|
||||||
caps: NET_BIND_SERVICE
|
caps: NET_BIND_SERVICE
|
||||||
|
|
||||||
[system/vendor/bin/slim_daemon]
|
[vendor/bin/loc_launcher]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
user: AID_GPS
|
user: AID_GPS
|
||||||
group: AID_GPS
|
group: AID_GPS
|
||||||
caps: NET_BIND_SERVICE
|
caps: SETUID SETGID
|
||||||
|
|
||||||
[vendor/bin/xtwifi-client]
|
[vendor/bin/xtwifi-client]
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
@ -164,4 +122,4 @@ caps: 0
|
||||||
mode: 0771
|
mode: 0771
|
||||||
user: AID_MEDIA
|
user: AID_MEDIA
|
||||||
group: AID_MEDIA
|
group: AID_MEDIA
|
||||||
caps: 0
|
caps: 0
|
||||||
|
|
0
configs/audio/audio_platform_info.xml
Normal file → Executable file
0
configs/audio/audio_platform_info.xml
Normal file → Executable file
0
configs/audio/mixer_paths_tasha.xml
Normal file → Executable file
0
configs/audio/mixer_paths_tasha.xml
Normal file → Executable file
|
@ -7,14 +7,14 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<!-- <hal format="hidl" optional="false">
|
<hal format="hidl" optional="false">
|
||||||
<name>android.frameworks.sensorservice</name>
|
<name>android.frameworks.sensorservice</name>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ISensorManager</name>
|
<name>ISensorManager</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal> -->
|
</hal>
|
||||||
<hal format="hidl" optional="false">
|
<hal format="hidl" optional="false">
|
||||||
<name>android.hidl.allocator</name>
|
<name>android.hidl.allocator</name>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
@ -55,4 +55,5 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
</compatibility-matrix>
|
|
||||||
|
</compatibility-matrix>
|
||||||
|
|
0
configs/data/dsi_config.xml
Normal file → Executable file
0
configs/data/dsi_config.xml
Normal file → Executable file
0
configs/data/netmgr_config.xml
Normal file → Executable file
0
configs/data/netmgr_config.xml
Normal file → Executable file
0
configs/data/qmi_config.xml
Normal file → Executable file
0
configs/data/qmi_config.xml
Normal file → Executable file
159
configs/manifest.xml
Normal file → Executable file
159
configs/manifest.xml
Normal file → Executable file
|
@ -1,3 +1,30 @@
|
||||||
|
<!-- Copyright (c) 2017, 2018 The Linux Foundation. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following
|
||||||
|
disclaimer in the documentation and/or other materials provided
|
||||||
|
with the distribution.
|
||||||
|
* Neither the name of The Linux Foundation nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
-->
|
||||||
<manifest version="1.0" type="device">
|
<manifest version="1.0" type="device">
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.biometrics.fingerprint</name>
|
<name>android.hardware.biometrics.fingerprint</name>
|
||||||
|
@ -19,7 +46,7 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.audio</name>
|
<name>android.hardware.audio</name>
|
||||||
<transport>hwbinder</transport>
|
<transport arch="32">passthrough</transport>
|
||||||
<version>2.0</version>
|
<version>2.0</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IDevicesFactory</name>
|
<name>IDevicesFactory</name>
|
||||||
|
@ -28,14 +55,14 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.audio.effect</name>
|
<name>android.hardware.audio.effect</name>
|
||||||
<transport>hwbinder</transport>
|
<transport arch="32">passthrough</transport>
|
||||||
<version>2.0</version>
|
<version>2.0</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IEffectsFactory</name>
|
<name>IEffectsFactory</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<!-- <hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.bluetooth</name>
|
<name>android.hardware.bluetooth</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
@ -43,8 +70,8 @@
|
||||||
<name>IBluetoothHci</name>
|
<name>IBluetoothHci</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal> -->
|
</hal>
|
||||||
<!-- <hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.camera.provider</name>
|
<name>android.hardware.camera.provider</name>
|
||||||
<transport arch="32">passthrough</transport>
|
<transport arch="32">passthrough</transport>
|
||||||
<version>2.4</version>
|
<version>2.4</version>
|
||||||
|
@ -52,11 +79,20 @@
|
||||||
<name>ICameraProvider</name>
|
<name>ICameraProvider</name>
|
||||||
<instance>legacy/0</instance>
|
<instance>legacy/0</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal> -->
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.configstore</name>
|
<name>android.hardware.cas</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IMediaCasService</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>android.hardware.configstore</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.1</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ISurfaceFlingerConfigs</name>
|
<name>ISurfaceFlingerConfigs</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -69,17 +105,19 @@
|
||||||
<interface>
|
<interface>
|
||||||
<name>ICryptoFactory</name>
|
<name>ICryptoFactory</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
<instance>widevine</instance>
|
|
||||||
</interface>
|
</interface>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IDrmFactory</name>
|
<name>IDrmFactory</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
<instance>widevine</instance>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
<fqname>@1.1::ICryptoFactory/clearkey</fqname>
|
||||||
|
<fqname>@1.1::IDrmFactory/clearkey</fqname>
|
||||||
|
<fqname>@1.1::ICryptoFactory/widevine</fqname>
|
||||||
|
<fqname>@1.1::IDrmFactory/widevine</fqname>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.gatekeeper</name>
|
<name>android.hardware.gatekeeper</name>
|
||||||
<transport>hwbinder</transport>
|
<transport arch="32+64">passthrough</transport>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IGatekeeper</name>
|
<name>IGatekeeper</name>
|
||||||
|
@ -93,8 +131,9 @@
|
||||||
<interface>
|
<interface>
|
||||||
<name>IGnss</name>
|
<name>IGnss</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
<instance>gnss_vendor</instance>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
<fqname>@1.0::IGnss/default</fqname>
|
||||||
|
<fqname>@1.0::IGnss/gnss_vendor</fqname>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.graphics.allocator</name>
|
<name>android.hardware.graphics.allocator</name>
|
||||||
|
@ -126,7 +165,7 @@
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.health</name>
|
<name>android.hardware.health</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>2.0</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IHealth</name>
|
<name>IHealth</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -141,6 +180,15 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>android.hardware.light</name>
|
||||||
|
<transport arch="32+64">passthrough</transport>
|
||||||
|
<version>2.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ILight</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.media.omx</name>
|
<name>android.hardware.media.omx</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
|
@ -166,7 +214,7 @@
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.power</name>
|
<name>android.hardware.power</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IPower</name>
|
<name>IPower</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -179,10 +227,12 @@
|
||||||
<interface>
|
<interface>
|
||||||
<name>IRadio</name>
|
<name>IRadio</name>
|
||||||
<instance>slot1</instance>
|
<instance>slot1</instance>
|
||||||
|
<instance>slot2</instance>
|
||||||
</interface>
|
</interface>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ISap</name>
|
<name>ISap</name>
|
||||||
<instance>slot1</instance>
|
<instance>slot1</instance>
|
||||||
|
<instance>slot2</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
|
@ -192,6 +242,7 @@
|
||||||
<interface>
|
<interface>
|
||||||
<name>IOemHook</name>
|
<name>IOemHook</name>
|
||||||
<instance>slot1</instance>
|
<instance>slot1</instance>
|
||||||
|
<instance>slot2</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
|
@ -214,8 +265,8 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.soundtrigger</name>
|
<name>android.hardware.soundtrigger</name>
|
||||||
<transport>hwbinder</transport>
|
<transport arch="32">passthrough</transport>
|
||||||
<version>2.0</version>
|
<version>2.1</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ISoundTriggerHw</name>
|
<name>ISoundTriggerHw</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -239,6 +290,15 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>android.hardware.usb</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IUsb</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.vibrator</name>
|
<name>android.hardware.vibrator</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
|
@ -251,7 +311,7 @@
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.wifi</name>
|
<name>android.hardware.wifi</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.1</version>
|
<version>1.2</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IWifi</name>
|
<name>IWifi</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -260,12 +320,21 @@
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.wifi.supplicant</name>
|
<name>android.hardware.wifi.supplicant</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ISupplicant</name>
|
<name>ISupplicant</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>com.qualcomm.qti.ant</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IAntHci</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>com.qualcomm.qti.dpm.api</name>
|
<name>com.qualcomm.qti.dpm.api</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
|
@ -296,7 +365,7 @@
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>com.quicinc.cne.api</name>
|
<name>com.quicinc.cne.api</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IApiService</name>
|
<name>IApiService</name>
|
||||||
<instance>cnd</instance>
|
<instance>cnd</instance>
|
||||||
|
@ -305,7 +374,7 @@
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>com.quicinc.cne.server</name>
|
<name>com.quicinc.cne.server</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>2.0</version>
|
<version>2.2</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IServer</name>
|
<name>IServer</name>
|
||||||
<instance>cnd</instance>
|
<instance>cnd</instance>
|
||||||
|
@ -340,10 +409,14 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>vendor.lineage.livedisplay</name>
|
<name>vendor.lineage.livedisplay</name>
|
||||||
<transport>hwbinder</transport>
|
<transport arch="32+64">passthrough</transport>
|
||||||
<version>1.0</version>
|
<version>2.0</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IColor</name>
|
<name>IDisplayModes</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
<interface>
|
||||||
|
<name>IPictureAdjustment</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
|
@ -357,13 +430,51 @@
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>vendor.qti.gnss</name>
|
<name>vendor.lineage.trust</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IUsbRestrict</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>vendor.qti.gnss</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.2</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ILocHidlGnss</name>
|
<name>ILocHidlGnss</name>
|
||||||
<instance>gnss_vendor</instance>
|
<instance>gnss_vendor</instance>
|
||||||
</interface>
|
</interface>
|
||||||
|
<fqname>@1.2::ILocHidlGnss/gnss_vendor</fqname>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>vendor.qti.gnss</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>2.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ILocHidlGnss</name>
|
||||||
|
<instance>gnss_vendor</instance>
|
||||||
|
</interface>
|
||||||
|
<fqname>@2.0::ILocHidlGnss/gnss_vendor</fqname>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>vendor.qti.hardware.alarm</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IAlarm</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>vendor.qti.hardware.data.latency</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ILinkLatency</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>vendor.qti.hardware.iop</name>
|
<name>vendor.qti.hardware.iop</name>
|
||||||
|
|
|
@ -270,6 +270,10 @@
|
||||||
511:4294967295:1000:1006:1013:1021:1047
|
511:4294967295:1000:1006:1013:1021:1047
|
||||||
/* Allow RCS service to aquire net_raw permission */
|
/* Allow RCS service to aquire net_raw permission */
|
||||||
18:4294967295:1001:3004
|
18:4294967295:1001:3004
|
||||||
|
/* Allow RCS service to communicate to IMS QMI Priv Svc*/
|
||||||
|
77:4294967295:1001:3003
|
||||||
|
/* Allow cnd to accquire netbind */
|
||||||
|
18:4294967295:1000:3003
|
||||||
/* Allow QMID service to aquire net_raw permission */
|
/* Allow QMID service to aquire net_raw permission */
|
||||||
3:4294967295:1001:1021:3004
|
3:4294967295:1001:1021:3004
|
||||||
2:4294967295:1000:1001:3004
|
2:4294967295:1000:1001:3004
|
||||||
|
@ -320,5 +324,3 @@
|
||||||
69:4294967295:1000
|
69:4294967295:1000
|
||||||
/* <WLPS QMI Service ID - 0x39>:<WLFW QMI Instance ID - all instances>:<Client Group ID> */
|
/* <WLPS QMI Service ID - 0x39>:<WLFW QMI Instance ID - all instances>:<Client Group ID> */
|
||||||
57:4294967295:1000
|
57:4294967295:1000
|
||||||
/* VSS GPS */
|
|
||||||
232:4294967295:1001:3004:1021
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
/* Allow communication to some OEM - QMI services with radio privilages */
|
|
||||||
/* Format is <Service id>:<all instances>:<radio>:<net_raw> */
|
|
||||||
/* VSS */
|
|
||||||
227:4294967295:1001:3004
|
|
||||||
/*COEX*/
|
|
||||||
34:4294967295:1001
|
|
2
configs/sensors/hals.conf
Normal file → Executable file
2
configs/sensors/hals.conf
Normal file → Executable file
|
@ -1 +1 @@
|
||||||
sensors.ssc.so
|
sensors.ssc.so
|
|
@ -1,150 +0,0 @@
|
||||||
[SS-CLUSTER1-SP0]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cluster1
|
|
||||||
set_point 43000
|
|
||||||
set_point_clr 41000
|
|
||||||
time_constant 0
|
|
||||||
device_perf_floor 1478400
|
|
||||||
|
|
||||||
[SS-CLUSTER1-SP1]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cluster1
|
|
||||||
set_point 45000
|
|
||||||
set_point_clr 43000
|
|
||||||
time_constant 0
|
|
||||||
device_perf_floor 1113600
|
|
||||||
|
|
||||||
[SS-CLUSTER1-SP2]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cluster1
|
|
||||||
set_point 48000
|
|
||||||
set_point_clr 45000
|
|
||||||
time_constant 0
|
|
||||||
device_perf_floor 940800
|
|
||||||
|
|
||||||
[SS-CLUSTER0-SP0]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cluster0
|
|
||||||
set_point 43000
|
|
||||||
set_point_clr 41000
|
|
||||||
time_constant 0
|
|
||||||
device_perf_floor 1128800
|
|
||||||
|
|
||||||
[SS-CLUSTER0-SP1]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cluster0
|
|
||||||
set_point 45000
|
|
||||||
set_point_clr 43000
|
|
||||||
time_constant 0
|
|
||||||
device_perf_floor 960000
|
|
||||||
|
|
||||||
[SS-CLUSTER0-SP2]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cluster0
|
|
||||||
set_point 48000
|
|
||||||
set_point_clr 45000
|
|
||||||
time_constant 0
|
|
||||||
device_perf_floor 844800
|
|
||||||
|
|
||||||
[SKIN-SS-CPUS-ALL-1]
|
|
||||||
algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device cpu_voltage
|
|
||||||
set_point 50000
|
|
||||||
set_point_clr 48000
|
|
||||||
time_constant 0
|
|
||||||
|
|
||||||
[SS-GPU]
|
|
||||||
#algo_type ss
|
|
||||||
sampling 250
|
|
||||||
sensor xo_therm_buf
|
|
||||||
device gpu
|
|
||||||
set_point 47000
|
|
||||||
set_point_clr 43000
|
|
||||||
time_constant 0
|
|
||||||
|
|
||||||
[GPU_management]
|
|
||||||
algo_type monitor
|
|
||||||
sensor xo_therm_buf
|
|
||||||
sampling 1000
|
|
||||||
thresholds 41000 43000
|
|
||||||
thresholds_clr 38000 41000
|
|
||||||
actions gpu gpu
|
|
||||||
action_info 510000000 401800000
|
|
||||||
|
|
||||||
|
|
||||||
[SKIN-BATTERY-MONITOR]
|
|
||||||
algo_type monitor
|
|
||||||
sampling 1000
|
|
||||||
sensor xo_therm_buf
|
|
||||||
thresholds 43000 45000 48000 60000
|
|
||||||
thresholds_clr 41000 43000 45000 48000
|
|
||||||
actions battery battery battery battery
|
|
||||||
action_info 0 1 2 3
|
|
||||||
|
|
||||||
[CAMERA-CAMCORDER-MONITOR]
|
|
||||||
algo_type monitor
|
|
||||||
sampling 1000
|
|
||||||
sensor xo_therm_buf
|
|
||||||
thresholds 42000 45000 50000
|
|
||||||
thresholds_clr 40000 42000 45000
|
|
||||||
actions camera+camcorder camera+camcorder camera+camcorder
|
|
||||||
action_info 1 2 3
|
|
||||||
|
|
||||||
[HISTORY-XO]
|
|
||||||
algo_type history
|
|
||||||
sampling 1000
|
|
||||||
sensor xo_therm_buf
|
|
||||||
thresholds 31000 41000 46000 51000 56000 61000
|
|
||||||
thresholds_clr 30000 40000 45000 50000 55000 60000
|
|
||||||
actions history_log history_log history_log history_log history_log history_log
|
|
||||||
action_info 0 1 2 3 4 5
|
|
||||||
|
|
||||||
[HISTORY-CPU0]
|
|
||||||
algo_type history
|
|
||||||
sampling 1000
|
|
||||||
sensor tsens_tz_sensor3
|
|
||||||
thresholds 61000 76000 91000
|
|
||||||
thresholds_clr 60000 75000 90000
|
|
||||||
actions history_log history_log history_log
|
|
||||||
action_info 0 1 2
|
|
||||||
|
|
||||||
[HISTORY-CPU4]
|
|
||||||
algo_type history
|
|
||||||
sampling 1000
|
|
||||||
sensor tsens_tz_sensor8
|
|
||||||
thresholds 61000 76000 91000
|
|
||||||
thresholds_clr 60000 75000 90000
|
|
||||||
actions history_log history_log history_log
|
|
||||||
action_info 0 1 2
|
|
||||||
|
|
||||||
[HISTORY-MODEM-PA0]
|
|
||||||
algo_type history
|
|
||||||
sampling 1000
|
|
||||||
sensor pa_therm0
|
|
||||||
thresholds 31000 36000 41000 46000 51000 56000 61000
|
|
||||||
thresholds_clr 30000 35000 40000 45000 50000 55000 60000
|
|
||||||
actions history_log history_log history_log history_log history_log history_log history_log
|
|
||||||
action_info 0 1 2 3 4 5 6
|
|
||||||
|
|
||||||
[HISTORY-MODEM-PA1]
|
|
||||||
algo_type history
|
|
||||||
sampling 1000
|
|
||||||
sensor pa_therm1
|
|
||||||
thresholds 31000 36000 41000 46000 51000 56000 61000
|
|
||||||
thresholds_clr 30000 35000 40000 45000 50000 55000 60000
|
|
||||||
actions history_log history_log history_log history_log history_log history_log history_log
|
|
||||||
action_info 0 1 2 3 4 5 6
|
|
262
configs/vendor_framework_compatibility_matrix.xml
Normal file
262
configs/vendor_framework_compatibility_matrix.xml
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
<!-- Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following
|
||||||
|
disclaimer in the documentation and/or other materials provided
|
||||||
|
with the distribution.
|
||||||
|
* Neither the name of The Linux Foundation nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
-->
|
||||||
|
<compatibility-matrix version="1.0" type="framework">
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.perf</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IPerf</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.display.color</name>
|
||||||
|
<version>1.0-2</version>
|
||||||
|
<interface>
|
||||||
|
<name>IDisplayColor</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.display.postproc</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IDisplayPostproc</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.display.config</name>
|
||||||
|
<version>1.0-4</version>
|
||||||
|
<interface>
|
||||||
|
<name>IDisplayConfig</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.qteeconnector</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IAppConnector</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
<interface>
|
||||||
|
<name>IGPAppConnector</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.factory</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IFactory</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>com.qualcomm.qti.ant</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IAntHci</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>com.qualcomm.qti.bluetooth_audio</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IBluetoothAudio</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>com.qualcomm.qti.wifidisplayhal</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IHDCPSession</name>
|
||||||
|
<instance>wifidisplayhdcphal</instance>
|
||||||
|
</interface>
|
||||||
|
<interface>
|
||||||
|
<name>IDSManager</name>
|
||||||
|
<instance>wifidisplaydshal</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>android.hardware.gnss</name>
|
||||||
|
<version>1.0-1</version>
|
||||||
|
<interface>
|
||||||
|
<name>IGnss</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.alarm</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IAlarm</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.fm</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IFmHci</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.iop</name>
|
||||||
|
<version>2.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IIop</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.qdutils_disp</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IQdutilsDisp</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.sensorscalibrate</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ISensorsCalibrate</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.soter</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ISoter</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.tui_comm</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ITuiComm</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.vpp</name>
|
||||||
|
<version>1.0-1</version>
|
||||||
|
<interface>
|
||||||
|
<name>IHidlVppService</name>
|
||||||
|
<instance>vppService</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>android.hardware.wifi.supplicant</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ISupplicant</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.wigig.netperftuner</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>INetPerfTuner</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.wigig.supptunnel</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ISuppTunnelProvider</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.imsrtpservice</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IRTPService</name>
|
||||||
|
<instance>imsrtpservice</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.voiceprint</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IQtiVoicePrintService</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>android.hardware.gnss</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IGnss</name>
|
||||||
|
<instance>gnss_vendor</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.gnss</name>
|
||||||
|
<version>1.0-2</version>
|
||||||
|
<version>2.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ILocHidlGnss</name>
|
||||||
|
<instance>gnss_vendor</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.wifi.supplicant</name>
|
||||||
|
<version>2.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>ISupplicantVendor</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.hardware.wifi.hostapd</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IHostapdVendor</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
<hal format="hidl" optional="true">
|
||||||
|
<name>vendor.qti.data.factory</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IFactory</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
|
</compatibility-matrix>
|
168
device.mk
Normal file → Executable file
168
device.mk
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 The CyanogenMod Project
|
# Copyright (C) 2016 The CyanogenMod Project
|
||||||
# Copyright (C) 2017 The LineageOS Project
|
# Copyright (C) 2017-2019 The LineageOS Project
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -20,31 +20,36 @@ $(call inherit-product-if-exists, vendor/samsung/gts3llte/gts3llte-vendor.mk)
|
||||||
|
|
||||||
LOCAL_PATH := device/samsung/gts3llte
|
LOCAL_PATH := device/samsung/gts3llte
|
||||||
|
|
||||||
# Overlay
|
# Overlays
|
||||||
DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
|
DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
|
||||||
|
|
||||||
# Screen density
|
# Screen density
|
||||||
PRODUCT_AAPT_CONFIG := normal
|
PRODUCT_AAPT_CONFIG := normal
|
||||||
PRODUCT_AAPT_PREF_CONFIG := xxhdpi
|
PRODUCT_AAPT_PREF_CONFIG := xxxhdpi
|
||||||
|
|
||||||
# Boot animation
|
# Boot animation
|
||||||
TARGET_SCREEN_HEIGHT := 2048
|
TARGET_SCREEN_HEIGHT := 2048
|
||||||
TARGET_SCREEN_WIDTH := 1536
|
TARGET_SCREEN_WIDTH := 1536
|
||||||
#TARGET_BOOTANIMATION_HALF_RES := true
|
TARGET_BOOTANIMATION_HALF_RES := true
|
||||||
|
|
||||||
# Device characteristics
|
# Device characteristics
|
||||||
PRODUCT_CHARACTERISTICS := tablet
|
PRODUCT_CHARACTERISTICS := tablet
|
||||||
|
|
||||||
$(call inherit-product, frameworks/native/build/phone-xxhdpi-3072-dalvik-heap.mk)
|
# Dalvik
|
||||||
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
$(call inherit-product-if-exists, frameworks/native/build/phone-xxhdpi-3072-hwui-memory.mk)
|
dalvik.vm.heapstartsize=16m \
|
||||||
|
dalvik.vm.heapgrowthlimit=256m \
|
||||||
|
dalvik.vm.heapsize=512m \
|
||||||
|
dalvik.vm.heaptargetutilization=0.75 \
|
||||||
|
dalvik.vm.heapminfree=4m \
|
||||||
|
dalvik.vm.heapmaxfree=16m
|
||||||
|
|
||||||
# Permissions
|
# Permissions
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \
|
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \
|
||||||
frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
|
frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.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.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
|
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.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.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.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
|
||||||
|
@ -57,20 +62,19 @@ PRODUCT_COPY_FILES += \
|
||||||
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.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.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.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.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepdetector.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.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.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.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.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.xml \
|
frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \
|
||||||
frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
|
frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
|
||||||
frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
|
frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
|
||||||
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \
|
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.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.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \
|
||||||
frameworks/native/data/etc/android.software.freeform_window_management.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.freeform_window_management.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.midi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.midi.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.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \
|
||||||
frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml \
|
frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.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
|
|
||||||
|
|
||||||
# QMI
|
# QMI
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
|
@ -81,17 +85,14 @@ PRODUCT_COPY_FILES += \
|
||||||
# ANT+
|
# ANT+
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
AntHalService \
|
AntHalService \
|
||||||
com.dsi.ant.antradio_library \
|
com.dsi.ant.antradio_library
|
||||||
libantradio
|
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.audio@2.0-impl \
|
android.hardware.audio@2.0-impl \
|
||||||
android.hardware.audio@2.0-service \
|
android.hardware.audio@2.0-service \
|
||||||
android.hardware.audio.effect@2.0-impl \
|
android.hardware.audio.effect@2.0-impl \
|
||||||
android.hardware.soundtrigger@2.0-impl \
|
|
||||||
audio.a2dp.default \
|
audio.a2dp.default \
|
||||||
audio.primary.msm8996 \
|
|
||||||
audio.r_submix.default \
|
audio.r_submix.default \
|
||||||
audio.usb.default \
|
audio.usb.default \
|
||||||
libaudio-resampler \
|
libaudio-resampler \
|
||||||
|
@ -102,33 +103,30 @@ PRODUCT_PACKAGES += \
|
||||||
libvolumelistener \
|
libvolumelistener \
|
||||||
tinymix
|
tinymix
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
# audio.primary.msm8996 \
|
||||||
$(LOCAL_PATH)/configs/audio/audio_effects.conf:system/etc/audio_effects.conf \
|
# android.hardware.soundtrigger@2.0-impl \
|
||||||
$(LOCAL_PATH)/configs/audio/listen_platform_info.xml:system/etc/listen_platform_info.xml \
|
|
||||||
$(LOCAL_PATH)/configs/audio/audio_output_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_output_policy.conf \
|
|
||||||
$(LOCAL_PATH)/configs/audio/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
|
|
||||||
$(LOCAL_PATH)/configs/audio/audio_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy.conf \
|
|
||||||
$(LOCAL_PATH)/configs/audio/mixer_paths_tasha.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tasha.xml
|
|
||||||
|
|
||||||
# Bluetooth
|
#PRODUCT_COPY_FILES += \
|
||||||
#PRODUCT_PACKAGES += \
|
# $(LOCAL_PATH)/configs/audio/audio_effects.conf:system/etc/audio_effects.conf \
|
||||||
# android.hardware.bluetooth@1.0-impl \
|
# $(LOCAL_PATH)/configs/audio/listen_platform_info.xml:system/etc/listen_platform_info.xml \
|
||||||
# android.hardware.bluetooth@1.0-service
|
# $(LOCAL_PATH)/configs/audio/audio_output_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_output_policy.conf \
|
||||||
|
# $(LOCAL_PATH)/configs/audio/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
|
||||||
|
# $(LOCAL_PATH)/configs/audio/audio_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy.conf \
|
||||||
|
# $(LOCAL_PATH)/configs/audio/mixer_paths_tasha.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tasha.xml
|
||||||
|
|
||||||
# Camera
|
# Camera
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.camera.provider@2.4-impl \
|
android.hardware.camera.provider@2.4-impl \
|
||||||
camera.device@3.2-impl \
|
|
||||||
libshims_cameraclient
|
|
||||||
|
|
||||||
PRODUCT_PACKAGES += \
|
|
||||||
vendor.qti.hardware.camera.device@1.0 \
|
vendor.qti.hardware.camera.device@1.0 \
|
||||||
vendor.qti.hardware.camera.device@1.0_vendor
|
vendor.qti.hardware.camera.device@1.0_vendor
|
||||||
|
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
libshims_cameraclient
|
||||||
|
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
Snap
|
Snap
|
||||||
|
|
||||||
# CNE
|
# Connectivity Engine support (CNE)
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
libcnefeatureconfig
|
libcnefeatureconfig
|
||||||
|
|
||||||
|
@ -139,6 +137,7 @@ PRODUCT_PACKAGES += \
|
||||||
android.hardware.graphics.composer@2.1-impl \
|
android.hardware.graphics.composer@2.1-impl \
|
||||||
android.hardware.graphics.composer@2.1-service \
|
android.hardware.graphics.composer@2.1-service \
|
||||||
android.hardware.graphics.mapper@2.0-impl \
|
android.hardware.graphics.mapper@2.0-impl \
|
||||||
|
android.hardware.configstore@1.1-service \
|
||||||
android.hardware.memtrack@1.0-impl \
|
android.hardware.memtrack@1.0-impl \
|
||||||
android.hardware.memtrack@1.0-service \
|
android.hardware.memtrack@1.0-service \
|
||||||
copybit.msm8996 \
|
copybit.msm8996 \
|
||||||
|
@ -146,9 +145,12 @@ PRODUCT_PACKAGES += \
|
||||||
hwcomposer.msm8996 \
|
hwcomposer.msm8996 \
|
||||||
memtrack.msm8996 \
|
memtrack.msm8996 \
|
||||||
libdisplayconfig \
|
libdisplayconfig \
|
||||||
|
libhwc2on1adapter \
|
||||||
|
libgenlock \
|
||||||
liboverlay \
|
liboverlay \
|
||||||
libqdMetaData.system \
|
libtinyxml \
|
||||||
libtinyxml
|
libqdMetaData \
|
||||||
|
libqdMetaData.system
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
|
@ -162,12 +164,12 @@ PRODUCT_PACKAGES += \
|
||||||
# DRM
|
# DRM
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.drm@1.0-impl \
|
android.hardware.drm@1.0-impl \
|
||||||
android.hardware.drm@1.0-service
|
android.hardware.drm@1.0-service \
|
||||||
|
android.hardware.drm@1.1-service.clearkey
|
||||||
|
|
||||||
# Fingerprint
|
# Fingerprint
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.biometrics.fingerprint@2.1-service \
|
android.hardware.biometrics.fingerprint@2.1-service \
|
||||||
fingerprint.msm8996 \
|
|
||||||
libbauthtzcommon_shim
|
libbauthtzcommon_shim
|
||||||
|
|
||||||
# For config.fs
|
# For config.fs
|
||||||
|
@ -184,7 +186,8 @@ PRODUCT_PACKAGES += \
|
||||||
android.hardware.gnss@1.0-impl-qti \
|
android.hardware.gnss@1.0-impl-qti \
|
||||||
libcurl \
|
libcurl \
|
||||||
libgnss \
|
libgnss \
|
||||||
libgnsspps
|
libgnsspps \
|
||||||
|
libsensorndkbridge
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/gps/etc/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \
|
$(LOCAL_PATH)/gps/etc/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \
|
||||||
|
@ -196,22 +199,29 @@ PRODUCT_COPY_FILES += \
|
||||||
|
|
||||||
# Healthd
|
# Healthd
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.health@1.0-impl \
|
android.hardware.health@2.0-impl \
|
||||||
android.hardware.health@1.0-service
|
android.hardware.health@2.0-service \
|
||||||
|
charger_res_images
|
||||||
|
|
||||||
# HIDL
|
# HIDL
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hidl.base@1.0 \
|
android.hidl.base@1.0 \
|
||||||
android.hidl.manager@1.0
|
android.hidl.base@1.0_system \
|
||||||
|
android.hidl.manager@1.0 \
|
||||||
|
android.hidl.manager@1.0_system
|
||||||
|
|
||||||
# IMS
|
# IMS
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
ims-ext-common
|
ims-ext-common
|
||||||
|
|
||||||
|
# IPA Manager
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
ipacm \
|
||||||
|
IPACM_cfg.xml
|
||||||
|
|
||||||
# IPC router config
|
# IPC router config
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/configs/sec_config:$(TARGET_COPY_OUT_VENDOR)/etc/sec_config \
|
$(LOCAL_PATH)/configs/sec_config:$(TARGET_COPY_OUT_VENDOR)/etc/sec_config
|
||||||
$(LOCAL_PATH)/configs/sec_config_oem:$(TARGET_COPY_OUT_VENDOR)/etc/sec_config_oem
|
|
||||||
|
|
||||||
# IPv6
|
# IPv6
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
@ -246,9 +256,9 @@ PRODUCT_PACKAGES += \
|
||||||
android.hardware.light@2.0-impl \
|
android.hardware.light@2.0-impl \
|
||||||
lights.MSM8996
|
lights.MSM8996
|
||||||
|
|
||||||
# LiveDisplay native
|
# LiveDisplay
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
vendor.lineage.livedisplay@1.0-service-sdm
|
vendor.lineage.livedisplay@2.0-service-sdm
|
||||||
|
|
||||||
# Media
|
# Media
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
|
@ -266,28 +276,19 @@ PRODUCT_PACKAGES += \
|
||||||
android.system.net.netd@1.0 \
|
android.system.net.netd@1.0 \
|
||||||
libandroid_net \
|
libandroid_net \
|
||||||
netutils-wrapper-1.0
|
netutils-wrapper-1.0
|
||||||
|
|
||||||
# OMX
|
# OMX
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
libc2dcolorconvert \
|
libc2dcolorconvert \
|
||||||
libdashplayer \
|
|
||||||
libdivxdrmdecrypt \
|
|
||||||
libhypv_intercept \
|
|
||||||
libmm-omxcore \
|
|
||||||
libextmedia_jni \
|
libextmedia_jni \
|
||||||
libOmxAacEnc \
|
libOmxAacEnc \
|
||||||
libOmxAmrEnc \
|
libOmxAmrEnc \
|
||||||
libOmxCore \
|
libOmxCore \
|
||||||
libOmxEvrcEnc \
|
libOmxEvrcEnc \
|
||||||
libOmxQcelp13Enc \
|
libOmxQcelp13Enc \
|
||||||
libOmxSwVencMpeg4 \
|
|
||||||
libOmxSwVencHevc \
|
|
||||||
libOmxVdec \
|
libOmxVdec \
|
||||||
libOmxVdecHevc \
|
|
||||||
libOmxVenc \
|
libOmxVenc \
|
||||||
libOmxVidcCommon \
|
libstagefrighthw
|
||||||
libstagefrighthw \
|
|
||||||
libstagefright_soft_flacdec
|
|
||||||
|
|
||||||
# Power
|
# Power
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
@ -296,6 +297,10 @@ PRODUCT_PACKAGES += \
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/configs/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml
|
$(LOCAL_PATH)/configs/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml
|
||||||
|
|
||||||
|
# QMI
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
libjson
|
||||||
|
|
||||||
# RCS
|
# RCS
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
rcs_service_aidl \
|
rcs_service_aidl \
|
||||||
|
@ -310,7 +315,6 @@ PRODUCT_PACKAGES += \
|
||||||
init.qcom.power.rc \
|
init.qcom.power.rc \
|
||||||
init.qcom.usb.rc \
|
init.qcom.usb.rc \
|
||||||
init.samsung.rc \
|
init.samsung.rc \
|
||||||
init.target.rc \
|
|
||||||
ueventd.qcom.rc \
|
ueventd.qcom.rc \
|
||||||
init.qcom.sh
|
init.qcom.sh
|
||||||
|
|
||||||
|
@ -320,6 +324,8 @@ PRODUCT_PACKAGES += \
|
||||||
|
|
||||||
# RIL
|
# RIL
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
android.hardware.radio@1.2 \
|
||||||
|
android.hardware.radio.config@1.0 \
|
||||||
libprotobuf-cpp-full \
|
libprotobuf-cpp-full \
|
||||||
librmnetctl \
|
librmnetctl \
|
||||||
libxml2
|
libxml2
|
||||||
|
@ -328,11 +334,12 @@ PRODUCT_PACKAGES += \
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
|
$(LOCAL_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
|
||||||
$(LOCAL_PATH)/seccomp_policy/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy
|
$(LOCAL_PATH)/seccomp_policy/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy
|
||||||
|
|
||||||
# Sensors
|
# Sensors
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.sensors@1.0-impl
|
android.hardware.sensors@1.0-impl \
|
||||||
|
android.hardware.sensors@1.0-service
|
||||||
|
|
||||||
# Sensors
|
# Sensors
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/configs/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf \
|
$(LOCAL_PATH)/configs/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf \
|
||||||
|
@ -340,17 +347,7 @@ PRODUCT_COPY_FILES += \
|
||||||
|
|
||||||
# Thermal engine
|
# Thermal engine
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/configs/thermal-engine-8996-lite.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine-8996-lite.conf \
|
|
||||||
$(LOCAL_PATH)/configs/thermal-engine-8996.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine-8996.conf
|
$(LOCAL_PATH)/configs/thermal-engine-8996.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine-8996.conf
|
||||||
|
|
||||||
# USB
|
|
||||||
PRODUCT_PACKAGES += \
|
|
||||||
android.hardware.usb@1.0-service
|
|
||||||
|
|
||||||
# Vibrator
|
|
||||||
PRODUCT_PACKAGES += \
|
|
||||||
android.hardware.vibrator@1.0-impl \
|
|
||||||
android.hardware.vibrator@1.0-service
|
|
||||||
|
|
||||||
# Telephony
|
# Telephony
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
@ -361,19 +358,30 @@ PRODUCT_BOOT_JARS += \
|
||||||
|
|
||||||
# TextClassifier
|
# TextClassifier
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
textclassifier.smartselection.bundle1
|
textclassifier.bundle1
|
||||||
|
|
||||||
|
# Trust HAL
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
vendor.lineage.trust@1.0-service
|
||||||
|
|
||||||
|
# USB
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
android.hardware.usb@1.0-service.basic
|
||||||
|
|
||||||
# VNDK
|
# VNDK
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
vndk-sp
|
vndk-sp
|
||||||
|
|
||||||
# WCNSS
|
# Vibrator
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_PACKAGES += \
|
||||||
$(LOCAL_PATH)/wifi/WCNSS_cfg.dat:system/etc/firmware/wlan/qca_cld/WCNSS_cfg.dat \
|
android.hardware.vibrator@1.0-impl \
|
||||||
$(LOCAL_PATH)/wifi/WCNSS_qcom_cfg.ini:system/etc/firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini \
|
android.hardware.vibrator@1.0-service
|
||||||
$(LOCAL_PATH)/wifi/grippower.info:system/etc/firmware/wlan/qca_cld/grippower.info
|
|
||||||
|
# USB
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
android.hardware.usb@1.0-service
|
||||||
|
|
||||||
# Wifi
|
# WiFi
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.wifi@1.0-service \
|
android.hardware.wifi@1.0-service \
|
||||||
libqsap_sdk \
|
libqsap_sdk \
|
||||||
|
@ -391,10 +399,14 @@ PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf \
|
$(LOCAL_PATH)/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf \
|
||||||
$(LOCAL_PATH)/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
|
$(LOCAL_PATH)/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
|
||||||
|
|
||||||
|
PRODUCT_COPY_FILES += \
|
||||||
|
$(LOCAL_PATH)/wifi/WCNSS_qcom_cfg.ini:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/WCNSS_qcom_cfg.ini
|
||||||
|
|
||||||
# ADB
|
# ADB
|
||||||
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
|
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||||
persist.sys.usb.config=adb \
|
persist.sys.usb.config=adb \
|
||||||
ro.adb.secure=0
|
ro.adb.secure=0 \
|
||||||
|
ro.secure=0
|
||||||
|
|
||||||
# Root
|
# Root
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
|
6
doze/Android.mk
Normal file → Executable file
6
doze/Android.mk
Normal file → Executable file
|
@ -7,6 +7,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||||
|
|
||||||
LOCAL_PACKAGE_NAME := SamsungDoze
|
LOCAL_PACKAGE_NAME := SamsungDoze
|
||||||
LOCAL_CERTIFICATE := platform
|
LOCAL_CERTIFICATE := platform
|
||||||
|
LOCAL_PRIVATE_PLATFORM_APIS := true
|
||||||
LOCAL_PRIVILEGED_MODULE := true
|
LOCAL_PRIVILEGED_MODULE := true
|
||||||
|
|
||||||
LOCAL_USE_AAPT2 := true
|
LOCAL_USE_AAPT2 := true
|
||||||
|
@ -17,10 +18,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \
|
||||||
android-support-v7-recyclerview \
|
android-support-v7-recyclerview \
|
||||||
android-support-v7-preference \
|
android-support-v7-preference \
|
||||||
android-support-v7-appcompat \
|
android-support-v7-appcompat \
|
||||||
android-support-v14-preference \
|
android-support-v14-preference
|
||||||
|
|
||||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
|
||||||
org.lineageos.platform.internal
|
|
||||||
|
|
||||||
LOCAL_RESOURCE_DIR := \
|
LOCAL_RESOURCE_DIR := \
|
||||||
$(LOCAL_PATH)/res \
|
$(LOCAL_PATH)/res \
|
||||||
|
|
6
doze/AndroidManifest.xml
Normal file → Executable file
6
doze/AndroidManifest.xml
Normal file → Executable file
|
@ -27,14 +27,14 @@
|
||||||
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
|
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="26"
|
android:minSdkVersion="24"
|
||||||
android:targetSdkVersion="26"/>
|
android:targetSdkVersion="24"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="@string/device_settings_app_name"
|
android:label="@string/device_settings_app_name"
|
||||||
android:persistent="true">
|
android:persistent="true">
|
||||||
|
|
||||||
<receiver android:name="org.lineageos.settings.doze.BootCompletedReceiver">
|
<receiver android:name=".BootCompletedReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
20
doze/res/color/switch_bar_bg.xml
Normal file
20
doze/res/color/switch_bar_bg.xml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2019 The LineageOS Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="#ff80868B" android:state_activated="false" />
|
||||||
|
<item android:color="?android:attr/colorAccent" android:state_activated="true" />
|
||||||
|
</selector>
|
20
doze/res/color/switchbar_switch_thumb_tint.xml
Normal file
20
doze/res/color/switchbar_switch_thumb_tint.xml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="#FFFFFF" />
|
||||||
|
</selector>
|
21
doze/res/color/switchbar_switch_track_tint.xml
Normal file
21
doze/res/color/switchbar_switch_track_tint.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="#BFFFFFFF" />
|
||||||
|
</selector>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
<!-- Copyright (C) 2019 The LineageOS Project
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="?android:attr/colorControlHighlight">
|
android:shape="rectangle">
|
||||||
<item android:drawable="?android:attr/colorSecondary" />
|
<solid android:color="@color/switch_bar_bg" />
|
||||||
</ripple>
|
</shape>
|
||||||
|
|
|
@ -29,11 +29,12 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:paddingStart="48dp"
|
android:paddingStart="56dp"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Title"
|
android:textAppearance="@android:style/TextAppearance.Material.Title"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
android:textAlignment="viewStart" />
|
android:textAlignment="viewStart" />
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
|
@ -42,6 +43,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:theme="@style/Theme.Main.SwitchBar" />
|
android:theme="@style/Theme.Main.SwitchBar.Switch" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -54,4 +54,9 @@
|
||||||
|
|
||||||
<style name="Theme.Main.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
|
<style name="Theme.Main.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.Main.SwitchBar.Switch">
|
||||||
|
<item name="android:trackTint">@color/switchbar_switch_track_tint</item>
|
||||||
|
<item name="android:thumbTint">@color/switchbar_switch_thumb_tint</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2015 The CyanogenMod Project
|
Copyright (C) 2015 The CyanogenMod Project
|
||||||
|
2018-2019 The LineageOS Project
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"
|
Licensed under the Apache License, Version 2.0 (the "License"
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -16,6 +17,13 @@
|
||||||
-->
|
-->
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="always_on_display"
|
||||||
|
android:disableDependentsState="true"
|
||||||
|
android:title="@string/ambient_display_always_on_title"
|
||||||
|
android:summary="@string/ambient_display_always_on_summary"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="tilt_sensor"
|
android:key="tilt_sensor"
|
||||||
android:title="@string/tilt_sensor_title">
|
android:title="@string/tilt_sensor_title">
|
||||||
|
|
9
doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java
Normal file → Executable file
9
doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The CyanogenMod Project
|
* Copyright (C) 2015 The CyanogenMod Project
|
||||||
* 2017 The LineageOS Project
|
* 2017-2019 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -29,10 +29,7 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, Intent intent) {
|
public void onReceive(final Context context, Intent intent) {
|
||||||
if (Utils.isDozeEnabled(context) && Utils.sensorsEnabled(context)) {
|
if (DEBUG) Log.d(TAG, "Received boot completed intent");
|
||||||
if (DEBUG) Log.d(TAG, "Starting service");
|
Utils.checkDozeService(context);
|
||||||
Utils.startService(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
* Copyright (C) 2015 The CyanogenMod Project
|
||||||
* 2017 The LineageOS Project
|
* 2017-2018 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -25,22 +25,18 @@ import android.content.IntentFilter;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class DozeService extends Service
|
public class DozeService extends Service {
|
||||||
{
|
|
||||||
private static final String TAG = "DozeService";
|
private static final String TAG = "DozeService";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
private ProximitySensor mProximitySensor;
|
private ProximitySensor mProximitySensor;
|
||||||
private TiltSensor mTiltSensor;
|
private TiltSensor mTiltSensor;
|
||||||
private SignificantSensor mSignificantSensor;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate()
|
public void onCreate() {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Creating service");
|
if (DEBUG) Log.d(TAG, "Creating service");
|
||||||
mProximitySensor = new ProximitySensor(this);
|
mProximitySensor = new ProximitySensor(this);
|
||||||
mTiltSensor = new TiltSensor(this);
|
mTiltSensor = new TiltSensor(this);
|
||||||
mSignificantSensor = new SignificantSensor(this);
|
|
||||||
|
|
||||||
IntentFilter screenStateFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
IntentFilter screenStateFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||||
screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
|
@ -48,62 +44,55 @@ public class DozeService extends Service
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId)
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Starting service");
|
if (DEBUG) Log.d(TAG, "Starting service");
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy()
|
public void onDestroy() {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Destroying service");
|
if (DEBUG) Log.d(TAG, "Destroying service");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
this.unregisterReceiver(mScreenStateReceiver);
|
this.unregisterReceiver(mScreenStateReceiver);
|
||||||
mProximitySensor.disable();
|
mProximitySensor.disable();
|
||||||
mTiltSensor.disable();
|
mTiltSensor.disable();
|
||||||
mSignificantSensor.disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent intent)
|
public IBinder onBind(Intent intent) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDisplayOn()
|
private void onDisplayOn() {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Display on");
|
if (DEBUG) Log.d(TAG, "Display on");
|
||||||
if (Utils.pickUpEnabled(this))
|
if (Utils.isPickUpEnabled(this)) {
|
||||||
{
|
|
||||||
mTiltSensor.disable();
|
mTiltSensor.disable();
|
||||||
mSignificantSensor.disable();
|
|
||||||
}
|
}
|
||||||
if (Utils.handwaveGestureEnabled(this) || Utils.pocketGestureEnabled(this))
|
if (Utils.isHandwaveGestureEnabled(this) ||
|
||||||
|
Utils.isPocketGestureEnabled(this)) {
|
||||||
mProximitySensor.disable();
|
mProximitySensor.disable();
|
||||||
}
|
|
||||||
|
|
||||||
private void onDisplayOff()
|
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Display off");
|
|
||||||
if (Utils.pickUpEnabled(this))
|
|
||||||
{
|
|
||||||
mTiltSensor.enable();
|
|
||||||
mSignificantSensor.enable();
|
|
||||||
}
|
}
|
||||||
if (Utils.handwaveGestureEnabled(this) || Utils.pocketGestureEnabled(this))
|
|
||||||
mProximitySensor.enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver()
|
private void onDisplayOff() {
|
||||||
{
|
if (DEBUG) Log.d(TAG, "Display off");
|
||||||
|
if (Utils.isPickUpEnabled(this)) {
|
||||||
|
mTiltSensor.enable();
|
||||||
|
}
|
||||||
|
if (Utils.isHandwaveGestureEnabled(this) ||
|
||||||
|
Utils.isPocketGestureEnabled(this)) {
|
||||||
|
mProximitySensor.enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent)
|
public void onReceive(Context context, Intent intent) {
|
||||||
{
|
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
|
||||||
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON))
|
|
||||||
onDisplayOn();
|
onDisplayOn();
|
||||||
else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
|
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
|
||||||
onDisplayOff();
|
onDisplayOff();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The CyanogenMod Project
|
* Copyright (C) 2015 The CyanogenMod Project
|
||||||
* 2017-2018 The LineageOS Project
|
* 2017-2019 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,6 +26,7 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.support.v14.preference.PreferenceFragment;
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
import android.support.v14.preference.SwitchPreference;
|
import android.support.v14.preference.SwitchPreference;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
|
@ -43,11 +44,16 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
|
||||||
CompoundButton.OnCheckedChangeListener {
|
CompoundButton.OnCheckedChangeListener {
|
||||||
|
|
||||||
private TextView mTextView;
|
private TextView mTextView;
|
||||||
|
private View mSwitchBar;
|
||||||
|
|
||||||
|
private SwitchPreference mAlwaysOnDisplayPreference;
|
||||||
|
|
||||||
private SwitchPreference mPickUpPreference;
|
private SwitchPreference mPickUpPreference;
|
||||||
private SwitchPreference mHandwavePreference;
|
private SwitchPreference mHandwavePreference;
|
||||||
private SwitchPreference mPocketPreference;
|
private SwitchPreference mPocketPreference;
|
||||||
|
|
||||||
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
addPreferencesFromResource(R.xml.doze_settings);
|
addPreferencesFromResource(R.xml.doze_settings);
|
||||||
|
@ -62,22 +68,40 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
|
||||||
|
|
||||||
boolean dozeEnabled = Utils.isDozeEnabled(getActivity());
|
boolean dozeEnabled = Utils.isDozeEnabled(getActivity());
|
||||||
|
|
||||||
|
mAlwaysOnDisplayPreference = (SwitchPreference) findPreference(Utils.ALWAYS_ON_DISPLAY);
|
||||||
|
mAlwaysOnDisplayPreference.setEnabled(dozeEnabled);
|
||||||
|
mAlwaysOnDisplayPreference.setChecked(Utils.isAlwaysOnEnabled(getActivity()));
|
||||||
|
mAlwaysOnDisplayPreference.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
PreferenceCategory tiltSensorCategory =
|
||||||
|
(PreferenceCategory) getPreferenceScreen().findPreference(Utils.CATEG_TILT_SENSOR);
|
||||||
PreferenceCategory proximitySensorCategory =
|
PreferenceCategory proximitySensorCategory =
|
||||||
(PreferenceCategory) getPreferenceScreen().findPreference(Utils.CATEG_PROX_SENSOR);
|
(PreferenceCategory) getPreferenceScreen().findPreference(Utils.CATEG_PROX_SENSOR);
|
||||||
|
|
||||||
mPickUpPreference = (SwitchPreference) findPreference(Utils.GESTURE_PICK_UP_KEY);
|
mPickUpPreference = (SwitchPreference) findPreference(Utils.GESTURE_PICK_UP_KEY);
|
||||||
mPickUpPreference.setEnabled(dozeEnabled);
|
mPickUpPreference.setEnabled(dozeEnabled);
|
||||||
|
mPickUpPreference.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mHandwavePreference = (SwitchPreference) findPreference(Utils.GESTURE_HAND_WAVE_KEY);
|
mHandwavePreference = (SwitchPreference) findPreference(Utils.GESTURE_HAND_WAVE_KEY);
|
||||||
mHandwavePreference.setEnabled(dozeEnabled);
|
mHandwavePreference.setEnabled(dozeEnabled);
|
||||||
|
mHandwavePreference.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mPocketPreference = (SwitchPreference) findPreference(Utils.GESTURE_POCKET_KEY);
|
mPocketPreference = (SwitchPreference) findPreference(Utils.GESTURE_POCKET_KEY);
|
||||||
mPocketPreference.setEnabled(dozeEnabled);
|
mPocketPreference.setEnabled(dozeEnabled);
|
||||||
|
mPocketPreference.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
// Hide proximity sensor related features if the device doesn't support them
|
// Hide proximity sensor related features if the device doesn't support them
|
||||||
if (!Utils.getProxCheckBeforePulse(getActivity())) {
|
if (!Utils.getProxCheckBeforePulse(getActivity())) {
|
||||||
getPreferenceScreen().removePreference(proximitySensorCategory);
|
getPreferenceScreen().removePreference(proximitySensorCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide AOD if not supported and set all its dependents otherwise
|
||||||
|
if (!Utils.alwaysOnDisplayAvailable(getActivity())) {
|
||||||
|
getPreferenceScreen().removePreference(mAlwaysOnDisplayPreference);
|
||||||
|
} else {
|
||||||
|
tiltSensorCategory.setDependency(Utils.ALWAYS_ON_DISPLAY);
|
||||||
|
proximitySensorCategory.setDependency(Utils.ALWAYS_ON_DISPLAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,29 +122,45 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
|
||||||
mTextView.setText(getString(dozeEnabled ?
|
mTextView.setText(getString(dozeEnabled ?
|
||||||
R.string.switch_bar_on : R.string.switch_bar_off));
|
R.string.switch_bar_on : R.string.switch_bar_off));
|
||||||
|
|
||||||
View switchBar = view.findViewById(R.id.switch_bar);
|
mSwitchBar = view.findViewById(R.id.switch_bar);
|
||||||
Switch switchWidget = switchBar.findViewById(android.R.id.switch_widget);
|
Switch switchWidget = mSwitchBar.findViewById(android.R.id.switch_widget);
|
||||||
switchWidget.setChecked(dozeEnabled);
|
switchWidget.setChecked(dozeEnabled);
|
||||||
switchWidget.setOnCheckedChangeListener(this);
|
switchWidget.setOnCheckedChangeListener(this);
|
||||||
switchBar.setOnClickListener(v -> switchWidget.setChecked(!switchWidget.isChecked()));
|
mSwitchBar.setActivated(dozeEnabled);
|
||||||
|
mSwitchBar.setOnClickListener(v -> {
|
||||||
|
switchWidget.setChecked(!switchWidget.isChecked());
|
||||||
|
mSwitchBar.setActivated(switchWidget.isChecked());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
Utils.checkDozeService(getActivity());
|
if (Utils.ALWAYS_ON_DISPLAY.equals(preference.getKey())) {
|
||||||
|
Utils.enableAlwaysOn(getActivity(), (Boolean) newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
mHandler.post(() -> Utils.checkDozeService(getActivity()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
|
||||||
Utils.enableDoze(b, getActivity());
|
Utils.enableDoze(getActivity(), isChecked);
|
||||||
Utils.checkDozeService(getActivity());
|
Utils.checkDozeService(getActivity());
|
||||||
|
|
||||||
mTextView.setText(getString(b ? R.string.switch_bar_on : R.string.switch_bar_off));
|
mTextView.setText(getString(isChecked ? R.string.switch_bar_on : R.string.switch_bar_off));
|
||||||
|
mSwitchBar.setActivated(isChecked);
|
||||||
|
|
||||||
mPickUpPreference.setEnabled(b);
|
if (!isChecked) {
|
||||||
mHandwavePreference.setEnabled(b);
|
Utils.enableAlwaysOn(getActivity(), false);
|
||||||
mPocketPreference.setEnabled(b);
|
mAlwaysOnDisplayPreference.setChecked(false);
|
||||||
|
}
|
||||||
|
mAlwaysOnDisplayPreference.setEnabled(isChecked);
|
||||||
|
|
||||||
|
mPickUpPreference.setEnabled(isChecked);
|
||||||
|
mHandwavePreference.setEnabled(isChecked);
|
||||||
|
mPocketPreference.setEnabled(isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,10 @@ import android.hardware.SensorEventListener;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class ProximitySensor implements SensorEventListener {
|
public class ProximitySensor implements SensorEventListener {
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
@ -38,6 +42,7 @@ public class ProximitySensor implements SensorEventListener {
|
||||||
private SensorManager mSensorManager;
|
private SensorManager mSensorManager;
|
||||||
private Sensor mSensor;
|
private Sensor mSensor;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private ExecutorService mExecutorService;
|
||||||
|
|
||||||
private boolean mSawNear = false;
|
private boolean mSawNear = false;
|
||||||
private long mInPocketTime = 0;
|
private long mInPocketTime = 0;
|
||||||
|
@ -46,11 +51,16 @@ public class ProximitySensor implements SensorEventListener {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorManager = mContext.getSystemService(SensorManager.class);
|
mSensorManager = mContext.getSystemService(SensorManager.class);
|
||||||
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY, false);
|
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY, false);
|
||||||
|
mExecutorService = Executors.newSingleThreadExecutor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Future<?> submit(Runnable runnable) {
|
||||||
|
return mExecutorService.submit(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
/* boolean isNear = event.values[0] < mSensor.getMaximumRange();
|
boolean isNear = event.values[0] < mSensor.getMaximumRange();
|
||||||
if (mSawNear && !isNear) {
|
if (mSawNear && !isNear) {
|
||||||
if (shouldPulse(event.timestamp)) {
|
if (shouldPulse(event.timestamp)) {
|
||||||
Utils.launchDozePulse(mContext);
|
Utils.launchDozePulse(mContext);
|
||||||
|
@ -58,17 +68,17 @@ public class ProximitySensor implements SensorEventListener {
|
||||||
} else {
|
} else {
|
||||||
mInPocketTime = event.timestamp;
|
mInPocketTime = event.timestamp;
|
||||||
}
|
}
|
||||||
mSawNear = isNear;*/
|
mSawNear = isNear;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldPulse(long timestamp) {
|
private boolean shouldPulse(long timestamp) {
|
||||||
long delta = timestamp - mInPocketTime;
|
long delta = timestamp - mInPocketTime;
|
||||||
|
|
||||||
if (Utils.handwaveGestureEnabled(mContext) && Utils.pocketGestureEnabled(mContext)) {
|
if (Utils.isHandwaveGestureEnabled(mContext) && Utils.isPocketGestureEnabled(mContext)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (Utils.handwaveGestureEnabled(mContext)) {
|
} else if (Utils.isHandwaveGestureEnabled(mContext)) {
|
||||||
return delta < HANDWAVE_MAX_DELTA_NS;
|
return delta < HANDWAVE_MAX_DELTA_NS;
|
||||||
} else if (Utils.pocketGestureEnabled(mContext)) {
|
} else if (Utils.isPocketGestureEnabled(mContext)) {
|
||||||
return delta >= POCKET_MIN_DELTA_NS;
|
return delta >= POCKET_MIN_DELTA_NS;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -81,11 +91,16 @@ public class ProximitySensor implements SensorEventListener {
|
||||||
|
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
if (DEBUG) Log.d(TAG, "Enabling");
|
if (DEBUG) Log.d(TAG, "Enabling");
|
||||||
mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL);
|
submit(() -> {
|
||||||
|
mSensorManager.registerListener(this, mSensor,
|
||||||
|
SensorManager.SENSOR_DELAY_NORMAL);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void disable() {
|
protected void disable() {
|
||||||
if (DEBUG) Log.d(TAG, "Disabling");
|
if (DEBUG) Log.d(TAG, "Disabling");
|
||||||
mSensorManager.unregisterListener(this, mSensor);
|
submit(() -> {
|
||||||
|
mSensorManager.unregisterListener(this, mSensor);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* 2017-2018 The LineageOS Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.lineageos.settings.doze;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class SignificantSensor implements SensorEventListener
|
|
||||||
{
|
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
private static final String TAG = "SignificantSensor";
|
|
||||||
|
|
||||||
private static final int BATCH_LATENCY_IN_MS = 100;
|
|
||||||
private static final int MIN_PULSE_INTERVAL_MS = 2500;
|
|
||||||
|
|
||||||
private SensorManager mSensorManager;
|
|
||||||
private Sensor mSensor;
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private long mEntryTimestamp;
|
|
||||||
|
|
||||||
public SignificantSensor(Context context)
|
|
||||||
{
|
|
||||||
mContext = context;
|
|
||||||
mSensorManager = mContext.getSystemService(SensorManager.class);
|
|
||||||
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event)
|
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]);
|
|
||||||
|
|
||||||
/* long delta = SystemClock.elapsedRealtime() - mEntryTimestamp;
|
|
||||||
if (delta < MIN_PULSE_INTERVAL_MS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mEntryTimestamp = SystemClock.elapsedRealtime();
|
|
||||||
|
|
||||||
if (event.values[0] == 1)
|
|
||||||
Utils.launchDozePulse(mContext);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy)
|
|
||||||
{
|
|
||||||
/* Empty */
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void enable()
|
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Enabling");
|
|
||||||
mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000);
|
|
||||||
mEntryTimestamp = SystemClock.elapsedRealtime();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void disable()
|
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Disabling");
|
|
||||||
mSensorManager.unregisterListener(this, mSensor);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,8 +25,12 @@ import android.hardware.SensorManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class TiltSensor implements SensorEventListener
|
import java.util.concurrent.ExecutorService;
|
||||||
{
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
public class TiltSensor implements SensorEventListener {
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
private static final String TAG = "TiltSensor";
|
private static final String TAG = "TiltSensor";
|
||||||
|
|
||||||
|
@ -36,47 +40,55 @@ public class TiltSensor implements SensorEventListener
|
||||||
private SensorManager mSensorManager;
|
private SensorManager mSensorManager;
|
||||||
private Sensor mSensor;
|
private Sensor mSensor;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private ExecutorService mExecutorService;
|
||||||
|
|
||||||
private long mEntryTimestamp;
|
private long mEntryTimestamp;
|
||||||
|
|
||||||
public TiltSensor(Context context)
|
public TiltSensor(Context context) {
|
||||||
{
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorManager = mContext.getSystemService(SensorManager.class);
|
mSensorManager = mContext.getSystemService(SensorManager.class);
|
||||||
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_TILT_DETECTOR);
|
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_TILT_DETECTOR);
|
||||||
|
mExecutorService = Executors.newSingleThreadExecutor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Future<?> submit(Runnable runnable) {
|
||||||
|
return mExecutorService.submit(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event)
|
public void onSensorChanged(SensorEvent event) {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]);
|
if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]);
|
||||||
|
|
||||||
/* long delta = SystemClock.elapsedRealtime() - mEntryTimestamp;
|
long delta = SystemClock.elapsedRealtime() - mEntryTimestamp;
|
||||||
if (delta < MIN_PULSE_INTERVAL_MS)
|
if (delta < MIN_PULSE_INTERVAL_MS) {
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
mEntryTimestamp = SystemClock.elapsedRealtime();
|
||||||
|
}
|
||||||
|
|
||||||
mEntryTimestamp = SystemClock.elapsedRealtime();
|
if (event.values[0] == 1) {
|
||||||
|
Utils.launchDozePulse(mContext);
|
||||||
if (event.values[0] == 1)
|
}
|
||||||
Utils.launchDozePulse(mContext);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy)
|
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||||
{
|
|
||||||
/* Empty */
|
/* Empty */
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void enable()
|
protected void enable() {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Enabling");
|
if (DEBUG) Log.d(TAG, "Enabling");
|
||||||
mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000);
|
submit(() -> {
|
||||||
mEntryTimestamp = SystemClock.elapsedRealtime();
|
mSensorManager.registerListener(this, mSensor,
|
||||||
|
SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000);
|
||||||
|
mEntryTimestamp = SystemClock.elapsedRealtime();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void disable()
|
protected void disable() {
|
||||||
{
|
|
||||||
if (DEBUG) Log.d(TAG, "Disabling");
|
if (DEBUG) Log.d(TAG, "Disabling");
|
||||||
mSensorManager.unregisterListener(this, mSensor);
|
submit(() -> {
|
||||||
|
mSensorManager.unregisterListener(this, mSensor);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
* Copyright (C) 2015 The CyanogenMod Project
|
||||||
* 2017 The LineageOS Project
|
* 2017-2019 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -25,6 +25,9 @@ import android.support.v7.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||||
|
|
||||||
|
import static android.provider.Settings.Secure.DOZE_ALWAYS_ON;
|
||||||
import static android.provider.Settings.Secure.DOZE_ENABLED;
|
import static android.provider.Settings.Secure.DOZE_ENABLED;
|
||||||
|
|
||||||
public final class Utils {
|
public final class Utils {
|
||||||
|
@ -34,6 +37,9 @@ public final class Utils {
|
||||||
|
|
||||||
private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
|
private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
|
||||||
|
|
||||||
|
protected static final String ALWAYS_ON_DISPLAY = "always_on_display";
|
||||||
|
|
||||||
|
protected static final String CATEG_TILT_SENSOR = "tilt_sensor";
|
||||||
protected static final String CATEG_PROX_SENSOR = "proximity_sensor";
|
protected static final String CATEG_PROX_SENSOR = "proximity_sensor";
|
||||||
|
|
||||||
protected static final String GESTURE_PICK_UP_KEY = "gesture_pick_up";
|
protected static final String GESTURE_PICK_UP_KEY = "gesture_pick_up";
|
||||||
|
@ -53,7 +59,7 @@ public final class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void checkDozeService(Context context) {
|
protected static void checkDozeService(Context context) {
|
||||||
if (isDozeEnabled(context) && sensorsEnabled(context)) {
|
if (isDozeEnabled(context) && !isAlwaysOnEnabled(context) && sensorsEnabled(context)) {
|
||||||
startService(context);
|
startService(context);
|
||||||
} else {
|
} else {
|
||||||
stopService(context);
|
stopService(context);
|
||||||
|
@ -76,7 +82,7 @@ public final class Utils {
|
||||||
DOZE_ENABLED, 1) != 0;
|
DOZE_ENABLED, 1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean enableDoze(boolean enable, Context context) {
|
protected static boolean enableDoze(Context context, boolean enable) {
|
||||||
return Settings.Secure.putInt(context.getContentResolver(),
|
return Settings.Secure.putInt(context.getContentResolver(),
|
||||||
DOZE_ENABLED, enable ? 1 : 0);
|
DOZE_ENABLED, enable ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -87,23 +93,43 @@ public final class Utils {
|
||||||
new UserHandle(UserHandle.USER_CURRENT));
|
new UserHandle(UserHandle.USER_CURRENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean pickUpEnabled(Context context) {
|
protected static boolean enableAlwaysOn(Context context, boolean enable) {
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
return Settings.Secure.putIntForUser(context.getContentResolver(),
|
||||||
.getBoolean(GESTURE_PICK_UP_KEY, false);
|
DOZE_ALWAYS_ON, enable ? 1 : 0, UserHandle.USER_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean handwaveGestureEnabled(Context context) {
|
protected static boolean isAlwaysOnEnabled(Context context) {
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
final boolean enabledByDefault = context.getResources()
|
||||||
.getBoolean(GESTURE_HAND_WAVE_KEY, false);
|
.getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled);
|
||||||
|
|
||||||
|
return Settings.Secure.getIntForUser(context.getContentResolver(),
|
||||||
|
DOZE_ALWAYS_ON, alwaysOnDisplayAvailable(context) && enabledByDefault ? 1 : 0,
|
||||||
|
UserHandle.USER_CURRENT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean pocketGestureEnabled(Context context) {
|
protected static boolean alwaysOnDisplayAvailable(Context context) {
|
||||||
|
return new AmbientDisplayConfiguration(context).alwaysOnAvailable();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean isGestureEnabled(Context context, String gesture) {
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
.getBoolean(GESTURE_POCKET_KEY, false);
|
.getBoolean(gesture, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean isPickUpEnabled(Context context) {
|
||||||
|
return isGestureEnabled(context, GESTURE_PICK_UP_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean isHandwaveGestureEnabled(Context context) {
|
||||||
|
return isGestureEnabled(context, GESTURE_HAND_WAVE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean isPocketGestureEnabled(Context context) {
|
||||||
|
return isGestureEnabled(context, GESTURE_POCKET_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean sensorsEnabled(Context context) {
|
protected static boolean sensorsEnabled(Context context) {
|
||||||
return pickUpEnabled(context) || handwaveGestureEnabled(context)
|
return isPickUpEnabled(context) || isHandwaveGestureEnabled(context)
|
||||||
|| pocketGestureEnabled(context);
|
|| isPocketGestureEnabled(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (C) 2016 The CyanogenMod 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Inherit from those products. Most specific first.
|
|
||||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
|
|
||||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
|
|
||||||
|
|
||||||
# Inherit from gts3llte device
|
|
||||||
$(call inherit-product, device/samsung/gts3llte/device.mk)
|
|
||||||
|
|
||||||
# Device identifier. This must come after all inclusions
|
|
||||||
PRODUCT_DEVICE := gts3llte
|
|
||||||
PRODUCT_NAME := full_gts3llte
|
|
||||||
PRODUCT_BRAND := samsung
|
|
||||||
PRODUCT_MODEL := gts3llte
|
|
||||||
PRODUCT_MANUFACTURER := samsung
|
|
5
gps/Android.mk
Normal file → Executable file
5
gps/Android.mk
Normal file → Executable file
|
@ -15,4 +15,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
include $(call first-makefiles-under,$(call my-dir))
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
include $(LOCAL_PATH)/build/target_specific_features.mk
|
||||||
|
|
||||||
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||||
|
|
2
gps/android/AGnss.cpp
Normal file → Executable file
2
gps/android/AGnss.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
8
gps/android/AGnss.h
Normal file → Executable file
8
gps/android/AGnss.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IAGnss.h>
|
#include <android/hardware/gnss/1.0/IAGnss.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
@ -76,4 +76,4 @@ struct AGnss : public IAGnss {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
|
||||||
|
|
2
gps/android/AGnssRil.cpp
Normal file → Executable file
2
gps/android/AGnssRil.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
2
gps/android/AGnssRil.h
Normal file → Executable file
2
gps/android/AGnssRil.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
11
gps/android/Android.mk
Normal file → Executable file
11
gps/android/Android.mk
Normal file → Executable file
|
@ -2,8 +2,7 @@ LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
|
LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
|
||||||
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
|
LOCAL_VENDOR_MODULE := true
|
||||||
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
|
|
||||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
AGnss.cpp \
|
AGnss.cpp \
|
||||||
|
@ -36,6 +35,7 @@ LOCAL_SHARED_LIBRARIES := \
|
||||||
libhidlbase \
|
libhidlbase \
|
||||||
libhidltransport \
|
libhidltransport \
|
||||||
libhwbinder \
|
libhwbinder \
|
||||||
|
libcutils \
|
||||||
libutils \
|
libutils \
|
||||||
android.hardware.gnss@1.0 \
|
android.hardware.gnss@1.0 \
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ LOCAL_SHARED_LIBRARIES += \
|
||||||
libloc_core \
|
libloc_core \
|
||||||
libgps.utils \
|
libgps.utils \
|
||||||
libdl \
|
libdl \
|
||||||
libloc_pla \
|
|
||||||
liblocation_api \
|
liblocation_api \
|
||||||
|
|
||||||
LOCAL_CFLAGS += $(GNSS_CFLAGS)
|
LOCAL_CFLAGS += $(GNSS_CFLAGS)
|
||||||
|
@ -52,19 +51,15 @@ include $(BUILD_SHARED_LIBRARY)
|
||||||
BUILD_GNSS_HIDL_SERVICE := true
|
BUILD_GNSS_HIDL_SERVICE := true
|
||||||
ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET), true)
|
ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET), true)
|
||||||
ifneq ($(LW_FEATURE_SET),true)
|
ifneq ($(LW_FEATURE_SET),true)
|
||||||
ifneq ($(TARGET_HAS_LOW_RAM),true)
|
|
||||||
BUILD_GNSS_HIDL_SERVICE := false
|
BUILD_GNSS_HIDL_SERVICE := false
|
||||||
endif # TARGET_HAS_LOW_RAM
|
|
||||||
endif # LW_FEATURE_SET
|
endif # LW_FEATURE_SET
|
||||||
endif # BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET
|
endif # BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET
|
||||||
|
|
||||||
ifeq ($(BUILD_GNSS_HIDL_SERVICE), true)
|
ifeq ($(BUILD_GNSS_HIDL_SERVICE), true)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
|
LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
|
||||||
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
|
|
||||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
|
||||||
LOCAL_VENDOR_MODULE := true
|
LOCAL_VENDOR_MODULE := true
|
||||||
LOCAL_MODULE_OWNER := qti
|
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||||
LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
|
LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
service.cpp \
|
service.cpp \
|
||||||
|
|
33
gps/android/Gnss.cpp
Normal file → Executable file
33
gps/android/Gnss.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -20,9 +20,13 @@
|
||||||
|
|
||||||
#define LOG_TAG "LocSvc_GnssInterface"
|
#define LOG_TAG "LocSvc_GnssInterface"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <cutils/properties.h>
|
||||||
#include "Gnss.h"
|
#include "Gnss.h"
|
||||||
|
#include <LocationUtil.h>
|
||||||
|
|
||||||
typedef void* (getLocationInterface)();
|
typedef void* (getLocationInterface)();
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
@ -107,7 +111,7 @@ GnssInterface* Gnss::getGnssInterface() {
|
||||||
return mGnssInterface;
|
return mGnssInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> Gnss::setCallback(const sp<IGnssCallback>& callback) {
|
Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
if (mGnssCbIface != nullptr) {
|
if (mGnssCbIface != nullptr) {
|
||||||
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
|
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
|
||||||
|
@ -251,7 +255,7 @@ Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
|
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
GnssAPIClient* api = getApi();
|
GnssAPIClient* api = getApi();
|
||||||
if (api) {
|
if (api) {
|
||||||
|
@ -260,8 +264,8 @@ Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode,
|
Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
|
||||||
IGnss::GnssPositionRecurrence recurrence,
|
V1_0::IGnss::GnssPositionRecurrence recurrence,
|
||||||
uint32_t minIntervalMs,
|
uint32_t minIntervalMs,
|
||||||
uint32_t preferredAccuracyMeters,
|
uint32_t preferredAccuracyMeters,
|
||||||
uint32_t preferredTimeMs) {
|
uint32_t preferredTimeMs) {
|
||||||
|
@ -275,48 +279,49 @@ Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode,
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IAGnss>> Gnss::getExtensionAGnss() {
|
Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
mAGnssIface = new AGnss(this);
|
mAGnssIface = new AGnss(this);
|
||||||
return mAGnssIface;
|
return mAGnssIface;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssNi>> Gnss::getExtensionGnssNi() {
|
Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
mGnssNi = new GnssNi(this);
|
mGnssNi = new GnssNi(this);
|
||||||
return mGnssNi;
|
return mGnssNi;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
|
Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
mGnssMeasurement = new GnssMeasurement();
|
if (mGnssMeasurement == nullptr)
|
||||||
|
mGnssMeasurement = new GnssMeasurement();
|
||||||
return mGnssMeasurement;
|
return mGnssMeasurement;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
|
Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
mGnssConfig = new GnssConfiguration(this);
|
mGnssConfig = new GnssConfiguration(this);
|
||||||
return mGnssConfig;
|
return mGnssConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
|
Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
mGnssGeofencingIface = new GnssGeofencing();
|
mGnssGeofencingIface = new GnssGeofencing();
|
||||||
return mGnssGeofencingIface;
|
return mGnssGeofencingIface;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssBatching>> Gnss::getExtensionGnssBatching() {
|
Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
|
||||||
mGnssBatching = new GnssBatching();
|
mGnssBatching = new GnssBatching();
|
||||||
return mGnssBatching;
|
return mGnssBatching;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssDebug>> Gnss::getExtensionGnssDebug() {
|
Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
mGnssDebug = new GnssDebug(this);
|
mGnssDebug = new GnssDebug(this);
|
||||||
return mGnssDebug;
|
return mGnssDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IAGnssRil>> Gnss::getExtensionAGnssRil() {
|
Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
|
||||||
mGnssRil = new AGnssRil(this);
|
mGnssRil = new AGnssRil(this);
|
||||||
return mGnssRil;
|
return mGnssRil;
|
||||||
}
|
}
|
||||||
|
|
64
gps/android/Gnss.h
Normal file → Executable file
64
gps/android/Gnss.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018-2018-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
|
||||||
|
|
||||||
#include <AGnss.h>
|
#include <AGnss.h>
|
||||||
#include <AGnssRil.h>
|
#include <AGnssRil.h>
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
#include <GnssDebug.h>
|
#include <GnssDebug.h>
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnss.h>
|
#include <android/hardware/gnss/1.0/IGnss.h>
|
||||||
|
#include <hidl/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
|
||||||
#include <GnssAPIClient.h>
|
#include <GnssAPIClient.h>
|
||||||
|
@ -42,34 +43,24 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
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::Return;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
using ::android::hardware::hidl_vec;
|
|
||||||
using ::android::hardware::hidl_string;
|
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssLocation;
|
||||||
|
|
||||||
struct Gnss : public IGnss {
|
struct Gnss : public IGnss {
|
||||||
Gnss();
|
Gnss();
|
||||||
~Gnss();
|
~Gnss();
|
||||||
|
|
||||||
// registerAsService will call interfaceChain to determine the version of service
|
|
||||||
/* comment this out until we know really how to manipulate hidl version
|
|
||||||
using interfaceChain_cb = std::function<
|
|
||||||
void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
|
|
||||||
virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override {
|
|
||||||
_hidl_cb({
|
|
||||||
"android.hardware.gnss@1.1::IGnss",
|
|
||||||
::android::hidl::base::V1_0::IBase::descriptor,
|
|
||||||
});
|
|
||||||
return ::android::hardware::Void();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods from ::android::hardware::gnss::V1_0::IGnss follow.
|
* Methods from ::android::hardware::gnss::V1_0::IGnss follow.
|
||||||
* These declarations were generated from Gnss.hal.
|
* These declarations were generated from Gnss.hal.
|
||||||
*/
|
*/
|
||||||
Return<bool> setCallback(const sp<IGnssCallback>& callback) override;
|
Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
|
||||||
Return<bool> start() override;
|
Return<bool> start() override;
|
||||||
Return<bool> stop() override;
|
Return<bool> stop() override;
|
||||||
Return<void> cleanup() override;
|
Return<void> cleanup() override;
|
||||||
|
@ -79,30 +70,30 @@ struct Gnss : public IGnss {
|
||||||
Return<bool> injectTime(int64_t timeMs,
|
Return<bool> injectTime(int64_t timeMs,
|
||||||
int64_t timeReferenceMs,
|
int64_t timeReferenceMs,
|
||||||
int32_t uncertaintyMs) override;
|
int32_t uncertaintyMs) override;
|
||||||
Return<void> deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override;
|
Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
|
||||||
Return<bool> setPositionMode(IGnss::GnssPositionMode mode,
|
Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
|
||||||
IGnss::GnssPositionRecurrence recurrence,
|
V1_0::IGnss::GnssPositionRecurrence recurrence,
|
||||||
uint32_t minIntervalMs,
|
uint32_t minIntervalMs,
|
||||||
uint32_t preferredAccuracyMeters,
|
uint32_t preferredAccuracyMeters,
|
||||||
uint32_t preferredTimeMs) override;
|
uint32_t preferredTimeMs) override;
|
||||||
Return<sp<IAGnss>> getExtensionAGnss() override;
|
Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
|
||||||
Return<sp<IGnssNi>> getExtensionGnssNi() override;
|
Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
|
||||||
Return<sp<IGnssMeasurement>> getExtensionGnssMeasurement() override;
|
Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
|
||||||
Return<sp<IGnssConfiguration>> getExtensionGnssConfiguration() override;
|
Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
|
||||||
Return<sp<IGnssGeofencing>> getExtensionGnssGeofencing() override;
|
Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
|
||||||
Return<sp<IGnssBatching>> getExtensionGnssBatching() override;
|
Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
|
||||||
|
|
||||||
Return<sp<IAGnssRil>> getExtensionAGnssRil() override;
|
Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
|
||||||
|
|
||||||
inline Return<sp<IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
|
inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Return<sp<IGnssXtra>> getExtensionXtra() override {
|
inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<IGnssDebug>> getExtensionGnssDebug() override;
|
Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
|
||||||
|
|
||||||
// These methods are not part of the IGnss base class.
|
// These methods are not part of the IGnss base class.
|
||||||
GnssAPIClient* getApi();
|
GnssAPIClient* getApi();
|
||||||
|
@ -110,6 +101,9 @@ struct Gnss : public IGnss {
|
||||||
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
|
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
|
||||||
GnssInterface* getGnssInterface();
|
GnssInterface* getGnssInterface();
|
||||||
|
|
||||||
|
// Callback for ODCPI request
|
||||||
|
void odcpiRequestCb(const OdcpiRequestInfo& request);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct GnssDeathRecipient : hidl_death_recipient {
|
struct GnssDeathRecipient : hidl_death_recipient {
|
||||||
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
|
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
|
||||||
|
@ -132,8 +126,8 @@ struct Gnss : public IGnss {
|
||||||
sp<AGnssRil> mGnssRil = nullptr;
|
sp<AGnssRil> mGnssRil = nullptr;
|
||||||
|
|
||||||
GnssAPIClient* mApi = nullptr;
|
GnssAPIClient* mApi = nullptr;
|
||||||
sp<IGnssCallback> mGnssCbIface = nullptr;
|
sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
|
||||||
sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
|
sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
|
||||||
GnssConfig mPendingConfig;
|
GnssConfig mPendingConfig;
|
||||||
GnssInterface* mGnssInterface = nullptr;
|
GnssInterface* mGnssInterface = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -146,4 +140,4 @@ extern "C" IGnss* HIDL_FETCH_IGnss(const char* name);
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
|
||||||
|
|
2
gps/android/GnssBatching.cpp
Normal file → Executable file
2
gps/android/GnssBatching.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
8
gps/android/GnssBatching.h
Normal file → Executable file
8
gps/android/GnssBatching.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnssBatching.h>
|
#include <android/hardware/gnss/1.0/IGnssBatching.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
@ -77,4 +77,4 @@ struct GnssBatching : public IGnssBatching {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
|
||||||
|
|
2
gps/android/GnssConfiguration.cpp
Normal file → Executable file
2
gps/android/GnssConfiguration.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
8
gps/android/GnssConfiguration.h
Normal file → Executable file
8
gps/android/GnssConfiguration.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnssConfiguration.h>
|
#include <android/hardware/gnss/1.0/IGnssConfiguration.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
@ -68,4 +68,4 @@ struct GnssConfiguration : public IGnssConfiguration {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
|
||||||
|
|
57
gps/android/GnssDebug.cpp
Normal file → Executable file
57
gps/android/GnssDebug.cpp
Normal file → Executable file
|
@ -30,8 +30,14 @@ namespace implementation {
|
||||||
|
|
||||||
using ::android::hardware::hidl_vec;
|
using ::android::hardware::hidl_vec;
|
||||||
|
|
||||||
#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000ULL) // 1/1/2017 00:00 GMT
|
#define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000)
|
||||||
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
|
#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000)
|
||||||
|
#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500)
|
||||||
|
#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180)
|
||||||
|
|
||||||
|
#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT
|
||||||
|
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
|
||||||
|
#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
|
||||||
|
|
||||||
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
|
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +97,40 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
|
||||||
data.position.valid = false;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// time block
|
||||||
if (reports.mTime.mValid) {
|
if (reports.mTime.mValid) {
|
||||||
data.time.timeEstimate = reports.mTime.timeEstimate;
|
data.time.timeEstimate = reports.mTime.timeEstimate;
|
||||||
|
@ -98,10 +138,17 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
|
||||||
data.time.frequencyUncertaintyNsPerSec =
|
data.time.frequencyUncertaintyNsPerSec =
|
||||||
reports.mTime.frequencyUncertaintyNsPerSec;
|
reports.mTime.frequencyUncertaintyNsPerSec;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
|
||||||
data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
|
data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
|
||||||
data.time.timeUncertaintyNs = (float)(GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC);
|
}
|
||||||
data.time.frequencyUncertaintyNsPerSec = 0;
|
if (data.time.timeUncertaintyNs <= 0 ||
|
||||||
|
data.time.timeUncertaintyNs > (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC) {
|
||||||
|
data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC;
|
||||||
|
}
|
||||||
|
if (data.time.frequencyUncertaintyNsPerSec <= 0 ||
|
||||||
|
data.time.frequencyUncertaintyNsPerSec > (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC) {
|
||||||
|
data.time.frequencyUncertaintyNsPerSec = (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// satellite data block
|
// satellite data block
|
||||||
|
|
6
gps/android/GnssDebug.h
Normal file → Executable file
6
gps/android/GnssDebug.h
Normal file → Executable file
|
@ -14,8 +14,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
|
||||||
|
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnssDebug.h>
|
#include <android/hardware/gnss/1.0/IGnssDebug.h>
|
||||||
|
@ -56,4 +56,4 @@ private:
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
|
||||||
|
|
2
gps/android/GnssGeofencing.cpp
Normal file → Executable file
2
gps/android/GnssGeofencing.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
8
gps/android/GnssGeofencing.h
Normal file → Executable file
8
gps/android/GnssGeofencing.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
|
#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
@ -88,4 +88,4 @@ struct GnssGeofencing : public IGnssGeofencing {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
|
||||||
|
|
8
gps/android/GnssMeasurement.cpp
Normal file → Executable file
8
gps/android/GnssMeasurement.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -52,8 +52,9 @@ GnssMeasurement::~GnssMeasurement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
|
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
|
||||||
|
|
||||||
Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
|
Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
|
||||||
const sp<IGnssMeasurementCallback>& callback) {
|
const sp<V1_0::IGnssMeasurementCallback>& callback) {
|
||||||
|
|
||||||
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
|
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
|
||||||
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
|
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
|
||||||
|
@ -72,9 +73,10 @@ Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
mGnssMeasurementCbIface = callback;
|
mGnssMeasurementCbIface = callback;
|
||||||
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/);
|
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
|
||||||
|
|
||||||
return mApi->measurementSetCallback(callback);
|
return mApi->measurementSetCallback(callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> GnssMeasurement::close() {
|
Return<void> GnssMeasurement::close() {
|
||||||
|
|
15
gps/android/GnssMeasurement.h
Normal file → Executable file
15
gps/android/GnssMeasurement.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,10 +18,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
|
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
|
||||||
|
#include <hidl/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
@ -47,8 +48,8 @@ struct GnssMeasurement : public IGnssMeasurement {
|
||||||
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
|
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
|
||||||
* These declarations were generated from IGnssMeasurement.hal.
|
* These declarations were generated from IGnssMeasurement.hal.
|
||||||
*/
|
*/
|
||||||
Return<GnssMeasurementStatus> setCallback(
|
Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
|
||||||
const sp<IGnssMeasurementCallback>& callback) override;
|
const sp<V1_0::IGnssMeasurementCallback>& callback) override;
|
||||||
Return<void> close() override;
|
Return<void> close() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -63,7 +64,7 @@ struct GnssMeasurement : public IGnssMeasurement {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
|
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
|
||||||
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
|
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
|
||||||
MeasurementAPIClient* mApi;
|
MeasurementAPIClient* mApi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,4 +74,4 @@ struct GnssMeasurement : public IGnssMeasurement {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
|
||||||
|
|
2
gps/android/GnssNi.cpp
Normal file → Executable file
2
gps/android/GnssNi.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|
8
gps/android/GnssNi.h
Normal file → Executable file
8
gps/android/GnssNi.h
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
|
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
|
||||||
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
|
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnssNi.h>
|
#include <android/hardware/gnss/1.0/IGnssNi.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
|
@ -72,4 +72,4 @@ struct GnssNi : public IGnssNi {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
|
#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
|
||||||
|
|
2
gps/android/android.hardware.gnss@1.0-service-qti.rc → gps/android/android.hardware.gnss@1.1-service-qti.rc
Normal file → Executable file
2
gps/android/android.hardware.gnss@1.0-service-qti.rc → gps/android/android.hardware.gnss@1.1-service-qti.rc
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
|
service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
|
||||||
class main
|
class hal
|
||||||
user gps
|
user gps
|
||||||
group system gps radio
|
group system gps radio
|
9
gps/android/location_api/BatchingAPIClient.cpp
Normal file → Executable file
9
gps/android/location_api/BatchingAPIClient.cpp
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -45,6 +45,10 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssBatching;
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssLocation;
|
||||||
|
|
||||||
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
|
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
|
||||||
LocationCapabilitiesMask mask);
|
LocationCapabilitiesMask mask);
|
||||||
|
|
||||||
|
@ -153,7 +157,8 @@ void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMa
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchingAPIClient::onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions)
|
void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
|
||||||
|
BatchingOptions /*batchOptions*/)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
|
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
|
||||||
if (mGnssBatchingCbIface != nullptr && count > 0) {
|
if (mGnssBatchingCbIface != nullptr && count > 0) {
|
||||||
|
|
11
gps/android/location_api/BatchingAPIClient.h
Normal file → Executable file
11
gps/android/location_api/BatchingAPIClient.h
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -45,11 +45,11 @@ namespace implementation {
|
||||||
class BatchingAPIClient : public LocationAPIClientBase
|
class BatchingAPIClient : public LocationAPIClientBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BatchingAPIClient(const sp<IGnssBatchingCallback>& callback);
|
BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
|
||||||
~BatchingAPIClient();
|
~BatchingAPIClient();
|
||||||
int getBatchSize();
|
int getBatchSize();
|
||||||
int startSession(const IGnssBatching::Options& options);
|
int startSession(const V1_0::IGnssBatching::Options& options);
|
||||||
int updateSessionOptions(const IGnssBatching::Options& options);
|
int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
|
||||||
int stopSession();
|
int stopSession();
|
||||||
void getBatchedLocation(int last_n_locations);
|
void getBatchedLocation(int last_n_locations);
|
||||||
void flushBatchedLocations();
|
void flushBatchedLocations();
|
||||||
|
@ -61,9 +61,8 @@ public:
|
||||||
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
|
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sp<IGnssBatchingCallback> mGnssBatchingCbIface;
|
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
|
||||||
uint32_t mDefaultId;
|
uint32_t mDefaultId;
|
||||||
int mBatchSize;
|
|
||||||
LocationCapabilitiesMask mLocationCapabilitiesMask;
|
LocationCapabilitiesMask mLocationCapabilitiesMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
6
gps/android/location_api/GeofenceAPIClient.cpp
Normal file → Executable file
6
gps/android/location_api/GeofenceAPIClient.cpp
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -42,6 +42,8 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssLocation;
|
||||||
|
|
||||||
GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
|
GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
|
||||||
LocationAPIClientBase(),
|
LocationAPIClientBase(),
|
||||||
|
@ -158,7 +160,7 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr
|
||||||
|
|
||||||
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
|
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
|
||||||
geofenceBreachNotification.ids[i], gnssLocation, transition,
|
geofenceBreachNotification.ids[i], gnssLocation, transition,
|
||||||
static_cast<GnssUtcTime>(geofenceBreachNotification.timestamp));
|
static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
|
||||||
if (!r.isOk()) {
|
if (!r.isOk()) {
|
||||||
LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
|
LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
|
||||||
__func__, r.description().c_str());
|
__func__, r.description().c_str());
|
||||||
|
|
6
gps/android/location_api/GeofenceAPIClient.h
Normal file → Executable file
6
gps/android/location_api/GeofenceAPIClient.h
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -45,7 +45,7 @@ using ::android::sp;
|
||||||
class GeofenceAPIClient : public LocationAPIClientBase
|
class GeofenceAPIClient : public LocationAPIClientBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback);
|
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
|
||||||
virtual ~GeofenceAPIClient() = default;
|
virtual ~GeofenceAPIClient() = default;
|
||||||
|
|
||||||
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
|
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
|
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sp<IGnssGeofenceCallback> mGnssGeofencingCbIface;
|
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
|
|
21
gps/android/location_api/GnssAPIClient.cpp
Normal file → Executable file
21
gps/android/location_api/GnssAPIClient.cpp
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -43,6 +43,11 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnss;
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssCallback;
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssLocation;
|
||||||
|
|
||||||
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
|
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
|
||||||
|
|
||||||
GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
|
GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
|
||||||
|
@ -160,6 +165,10 @@ bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
|
||||||
mLocationOptions.size = sizeof(LocationOptions);
|
mLocationOptions.size = sizeof(LocationOptions);
|
||||||
mLocationOptions.minInterval = minIntervalMs;
|
mLocationOptions.minInterval = minIntervalMs;
|
||||||
mLocationOptions.minDistance = preferredAccuracyMeters;
|
mLocationOptions.minDistance = preferredAccuracyMeters;
|
||||||
|
if (IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
|
||||||
|
mLocationOptions.minInterval =
|
||||||
|
std::numeric_limits<decltype(mLocationOptions.minInterval)>::max();
|
||||||
|
}
|
||||||
if (mode == IGnss::GnssPositionMode::STANDALONE)
|
if (mode == IGnss::GnssPositionMode::STANDALONE)
|
||||||
mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
|
mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
|
||||||
else if (mode == IGnss::GnssPositionMode::MS_BASED)
|
else if (mode == IGnss::GnssPositionMode::MS_BASED)
|
||||||
|
@ -445,7 +454,7 @@ void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
|
||||||
android::hardware::hidl_string nmeaString;
|
android::hardware::hidl_string nmeaString;
|
||||||
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
|
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
|
||||||
auto r = gnssCbIface->gnssNmeaCb(
|
auto r = gnssCbIface->gnssNmeaCb(
|
||||||
static_cast<GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
|
static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
|
||||||
if (!r.isOk()) {
|
if (!r.isOk()) {
|
||||||
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__,
|
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__,
|
||||||
gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str());
|
gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str());
|
||||||
|
@ -499,10 +508,10 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
|
memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
|
||||||
out.numSvs = in.count;
|
out.numSvs = in.count;
|
||||||
if (out.numSvs > static_cast<uint32_t>(GnssMax::SVS_COUNT)) {
|
if (out.numSvs > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
|
||||||
LOC_LOGW("%s]: Too many satellites %zd. Clamps to %d.",
|
LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.",
|
||||||
__FUNCTION__, out.numSvs, GnssMax::SVS_COUNT);
|
__FUNCTION__, out.numSvs, V1_0::GnssMax::SVS_COUNT);
|
||||||
out.numSvs = static_cast<uint32_t>(GnssMax::SVS_COUNT);
|
out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < out.numSvs; i++) {
|
for (size_t i = 0; i < out.numSvs; i++) {
|
||||||
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
|
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
|
||||||
|
|
24
gps/android/location_api/GnssAPIClient.h
Normal file → Executable file
24
gps/android/location_api/GnssAPIClient.h
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
#ifndef GNSS_API_CLINET_H
|
#ifndef GNSS_API_CLINET_H
|
||||||
#define GNSS_API_CLINET_H
|
#define GNSS_API_CLINET_H
|
||||||
|
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <android/hardware/gnss/1.0/IGnss.h>
|
#include <android/hardware/gnss/1.0/IGnss.h>
|
||||||
#include <android/hardware/gnss/1.0/IGnssCallback.h>
|
#include <android/hardware/gnss/1.0/IGnssCallback.h>
|
||||||
|
@ -47,28 +48,28 @@ using ::android::sp;
|
||||||
class GnssAPIClient : public LocationAPIClientBase
|
class GnssAPIClient : public LocationAPIClientBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GnssAPIClient(const sp<IGnssCallback>& gpsCb,
|
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
|
||||||
const sp<IGnssNiCallback>& niCb);
|
const sp<V1_0::IGnssNiCallback>& niCb);
|
||||||
virtual ~GnssAPIClient();
|
virtual ~GnssAPIClient();
|
||||||
GnssAPIClient(const GnssAPIClient&) = delete;
|
GnssAPIClient(const GnssAPIClient&) = delete;
|
||||||
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
|
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
|
||||||
|
|
||||||
// for GpsInterface
|
// for GpsInterface
|
||||||
void gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
|
void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
|
||||||
const sp<IGnssNiCallback>& niCb);
|
const sp<V1_0::IGnssNiCallback>& niCb);
|
||||||
bool gnssStart();
|
bool gnssStart();
|
||||||
bool gnssStop();
|
bool gnssStop();
|
||||||
bool gnssSetPositionMode(IGnss::GnssPositionMode mode,
|
bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
|
||||||
IGnss::GnssPositionRecurrence recurrence,
|
V1_0::IGnss::GnssPositionRecurrence recurrence,
|
||||||
uint32_t minIntervalMs,
|
uint32_t minIntervalMs,
|
||||||
uint32_t preferredAccuracyMeters,
|
uint32_t preferredAccuracyMeters,
|
||||||
uint32_t preferredTimeMs);
|
uint32_t preferredTimeMs);
|
||||||
|
|
||||||
// for GpsNiInterface
|
// for GpsNiInterface
|
||||||
void gnssNiRespond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse);
|
void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
|
||||||
|
|
||||||
// these apis using LocationAPIControlClient
|
// these apis using LocationAPIControlClient
|
||||||
void gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags);
|
void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
|
||||||
void gnssEnable(LocationTechnologyType techType);
|
void gnssEnable(LocationTechnologyType techType);
|
||||||
void gnssDisable();
|
void gnssDisable();
|
||||||
void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
|
void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
|
||||||
|
@ -89,12 +90,13 @@ public:
|
||||||
void onStopTrackingCb(LocationError error) final;
|
void onStopTrackingCb(LocationError error) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sp<IGnssCallback> mGnssCbIface;
|
sp<V1_0::IGnssCallback> mGnssCbIface;
|
||||||
sp<IGnssNiCallback> mGnssNiCbIface;
|
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
|
||||||
std::mutex mMutex;
|
std::mutex mMutex;
|
||||||
LocationAPIControlClient* mControlClient;
|
LocationAPIControlClient* mControlClient;
|
||||||
LocationCapabilitiesMask mLocationCapabilitiesMask;
|
LocationCapabilitiesMask mLocationCapabilitiesMask;
|
||||||
bool mLocationCapabilitiesCached;
|
bool mLocationCapabilitiesCached;
|
||||||
|
|
||||||
LocationOptions mLocationOptions;
|
LocationOptions mLocationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
39
gps/android/location_api/LocationUtil.cpp
Normal file → Executable file
39
gps/android/location_api/LocationUtil.cpp
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -35,6 +35,10 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssLocation;
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssConstellationType;
|
||||||
|
using ::android::hardware::gnss::V1_0::GnssLocationFlags;
|
||||||
|
|
||||||
void convertGnssLocation(Location& in, GnssLocation& out)
|
void convertGnssLocation(Location& in, GnssLocation& out)
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(GnssLocation));
|
memset(&out, 0, sizeof(GnssLocation));
|
||||||
|
@ -63,7 +67,38 @@ void convertGnssLocation(Location& in, GnssLocation& out)
|
||||||
out.verticalAccuracyMeters = in.verticalAccuracy;
|
out.verticalAccuracyMeters = in.verticalAccuracy;
|
||||||
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
|
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
|
||||||
out.bearingAccuracyDegrees = in.bearingAccuracy;
|
out.bearingAccuracyDegrees = in.bearingAccuracy;
|
||||||
out.timestamp = static_cast<GnssUtcTime>(in.timestamp);
|
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void convertGnssLocation(const GnssLocation& in, Location& out)
|
||||||
|
{
|
||||||
|
memset(&out, 0, sizeof(out));
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG)
|
||||||
|
out.flags |= LOCATION_HAS_LAT_LONG_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE)
|
||||||
|
out.flags |= LOCATION_HAS_ALTITUDE_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED)
|
||||||
|
out.flags |= LOCATION_HAS_SPEED_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING)
|
||||||
|
out.flags |= LOCATION_HAS_BEARING_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY)
|
||||||
|
out.flags |= LOCATION_HAS_ACCURACY_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY)
|
||||||
|
out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY)
|
||||||
|
out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
|
||||||
|
if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY)
|
||||||
|
out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
|
||||||
|
out.latitude = in.latitudeDegrees;
|
||||||
|
out.longitude = in.longitudeDegrees;
|
||||||
|
out.altitude = in.altitudeMeters;
|
||||||
|
out.speed = in.speedMetersPerSec;
|
||||||
|
out.bearing = in.bearingDegrees;
|
||||||
|
out.accuracy = in.horizontalAccuracyMeters;
|
||||||
|
out.verticalAccuracy = in.verticalAccuracyMeters;
|
||||||
|
out.speedAccuracy = in.speedAccuracyMetersPerSecond;
|
||||||
|
out.bearingAccuracy = in.bearingAccuracyDegrees;
|
||||||
|
out.timestamp = static_cast<uint64_t>(in.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
|
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
|
||||||
|
|
7
gps/android/location_api/LocationUtil.h
Normal file → Executable file
7
gps/android/location_api/LocationUtil.h
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -40,8 +40,9 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
void convertGnssLocation(Location& in, GnssLocation& out);
|
void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
|
||||||
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out);
|
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
|
||||||
|
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
|
||||||
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
|
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
|
||||||
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
|
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
|
||||||
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
|
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
|
||||||
|
|
38
gps/android/location_api/MeasurementAPIClient.cpp
Normal file → Executable file
38
gps/android/location_api/MeasurementAPIClient.cpp
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -42,10 +42,13 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
|
||||||
|
using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback;
|
||||||
|
|
||||||
static void convertGnssData(GnssMeasurementsNotification& in,
|
static void convertGnssData(GnssMeasurementsNotification& in,
|
||||||
IGnssMeasurementCallback::GnssData& out);
|
V1_0::IGnssMeasurementCallback::GnssData& out);
|
||||||
static void convertGnssMeasurement(GnssMeasurementsData& in,
|
static void convertGnssMeasurement(GnssMeasurementsData& in,
|
||||||
IGnssMeasurementCallback::GnssMeasurement& out);
|
V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
|
||||||
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
|
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
|
||||||
|
|
||||||
MeasurementAPIClient::MeasurementAPIClient() :
|
MeasurementAPIClient::MeasurementAPIClient() :
|
||||||
|
@ -62,7 +65,7 @@ MeasurementAPIClient::~MeasurementAPIClient()
|
||||||
|
|
||||||
// for GpsInterface
|
// for GpsInterface
|
||||||
Return<IGnssMeasurement::GnssMeasurementStatus>
|
Return<IGnssMeasurement::GnssMeasurementStatus>
|
||||||
MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
|
MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
|
||||||
|
|
||||||
|
@ -70,6 +73,12 @@ MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>&
|
||||||
mGnssMeasurementCbIface = callback;
|
mGnssMeasurementCbIface = callback;
|
||||||
mMutex.unlock();
|
mMutex.unlock();
|
||||||
|
|
||||||
|
return startTracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<IGnssMeasurement::GnssMeasurementStatus>
|
||||||
|
MeasurementAPIClient::startTracking()
|
||||||
|
{
|
||||||
LocationCallbacks locationCallbacks;
|
LocationCallbacks locationCallbacks;
|
||||||
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||||
|
@ -115,15 +124,18 @@ void MeasurementAPIClient::measurementClose() {
|
||||||
void MeasurementAPIClient::onGnssMeasurementsCb(
|
void MeasurementAPIClient::onGnssMeasurementsCb(
|
||||||
GnssMeasurementsNotification gnssMeasurementsNotification)
|
GnssMeasurementsNotification gnssMeasurementsNotification)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (count: %zu active: %zu)",
|
LOC_LOGD("%s]: (count: %zu active: %d)",
|
||||||
__FUNCTION__, gnssMeasurementsNotification.count, mTracking);
|
__FUNCTION__, gnssMeasurementsNotification.count, mTracking);
|
||||||
if (mTracking) {
|
if (mTracking) {
|
||||||
mMutex.lock();
|
mMutex.lock();
|
||||||
auto gnssMeasurementCbIface(mGnssMeasurementCbIface);
|
sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
|
||||||
|
if (mGnssMeasurementCbIface != nullptr) {
|
||||||
|
gnssMeasurementCbIface = mGnssMeasurementCbIface;
|
||||||
|
}
|
||||||
mMutex.unlock();
|
mMutex.unlock();
|
||||||
|
|
||||||
if (gnssMeasurementCbIface != nullptr) {
|
if (gnssMeasurementCbIface != nullptr) {
|
||||||
IGnssMeasurementCallback::GnssData gnssData;
|
V1_0::IGnssMeasurementCallback::GnssData gnssData;
|
||||||
convertGnssData(gnssMeasurementsNotification, gnssData);
|
convertGnssData(gnssMeasurementsNotification, gnssData);
|
||||||
auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
|
auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
|
||||||
if (!r.isOk()) {
|
if (!r.isOk()) {
|
||||||
|
@ -135,7 +147,7 @@ void MeasurementAPIClient::onGnssMeasurementsCb(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convertGnssMeasurement(GnssMeasurementsData& in,
|
static void convertGnssMeasurement(GnssMeasurementsData& in,
|
||||||
IGnssMeasurementCallback::GnssMeasurement& out)
|
V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
|
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
|
||||||
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
|
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
|
||||||
|
@ -242,13 +254,13 @@ static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convertGnssData(GnssMeasurementsNotification& in,
|
static void convertGnssData(GnssMeasurementsNotification& in,
|
||||||
IGnssMeasurementCallback::GnssData& out)
|
V1_0::IGnssMeasurementCallback::GnssData& out)
|
||||||
{
|
{
|
||||||
out.measurementCount = in.count;
|
out.measurementCount = in.count;
|
||||||
if (out.measurementCount > static_cast<uint32_t>(GnssMax::SVS_COUNT)) {
|
if (out.measurementCount > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
|
||||||
LOC_LOGW("%s]: Too many measurement %zd. Clamps to %d.",
|
LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.",
|
||||||
__FUNCTION__, out.measurementCount, GnssMax::SVS_COUNT);
|
__FUNCTION__, out.measurementCount, V1_0::GnssMax::SVS_COUNT);
|
||||||
out.measurementCount = static_cast<uint32_t>(GnssMax::SVS_COUNT);
|
out.measurementCount = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < out.measurementCount; i++) {
|
for (size_t i = 0; i < out.measurementCount; i++) {
|
||||||
convertGnssMeasurement(in.measurements[i], out.measurements[i]);
|
convertGnssMeasurement(in.measurements[i], out.measurements[i]);
|
||||||
|
|
11
gps/android/location_api/MeasurementAPIClient.h
Normal file → Executable file
11
gps/android/location_api/MeasurementAPIClient.h
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -42,7 +42,6 @@ namespace gnss {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
|
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
|
|
||||||
class MeasurementAPIClient : public LocationAPIClientBase
|
class MeasurementAPIClient : public LocationAPIClientBase
|
||||||
|
@ -54,16 +53,18 @@ public:
|
||||||
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
|
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
|
||||||
|
|
||||||
// for GpsMeasurementInterface
|
// for GpsMeasurementInterface
|
||||||
Return<IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
|
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
|
||||||
const sp<IGnssMeasurementCallback>& callback);
|
const sp<V1_0::IGnssMeasurementCallback>& callback);
|
||||||
void measurementClose();
|
void measurementClose();
|
||||||
|
Return<IGnssMeasurement::GnssMeasurementStatus> startTracking();
|
||||||
|
|
||||||
// callbacks we are interested in
|
// callbacks we are interested in
|
||||||
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
|
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface;
|
|
||||||
std::mutex mMutex;
|
std::mutex mMutex;
|
||||||
|
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
|
||||||
|
|
||||||
bool mTracking;
|
bool mTracking;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
6
gps/android/service.cpp
Normal file → Executable file
6
gps/android/service.cpp
Normal file → Executable file
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -18,9 +18,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOG_TAG "android.hardware.gnss@1.0-service-qti"
|
#define LOG_TAG "android.hardware.gnss@1.1-service-qti"
|
||||||
|
|
||||||
#include <android/hardware/gnss/1.0/IGnss.h>
|
#include <android/hardware/gnss/1.1/IGnss.h>
|
||||||
#include <hidl/LegacySupport.h>
|
#include <hidl/LegacySupport.h>
|
||||||
|
|
||||||
using android::hardware::gnss::V1_0::IGnss;
|
using android::hardware::gnss::V1_0::IGnss;
|
||||||
|
|
17
gps/build/target_specific_features.mk
Executable file
17
gps/build/target_specific_features.mk
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
GNSS_CFLAGS := \
|
||||||
|
-Werror \
|
||||||
|
-Wno-error=unused-parameter \
|
||||||
|
-Wno-error=format \
|
||||||
|
-Wno-error=macro-redefined \
|
||||||
|
-Wno-error=reorder \
|
||||||
|
-Wno-error=missing-braces \
|
||||||
|
-Wno-error=self-assign \
|
||||||
|
-Wno-error=enum-conversion \
|
||||||
|
-Wno-error=logical-op-parentheses \
|
||||||
|
-Wno-error=null-arithmetic \
|
||||||
|
-Wno-error=null-conversion \
|
||||||
|
-Wno-error=parentheses-equality \
|
||||||
|
-Wno-error=undefined-bool-conversion \
|
||||||
|
-Wno-error=tautological-compare \
|
||||||
|
-Wno-error=switch \
|
||||||
|
-Wno-error=date-time
|
10
gps/core/Android.mk
Normal file → Executable file
10
gps/core/Android.mk
Normal file → Executable file
|
@ -3,8 +3,7 @@ LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE := libloc_core
|
LOCAL_MODULE := libloc_core
|
||||||
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
|
LOCAL_VENDOR_MODULE := true
|
||||||
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
|
ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
|
||||||
|
@ -17,8 +16,7 @@ LOCAL_SHARED_LIBRARIES := \
|
||||||
libcutils \
|
libcutils \
|
||||||
libgps.utils \
|
libgps.utils \
|
||||||
libdl \
|
libdl \
|
||||||
liblog \
|
liblog
|
||||||
libloc_pla
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
LocApiBase.cpp \
|
LocApiBase.cpp \
|
||||||
|
@ -27,9 +25,6 @@ LOCAL_SRC_FILES += \
|
||||||
LocDualContext.cpp \
|
LocDualContext.cpp \
|
||||||
loc_core_log.cpp \
|
loc_core_log.cpp \
|
||||||
data-items/DataItemsFactoryProxy.cpp \
|
data-items/DataItemsFactoryProxy.cpp \
|
||||||
data-items/common/ClientIndex.cpp \
|
|
||||||
data-items/common/DataItemIndex.cpp \
|
|
||||||
data-items/common/IndexFactory.cpp \
|
|
||||||
SystemStatusOsObserver.cpp \
|
SystemStatusOsObserver.cpp \
|
||||||
SystemStatus.cpp
|
SystemStatus.cpp
|
||||||
|
|
||||||
|
@ -43,6 +38,7 @@ LOCAL_C_INCLUDES:= \
|
||||||
$(LOCAL_PATH)/observer \
|
$(LOCAL_PATH)/observer \
|
||||||
|
|
||||||
LOCAL_HEADER_LIBRARIES := \
|
LOCAL_HEADER_LIBRARIES := \
|
||||||
|
libutils_headers \
|
||||||
libgps.utils_headers \
|
libgps.utils_headers \
|
||||||
libloc_pla_headers \
|
libloc_pla_headers \
|
||||||
liblocation_api_headers
|
liblocation_api_headers
|
||||||
|
|
6
gps/core/ContextBase.cpp
Normal file → Executable file
6
gps/core/ContextBase.cpp
Normal file → Executable file
|
@ -35,7 +35,7 @@
|
||||||
#include <ContextBase.h>
|
#include <ContextBase.h>
|
||||||
#include <msg_q.h>
|
#include <msg_q.h>
|
||||||
#include <loc_target.h>
|
#include <loc_target.h>
|
||||||
#include <platform_lib_includes.h>
|
#include <loc_pla.h>
|
||||||
#include <loc_log.h>
|
#include <loc_log.h>
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
@ -65,6 +65,8 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
|
||||||
{"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
|
{"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'},
|
{"AGPS_CONFIG_INJECT", &mGps_conf.AGPS_CONFIG_INJECT, NULL, 'n'},
|
||||||
{"EXTERNAL_DR_ENABLED", &mGps_conf.EXTERNAL_DR_ENABLED, 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'},
|
||||||
};
|
};
|
||||||
|
|
||||||
const loc_param_s_type ContextBase::mSap_conf_table[] =
|
const loc_param_s_type ContextBase::mSap_conf_table[] =
|
||||||
|
@ -98,6 +100,8 @@ void ContextBase::readConfig()
|
||||||
mGps_conf.SUPL_VER = 0x10000;
|
mGps_conf.SUPL_VER = 0x10000;
|
||||||
mGps_conf.SUPL_MODE = 0x1;
|
mGps_conf.SUPL_MODE = 0x1;
|
||||||
mGps_conf.SUPL_ES = 0;
|
mGps_conf.SUPL_ES = 0;
|
||||||
|
mGps_conf.SUPL_HOST[0] = 0;
|
||||||
|
mGps_conf.SUPL_PORT = 0;
|
||||||
mGps_conf.CAPABILITIES = 0x7;
|
mGps_conf.CAPABILITIES = 0x7;
|
||||||
/* LTE Positioning Profile configuration is disable by default*/
|
/* LTE Positioning Profile configuration is disable by default*/
|
||||||
mGps_conf.LPP_PROFILE = 0;
|
mGps_conf.LPP_PROFILE = 0;
|
||||||
|
|
5
gps/core/ContextBase.h
Normal file → Executable file
5
gps/core/ContextBase.h
Normal file → Executable file
|
@ -36,7 +36,8 @@
|
||||||
#include <LBSProxyBase.h>
|
#include <LBSProxyBase.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
#define MAX_XTRA_SERVER_URL_LENGTH 256
|
#define MAX_XTRA_SERVER_URL_LENGTH (256)
|
||||||
|
#define MAX_SUPL_SERVER_URL_LENGTH (256)
|
||||||
|
|
||||||
/* GPS.conf support */
|
/* GPS.conf support */
|
||||||
/* NOTE: the implementaiton of the parser casts number
|
/* NOTE: the implementaiton of the parser casts number
|
||||||
|
@ -64,6 +65,8 @@ typedef struct loc_gps_cfg_s
|
||||||
uint32_t LPPE_CP_TECHNOLOGY;
|
uint32_t LPPE_CP_TECHNOLOGY;
|
||||||
uint32_t LPPE_UP_TECHNOLOGY;
|
uint32_t LPPE_UP_TECHNOLOGY;
|
||||||
uint32_t EXTERNAL_DR_ENABLED;
|
uint32_t EXTERNAL_DR_ENABLED;
|
||||||
|
char SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
|
||||||
|
uint32_t SUPL_PORT;
|
||||||
} loc_gps_cfg_s_type;
|
} loc_gps_cfg_s_type;
|
||||||
|
|
||||||
/* NOTE: the implementaiton of the parser casts number
|
/* NOTE: the implementaiton of the parser casts number
|
||||||
|
|
0
gps/core/LBSProxyBase.h
Normal file → Executable file
0
gps/core/LBSProxyBase.h
Normal file → Executable file
6
gps/core/LocAdapterBase.cpp
Normal file → Executable file
6
gps/core/LocAdapterBase.cpp
Normal file → Executable file
|
@ -32,7 +32,7 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <LocAdapterBase.h>
|
#include <LocAdapterBase.h>
|
||||||
#include <loc_target.h>
|
#include <loc_target.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <log_util.h>
|
||||||
#include <LocAdapterProxyBase.h>
|
#include <LocAdapterProxyBase.h>
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
@ -161,4 +161,8 @@ bool LocAdapterBase::
|
||||||
reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
|
reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
|
bool LocAdapterBase::
|
||||||
|
reportOdcpiRequestEvent(OdcpiRequestInfo& /*request*/)
|
||||||
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
1
gps/core/LocAdapterBase.h
Normal file → Executable file
1
gps/core/LocAdapterBase.h
Normal file → Executable file
|
@ -153,6 +153,7 @@ public:
|
||||||
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
|
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
|
||||||
int msInWeek);
|
int msInWeek);
|
||||||
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
|
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
|
||||||
|
virtual bool reportOdcpiRequestEvent(OdcpiRequestInfo& request);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
0
gps/core/LocAdapterProxyBase.h
Normal file → Executable file
0
gps/core/LocAdapterProxyBase.h
Normal file → Executable file
30
gps/core/LocApiBase.cpp
Normal file → Executable file
30
gps/core/LocApiBase.cpp
Normal file → Executable file
|
@ -33,7 +33,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <LocApiBase.h>
|
#include <LocApiBase.h>
|
||||||
#include <LocAdapterBase.h>
|
#include <LocAdapterBase.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <log_util.h>
|
||||||
#include <LocDualContext.h>
|
#include <LocDualContext.h>
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
@ -107,19 +107,16 @@ struct LocSsrMsg : public LocMsg {
|
||||||
|
|
||||||
struct LocOpenMsg : public LocMsg {
|
struct LocOpenMsg : public LocMsg {
|
||||||
LocApiBase* mLocApi;
|
LocApiBase* mLocApi;
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T mMask;
|
inline LocOpenMsg(LocApiBase* locApi) :
|
||||||
inline LocOpenMsg(LocApiBase* locApi,
|
LocMsg(), mLocApi(locApi)
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T mask) :
|
|
||||||
LocMsg(), mLocApi(locApi), mMask(mask)
|
|
||||||
{
|
{
|
||||||
locallog();
|
locallog();
|
||||||
}
|
}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
mLocApi->open(mMask);
|
mLocApi->open(mLocApi->getEvtMask());
|
||||||
}
|
}
|
||||||
inline void locallog() const {
|
inline void locallog() const {
|
||||||
LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
|
LOC_LOGv("LocOpen Mask: %" PRIx64 "\n", mLocApi->getEvtMask());
|
||||||
__func__, __LINE__, mMask);
|
|
||||||
}
|
}
|
||||||
inline virtual void log() const {
|
inline virtual void log() const {
|
||||||
locallog();
|
locallog();
|
||||||
|
@ -163,8 +160,7 @@ void LocApiBase::addAdapter(LocAdapterBase* adapter)
|
||||||
for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
|
for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
|
||||||
if (mLocAdapters[i] == NULL) {
|
if (mLocAdapters[i] == NULL) {
|
||||||
mLocAdapters[i] = adapter;
|
mLocAdapters[i] = adapter;
|
||||||
mMsgTask->sendMsg(new LocOpenMsg(this,
|
mMsgTask->sendMsg(new LocOpenMsg(this));
|
||||||
(adapter->getEvtMask())));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +196,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
|
||||||
close();
|
close();
|
||||||
} else {
|
} else {
|
||||||
// else we need to remove the bit
|
// else we need to remove the bit
|
||||||
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
|
mMsgTask->sendMsg(new LocOpenMsg(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +204,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
|
||||||
|
|
||||||
void LocApiBase::updateEvtMask()
|
void LocApiBase::updateEvtMask()
|
||||||
{
|
{
|
||||||
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
|
open(getEvtMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocApiBase::handleEngineUpEvent()
|
void LocApiBase::handleEngineUpEvent()
|
||||||
|
@ -264,6 +260,12 @@ void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
|
||||||
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
|
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocApiBase::reportOdcpiRequest(OdcpiRequestInfo& request)
|
||||||
|
{
|
||||||
|
// loop through adapters, and deliver to the first handling adapter.
|
||||||
|
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportOdcpiRequestEvent(request));
|
||||||
|
}
|
||||||
|
|
||||||
void LocApiBase::reportSv(GnssSvNotification& svNotify)
|
void LocApiBase::reportSv(GnssSvNotification& svNotify)
|
||||||
{
|
{
|
||||||
const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
|
const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
|
||||||
|
@ -440,6 +442,10 @@ enum loc_api_adapter_err LocApiBase::
|
||||||
injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
|
injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
|
||||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||||
|
|
||||||
|
enum loc_api_adapter_err LocApiBase::
|
||||||
|
injectPosition(const Location& /*location*/)
|
||||||
|
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||||
|
|
||||||
enum loc_api_adapter_err LocApiBase::
|
enum loc_api_adapter_err LocApiBase::
|
||||||
setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
|
setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
|
||||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||||
|
|
5
gps/core/LocApiBase.h
Normal file → Executable file
5
gps/core/LocApiBase.h
Normal file → Executable file
|
@ -34,7 +34,7 @@
|
||||||
#include <gps_extended.h>
|
#include <gps_extended.h>
|
||||||
#include <LocationAPI.h>
|
#include <LocationAPI.h>
|
||||||
#include <MsgTask.h>
|
#include <MsgTask.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <log_util.h>
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
class ContextBase;
|
class ContextBase;
|
||||||
|
@ -134,6 +134,7 @@ public:
|
||||||
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
|
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
|
||||||
void saveSupportedFeatureList(uint8_t *featureList);
|
void saveSupportedFeatureList(uint8_t *featureList);
|
||||||
void reportWwanZppFix(LocGpsLocation &zppLoc);
|
void reportWwanZppFix(LocGpsLocation &zppLoc);
|
||||||
|
void reportOdcpiRequest(OdcpiRequestInfo& request);
|
||||||
|
|
||||||
// downward calls
|
// downward calls
|
||||||
// All below functions are to be defined by adapter specific modules:
|
// All below functions are to be defined by adapter specific modules:
|
||||||
|
@ -153,6 +154,8 @@ public:
|
||||||
setAPN(char* apn, int len);
|
setAPN(char* apn, int len);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
injectPosition(double latitude, double longitude, float accuracy);
|
injectPosition(double latitude, double longitude, float accuracy);
|
||||||
|
virtual enum loc_api_adapter_err
|
||||||
|
injectPosition(const Location& location);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
|
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
|
|
2
gps/core/LocDualContext.cpp
Normal file → Executable file
2
gps/core/LocDualContext.cpp
Normal file → Executable file
|
@ -33,7 +33,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <LocDualContext.h>
|
#include <LocDualContext.h>
|
||||||
#include <msg_q.h>
|
#include <msg_q.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_log.h>
|
#include <loc_log.h>
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
|
0
gps/core/LocDualContext.h
Normal file → Executable file
0
gps/core/LocDualContext.h
Normal file → Executable file
219
gps/core/SystemStatus.cpp
Normal file → Executable file
219
gps/core/SystemStatus.cpp
Normal file → Executable file
|
@ -34,8 +34,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <loc_pla.h>
|
||||||
#include <MsgTask.h>
|
#include <log_util.h>
|
||||||
#include <loc_nmea.h>
|
#include <loc_nmea.h>
|
||||||
#include <DataItemsFactoryProxy.h>
|
#include <DataItemsFactoryProxy.h>
|
||||||
#include <SystemStatus.h>
|
#include <SystemStatus.h>
|
||||||
|
@ -120,6 +120,12 @@ public:
|
||||||
double mAgcGal; // x16
|
double mAgcGal; // x16
|
||||||
int32_t mLeapSeconds;// x17
|
int32_t mLeapSeconds;// x17
|
||||||
int32_t mLeapSecUnc; // x18
|
int32_t mLeapSecUnc; // x18
|
||||||
|
uint32_t mGloBpAmpI; // x19
|
||||||
|
uint32_t mGloBpAmpQ; // x1A
|
||||||
|
uint32_t mBdsBpAmpI; // x1B
|
||||||
|
uint32_t mBdsBpAmpQ; // x1C
|
||||||
|
uint32_t mGalBpAmpI; // x1D
|
||||||
|
uint32_t mGalBpAmpQ; // x1E
|
||||||
};
|
};
|
||||||
|
|
||||||
// parser
|
// parser
|
||||||
|
@ -154,6 +160,12 @@ private:
|
||||||
eMax0 = eAgcGal,
|
eMax0 = eAgcGal,
|
||||||
eLeapSeconds = 23,
|
eLeapSeconds = 23,
|
||||||
eLeapSecUnc = 24,
|
eLeapSecUnc = 24,
|
||||||
|
eGloBpAmpI = 25,
|
||||||
|
eGloBpAmpQ = 26,
|
||||||
|
eBdsBpAmpI = 27,
|
||||||
|
eBdsBpAmpQ = 28,
|
||||||
|
eGalBpAmpI = 29,
|
||||||
|
eGalBpAmpQ = 30,
|
||||||
eMax
|
eMax
|
||||||
};
|
};
|
||||||
SystemStatusPQWM1 mM1;
|
SystemStatusPQWM1 mM1;
|
||||||
|
@ -183,6 +195,12 @@ public:
|
||||||
inline uint32_t getRecErrorRecovery() { return mM1.mRecErrorRecovery; }
|
inline uint32_t getRecErrorRecovery() { return mM1.mRecErrorRecovery; }
|
||||||
inline int32_t getLeapSeconds(){ return mM1.mLeapSeconds; }
|
inline int32_t getLeapSeconds(){ return mM1.mLeapSeconds; }
|
||||||
inline int32_t getLeapSecUnc() { return mM1.mLeapSecUnc; }
|
inline int32_t getLeapSecUnc() { return mM1.mLeapSecUnc; }
|
||||||
|
inline uint32_t getGloBpAmpI() { return mM1.mGloBpAmpI; }
|
||||||
|
inline uint32_t getGloBpAmpQ() { return mM1.mGloBpAmpQ; }
|
||||||
|
inline uint32_t getBdsBpAmpI() { return mM1.mBdsBpAmpI; }
|
||||||
|
inline uint32_t getBdsBpAmpQ() { return mM1.mBdsBpAmpQ; }
|
||||||
|
inline uint32_t getGalBpAmpI() { return mM1.mGalBpAmpI; }
|
||||||
|
inline uint32_t getGalBpAmpQ() { return mM1.mGalBpAmpQ; }
|
||||||
|
|
||||||
SystemStatusPQWM1parser(const char *str_in, uint32_t len_in)
|
SystemStatusPQWM1parser(const char *str_in, uint32_t len_in)
|
||||||
: SystemStatusNmeaBase(str_in, len_in)
|
: SystemStatusNmeaBase(str_in, len_in)
|
||||||
|
@ -219,6 +237,14 @@ public:
|
||||||
mM1.mLeapSeconds = atoi(mField[eLeapSeconds].c_str());
|
mM1.mLeapSeconds = atoi(mField[eLeapSeconds].c_str());
|
||||||
mM1.mLeapSecUnc = atoi(mField[eLeapSecUnc].c_str());
|
mM1.mLeapSecUnc = atoi(mField[eLeapSecUnc].c_str());
|
||||||
}
|
}
|
||||||
|
if (mField.size() > eGalBpAmpQ) {
|
||||||
|
mM1.mGloBpAmpI = atoi(mField[eGloBpAmpI].c_str());
|
||||||
|
mM1.mGloBpAmpQ = atoi(mField[eGloBpAmpQ].c_str());
|
||||||
|
mM1.mBdsBpAmpI = atoi(mField[eBdsBpAmpI].c_str());
|
||||||
|
mM1.mBdsBpAmpQ = atoi(mField[eBdsBpAmpQ].c_str());
|
||||||
|
mM1.mGalBpAmpI = atoi(mField[eGalBpAmpI].c_str());
|
||||||
|
mM1.mGalBpAmpQ = atoi(mField[eGalBpAmpQ].c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline SystemStatusPQWM1& get() { return mM1;} //getparser
|
inline SystemStatusPQWM1& get() { return mM1;} //getparser
|
||||||
|
@ -765,7 +791,13 @@ SystemStatusRfAndParams::SystemStatusRfAndParams(const SystemStatusPQWM1& nmea)
|
||||||
mAgcGps(nmea.mAgcGps),
|
mAgcGps(nmea.mAgcGps),
|
||||||
mAgcGlo(nmea.mAgcGlo),
|
mAgcGlo(nmea.mAgcGlo),
|
||||||
mAgcBds(nmea.mAgcBds),
|
mAgcBds(nmea.mAgcBds),
|
||||||
mAgcGal(nmea.mAgcGal)
|
mAgcGal(nmea.mAgcGal),
|
||||||
|
mGloBpAmpI(nmea.mGloBpAmpI),
|
||||||
|
mGloBpAmpQ(nmea.mGloBpAmpQ),
|
||||||
|
mBdsBpAmpI(nmea.mBdsBpAmpI),
|
||||||
|
mBdsBpAmpQ(nmea.mBdsBpAmpQ),
|
||||||
|
mGalBpAmpI(nmea.mGalBpAmpI),
|
||||||
|
mGalBpAmpQ(nmea.mGalBpAmpQ)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,7 +815,13 @@ bool SystemStatusRfAndParams::equals(const SystemStatusRfAndParams& peer)
|
||||||
(mAgcGps != peer.mAgcGps) ||
|
(mAgcGps != peer.mAgcGps) ||
|
||||||
(mAgcGlo != peer.mAgcGlo) ||
|
(mAgcGlo != peer.mAgcGlo) ||
|
||||||
(mAgcBds != peer.mAgcBds) ||
|
(mAgcBds != peer.mAgcBds) ||
|
||||||
(mAgcGal != peer.mAgcGal)) {
|
(mAgcGal != peer.mAgcGal) ||
|
||||||
|
(mGloBpAmpI != peer.mGloBpAmpI) ||
|
||||||
|
(mGloBpAmpQ != peer.mGloBpAmpQ) ||
|
||||||
|
(mBdsBpAmpI != peer.mBdsBpAmpI) ||
|
||||||
|
(mBdsBpAmpQ != peer.mBdsBpAmpQ) ||
|
||||||
|
(mGalBpAmpI != peer.mGalBpAmpI) ||
|
||||||
|
(mGalBpAmpQ != peer.mGalBpAmpQ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1217,8 +1255,7 @@ IOsObserver* SystemStatus::getOsObserver()
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemStatus::SystemStatus(const MsgTask* msgTask) :
|
SystemStatus::SystemStatus(const MsgTask* msgTask) :
|
||||||
mSysStatusObsvr(this, msgTask),
|
mSysStatusObsvr(this, msgTask)
|
||||||
mConnected(false)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
ENTRY_LOG ();
|
ENTRY_LOG ();
|
||||||
|
@ -1268,17 +1305,10 @@ SystemStatus::SystemStatus(const MsgTask* msgTask) :
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
SystemStatus - storing dataitems
|
SystemStatus - storing dataitems
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
template <typename TYPE_SYSTEMSTATUS_ITEM, typename TYPE_REPORT, typename TYPE_ITEMBASE>
|
|
||||||
bool SystemStatus::setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s)
|
|
||||||
{
|
|
||||||
TYPE_SYSTEMSTATUS_ITEM sout(s);
|
|
||||||
return setIteminReport(report, sout);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||||
bool SystemStatus::setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s)
|
bool SystemStatus::setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s)
|
||||||
{
|
{
|
||||||
if (!report.empty() && report.back().equals(s)) {
|
if (!report.empty() && report.back().equals(static_cast<TYPE_ITEM&>(s.collate(report.back())))) {
|
||||||
// there is no change - just update reported timestamp
|
// there is no change - just update reported timestamp
|
||||||
report.back().mUtcReported = s.mUtcReported;
|
report.back().mUtcReported = s.mUtcReported;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1317,11 +1347,10 @@ void SystemStatus::getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) c
|
||||||
@param[In] data pointer to the NMEA string
|
@param[In] data pointer to the NMEA string
|
||||||
@param[In] len length of the NMEA string
|
@param[In] len length of the NMEA string
|
||||||
|
|
||||||
@return true when successfully done
|
@return true when the NMEA is consumed by the method.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
if (!loc_nmea_is_debug(data, len)) {
|
if (!loc_nmea_is_debug(data, len)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1332,43 +1361,43 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
||||||
pthread_mutex_lock(&mMutexSystemStatus);
|
pthread_mutex_lock(&mMutexSystemStatus);
|
||||||
|
|
||||||
// parse the received nmea strings here
|
// parse the received nmea strings here
|
||||||
if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
SystemStatusPQWM1 s = SystemStatusPQWM1parser(buf, len).get();
|
SystemStatusPQWM1 s = SystemStatusPQWM1parser(buf, len).get();
|
||||||
ret |= setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s));
|
setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s));
|
||||||
ret |= setIteminReport(mCache.mXoState, SystemStatusXoState(s));
|
setIteminReport(mCache.mXoState, SystemStatusXoState(s));
|
||||||
ret |= setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s));
|
setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s));
|
||||||
ret |= setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s));
|
setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mInjectedPosition,
|
setIteminReport(mCache.mInjectedPosition,
|
||||||
SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get()));
|
SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mBestPosition,
|
setIteminReport(mCache.mBestPosition,
|
||||||
SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get()));
|
SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mXtra,
|
setIteminReport(mCache.mXtra,
|
||||||
SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get()));
|
SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mEphemeris,
|
setIteminReport(mCache.mEphemeris,
|
||||||
SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get()));
|
SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mSvHealth,
|
setIteminReport(mCache.mSvHealth,
|
||||||
SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get()));
|
SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mPdr,
|
setIteminReport(mCache.mPdr,
|
||||||
SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get()));
|
SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mNavData,
|
setIteminReport(mCache.mNavData,
|
||||||
SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get()));
|
SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
|
||||||
ret = setIteminReport(mCache.mPositionFailure,
|
setIteminReport(mCache.mPositionFailure,
|
||||||
SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get()));
|
SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1376,7 +1405,7 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -1417,94 +1446,92 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
|
||||||
switch(dataitem->getId())
|
switch(dataitem->getId())
|
||||||
{
|
{
|
||||||
case AIRPLANEMODE_DATA_ITEM_ID:
|
case AIRPLANEMODE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusAirplaneMode>(mCache.mAirplaneMode,
|
ret = setIteminReport(mCache.mAirplaneMode,
|
||||||
*(static_cast<AirplaneModeDataItemBase*>(dataitem)));
|
SystemStatusAirplaneMode(*(static_cast<AirplaneModeDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case ENH_DATA_ITEM_ID:
|
case ENH_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusENH>(mCache.mENH,
|
ret = setIteminReport(mCache.mENH,
|
||||||
*(static_cast<ENHDataItemBase*>(dataitem)));
|
SystemStatusENH(*(static_cast<ENHDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case GPSSTATE_DATA_ITEM_ID:
|
case GPSSTATE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusGpsState>(mCache.mGPSState,
|
ret = setIteminReport(mCache.mGPSState,
|
||||||
*(static_cast<GPSStateDataItemBase*>(dataitem)));
|
SystemStatusGpsState(*(static_cast<GPSStateDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case NLPSTATUS_DATA_ITEM_ID:
|
case NLPSTATUS_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusNLPStatus>(mCache.mNLPStatus,
|
ret = setIteminReport(mCache.mNLPStatus,
|
||||||
*(static_cast<NLPStatusDataItemBase*>(dataitem)));
|
SystemStatusNLPStatus(*(static_cast<NLPStatusDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case WIFIHARDWARESTATE_DATA_ITEM_ID:
|
case WIFIHARDWARESTATE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusWifiHardwareState>(mCache.mWifiHardwareState,
|
ret = setIteminReport(mCache.mWifiHardwareState,
|
||||||
*(static_cast<WifiHardwareStateDataItemBase*>(dataitem)));
|
SystemStatusWifiHardwareState(*(static_cast<WifiHardwareStateDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case NETWORKINFO_DATA_ITEM_ID:
|
case NETWORKINFO_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusNetworkInfo>(mCache.mNetworkInfo,
|
ret = setIteminReport(mCache.mNetworkInfo,
|
||||||
*(static_cast<NetworkInfoDataItemBase*>(dataitem)));
|
SystemStatusNetworkInfo(*(static_cast<NetworkInfoDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case RILSERVICEINFO_DATA_ITEM_ID:
|
case RILSERVICEINFO_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusServiceInfo>(mCache.mRilServiceInfo,
|
ret = setIteminReport(mCache.mRilServiceInfo,
|
||||||
*(static_cast<RilServiceInfoDataItemBase*>(dataitem)));
|
SystemStatusServiceInfo(*(static_cast<RilServiceInfoDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case RILCELLINFO_DATA_ITEM_ID:
|
case RILCELLINFO_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusRilCellInfo>(mCache.mRilCellInfo,
|
ret = setIteminReport(mCache.mRilCellInfo,
|
||||||
*(static_cast<RilCellInfoDataItemBase*>(dataitem)));
|
SystemStatusRilCellInfo(*(static_cast<RilCellInfoDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case SERVICESTATUS_DATA_ITEM_ID:
|
case SERVICESTATUS_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusServiceStatus>(mCache.mServiceStatus,
|
ret = setIteminReport(mCache.mServiceStatus,
|
||||||
*(static_cast<ServiceStatusDataItemBase*>(dataitem)));
|
SystemStatusServiceStatus(*(static_cast<ServiceStatusDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case MODEL_DATA_ITEM_ID:
|
case MODEL_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusModel>(mCache.mModel,
|
ret = setIteminReport(mCache.mModel,
|
||||||
*(static_cast<ModelDataItemBase*>(dataitem)));
|
SystemStatusModel(*(static_cast<ModelDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case MANUFACTURER_DATA_ITEM_ID:
|
case MANUFACTURER_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusManufacturer>(mCache.mManufacturer,
|
ret = setIteminReport(mCache.mManufacturer,
|
||||||
*(static_cast<ManufacturerDataItemBase*>(dataitem)));
|
SystemStatusManufacturer(*(static_cast<ManufacturerDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case ASSISTED_GPS_DATA_ITEM_ID:
|
case ASSISTED_GPS_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusAssistedGps>(mCache.mAssistedGps,
|
ret = setIteminReport(mCache.mAssistedGps,
|
||||||
*(static_cast<AssistedGpsDataItemBase*>(dataitem)));
|
SystemStatusAssistedGps(*(static_cast<AssistedGpsDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case SCREEN_STATE_DATA_ITEM_ID:
|
case SCREEN_STATE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusScreenState>(mCache.mScreenState,
|
ret = setIteminReport(mCache.mScreenState,
|
||||||
*(static_cast<ScreenStateDataItemBase*>(dataitem)));
|
SystemStatusScreenState(*(static_cast<ScreenStateDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case POWER_CONNECTED_STATE_DATA_ITEM_ID:
|
case POWER_CONNECTED_STATE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusPowerConnectState>(mCache.mPowerConnectState,
|
ret = setIteminReport(mCache.mPowerConnectState,
|
||||||
*(static_cast<PowerConnectStateDataItemBase*>(dataitem)));
|
SystemStatusPowerConnectState(*(static_cast<PowerConnectStateDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case TIMEZONE_CHANGE_DATA_ITEM_ID:
|
case TIMEZONE_CHANGE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusTimeZoneChange>(mCache.mTimeZoneChange,
|
ret = setIteminReport(mCache.mTimeZoneChange,
|
||||||
*(static_cast<TimeZoneChangeDataItemBase*>(dataitem)));
|
SystemStatusTimeZoneChange(*(static_cast<TimeZoneChangeDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case TIME_CHANGE_DATA_ITEM_ID:
|
case TIME_CHANGE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusTimeChange>(mCache.mTimeChange,
|
ret = setIteminReport(mCache.mTimeChange,
|
||||||
*(static_cast<TimeChangeDataItemBase*>(dataitem)));
|
SystemStatusTimeChange(*(static_cast<TimeChangeDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID:
|
case WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusWifiSupplicantStatus>(
|
ret = setIteminReport(mCache.mWifiSupplicantStatus,
|
||||||
mCache.mWifiSupplicantStatus,
|
SystemStatusWifiSupplicantStatus(*(static_cast<WifiSupplicantStatusDataItemBase*>(dataitem))));
|
||||||
*(static_cast<WifiSupplicantStatusDataItemBase*>(dataitem)));
|
|
||||||
break;
|
break;
|
||||||
case SHUTDOWN_STATE_DATA_ITEM_ID:
|
case SHUTDOWN_STATE_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusShutdownState>(mCache.mShutdownState,
|
ret = setIteminReport(mCache.mShutdownState,
|
||||||
*(static_cast<ShutdownStateDataItemBase*>(dataitem)));
|
SystemStatusShutdownState(*(static_cast<ShutdownStateDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case TAC_DATA_ITEM_ID:
|
case TAC_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusTac>(mCache.mTac,
|
ret = setIteminReport(mCache.mTac,
|
||||||
*(static_cast<TacDataItemBase*>(dataitem)));
|
SystemStatusTac(*(static_cast<TacDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case MCCMNC_DATA_ITEM_ID:
|
case MCCMNC_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusMccMnc>(mCache.mMccMnc,
|
ret = setIteminReport(mCache.mMccMnc,
|
||||||
*(static_cast<MccmncDataItemBase*>(dataitem)));
|
SystemStatusMccMnc(*(static_cast<MccmncDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case BTLE_SCAN_DATA_ITEM_ID:
|
case BTLE_SCAN_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusBtDeviceScanDetail>(mCache.mBtDeviceScanDetail,
|
ret = setIteminReport(mCache.mBtDeviceScanDetail,
|
||||||
*(static_cast<BtDeviceScanDetailsDataItemBase*>(dataitem)));
|
SystemStatusBtDeviceScanDetail(*(static_cast<BtDeviceScanDetailsDataItemBase*>(dataitem))));
|
||||||
break;
|
break;
|
||||||
case BT_SCAN_DATA_ITEM_ID:
|
case BT_SCAN_DATA_ITEM_ID:
|
||||||
ret = setItemBaseinReport<SystemStatusBtleDeviceScanDetail>(
|
ret = setIteminReport(mCache.mBtLeDeviceScanDetail,
|
||||||
mCache.mBtLeDeviceScanDetail,
|
SystemStatusBtleDeviceScanDetail(*(static_cast<BtLeDeviceScanDetailsDataItemBase*>(dataitem))));
|
||||||
*(static_cast<BtLeDeviceScanDetailsDataItemBase*>(dataitem)));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1623,7 +1650,7 @@ bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) con
|
||||||
|
|
||||||
@return true when successfully done
|
@return true when successfully done
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
bool SystemStatus::setDefaultReport(void)
|
bool SystemStatus::setDefaultGnssEngineStates(void)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&mMutexSystemStatus);
|
pthread_mutex_lock(&mMutexSystemStatus);
|
||||||
|
|
||||||
|
@ -1644,29 +1671,6 @@ bool SystemStatus::setDefaultReport(void)
|
||||||
|
|
||||||
setDefaultIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure());
|
setDefaultIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure());
|
||||||
|
|
||||||
setDefaultIteminReport(mCache.mAirplaneMode, SystemStatusAirplaneMode());
|
|
||||||
setDefaultIteminReport(mCache.mENH, SystemStatusENH());
|
|
||||||
setDefaultIteminReport(mCache.mGPSState, SystemStatusGpsState());
|
|
||||||
setDefaultIteminReport(mCache.mNLPStatus, SystemStatusNLPStatus());
|
|
||||||
setDefaultIteminReport(mCache.mWifiHardwareState, SystemStatusWifiHardwareState());
|
|
||||||
setDefaultIteminReport(mCache.mNetworkInfo, SystemStatusNetworkInfo());
|
|
||||||
setDefaultIteminReport(mCache.mRilServiceInfo, SystemStatusServiceInfo());
|
|
||||||
setDefaultIteminReport(mCache.mRilCellInfo, SystemStatusRilCellInfo());
|
|
||||||
setDefaultIteminReport(mCache.mServiceStatus, SystemStatusServiceStatus());
|
|
||||||
setDefaultIteminReport(mCache.mModel, SystemStatusModel());
|
|
||||||
setDefaultIteminReport(mCache.mManufacturer, SystemStatusManufacturer());
|
|
||||||
setDefaultIteminReport(mCache.mAssistedGps, SystemStatusAssistedGps());
|
|
||||||
setDefaultIteminReport(mCache.mScreenState, SystemStatusScreenState());
|
|
||||||
setDefaultIteminReport(mCache.mPowerConnectState, SystemStatusPowerConnectState());
|
|
||||||
setDefaultIteminReport(mCache.mTimeZoneChange, SystemStatusTimeZoneChange());
|
|
||||||
setDefaultIteminReport(mCache.mTimeChange, SystemStatusTimeChange());
|
|
||||||
setDefaultIteminReport(mCache.mWifiSupplicantStatus, SystemStatusWifiSupplicantStatus());
|
|
||||||
setDefaultIteminReport(mCache.mShutdownState, SystemStatusShutdownState());
|
|
||||||
setDefaultIteminReport(mCache.mTac, SystemStatusTac());
|
|
||||||
setDefaultIteminReport(mCache.mMccMnc, SystemStatusMccMnc());
|
|
||||||
setDefaultIteminReport(mCache.mBtDeviceScanDetail, SystemStatusBtDeviceScanDetail());
|
|
||||||
setDefaultIteminReport(mCache.mBtLeDeviceScanDetail, SystemStatusBtleDeviceScanDetail());
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&mMutexSystemStatus);
|
pthread_mutex_unlock(&mMutexSystemStatus);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1678,17 +1682,12 @@ bool SystemStatus::setDefaultReport(void)
|
||||||
|
|
||||||
@return true when successfully done
|
@return true when successfully done
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
bool SystemStatus::eventConnectionStatus(bool connected, uint8_t type)
|
bool SystemStatus::eventConnectionStatus(bool connected, int8_t type)
|
||||||
{
|
{
|
||||||
if (connected != mConnected) {
|
// send networkinof dataitem to systemstatus observer clients
|
||||||
mConnected = connected;
|
SystemStatusNetworkInfo s(type, "", "", connected);
|
||||||
|
mSysStatusObsvr.notify({&s});
|
||||||
|
|
||||||
// send networkinof dataitem to systemstatus observer clients
|
|
||||||
SystemStatusNetworkInfo s(type, "", "", false, connected, false);
|
|
||||||
list<IDataItemCore*> dl(0);
|
|
||||||
dl.push_back(&s);
|
|
||||||
mSysStatusObsvr.notify(dl);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
91
gps/core/SystemStatus.h
Normal file → Executable file
91
gps/core/SystemStatus.h
Normal file → Executable file
|
@ -30,9 +30,10 @@
|
||||||
#define __SYSTEM_STATUS__
|
#define __SYSTEM_STATUS__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <sys/time.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <platform_lib_log_util.h>
|
#include <loc_pla.h>
|
||||||
|
#include <log_util.h>
|
||||||
#include <MsgTask.h>
|
#include <MsgTask.h>
|
||||||
#include <IDataItemCore.h>
|
#include <IDataItemCore.h>
|
||||||
#include <IOsObserver.h>
|
#include <IOsObserver.h>
|
||||||
|
@ -70,14 +71,17 @@ public:
|
||||||
static const uint32_t maxItem = 5;
|
static const uint32_t maxItem = 5;
|
||||||
|
|
||||||
SystemStatusItemBase() {
|
SystemStatusItemBase() {
|
||||||
timeval tv;
|
struct timespec tv;
|
||||||
gettimeofday(&tv, NULL);
|
clock_gettime(CLOCK_MONOTONIC, &tv);
|
||||||
mUtcTime.tv_sec = tv.tv_sec;
|
mUtcTime.tv_sec = tv.tv_sec;
|
||||||
mUtcTime.tv_nsec = tv.tv_usec *1000ULL;
|
mUtcTime.tv_nsec = tv.tv_nsec;
|
||||||
mUtcReported = mUtcTime;
|
mUtcReported = mUtcTime;
|
||||||
};
|
};
|
||||||
virtual ~SystemStatusItemBase() { };
|
virtual ~SystemStatusItemBase() {};
|
||||||
virtual void dump(void) { };
|
inline virtual SystemStatusItemBase& collate(SystemStatusItemBase&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
virtual void dump(void) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SystemStatusLocation : public SystemStatusItemBase
|
class SystemStatusLocation : public SystemStatusItemBase
|
||||||
|
@ -92,7 +96,7 @@ public:
|
||||||
const GpsLocationExtended& locationEx) :
|
const GpsLocationExtended& locationEx) :
|
||||||
mValid(true),
|
mValid(true),
|
||||||
mLocation(location),
|
mLocation(location),
|
||||||
mLocationEx(locationEx) { }
|
mLocationEx(locationEx) {}
|
||||||
bool equals(const SystemStatusLocation& peer);
|
bool equals(const SystemStatusLocation& peer);
|
||||||
void dump(void);
|
void dump(void);
|
||||||
};
|
};
|
||||||
|
@ -152,6 +156,12 @@ public:
|
||||||
double mAgcGlo;
|
double mAgcGlo;
|
||||||
double mAgcBds;
|
double mAgcBds;
|
||||||
double mAgcGal;
|
double mAgcGal;
|
||||||
|
uint32_t mGloBpAmpI;
|
||||||
|
uint32_t mGloBpAmpQ;
|
||||||
|
uint32_t mBdsBpAmpI;
|
||||||
|
uint32_t mBdsBpAmpQ;
|
||||||
|
uint32_t mGalBpAmpI;
|
||||||
|
uint32_t mGalBpAmpQ;
|
||||||
inline SystemStatusRfAndParams() :
|
inline SystemStatusRfAndParams() :
|
||||||
mPgaGain(0),
|
mPgaGain(0),
|
||||||
mGpsBpAmpI(0),
|
mGpsBpAmpI(0),
|
||||||
|
@ -165,7 +175,13 @@ public:
|
||||||
mAgcGps(0),
|
mAgcGps(0),
|
||||||
mAgcGlo(0),
|
mAgcGlo(0),
|
||||||
mAgcBds(0),
|
mAgcBds(0),
|
||||||
mAgcGal(0) {}
|
mAgcGal(0),
|
||||||
|
mGloBpAmpI(0),
|
||||||
|
mGloBpAmpQ(0),
|
||||||
|
mBdsBpAmpI(0),
|
||||||
|
mBdsBpAmpQ(0),
|
||||||
|
mGalBpAmpI(0),
|
||||||
|
mGalBpAmpQ(0) {}
|
||||||
inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
|
inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
|
||||||
bool equals(const SystemStatusRfAndParams& peer);
|
bool equals(const SystemStatusRfAndParams& peer);
|
||||||
void dump(void);
|
void dump(void);
|
||||||
|
@ -444,38 +460,49 @@ public:
|
||||||
class SystemStatusNetworkInfo : public SystemStatusItemBase,
|
class SystemStatusNetworkInfo : public SystemStatusItemBase,
|
||||||
public NetworkInfoDataItemBase
|
public NetworkInfoDataItemBase
|
||||||
{
|
{
|
||||||
|
NetworkInfoDataItemBase* mSrcObjPtr;
|
||||||
public:
|
public:
|
||||||
inline SystemStatusNetworkInfo(
|
inline SystemStatusNetworkInfo(
|
||||||
int32_t type=0,
|
int32_t type=0,
|
||||||
std::string typeName="",
|
std::string typeName="",
|
||||||
string subTypeName="",
|
string subTypeName="",
|
||||||
bool available=false,
|
|
||||||
bool connected=false,
|
bool connected=false,
|
||||||
bool roaming=false) :
|
bool roaming=false) :
|
||||||
NetworkInfoDataItemBase(
|
NetworkInfoDataItemBase(
|
||||||
|
(NetworkType)type,
|
||||||
type,
|
type,
|
||||||
typeName,
|
typeName,
|
||||||
subTypeName,
|
subTypeName,
|
||||||
available,
|
connected && (!roaming),
|
||||||
connected,
|
connected,
|
||||||
roaming) {}
|
roaming),
|
||||||
|
mSrcObjPtr(nullptr) {}
|
||||||
inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) :
|
inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) :
|
||||||
NetworkInfoDataItemBase(itemBase) {
|
NetworkInfoDataItemBase(itemBase),
|
||||||
|
mSrcObjPtr((NetworkInfoDataItemBase*)&itemBase) {
|
||||||
mType = itemBase.getType();
|
mType = itemBase.getType();
|
||||||
}
|
}
|
||||||
inline bool equals(const SystemStatusNetworkInfo& peer) {
|
inline bool equals(const SystemStatusNetworkInfo& peer) {
|
||||||
if ((mType == peer.mType) &&
|
return (mAllTypes == peer.mAllTypes);
|
||||||
(mTypeName == peer.mTypeName) &&
|
}
|
||||||
(mSubTypeName == peer.mSubTypeName) &&
|
inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) {
|
||||||
(mAvailable == peer.mAvailable) &&
|
uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes;
|
||||||
(mConnected == peer.mConnected) &&
|
if (mConnected) {
|
||||||
(mRoaming == peer.mRoaming)) {
|
mAllTypes |= allTypes;
|
||||||
return true;
|
} else if (0 != mAllTypes) {
|
||||||
|
mAllTypes = (allTypes & (~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;
|
||||||
}
|
}
|
||||||
return false;
|
return *this;
|
||||||
}
|
}
|
||||||
inline void dump(void) override {
|
inline void dump(void) override {
|
||||||
LOC_LOGD("NetworkInfo: type=%u connected=%u", mType, mConnected);
|
LOC_LOGD("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x",
|
||||||
|
mAllTypes, mConnected, mType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -487,8 +514,9 @@ public:
|
||||||
RilServiceInfoDataItemBase() {}
|
RilServiceInfoDataItemBase() {}
|
||||||
inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) :
|
inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) :
|
||||||
RilServiceInfoDataItemBase(itemBase) {}
|
RilServiceInfoDataItemBase(itemBase) {}
|
||||||
inline bool equals(const SystemStatusServiceInfo& /*peer*/) {
|
inline bool equals(const SystemStatusServiceInfo& peer) {
|
||||||
return true;
|
return static_cast<const RilServiceInfoDataItemBase&>(peer) ==
|
||||||
|
static_cast<const RilServiceInfoDataItemBase&>(*this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -500,8 +528,9 @@ public:
|
||||||
RilCellInfoDataItemBase() {}
|
RilCellInfoDataItemBase() {}
|
||||||
inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) :
|
inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) :
|
||||||
RilCellInfoDataItemBase(itemBase) {}
|
RilCellInfoDataItemBase(itemBase) {}
|
||||||
inline bool equals(const SystemStatusRilCellInfo& /*peer*/) {
|
inline bool equals(const SystemStatusRilCellInfo& peer) {
|
||||||
return true;
|
return static_cast<const RilCellInfoDataItemBase&>(peer) ==
|
||||||
|
static_cast<const RilCellInfoDataItemBase&>(*this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -770,13 +799,9 @@ private:
|
||||||
// Data members
|
// Data members
|
||||||
static pthread_mutex_t mMutexSystemStatus;
|
static pthread_mutex_t mMutexSystemStatus;
|
||||||
SystemStatusReports mCache;
|
SystemStatusReports mCache;
|
||||||
bool mConnected;
|
|
||||||
|
|
||||||
template <typename TYPE_SYSTEMSTATUS_ITEM, typename TYPE_REPORT, typename TYPE_ITEMBASE>
|
|
||||||
bool setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s);
|
|
||||||
|
|
||||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||||
bool setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s);
|
bool setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s);
|
||||||
|
|
||||||
// set default dataitem derived item in report cache
|
// set default dataitem derived item in report cache
|
||||||
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
template <typename TYPE_REPORT, typename TYPE_ITEM>
|
||||||
|
@ -796,8 +821,8 @@ public:
|
||||||
bool eventDataItemNotify(IDataItemCore* dataitem);
|
bool eventDataItemNotify(IDataItemCore* dataitem);
|
||||||
bool setNmeaString(const char *data, uint32_t len);
|
bool setNmeaString(const char *data, uint32_t len);
|
||||||
bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
|
bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
|
||||||
bool setDefaultReport(void);
|
bool setDefaultGnssEngineStates(void);
|
||||||
bool eventConnectionStatus(bool connected, uint8_t type);
|
bool eventConnectionStatus(bool connected, int8_t type);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
682
gps/core/SystemStatusOsObserver.cpp
Normal file → Executable file
682
gps/core/SystemStatusOsObserver.cpp
Normal file → Executable file
|
@ -32,25 +32,20 @@
|
||||||
#include <SystemStatus.h>
|
#include <SystemStatus.h>
|
||||||
#include <SystemStatusOsObserver.h>
|
#include <SystemStatusOsObserver.h>
|
||||||
#include <IDataItemCore.h>
|
#include <IDataItemCore.h>
|
||||||
#include <IClientIndex.h>
|
|
||||||
#include <IDataItemIndex.h>
|
|
||||||
#include <IndexFactory.h>
|
|
||||||
#include <DataItemsFactoryProxy.h>
|
#include <DataItemsFactoryProxy.h>
|
||||||
|
|
||||||
namespace loc_core
|
namespace loc_core
|
||||||
{
|
{
|
||||||
SystemStatusOsObserver::SystemStatusOsObserver(
|
template <typename CINT, typename COUT>
|
||||||
SystemStatus* systemstatus, const MsgTask* msgTask) :
|
COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) {
|
||||||
mSystemStatus(systemstatus),
|
COUT outContainer(0);
|
||||||
mAddress("SystemStatusOsObserver"),
|
for (auto item : inContainer) {
|
||||||
mClientIndex(IndexFactory<IDataItemObserver*, DataItemId> :: createClientIndex()),
|
outContainer.insert(outContainer.begin(), item);
|
||||||
mDataItemIndex(IndexFactory<IDataItemObserver*, DataItemId> :: createDataItemIndex())
|
}
|
||||||
{
|
return outContainer;
|
||||||
mContext.mMsgTask = msgTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemStatusOsObserver::~SystemStatusOsObserver()
|
SystemStatusOsObserver::~SystemStatusOsObserver() {
|
||||||
{
|
|
||||||
// Close data-item library handle
|
// Close data-item library handle
|
||||||
DataItemsFactoryProxy::closeDataItemLibraryHandle();
|
DataItemsFactoryProxy::closeDataItemLibraryHandle();
|
||||||
|
|
||||||
|
@ -62,290 +57,238 @@ SystemStatusOsObserver::~SystemStatusOsObserver()
|
||||||
}
|
}
|
||||||
|
|
||||||
mDataItemCache.clear();
|
mDataItemCache.clear();
|
||||||
delete mClientIndex;
|
|
||||||
delete mDataItemIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscriptionObj)
|
void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscriptionObj)
|
||||||
{
|
{
|
||||||
mContext.mSubscriptionObj = subscriptionObj;
|
struct SetSubsObj : public LocMsg {
|
||||||
|
ObserverContext& mContext;
|
||||||
|
IDataItemSubscription* mSubsObj;
|
||||||
|
inline SetSubsObj(ObserverContext& context, IDataItemSubscription* subscriptionObj) :
|
||||||
|
mContext(context), mSubsObj(subscriptionObj) {}
|
||||||
|
void proc() const {
|
||||||
|
mContext.mSubscriptionObj = mSubsObj;
|
||||||
|
|
||||||
LOC_LOGD("Request cache size - Subscribe:%zu RequestData:%zu",
|
if (!mContext.mSSObserver->mDataItemToClients.empty()) {
|
||||||
mSubscribeReqCache.size(), mReqDataCache.size());
|
list<DataItemId> dis(
|
||||||
|
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
|
||||||
// we have received the subscription object. process cached requests
|
mContext.mSSObserver->mDataItemToClients.getKeys()));
|
||||||
// process - subscribe request cache
|
mContext.mSubscriptionObj->subscribe(dis, mContext.mSSObserver);
|
||||||
for (auto each : mSubscribeReqCache) {
|
mContext.mSubscriptionObj->requestData(dis, mContext.mSSObserver);
|
||||||
subscribe(each.second, each.first);
|
}
|
||||||
}
|
|
||||||
// process - requestData request cache
|
|
||||||
for (auto each : mReqDataCache) {
|
|
||||||
requestData(each.second, each.first);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper to cache requests subscribe and requestData till subscription obj is obtained
|
|
||||||
void SystemStatusOsObserver::cacheObserverRequest(ObserverReqCache& reqCache,
|
|
||||||
const list<DataItemId>& l, IDataItemObserver* client)
|
|
||||||
{
|
|
||||||
ObserverReqCache::iterator dicIter = reqCache.find(client);
|
|
||||||
if (dicIter != reqCache.end()) {
|
|
||||||
// found
|
|
||||||
list<DataItemId> difference(0);
|
|
||||||
set_difference(l.begin(), l.end(),
|
|
||||||
dicIter->second.begin(), dicIter->second.end(),
|
|
||||||
inserter(difference, difference.begin()));
|
|
||||||
if (!difference.empty()) {
|
|
||||||
difference.sort();
|
|
||||||
dicIter->second.merge(difference);
|
|
||||||
dicIter->second.unique();
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
else {
|
|
||||||
// not found
|
if (nullptr == subscriptionObj) {
|
||||||
reqCache[client] = l;
|
LOC_LOGw("subscriptionObj is NULL");
|
||||||
|
} else {
|
||||||
|
mContext.mMsgTask->sendMsg(new SetSubsObj(mContext, subscriptionObj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
IDataItemSubscription Overrides
|
IDataItemSubscription Overrides
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void SystemStatusOsObserver::subscribe(
|
void SystemStatusOsObserver::subscribe(const list<DataItemId>& l, IDataItemObserver* client,
|
||||||
const list<DataItemId>& l, IDataItemObserver* client)
|
bool toRequestData)
|
||||||
{
|
{
|
||||||
if (nullptr == mContext.mSubscriptionObj) {
|
|
||||||
LOC_LOGD("%s]: Subscription object is NULL. Caching requests", __func__);
|
|
||||||
cacheObserverRequest(mSubscribeReqCache, l, client);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HandleSubscribeReq : public LocMsg {
|
struct HandleSubscribeReq : public LocMsg {
|
||||||
HandleSubscribeReq(SystemStatusOsObserver* parent,
|
inline HandleSubscribeReq(SystemStatusOsObserver* parent,
|
||||||
const list<DataItemId>& l, IDataItemObserver* client) :
|
list<DataItemId>& l, IDataItemObserver* client, bool requestData) :
|
||||||
mParent(parent), mClient(client), mDataItemList(l) {}
|
mParent(parent), mClient(client),
|
||||||
virtual ~HandleSubscribeReq() {}
|
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)),
|
||||||
|
mToRequestData(requestData) {}
|
||||||
|
|
||||||
void proc() const {
|
void proc() const {
|
||||||
|
unordered_set<DataItemId> dataItemsToSubscribe(0);
|
||||||
|
mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe);
|
||||||
|
mParent->mClientToDataItems.add(mClient, mDataItemSet);
|
||||||
|
|
||||||
if (mDataItemList.empty()) {
|
mParent->sendCachedDataItems(mDataItemSet, mClient);
|
||||||
LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle First Response
|
// Send subscription set to framework
|
||||||
list<DataItemId> pendingFirstResponseList(0);
|
if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToSubscribe.empty()) {
|
||||||
mParent->mClientIndex->add(mClient, mDataItemList, pendingFirstResponseList);
|
|
||||||
|
|
||||||
// Do not send first response for only pendingFirstResponseList,
|
|
||||||
// instead send for all the data items (present in the cache) that
|
|
||||||
// have been subscribed for each time.
|
|
||||||
mParent->sendFirstResponse(mDataItemList, mClient);
|
|
||||||
|
|
||||||
list<DataItemId> yetToSubscribeDataItemsList(0);
|
|
||||||
mParent->mDataItemIndex->add(mClient, mDataItemList, yetToSubscribeDataItemsList);
|
|
||||||
|
|
||||||
// Send subscription list to framework
|
|
||||||
if (!yetToSubscribeDataItemsList.empty()) {
|
|
||||||
mParent->mContext.mSubscriptionObj->subscribe(yetToSubscribeDataItemsList, mParent);
|
|
||||||
LOC_LOGD("Subscribe Request sent to framework for the following");
|
LOC_LOGD("Subscribe Request sent to framework for the following");
|
||||||
mParent->logMe(yetToSubscribeDataItemsList);
|
mParent->logMe(dataItemsToSubscribe);
|
||||||
|
|
||||||
|
if (mToRequestData) {
|
||||||
|
mParent->mContext.mSubscriptionObj->requestData(
|
||||||
|
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
|
||||||
|
std::move(dataItemsToSubscribe)),
|
||||||
|
mParent);
|
||||||
|
} else {
|
||||||
|
mParent->mContext.mSubscriptionObj->subscribe(
|
||||||
|
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
|
||||||
|
std::move(dataItemsToSubscribe)),
|
||||||
|
mParent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemStatusOsObserver* mParent;
|
mutable SystemStatusOsObserver* mParent;
|
||||||
IDataItemObserver* mClient;
|
IDataItemObserver* mClient;
|
||||||
const list<DataItemId> mDataItemList;
|
const unordered_set<DataItemId> mDataItemSet;
|
||||||
|
bool mToRequestData;
|
||||||
};
|
};
|
||||||
mContext.mMsgTask->sendMsg(new (nothrow) HandleSubscribeReq(this, l, client));
|
|
||||||
|
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(
|
void SystemStatusOsObserver::updateSubscription(
|
||||||
const list<DataItemId>& l, IDataItemObserver* client)
|
const list<DataItemId>& l, IDataItemObserver* client)
|
||||||
{
|
{
|
||||||
if (nullptr == mContext.mSubscriptionObj) {
|
|
||||||
LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HandleUpdateSubscriptionReq : public LocMsg {
|
struct HandleUpdateSubscriptionReq : public LocMsg {
|
||||||
HandleUpdateSubscriptionReq(SystemStatusOsObserver* parent,
|
HandleUpdateSubscriptionReq(SystemStatusOsObserver* parent,
|
||||||
const list<DataItemId>& l, IDataItemObserver* client) :
|
list<DataItemId>& l, IDataItemObserver* client) :
|
||||||
mParent(parent), mClient(client), mDataItemList(l) {}
|
mParent(parent), mClient(client),
|
||||||
virtual ~HandleUpdateSubscriptionReq() {}
|
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
|
||||||
|
|
||||||
void proc() const {
|
void proc() const {
|
||||||
if (mDataItemList.empty()) {
|
unordered_set<DataItemId> dataItemsToSubscribe(0);
|
||||||
LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
|
unordered_set<DataItemId> dataItemsToUnsubscribe(0);
|
||||||
return;
|
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
|
||||||
list<DataItemId> currentlySubscribedList(0);
|
// result, the entire entry will be removed. dataItemsToUnsubscribe will be
|
||||||
mParent->mClientIndex->getSubscribedList(mClient, currentlySubscribedList);
|
// populated to keep the keys of the removed entries.
|
||||||
|
mParent->mDataItemToClients.trimOrRemove(
|
||||||
list<DataItemId> removeDataItemList(0);
|
// this call updates <IDataItemObserver*, DataItemId> map; removes
|
||||||
set_difference(currentlySubscribedList.begin(), currentlySubscribedList.end(),
|
// the DataItemId's that are not new to the clietn from mDataItemSet;
|
||||||
mDataItemList.begin(), mDataItemList.end(),
|
// and returns a set of mDataItemSet's that are no longer used by client.
|
||||||
inserter(removeDataItemList,removeDataItemList.begin()));
|
// This unused set of mDataItemSet's is passed to trimOrRemove method of
|
||||||
|
// <DataItemId, IDataItemObserver*> map to remove the client from the
|
||||||
// Handle First Response
|
// corresponding entries, and gets a set of the entries that are
|
||||||
list<DataItemId> pendingFirstResponseList(0);
|
// removed from the <DataItemId, IDataItemObserver*> map as a result.
|
||||||
mParent->mClientIndex->add(mClient, mDataItemList, pendingFirstResponseList);
|
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
|
// Send First Response
|
||||||
mParent->sendFirstResponse(pendingFirstResponseList, mClient);
|
mParent->sendCachedDataItems(mDataItemSet, mClient);
|
||||||
|
|
||||||
list<DataItemId> yetToSubscribeDataItemsList(0);
|
if (nullptr != mParent->mContext.mSubscriptionObj) {
|
||||||
mParent->mDataItemIndex->add(
|
// Send subscription set to framework
|
||||||
mClient, mDataItemList, yetToSubscribeDataItemsList);
|
if (!dataItemsToSubscribe.empty()) {
|
||||||
|
LOC_LOGD("Subscribe Request sent to framework for the following");
|
||||||
|
mParent->logMe(dataItemsToSubscribe);
|
||||||
|
|
||||||
// Send subscription list to framework
|
mParent->mContext.mSubscriptionObj->subscribe(
|
||||||
if (!yetToSubscribeDataItemsList.empty()) {
|
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
|
||||||
mParent->mContext.mSubscriptionObj->subscribe(
|
std::move(dataItemsToSubscribe)),
|
||||||
yetToSubscribeDataItemsList, mParent);
|
mParent);
|
||||||
LOC_LOGD("Subscribe Request sent to framework for the following");
|
}
|
||||||
mParent->logMe(yetToSubscribeDataItemsList);
|
|
||||||
}
|
|
||||||
|
|
||||||
list<DataItemId> unsubscribeList(0);
|
|
||||||
list<DataItemId> unused(0);
|
|
||||||
mParent->mClientIndex->remove(mClient, removeDataItemList, unused);
|
|
||||||
|
|
||||||
if (!mParent->mClientIndex->isSubscribedClient(mClient)) {
|
|
||||||
mParent->mDataItemIndex->remove(
|
|
||||||
list<IDataItemObserver*> (1,mClient), unsubscribeList);
|
|
||||||
}
|
|
||||||
if (!unsubscribeList.empty()) {
|
|
||||||
// Send unsubscribe to framework
|
// Send unsubscribe to framework
|
||||||
mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent);
|
if (!dataItemsToUnsubscribe.empty()) {
|
||||||
LOC_LOGD("Unsubscribe Request sent to framework for the following");
|
LOC_LOGD("Unsubscribe Request sent to framework for the following");
|
||||||
mParent->logMe(unsubscribeList);
|
mParent->logMe(dataItemsToUnsubscribe);
|
||||||
|
|
||||||
|
mParent->mContext.mSubscriptionObj->unsubscribe(
|
||||||
|
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
|
||||||
|
std::move(dataItemsToUnsubscribe)),
|
||||||
|
mParent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemStatusOsObserver* mParent;
|
SystemStatusOsObserver* mParent;
|
||||||
IDataItemObserver* mClient;
|
IDataItemObserver* mClient;
|
||||||
const list<DataItemId> mDataItemList;
|
unordered_set<DataItemId> mDataItemSet;
|
||||||
};
|
};
|
||||||
mContext.mMsgTask->sendMsg(new (nothrow) HandleUpdateSubscriptionReq(this, l, client));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemStatusOsObserver::requestData(
|
if (l.empty() || nullptr == client) {
|
||||||
const list<DataItemId>& l, IDataItemObserver* client)
|
LOC_LOGw("Data item set is empty or client is nullptr");
|
||||||
{
|
} else {
|
||||||
if (nullptr == mContext.mSubscriptionObj) {
|
mContext.mMsgTask->sendMsg(
|
||||||
LOC_LOGD("%s]: Subscription object is NULL. Caching requests", __func__);
|
new HandleUpdateSubscriptionReq(this, (list<DataItemId>&)l, client));
|
||||||
cacheObserverRequest(mReqDataCache, l, client);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct HandleRequestData : public LocMsg {
|
|
||||||
HandleRequestData(SystemStatusOsObserver* parent,
|
|
||||||
const list<DataItemId>& l, IDataItemObserver* client) :
|
|
||||||
mParent(parent), mClient(client), mDataItemList(l) {}
|
|
||||||
virtual ~HandleRequestData() {}
|
|
||||||
void proc() const {
|
|
||||||
if (mDataItemList.empty()) {
|
|
||||||
LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
list<DataItemId> yetToSubscribeDataItemsList(0);
|
|
||||||
mParent->mClientIndex->add(
|
|
||||||
mClient, mDataItemList, yetToSubscribeDataItemsList);
|
|
||||||
mParent->mDataItemIndex->add(
|
|
||||||
mClient, mDataItemList, yetToSubscribeDataItemsList);
|
|
||||||
|
|
||||||
// Send subscription list to framework
|
|
||||||
if (!mDataItemList.empty()) {
|
|
||||||
mParent->mContext.mSubscriptionObj->requestData(mDataItemList, mParent);
|
|
||||||
LOC_LOGD("Subscribe Request sent to framework for the following");
|
|
||||||
mParent->logMe(yetToSubscribeDataItemsList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SystemStatusOsObserver* mParent;
|
|
||||||
IDataItemObserver* mClient;
|
|
||||||
const list<DataItemId> mDataItemList;
|
|
||||||
};
|
|
||||||
mContext.mMsgTask->sendMsg(new (nothrow) HandleRequestData(this, l, client));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemStatusOsObserver::unsubscribe(
|
void SystemStatusOsObserver::unsubscribe(
|
||||||
const list<DataItemId>& l, IDataItemObserver* client)
|
const list<DataItemId>& l, IDataItemObserver* client)
|
||||||
{
|
{
|
||||||
if (nullptr == mContext.mSubscriptionObj) {
|
|
||||||
LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
struct HandleUnsubscribeReq : public LocMsg {
|
struct HandleUnsubscribeReq : public LocMsg {
|
||||||
HandleUnsubscribeReq(SystemStatusOsObserver* parent,
|
HandleUnsubscribeReq(SystemStatusOsObserver* parent,
|
||||||
const list<DataItemId>& l, IDataItemObserver* client) :
|
list<DataItemId>& l, IDataItemObserver* client) :
|
||||||
mParent(parent), mClient(client), mDataItemList(l) {}
|
mParent(parent), mClient(client),
|
||||||
virtual ~HandleUnsubscribeReq() {}
|
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
|
||||||
|
|
||||||
void proc() const {
|
void proc() const {
|
||||||
if (mDataItemList.empty()) {
|
unordered_set<DataItemId> dataItemsUnusedByClient(0);
|
||||||
LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
|
unordered_set<IDataItemObserver*> clientToRemove(0);
|
||||||
return;
|
mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove,
|
||||||
}
|
&dataItemsUnusedByClient);
|
||||||
|
unordered_set<DataItemId> dataItemsToUnsubscribe(0);
|
||||||
|
mParent->mDataItemToClients.trimOrRemove(dataItemsUnusedByClient, {mClient},
|
||||||
|
&dataItemsToUnsubscribe, nullptr);
|
||||||
|
|
||||||
list<DataItemId> unsubscribeList(0);
|
if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToUnsubscribe.empty()) {
|
||||||
list<DataItemId> unused(0);
|
|
||||||
mParent->mClientIndex->remove(mClient, mDataItemList, unused);
|
|
||||||
|
|
||||||
for (auto each : mDataItemList) {
|
|
||||||
list<IDataItemObserver*> clientListSubs(0);
|
|
||||||
list<IDataItemObserver*> clientListOut(0);
|
|
||||||
mParent->mDataItemIndex->remove(
|
|
||||||
each, list<IDataItemObserver*> (1,mClient), clientListOut);
|
|
||||||
// check if there are any other subscribed client for this data item id
|
|
||||||
mParent->mDataItemIndex->getListOfSubscribedClients(each, clientListSubs);
|
|
||||||
if (clientListSubs.empty())
|
|
||||||
{
|
|
||||||
LOC_LOGD("Client list subscribed is empty for dataitem - %d", each);
|
|
||||||
unsubscribeList.push_back(each);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!unsubscribeList.empty()) {
|
|
||||||
// Send unsubscribe to framework
|
|
||||||
mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent);
|
|
||||||
LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
|
LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
|
||||||
mParent->logMe(unsubscribeList);
|
mParent->logMe(dataItemsToUnsubscribe);
|
||||||
|
|
||||||
|
// Send unsubscribe to framework
|
||||||
|
mParent->mContext.mSubscriptionObj->unsubscribe(
|
||||||
|
containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
|
||||||
|
std::move(dataItemsToUnsubscribe)),
|
||||||
|
mParent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemStatusOsObserver* mParent;
|
SystemStatusOsObserver* mParent;
|
||||||
IDataItemObserver* mClient;
|
IDataItemObserver* mClient;
|
||||||
const list<DataItemId> mDataItemList;
|
unordered_set<DataItemId> mDataItemSet;
|
||||||
};
|
};
|
||||||
mContext.mMsgTask->sendMsg(new (nothrow) HandleUnsubscribeReq(this, l, client));
|
|
||||||
|
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)
|
void SystemStatusOsObserver::unsubscribeAll(IDataItemObserver* client)
|
||||||
{
|
{
|
||||||
if (nullptr == mContext.mSubscriptionObj) {
|
|
||||||
LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HandleUnsubscribeAllReq : public LocMsg {
|
struct HandleUnsubscribeAllReq : public LocMsg {
|
||||||
HandleUnsubscribeAllReq(SystemStatusOsObserver* parent,
|
HandleUnsubscribeAllReq(SystemStatusOsObserver* parent,
|
||||||
IDataItemObserver* client) :
|
IDataItemObserver* client) :
|
||||||
mParent(parent), mClient(client) {}
|
mParent(parent), mClient(client) {}
|
||||||
virtual ~HandleUnsubscribeAllReq() {}
|
|
||||||
void proc() const {
|
|
||||||
list<IDataItemObserver*> clients(1, mClient);
|
|
||||||
list<DataItemId> unsubscribeList(0);
|
|
||||||
if(0 == mParent->mClientIndex->remove(mClient)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mParent->mDataItemIndex->remove(clients, unsubscribeList);
|
|
||||||
|
|
||||||
if (!unsubscribeList.empty()) {
|
void proc() const {
|
||||||
// Send unsubscribe to framework
|
unordered_set<DataItemId> diByClient = mParent->mClientToDataItems.getValSet(mClient);
|
||||||
mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent);
|
if (!diByClient.empty()) {
|
||||||
LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
|
unordered_set<DataItemId> dataItemsToUnsubscribe;
|
||||||
mParent->logMe(unsubscribeList);
|
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;
|
SystemStatusOsObserver* mParent;
|
||||||
IDataItemObserver* mClient;
|
IDataItemObserver* mClient;
|
||||||
};
|
};
|
||||||
mContext.mMsgTask->sendMsg(new (nothrow) HandleUnsubscribeAllReq(this, client));
|
|
||||||
|
if (nullptr == client) {
|
||||||
|
LOC_LOGw("Data item set is empty or client is nullptr");
|
||||||
|
} else {
|
||||||
|
mContext.mMsgTask->sendMsg(new HandleUnsubscribeAllReq(this, client));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -353,84 +296,81 @@ void SystemStatusOsObserver::unsubscribeAll(IDataItemObserver* client)
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
|
void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
|
||||||
{
|
{
|
||||||
list<IDataItemCore*> dataItemList(0);
|
|
||||||
|
|
||||||
for (auto each : dlist) {
|
|
||||||
string dv;
|
|
||||||
each->stringify(dv);
|
|
||||||
LOC_LOGD("notify: DataItem In Value:%s", dv.c_str());
|
|
||||||
|
|
||||||
IDataItemCore* di = DataItemsFactoryProxy::createNewDataItem(each->getId());
|
|
||||||
if (nullptr == di) {
|
|
||||||
LOC_LOGE("Unable to create dataitem:%d", each->getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy contents into the newly created data item
|
|
||||||
di->copy(each);
|
|
||||||
|
|
||||||
// Request systemstatus to record this dataitem in its cache
|
|
||||||
if (mSystemStatus->eventDataItemNotify(di)) {
|
|
||||||
// add this dataitem if updated from last one
|
|
||||||
dataItemList.push_back(di);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HandleNotify : public LocMsg {
|
struct HandleNotify : public LocMsg {
|
||||||
HandleNotify(SystemStatusOsObserver* parent, const list<IDataItemCore*>& l) :
|
HandleNotify(SystemStatusOsObserver* parent, vector<IDataItemCore*>& v) :
|
||||||
mParent(parent), mDList(l) {}
|
mParent(parent), mDiVec(std::move(v)) {}
|
||||||
virtual ~HandleNotify() {
|
|
||||||
for (auto each : mDList) {
|
inline virtual ~HandleNotify() {
|
||||||
delete each;
|
for (auto item : mDiVec) {
|
||||||
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void proc() const {
|
void proc() const {
|
||||||
// Update Cache with received data items and prepare
|
// Update Cache with received data items and prepare
|
||||||
// list of data items to be sent.
|
// list of data items to be sent.
|
||||||
list<DataItemId> dataItemIdsToBeSent(0);
|
unordered_set<DataItemId> dataItemIdsToBeSent(0);
|
||||||
for (auto item : mDList) {
|
for (auto item : mDiVec) {
|
||||||
bool dataItemUpdated = false;
|
if (mParent->updateCache(item)) {
|
||||||
mParent->updateCache(item, dataItemUpdated);
|
dataItemIdsToBeSent.insert(item->getId());
|
||||||
if (dataItemUpdated) {
|
|
||||||
dataItemIdsToBeSent.push_back(item->getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data item to all subscribed clients
|
// Send data item to all subscribed clients
|
||||||
list<IDataItemObserver*> clientList(0);
|
unordered_set<IDataItemObserver*> clientSet(0);
|
||||||
for (auto each : dataItemIdsToBeSent) {
|
for (auto each : dataItemIdsToBeSent) {
|
||||||
list<IDataItemObserver*> clients(0);
|
auto clients = mParent->mDataItemToClients.getValSetPtr(each);
|
||||||
mParent->mDataItemIndex->getListOfSubscribedClients(each, clients);
|
if (nullptr != clients) {
|
||||||
for (auto each_cient: clients) {
|
clientSet.insert(clients->begin(), clients->end());
|
||||||
clientList.push_back(each_cient);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clientList.unique();
|
|
||||||
|
|
||||||
for (auto client : clientList) {
|
for (auto client : clientSet) {
|
||||||
list<DataItemId> dataItemIdsSubscribedByThisClient(0);
|
unordered_set<DataItemId> dataItemIdsForThisClient(
|
||||||
list<DataItemId> dataItemIdsToBeSentForThisClient(0);
|
mParent->mClientToDataItems.getValSet(client));
|
||||||
mParent->mClientIndex->getSubscribedList(
|
for (auto itr = dataItemIdsForThisClient.begin();
|
||||||
client, dataItemIdsSubscribedByThisClient);
|
itr != dataItemIdsForThisClient.end(); ) {
|
||||||
dataItemIdsSubscribedByThisClient.sort();
|
if (dataItemIdsToBeSent.find(*itr) == dataItemIdsToBeSent.end()) {
|
||||||
dataItemIdsToBeSent.sort();
|
itr = dataItemIdsForThisClient.erase(itr);
|
||||||
|
} else {
|
||||||
|
itr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set_intersection(dataItemIdsToBeSent.begin(),
|
mParent->sendCachedDataItems(dataItemIdsForThisClient, client);
|
||||||
dataItemIdsToBeSent.end(),
|
|
||||||
dataItemIdsSubscribedByThisClient.begin(),
|
|
||||||
dataItemIdsSubscribedByThisClient.end(),
|
|
||||||
inserter(dataItemIdsToBeSentForThisClient,
|
|
||||||
dataItemIdsToBeSentForThisClient.begin()));
|
|
||||||
|
|
||||||
mParent->sendCachedDataItems(dataItemIdsToBeSentForThisClient, client);
|
|
||||||
dataItemIdsSubscribedByThisClient.clear();
|
|
||||||
dataItemIdsToBeSentForThisClient.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemStatusOsObserver* mParent;
|
SystemStatusOsObserver* mParent;
|
||||||
const list<IDataItemCore*> mDList;
|
const vector<IDataItemCore*> mDiVec;
|
||||||
};
|
};
|
||||||
mContext.mMsgTask->sendMsg(new (nothrow) HandleNotify(this, dataItemList));
|
|
||||||
|
if (!dlist.empty()) {
|
||||||
|
vector<IDataItemCore*> dataItemVec(dlist.size());
|
||||||
|
|
||||||
|
for (auto each : dlist) {
|
||||||
|
IF_LOC_LOGD {
|
||||||
|
string dv;
|
||||||
|
each->stringify(dv);
|
||||||
|
LOC_LOGD("notify: DataItem In Value:%s", dv.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (!dataItemVec.empty()) {
|
||||||
|
mContext.mMsgTask->sendMsg(new HandleNotify(this, dataItemVec));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -444,7 +384,7 @@ void SystemStatusOsObserver::turnOn(DataItemId dit, int timeOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if data item exists in mActiveRequestCount
|
// Check if data item exists in mActiveRequestCount
|
||||||
map<DataItemId, int>::iterator citer = mActiveRequestCount.find(dit);
|
DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
|
||||||
if (citer == mActiveRequestCount.end()) {
|
if (citer == mActiveRequestCount.end()) {
|
||||||
// Data item not found in map
|
// Data item not found in map
|
||||||
// Add reference count as 1 and add dataitem to map
|
// Add reference count as 1 and add dataitem to map
|
||||||
|
@ -482,7 +422,7 @@ void SystemStatusOsObserver::turnOff(DataItemId dit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if data item exists in mActiveRequestCount
|
// Check if data item exists in mActiveRequestCount
|
||||||
map<DataItemId, int>::iterator citer = mActiveRequestCount.find(dit);
|
DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
|
||||||
if (citer != mActiveRequestCount.end()) {
|
if (citer != mActiveRequestCount.end()) {
|
||||||
// found
|
// found
|
||||||
citer->second--;
|
citer->second--;
|
||||||
|
@ -508,87 +448,127 @@ void SystemStatusOsObserver::turnOff(DataItemId dit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_GLIB
|
||||||
|
bool SystemStatusOsObserver::connectBackhaul()
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (mContext.mFrameworkActionReqObj != NULL) {
|
||||||
|
struct HandleConnectBackhaul : public LocMsg {
|
||||||
|
HandleConnectBackhaul(IFrameworkActionReq* fwkActReq) :
|
||||||
|
mFwkActionReqObj(fwkActReq) {}
|
||||||
|
virtual ~HandleConnectBackhaul() {}
|
||||||
|
void proc() const {
|
||||||
|
LOC_LOGD("HandleConnectBackhaul");
|
||||||
|
mFwkActionReqObj->connectBackhaul();
|
||||||
|
}
|
||||||
|
IFrameworkActionReq* mFwkActionReqObj;
|
||||||
|
};
|
||||||
|
mContext.mMsgTask->sendMsg(
|
||||||
|
new (nothrow) HandleConnectBackhaul(mContext.mFrameworkActionReqObj));
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++mBackHaulConnectReqCount;
|
||||||
|
LOC_LOGE("Framework action request object is NULL.Caching connect request: %d",
|
||||||
|
mBackHaulConnectReqCount);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SystemStatusOsObserver::disconnectBackhaul()
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (mContext.mFrameworkActionReqObj != NULL) {
|
||||||
|
struct HandleDisconnectBackhaul : public LocMsg {
|
||||||
|
HandleDisconnectBackhaul(IFrameworkActionReq* fwkActReq) :
|
||||||
|
mFwkActionReqObj(fwkActReq) {}
|
||||||
|
virtual ~HandleDisconnectBackhaul() {}
|
||||||
|
void proc() const {
|
||||||
|
LOC_LOGD("HandleDisconnectBackhaul");
|
||||||
|
mFwkActionReqObj->disconnectBackhaul();
|
||||||
|
}
|
||||||
|
IFrameworkActionReq* mFwkActionReqObj;
|
||||||
|
};
|
||||||
|
mContext.mMsgTask->sendMsg(
|
||||||
|
new (nothrow) HandleDisconnectBackhaul(mContext.mFrameworkActionReqObj));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (mBackHaulConnectReqCount > 0) {
|
||||||
|
--mBackHaulConnectReqCount;
|
||||||
|
}
|
||||||
|
LOC_LOGE("Framework action request object is NULL.Caching disconnect request: %d",
|
||||||
|
mBackHaulConnectReqCount);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Helpers
|
Helpers
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void SystemStatusOsObserver::sendFirstResponse(
|
|
||||||
const list<DataItemId>& l, IDataItemObserver* to)
|
|
||||||
{
|
|
||||||
if (l.empty()) {
|
|
||||||
LOC_LOGV("list is empty. Nothing to do. Exiting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string clientName;
|
|
||||||
to->getName(clientName);
|
|
||||||
list<IDataItemCore*> dataItems(0);
|
|
||||||
|
|
||||||
for (auto each : l) {
|
|
||||||
map<DataItemId, IDataItemCore*>::const_iterator 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_back(citer->second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dataItems.empty()) {
|
|
||||||
LOC_LOGV("No items to notify. Nothing to do. Exiting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
to->notify(dataItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemStatusOsObserver::sendCachedDataItems(
|
void SystemStatusOsObserver::sendCachedDataItems(
|
||||||
const list<DataItemId>& l, IDataItemObserver* to)
|
const unordered_set<DataItemId>& s, IDataItemObserver* to)
|
||||||
{
|
{
|
||||||
string clientName;
|
if (nullptr == to) {
|
||||||
to->getName(clientName);
|
LOC_LOGv("client pointer is NULL.");
|
||||||
list<IDataItemCore*> dataItems(0);
|
} else {
|
||||||
|
string clientName;
|
||||||
|
to->getName(clientName);
|
||||||
|
list<IDataItemCore*> dataItems(0);
|
||||||
|
|
||||||
for (auto each : l) {
|
for (auto each : s) {
|
||||||
string dv;
|
auto citer = mDataItemCache.find(each);
|
||||||
IDataItemCore* di = mDataItemCache[each];
|
if (citer != mDataItemCache.end()) {
|
||||||
di->stringify(dv);
|
string dv;
|
||||||
LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str());
|
citer->second->stringify(dv);
|
||||||
dataItems.push_back(di);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
to->notify(dataItems);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemStatusOsObserver::updateCache(IDataItemCore* d, bool& dataItemUpdated)
|
bool SystemStatusOsObserver::updateCache(IDataItemCore* d)
|
||||||
{
|
{
|
||||||
if (nullptr == d) {
|
bool dataItemUpdated = false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if data item exists in cache
|
// Request systemstatus to record this dataitem in its cache
|
||||||
map<DataItemId, IDataItemCore*>::iterator citer =
|
// if the return is false, it means that SystemStatus is not
|
||||||
mDataItemCache.find(d->getId());
|
// handling it, so SystemStatusOsObserver also doesn't.
|
||||||
if (citer == mDataItemCache.end()) {
|
// So it has to be true to proceed.
|
||||||
// New data item; not found in cache
|
if (nullptr != d && mSystemStatus->eventDataItemNotify(d)) {
|
||||||
IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(d->getId());
|
auto citer = mDataItemCache.find(d->getId());
|
||||||
if (nullptr == dataitem) {
|
if (citer == mDataItemCache.end()) {
|
||||||
return;
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the contents of the data item
|
if (dataItemUpdated) {
|
||||||
dataitem->copy(d);
|
LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated);
|
||||||
pair<DataItemId, IDataItemCore*> cpair(d->getId(), dataitem);
|
|
||||||
// Insert in mDataItemCache
|
|
||||||
mDataItemCache.insert(cpair);
|
|
||||||
dataItemUpdated = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Found in cache; Update cache if necessary
|
|
||||||
if(0 == citer->second->copy(d, &dataItemUpdated)) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataItemUpdated) {
|
return dataItemUpdated;
|
||||||
LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
109
gps/core/SystemStatusOsObserver.h
Normal file → Executable file
109
gps/core/SystemStatusOsObserver.h
Normal file → Executable file
|
@ -39,7 +39,9 @@
|
||||||
#include <MsgTask.h>
|
#include <MsgTask.h>
|
||||||
#include <DataItemId.h>
|
#include <DataItemId.h>
|
||||||
#include <IOsObserver.h>
|
#include <IOsObserver.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <loc_pla.h>
|
||||||
|
#include <log_util.h>
|
||||||
|
#include <LocUnorderedSetMap.h>
|
||||||
|
|
||||||
namespace loc_core
|
namespace loc_core
|
||||||
{
|
{
|
||||||
|
@ -47,86 +49,123 @@ namespace loc_core
|
||||||
SystemStatusOsObserver
|
SystemStatusOsObserver
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace loc_util;
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class IDataItemCore;
|
class IDataItemCore;
|
||||||
template<typename CT, typename DIT> class IClientIndex;
|
class SystemStatus;
|
||||||
template<typename CT, typename DIT> class IDataItemIndex;
|
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;
|
||||||
|
|
||||||
struct SystemContext {
|
struct ObserverContext {
|
||||||
IDataItemSubscription* mSubscriptionObj;
|
IDataItemSubscription* mSubscriptionObj;
|
||||||
IFrameworkActionReq* mFrameworkActionReqObj;
|
IFrameworkActionReq* mFrameworkActionReqObj;
|
||||||
const MsgTask* mMsgTask;
|
const MsgTask* mMsgTask;
|
||||||
|
SystemStatusOsObserver* mSSObserver;
|
||||||
|
|
||||||
inline SystemContext() :
|
inline ObserverContext(const MsgTask* msgTask, SystemStatusOsObserver* observer) :
|
||||||
mSubscriptionObj(NULL),
|
mSubscriptionObj(NULL), mFrameworkActionReqObj(NULL),
|
||||||
mFrameworkActionReqObj(NULL),
|
mMsgTask(msgTask), mSSObserver(observer) {}
|
||||||
mMsgTask(NULL) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef map<IDataItemObserver*, list<DataItemId>> ObserverReqCache;
|
|
||||||
|
|
||||||
// Clients wanting to get data from OS/Framework would need to
|
// Clients wanting to get data from OS/Framework would need to
|
||||||
// subscribe with OSObserver using IDataItemSubscription interface.
|
// subscribe with OSObserver using IDataItemSubscription interface.
|
||||||
// Such clients would need to implement IDataItemObserver interface
|
// Such clients would need to implement IDataItemObserver interface
|
||||||
// to receive data when it becomes available.
|
// to receive data when it becomes available.
|
||||||
class SystemStatus;
|
|
||||||
class SystemStatusOsObserver : public IOsObserver {
|
class SystemStatusOsObserver : public IOsObserver {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// ctor
|
// ctor
|
||||||
SystemStatusOsObserver(
|
inline SystemStatusOsObserver(SystemStatus* systemstatus, const MsgTask* msgTask) :
|
||||||
SystemStatus* systemstatus, const MsgTask* msgTask);
|
mSystemStatus(systemstatus), mContext(msgTask, this),
|
||||||
|
mAddress("SystemStatusOsObserver"),
|
||||||
|
mClientToDataItems(MAX_DATA_ITEM_ID), mDataItemToClients(MAX_DATA_ITEM_ID)
|
||||||
|
#ifdef USE_GLIB
|
||||||
|
, mBackHaulConnectReqCount(0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// dtor
|
// dtor
|
||||||
~SystemStatusOsObserver();
|
~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
|
// To set the subscription object
|
||||||
virtual void setSubscriptionObj(IDataItemSubscription* subscriptionObj);
|
virtual void setSubscriptionObj(IDataItemSubscription* subscriptionObj);
|
||||||
|
|
||||||
// To set the framework action request object
|
// To set the framework action request object
|
||||||
inline void setFrameworkActionReqObj(IFrameworkActionReq* frameworkActionReqObj) {
|
inline void setFrameworkActionReqObj(IFrameworkActionReq* frameworkActionReqObj) {
|
||||||
mContext.mFrameworkActionReqObj = frameworkActionReqObj;
|
mContext.mFrameworkActionReqObj = frameworkActionReqObj;
|
||||||
|
#ifdef USE_GLIB
|
||||||
|
if (mBackHaulConnectReqCount > 0) {
|
||||||
|
connectBackhaul();
|
||||||
|
mBackHaulConnectReqCount = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDataItemSubscription Overrides
|
// IDataItemSubscription Overrides
|
||||||
virtual void subscribe(const list<DataItemId>& l, IDataItemObserver* client);
|
inline virtual void subscribe(const list<DataItemId>& l, IDataItemObserver* client) override {
|
||||||
virtual void updateSubscription(const list<DataItemId>& l, IDataItemObserver* client);
|
subscribe(l, client, false);
|
||||||
virtual void requestData(const list<DataItemId>& l, IDataItemObserver* client);
|
}
|
||||||
virtual void unsubscribe(const list<DataItemId>& l, IDataItemObserver* client);
|
virtual void updateSubscription(const list<DataItemId>& l, IDataItemObserver* client) override;
|
||||||
virtual void unsubscribeAll(IDataItemObserver* client);
|
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
|
// IDataItemObserver Overrides
|
||||||
virtual void notify(const list<IDataItemCore*>& dlist);
|
virtual void notify(const list<IDataItemCore*>& dlist) override;
|
||||||
inline virtual void getName(string& name) {
|
inline virtual void getName(string& name) override {
|
||||||
name = mAddress;
|
name = mAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IFrameworkActionReq Overrides
|
// IFrameworkActionReq Overrides
|
||||||
virtual void turnOn(DataItemId dit, int timeOut = 0);
|
virtual void turnOn(DataItemId dit, int timeOut = 0) override;
|
||||||
virtual void turnOff(DataItemId dit);
|
virtual void turnOff(DataItemId dit) override;
|
||||||
|
#ifdef USE_GLIB
|
||||||
|
virtual bool connectBackhaul() override;
|
||||||
|
virtual bool disconnectBackhaul();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SystemStatus* mSystemStatus;
|
SystemStatus* mSystemStatus;
|
||||||
SystemContext mContext;
|
ObserverContext mContext;
|
||||||
const string mAddress;
|
const string mAddress;
|
||||||
IClientIndex<IDataItemObserver*, DataItemId>* mClientIndex;
|
ClientToDataItems mClientToDataItems;
|
||||||
IDataItemIndex<IDataItemObserver*, DataItemId>* mDataItemIndex;
|
DataItemToClients mDataItemToClients;
|
||||||
map<DataItemId, IDataItemCore*> mDataItemCache;
|
DataItemIdToCore mDataItemCache;
|
||||||
map<DataItemId, int> mActiveRequestCount;
|
DataItemIdToInt mActiveRequestCount;
|
||||||
|
|
||||||
// Cache the subscribe and requestData till subscription obj is obtained
|
// Cache the subscribe and requestData till subscription obj is obtained
|
||||||
ObserverReqCache mSubscribeReqCache;
|
|
||||||
ObserverReqCache mReqDataCache;
|
|
||||||
void cacheObserverRequest(ObserverReqCache& reqCache,
|
void cacheObserverRequest(ObserverReqCache& reqCache,
|
||||||
const list<DataItemId>& l, IDataItemObserver* client);
|
const list<DataItemId>& l, IDataItemObserver* client);
|
||||||
|
#ifdef USE_GLIB
|
||||||
|
// Cache the framework action request for connect/disconnect
|
||||||
|
int mBackHaulConnectReqCount;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void subscribe(const list<DataItemId>& l, IDataItemObserver* client, bool toRequestData);
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
void sendFirstResponse(const list<DataItemId>& l, IDataItemObserver* to);
|
void sendCachedDataItems(const unordered_set<DataItemId>& s, IDataItemObserver* to);
|
||||||
void sendCachedDataItems(const list<DataItemId>& l, IDataItemObserver* to);
|
bool updateCache(IDataItemCore* d);
|
||||||
void updateCache(IDataItemCore* d, bool& dataItemUpdated);
|
inline void logMe(const unordered_set<DataItemId>& l) {
|
||||||
inline void logMe(const list<DataItemId>& l) {
|
IF_LOC_LOGD {
|
||||||
for (auto id : l) {
|
for (auto id : l) {
|
||||||
LOC_LOGD("DataItem %d", id);
|
LOC_LOGD("DataItem %d", id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
0
gps/core/UlpProxyBase.h
Normal file → Executable file
0
gps/core/UlpProxyBase.h
Normal file → Executable file
83
gps/core/data-items/DataItemConcreteTypesBase.h
Normal file → Executable file
83
gps/core/data-items/DataItemConcreteTypesBase.h
Normal file → Executable file
|
@ -221,9 +221,22 @@ protected:
|
||||||
|
|
||||||
class NetworkInfoDataItemBase : public IDataItemCore {
|
class NetworkInfoDataItemBase : public IDataItemCore {
|
||||||
public:
|
public:
|
||||||
|
enum NetworkType {
|
||||||
|
TYPE_MOBILE,
|
||||||
|
TYPE_WIFI,
|
||||||
|
TYPE_ETHERNET,
|
||||||
|
TYPE_BLUETOOTH,
|
||||||
|
TYPE_MMS,
|
||||||
|
TYPE_SUPL,
|
||||||
|
TYPE_DUN,
|
||||||
|
TYPE_HIPRI,
|
||||||
|
TYPE_WIMAX,
|
||||||
|
TYPE_UNKNOWN,
|
||||||
|
};
|
||||||
NetworkInfoDataItemBase(
|
NetworkInfoDataItemBase(
|
||||||
int32_t type, string typeName, string subTypeName,
|
NetworkType initialType, int32_t type, string typeName, string subTypeName,
|
||||||
bool available, bool connected, bool roaming ):
|
bool available, bool connected, bool roaming ):
|
||||||
|
mAllTypes(typeToAllTypes(initialType)),
|
||||||
mType(type),
|
mType(type),
|
||||||
mTypeName(typeName),
|
mTypeName(typeName),
|
||||||
mSubTypeName(subTypeName),
|
mSubTypeName(subTypeName),
|
||||||
|
@ -235,22 +248,12 @@ public:
|
||||||
inline virtual DataItemId getId() { return mId; }
|
inline virtual DataItemId getId() { return mId; }
|
||||||
virtual void stringify(string& /*valueStr*/) {}
|
virtual void stringify(string& /*valueStr*/) {}
|
||||||
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
|
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
|
||||||
enum NetworkType {
|
|
||||||
TYPE_UNKNOWN,
|
|
||||||
TYPE_MOBILE,
|
|
||||||
TYPE_WIFI,
|
|
||||||
TYPE_ETHERNET,
|
|
||||||
TYPE_BLUETOOTH,
|
|
||||||
TYPE_MMS,
|
|
||||||
TYPE_SUPL,
|
|
||||||
TYPE_DUN,
|
|
||||||
TYPE_HIPRI,
|
|
||||||
TYPE_WIMAX
|
|
||||||
};
|
|
||||||
inline virtual NetworkType getType(void) const {
|
inline virtual NetworkType getType(void) const {
|
||||||
return (NetworkType)mType;
|
return (NetworkType)mType;
|
||||||
}
|
}
|
||||||
// Data members
|
inline uint64_t getAllTypes() { return mAllTypes; }
|
||||||
|
// Data members
|
||||||
|
uint64_t mAllTypes;
|
||||||
int32_t mType;
|
int32_t mType;
|
||||||
string mTypeName;
|
string mTypeName;
|
||||||
string mSubTypeName;
|
string mSubTypeName;
|
||||||
|
@ -259,7 +262,9 @@ public:
|
||||||
bool mRoaming;
|
bool mRoaming;
|
||||||
protected:
|
protected:
|
||||||
DataItemId mId;
|
DataItemId mId;
|
||||||
|
inline uint64_t typeToAllTypes(NetworkType type) {
|
||||||
|
return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ? 0 : (1<<type);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServiceStatusDataItemBase : public IDataItemCore {
|
class ServiceStatusDataItemBase : public IDataItemCore {
|
||||||
|
@ -309,24 +314,42 @@ protected:
|
||||||
|
|
||||||
class RilServiceInfoDataItemBase : public IDataItemCore {
|
class RilServiceInfoDataItemBase : public IDataItemCore {
|
||||||
public:
|
public:
|
||||||
RilServiceInfoDataItemBase() :
|
inline RilServiceInfoDataItemBase() :
|
||||||
mId(RILSERVICEINFO_DATA_ITEM_ID) {}
|
mData(nullptr), mId(RILSERVICEINFO_DATA_ITEM_ID) {}
|
||||||
virtual ~RilServiceInfoDataItemBase() {}
|
inline virtual ~RilServiceInfoDataItemBase() { if (nullptr != mData) free(mData); }
|
||||||
inline virtual DataItemId getId() { return mId; }
|
inline virtual DataItemId getId() { return mId; }
|
||||||
virtual void stringify(string& /*valueStr*/) {}
|
virtual void stringify(string& /*valueStr*/) {}
|
||||||
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
|
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:
|
protected:
|
||||||
DataItemId mId;
|
DataItemId mId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RilCellInfoDataItemBase : public IDataItemCore {
|
class RilCellInfoDataItemBase : public IDataItemCore {
|
||||||
public:
|
public:
|
||||||
RilCellInfoDataItemBase() :
|
inline RilCellInfoDataItemBase() :
|
||||||
mId(RILCELLINFO_DATA_ITEM_ID) {}
|
mData(nullptr), mId(RILCELLINFO_DATA_ITEM_ID) {}
|
||||||
virtual ~RilCellInfoDataItemBase() {}
|
inline virtual ~RilCellInfoDataItemBase() { if (nullptr != mData) free(mData); }
|
||||||
inline virtual DataItemId getId() { return mId; }
|
inline virtual DataItemId getId() { return mId; }
|
||||||
virtual void stringify(string& /*valueStr*/) {}
|
virtual void stringify(string& /*valueStr*/) {}
|
||||||
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
|
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:
|
protected:
|
||||||
DataItemId mId;
|
DataItemId mId;
|
||||||
};
|
};
|
||||||
|
@ -393,7 +416,7 @@ protected:
|
||||||
class MccmncDataItemBase : public IDataItemCore {
|
class MccmncDataItemBase : public IDataItemCore {
|
||||||
public:
|
public:
|
||||||
MccmncDataItemBase(const string & name) :
|
MccmncDataItemBase(const string & name) :
|
||||||
mValue (name),
|
mValue(name),
|
||||||
mId(MCCMNC_DATA_ITEM_ID) {}
|
mId(MCCMNC_DATA_ITEM_ID) {}
|
||||||
virtual ~MccmncDataItemBase() {}
|
virtual ~MccmncDataItemBase() {}
|
||||||
inline virtual DataItemId getId() { return mId; }
|
inline virtual DataItemId getId() { return mId; }
|
||||||
|
@ -407,7 +430,7 @@ protected:
|
||||||
|
|
||||||
class SrnDeviceScanDetailsDataItemBase : public IDataItemCore {
|
class SrnDeviceScanDetailsDataItemBase : public IDataItemCore {
|
||||||
public:
|
public:
|
||||||
SrnDeviceScanDetailsDataItemBase (DataItemId Id) :
|
SrnDeviceScanDetailsDataItemBase(DataItemId Id) :
|
||||||
mValidSrnData(false),
|
mValidSrnData(false),
|
||||||
mApSrnRssi(-1),
|
mApSrnRssi(-1),
|
||||||
mApSrnTimestamp(0),
|
mApSrnTimestamp(0),
|
||||||
|
@ -415,7 +438,7 @@ public:
|
||||||
mReceiveTimestamp(0),
|
mReceiveTimestamp(0),
|
||||||
mErrorCause(-1),
|
mErrorCause(-1),
|
||||||
mId(Id) {}
|
mId(Id) {}
|
||||||
virtual ~SrnDeviceScanDetailsDataItemBase () {}
|
virtual ~SrnDeviceScanDetailsDataItemBase() {}
|
||||||
inline virtual DataItemId getId() { return mId; }
|
inline virtual DataItemId getId() { return mId; }
|
||||||
// Data members common to all SRN tech types
|
// Data members common to all SRN tech types
|
||||||
/* Represents info on whether SRN data is valid (no error)*/
|
/* Represents info on whether SRN data is valid (no error)*/
|
||||||
|
@ -456,6 +479,18 @@ public:
|
||||||
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
|
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
|
} // namespace loc_core
|
||||||
|
|
||||||
#endif //__DATAITEMCONCRETEBASETYPES__
|
#endif //__DATAITEMCONCRETEBASETYPES__
|
||||||
|
|
8
gps/core/data-items/DataItemId.h
Normal file → Executable file
8
gps/core/data-items/DataItemId.h
Normal file → Executable file
|
@ -67,7 +67,13 @@ typedef enum e_DataItemId {
|
||||||
BTLE_SCAN_DATA_ITEM_ID,
|
BTLE_SCAN_DATA_ITEM_ID,
|
||||||
BT_SCAN_DATA_ITEM_ID,
|
BT_SCAN_DATA_ITEM_ID,
|
||||||
OEM_GTP_UPLOAD_TRIGGER_READY_ITEM_ID,
|
OEM_GTP_UPLOAD_TRIGGER_READY_ITEM_ID,
|
||||||
MAX_DATA_ITEM_ID
|
|
||||||
|
MAX_DATA_ITEM_ID,
|
||||||
|
|
||||||
|
// 26 -
|
||||||
|
BATTERY_LEVEL_DATA_ITEM_ID,
|
||||||
|
|
||||||
|
MAX_DATA_ITEM_ID_1_1,
|
||||||
} DataItemId;
|
} DataItemId;
|
||||||
|
|
||||||
#endif // #ifndef __DATAITEMID_H__
|
#endif // #ifndef __DATAITEMID_H__
|
||||||
|
|
5
gps/core/data-items/DataItemsFactoryProxy.cpp
Normal file → Executable file
5
gps/core/data-items/DataItemsFactoryProxy.cpp
Normal file → Executable file
|
@ -32,7 +32,8 @@
|
||||||
#include <DataItemId.h>
|
#include <DataItemId.h>
|
||||||
#include <IDataItemCore.h>
|
#include <IDataItemCore.h>
|
||||||
#include <DataItemsFactoryProxy.h>
|
#include <DataItemsFactoryProxy.h>
|
||||||
#include <platform_lib_log_util.h>
|
#include <loc_pla.h>
|
||||||
|
#include <log_util.h>
|
||||||
|
|
||||||
namespace loc_core
|
namespace loc_core
|
||||||
{
|
{
|
||||||
|
@ -68,7 +69,7 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id)
|
||||||
getConcreteDIFunc = (get_concrete_data_item_fn * )
|
getConcreteDIFunc = (get_concrete_data_item_fn * )
|
||||||
dlsym(dataItemLibHandle, DATA_ITEMS_GET_CONCRETE_DI);
|
dlsym(dataItemLibHandle, DATA_ITEMS_GET_CONCRETE_DI);
|
||||||
if (NULL != getConcreteDIFunc) {
|
if (NULL != getConcreteDIFunc) {
|
||||||
LOC_LOGD("Loaded function %s : %x",DATA_ITEMS_GET_CONCRETE_DI,getConcreteDIFunc);
|
LOC_LOGD("Loaded function %s : %p",DATA_ITEMS_GET_CONCRETE_DI,getConcreteDIFunc);
|
||||||
mydi = (*getConcreteDIFunc)(id);
|
mydi = (*getConcreteDIFunc)(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
0
gps/core/data-items/DataItemsFactoryProxy.h
Normal file → Executable file
0
gps/core/data-items/DataItemsFactoryProxy.h
Normal file → Executable file
0
gps/core/data-items/IDataItemCore.h
Normal file → Executable file
0
gps/core/data-items/IDataItemCore.h
Normal file → Executable file
|
@ -1,171 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iterator>
|
|
||||||
#include <string>
|
|
||||||
#include <platform_lib_log_util.h>
|
|
||||||
#include <ClientIndex.h>
|
|
||||||
#include <IDataItemObserver.h>
|
|
||||||
#include <DataItemId.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace loc_core;
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
inline ClientIndex <CT,DIT> :: ClientIndex () {}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
inline ClientIndex <CT,DIT> :: ~ClientIndex () {}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
bool ClientIndex <CT,DIT> :: isSubscribedClient (CT client) {
|
|
||||||
bool result = false;
|
|
||||||
ENTRY_LOG ();
|
|
||||||
typename map < CT, list <DIT> > :: iterator it =
|
|
||||||
mDataItemsPerClientMap.find (client);
|
|
||||||
if (it != mDataItemsPerClientMap.end ()) {
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void ClientIndex <CT,DIT> :: getSubscribedList (CT client, list <DIT> & out) {
|
|
||||||
ENTRY_LOG ();
|
|
||||||
typename map < CT, list <DIT> > :: iterator it =
|
|
||||||
mDataItemsPerClientMap.find (client);
|
|
||||||
if (it != mDataItemsPerClientMap.end ()) {
|
|
||||||
out = it->second;
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
int ClientIndex <CT,DIT> :: remove (CT client) {
|
|
||||||
int result = 0;
|
|
||||||
ENTRY_LOG ();
|
|
||||||
mDataItemsPerClientMap.erase (client);
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void ClientIndex <CT,DIT> :: remove (const list <DIT> & r, list <CT> & out) {
|
|
||||||
ENTRY_LOG ();
|
|
||||||
typename map < CT, list <DIT> > :: iterator dicIter =
|
|
||||||
mDataItemsPerClientMap.begin ();
|
|
||||||
while (dicIter != mDataItemsPerClientMap.end()) {
|
|
||||||
typename list <DIT> :: const_iterator it = r.begin ();
|
|
||||||
for (; it != r.end (); ++it) {
|
|
||||||
typename list <DIT> :: iterator iter =
|
|
||||||
find (dicIter->second.begin (), dicIter->second.end (), *it);
|
|
||||||
if (iter != dicIter->second.end ()) {
|
|
||||||
dicIter->second.erase (iter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dicIter->second.empty ()) {
|
|
||||||
out.push_back (dicIter->first);
|
|
||||||
// Post-increment operator increases the iterator but returns the
|
|
||||||
// prevous one that will be invalidated by erase()
|
|
||||||
mDataItemsPerClientMap.erase (dicIter++);
|
|
||||||
} else {
|
|
||||||
++dicIter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void ClientIndex <CT,DIT> :: remove
|
|
||||||
(
|
|
||||||
CT client,
|
|
||||||
const list <DIT> & r,
|
|
||||||
list <DIT> & out
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ENTRY_LOG ();
|
|
||||||
typename map < CT, list <DIT> > :: iterator dicIter =
|
|
||||||
mDataItemsPerClientMap.find (client);
|
|
||||||
if (dicIter != mDataItemsPerClientMap.end ()) {
|
|
||||||
set_intersection (dicIter->second.begin (), dicIter->second.end (),
|
|
||||||
r.begin (), r.end (),
|
|
||||||
inserter (out,out.begin ()));
|
|
||||||
if (!out.empty ()) {
|
|
||||||
typename list <DIT> :: iterator it = out.begin ();
|
|
||||||
for (; it != out.end (); ++it) {
|
|
||||||
dicIter->second.erase (find (dicIter->second.begin (),
|
|
||||||
dicIter->second.end (),
|
|
||||||
*it));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dicIter->second.empty ()) {
|
|
||||||
mDataItemsPerClientMap.erase (dicIter);
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void ClientIndex <CT,DIT> :: add
|
|
||||||
(
|
|
||||||
CT client,
|
|
||||||
const list <DIT> & l,
|
|
||||||
list <DIT> & out
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ENTRY_LOG ();
|
|
||||||
list <DIT> difference;
|
|
||||||
typename map < CT, list <DIT> > :: iterator dicIter =
|
|
||||||
mDataItemsPerClientMap.find (client);
|
|
||||||
if (dicIter != mDataItemsPerClientMap.end ()) {
|
|
||||||
set_difference (l.begin (), l.end (),
|
|
||||||
dicIter->second.begin (), dicIter->second.end (),
|
|
||||||
inserter (difference,difference.begin ()));
|
|
||||||
if (!difference.empty ()) {
|
|
||||||
difference.sort ();
|
|
||||||
out = difference;
|
|
||||||
dicIter->second.merge (difference);
|
|
||||||
dicIter->second.unique ();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out = l;
|
|
||||||
pair < CT, list <DIT> > dicnpair (client, out);
|
|
||||||
mDataItemsPerClientMap.insert (dicnpair);
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Explicit instantiation must occur in same namespace where class is defined
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
template class ClientIndex <IDataItemObserver *, DataItemId>;
|
|
||||||
template class ClientIndex <string, DataItemId>;
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
/* 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 __CLIENTINDEX_H__
|
|
||||||
#define __CLIENTINDEX_H__
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include <IClientIndex.h>
|
|
||||||
|
|
||||||
using loc_core::IClientIndex;
|
|
||||||
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
|
|
||||||
class ClientIndex : public IClientIndex <CT, DIT> {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ClientIndex ();
|
|
||||||
|
|
||||||
~ClientIndex ();
|
|
||||||
|
|
||||||
bool isSubscribedClient (CT client);
|
|
||||||
|
|
||||||
void getSubscribedList (CT client, std :: list <DIT> & out);
|
|
||||||
|
|
||||||
int remove (CT client);
|
|
||||||
|
|
||||||
void remove (const std :: list <DIT> & r, std :: list <CT> & out);
|
|
||||||
|
|
||||||
void remove (CT client, const std :: list <DIT> & r, std :: list <DIT> & out);
|
|
||||||
|
|
||||||
void add (CT client, const std :: list <DIT> & l, std :: list <DIT> & out);
|
|
||||||
|
|
||||||
private:
|
|
||||||
//Data members
|
|
||||||
std :: map < CT , std :: list <DIT> > mDataItemsPerClientMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace loc_core
|
|
||||||
|
|
||||||
#endif // #ifndef __CLIENTINDEX_H__
|
|
|
@ -1,202 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iterator>
|
|
||||||
#include <DataItemIndex.h>
|
|
||||||
#include <platform_lib_log_util.h>
|
|
||||||
#include <IDataItemObserver.h>
|
|
||||||
#include <DataItemId.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace loc_core;
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
inline DataItemIndex <CT,DIT> :: DataItemIndex () {}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
inline DataItemIndex <CT,DIT> :: ~DataItemIndex () {}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void DataItemIndex <CT,DIT> :: getListOfSubscribedClients
|
|
||||||
(
|
|
||||||
DIT id,
|
|
||||||
list <CT> & out
|
|
||||||
)
|
|
||||||
{
|
|
||||||
typename map < DIT, list <CT> > :: iterator cdiIter =
|
|
||||||
mClientsPerDataItemMap.find (id);
|
|
||||||
if (cdiIter != mClientsPerDataItemMap.end ()) {
|
|
||||||
out = cdiIter->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
int DataItemIndex <CT,DIT> :: remove (DIT id) {
|
|
||||||
int result = 0;
|
|
||||||
ENTRY_LOG ();
|
|
||||||
mClientsPerDataItemMap.erase (id);
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void DataItemIndex <CT,DIT> :: remove (const list <CT> & r, list <DIT> & out) {
|
|
||||||
ENTRY_LOG ();
|
|
||||||
typename map < DIT, list <CT> > :: iterator cdiIter =
|
|
||||||
mClientsPerDataItemMap.begin ();
|
|
||||||
while (cdiIter != mClientsPerDataItemMap.end()) {
|
|
||||||
typename list <CT> :: const_iterator it = r.begin ();
|
|
||||||
for (; it != r.end (); ++it) {
|
|
||||||
typename list <CT> :: iterator iter =
|
|
||||||
find
|
|
||||||
(
|
|
||||||
cdiIter->second.begin (),
|
|
||||||
cdiIter->second.end (),
|
|
||||||
*it
|
|
||||||
);
|
|
||||||
if (iter != cdiIter->second.end ()) {
|
|
||||||
cdiIter->second.erase (iter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cdiIter->second.empty ()) {
|
|
||||||
out.push_back (cdiIter->first);
|
|
||||||
// Post-increment operator increases the iterator but returns the
|
|
||||||
// prevous one that will be invalidated by erase()
|
|
||||||
mClientsPerDataItemMap.erase (cdiIter++);
|
|
||||||
} else {
|
|
||||||
++cdiIter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void DataItemIndex <CT,DIT> :: remove
|
|
||||||
(
|
|
||||||
DIT id,
|
|
||||||
const list <CT> & r,
|
|
||||||
list <CT> & out
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ENTRY_LOG ();
|
|
||||||
|
|
||||||
typename map < DIT, list <CT> > :: iterator cdiIter =
|
|
||||||
mClientsPerDataItemMap.find (id);
|
|
||||||
if (cdiIter != mClientsPerDataItemMap.end ()) {
|
|
||||||
set_intersection (cdiIter->second.begin (), cdiIter->second.end (),
|
|
||||||
r.begin (), r.end (),
|
|
||||||
inserter (out, out.begin ()));
|
|
||||||
if (!out.empty ()) {
|
|
||||||
typename list <CT> :: iterator it = out.begin ();
|
|
||||||
for (; it != out.end (); ++it) {
|
|
||||||
cdiIter->second.erase (find (cdiIter->second.begin (),
|
|
||||||
cdiIter->second.end (),
|
|
||||||
*it));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cdiIter->second.empty ()) {
|
|
||||||
mClientsPerDataItemMap.erase (cdiIter);
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void DataItemIndex <CT,DIT> :: add
|
|
||||||
(
|
|
||||||
DIT id,
|
|
||||||
const list <CT> & l,
|
|
||||||
list <CT> & out
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ENTRY_LOG ();
|
|
||||||
list <CT> difference;
|
|
||||||
typename map < DIT, list <CT> > :: iterator cdiIter =
|
|
||||||
mClientsPerDataItemMap.find (id);
|
|
||||||
if (cdiIter != mClientsPerDataItemMap.end ()) {
|
|
||||||
set_difference (l.begin (), l.end (),
|
|
||||||
cdiIter->second.begin (), cdiIter->second.end (),
|
|
||||||
inserter (difference, difference.begin ()));
|
|
||||||
if (!difference.empty ()) {
|
|
||||||
difference.sort ();
|
|
||||||
out = difference;
|
|
||||||
cdiIter->second.merge (difference);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out = l;
|
|
||||||
pair < DIT, list <CT> > cndipair (id, out);
|
|
||||||
mClientsPerDataItemMap.insert (cndipair);
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
void DataItemIndex <CT,DIT> :: add
|
|
||||||
(
|
|
||||||
CT client,
|
|
||||||
const list <DIT> & l,
|
|
||||||
list <DIT> & out
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ENTRY_LOG ();
|
|
||||||
typename map < DIT, list <CT> > :: iterator cdiIter;
|
|
||||||
typename list <DIT> :: const_iterator it = l.begin ();
|
|
||||||
for (; it != l.end (); ++it) {
|
|
||||||
cdiIter = mClientsPerDataItemMap.find (*it);
|
|
||||||
if (cdiIter == mClientsPerDataItemMap.end ()) {
|
|
||||||
out.push_back (*it);
|
|
||||||
pair < DIT, list <CT> > cndiPair (*it, list <CT> (1, client));
|
|
||||||
mClientsPerDataItemMap.insert (cndiPair);
|
|
||||||
} else {
|
|
||||||
typename list<CT> :: iterator clientIter =
|
|
||||||
find
|
|
||||||
(
|
|
||||||
cdiIter->second.begin (),
|
|
||||||
cdiIter->second.end (),
|
|
||||||
client
|
|
||||||
);
|
|
||||||
if (clientIter == cdiIter->second.end()) {
|
|
||||||
cdiIter->second.push_back (client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXIT_LOG_WITH_ERROR ("%d",0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Explicit instantiation must occur in same namespace where class is defined
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
template class DataItemIndex <IDataItemObserver *, DataItemId>;
|
|
||||||
template class DataItemIndex <string, DataItemId>;
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
/* 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 __DATAITEMINDEX_H__
|
|
||||||
#define __DATAITEMINDEX_H__
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include <IDataItemIndex.h>
|
|
||||||
|
|
||||||
using loc_core::IDataItemIndex;
|
|
||||||
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
|
|
||||||
class DataItemIndex : public IDataItemIndex <CT, DIT> {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DataItemIndex ();
|
|
||||||
|
|
||||||
~DataItemIndex ();
|
|
||||||
|
|
||||||
void getListOfSubscribedClients (DIT id, std :: list <CT> & out);
|
|
||||||
|
|
||||||
int remove (DIT id);
|
|
||||||
|
|
||||||
void remove (const std :: list <CT> & r, std :: list <DIT> & out);
|
|
||||||
|
|
||||||
void remove (DIT id, const std :: list <CT> & r, std :: list <CT> & out);
|
|
||||||
|
|
||||||
void add (DIT id, const std :: list <CT> & l, std :: list <CT> & out);
|
|
||||||
|
|
||||||
void add (CT client, const std :: list <DIT> & l, std :: list <DIT> & out);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std :: map < DIT, std :: list <CT> > mClientsPerDataItemMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace loc_core
|
|
||||||
|
|
||||||
#endif // #ifndef __DATAITEMINDEX_H__
|
|
|
@ -1,83 +0,0 @@
|
||||||
/* 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 __ICLIENTINDEX_H__
|
|
||||||
#define __ICLIENTINDEX_H__
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
|
|
||||||
class IClientIndex {
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Checks if client is subscribed
|
|
||||||
virtual bool isSubscribedClient (CT client) = 0;
|
|
||||||
|
|
||||||
// gets subscription list
|
|
||||||
virtual void getSubscribedList (CT client, std :: list <DIT> & out) = 0;
|
|
||||||
|
|
||||||
// removes an entry
|
|
||||||
virtual int remove (CT client) = 0;
|
|
||||||
|
|
||||||
// removes std :: list of data items and returns a list of clients
|
|
||||||
// removed if any.
|
|
||||||
virtual void remove
|
|
||||||
(
|
|
||||||
const std :: list <DIT> & r,
|
|
||||||
std :: list <CT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// removes list of data items indexed by client and returns list
|
|
||||||
// of data items removed if any.
|
|
||||||
virtual void remove
|
|
||||||
(
|
|
||||||
CT client,
|
|
||||||
const std :: list <DIT> & r,
|
|
||||||
std :: list <DIT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// adds/modifies entry in map and returns new data items added.
|
|
||||||
virtual void add
|
|
||||||
(
|
|
||||||
CT client,
|
|
||||||
const std :: list <DIT> & l,
|
|
||||||
std :: list <DIT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// dtor
|
|
||||||
virtual ~IClientIndex () {}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace loc_core
|
|
||||||
|
|
||||||
#endif // #ifndef __ICLIENTINDEX_H__
|
|
|
@ -1,94 +0,0 @@
|
||||||
/* 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 __IDATAITEMINDEX_H__
|
|
||||||
#define __IDATAITEMINDEX_H__
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
|
|
||||||
class IDataItemIndex {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// gets std :: list of subscribed clients
|
|
||||||
virtual void getListOfSubscribedClients
|
|
||||||
(
|
|
||||||
DIT id,
|
|
||||||
std :: list <CT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// removes an entry from
|
|
||||||
virtual int remove (DIT id) = 0;
|
|
||||||
|
|
||||||
// removes list of clients and returns a list of data items
|
|
||||||
// removed if any.
|
|
||||||
virtual void remove
|
|
||||||
(
|
|
||||||
const std :: list <CT> & r,
|
|
||||||
std :: list <DIT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// removes list of clients indexed by data item and returns list of
|
|
||||||
// clients removed if any.
|
|
||||||
virtual void remove
|
|
||||||
(
|
|
||||||
DIT id,
|
|
||||||
const std :: list <CT> & r,
|
|
||||||
std :: list <CT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// adds/modifies entry and returns new clients added
|
|
||||||
virtual void add
|
|
||||||
(
|
|
||||||
DIT id,
|
|
||||||
const std :: list <CT> & l,
|
|
||||||
std :: list <CT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// adds/modifies entry and returns yet to subscribe list of data items
|
|
||||||
virtual void add
|
|
||||||
(
|
|
||||||
CT client,
|
|
||||||
const std :: list <DIT> & l,
|
|
||||||
std :: list <DIT> & out
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
// dtor
|
|
||||||
virtual ~IDataItemIndex () {}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace loc_core
|
|
||||||
|
|
||||||
#endif // #ifndef __IDATAITEMINDEX_H__
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <IndexFactory.h>
|
|
||||||
#include <IClientIndex.h>
|
|
||||||
#include <ClientIndex.h>
|
|
||||||
#include <IDataItemIndex.h>
|
|
||||||
#include <DataItemIndex.h>
|
|
||||||
#include <IDataItemObserver.h>
|
|
||||||
#include <DataItemId.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using loc_core::IClientIndex;
|
|
||||||
using loc_core::IDataItemIndex;
|
|
||||||
using loc_core::IDataItemObserver;
|
|
||||||
using namespace loc_core;
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
inline IClientIndex <CT, DIT> * IndexFactory <CT, DIT> :: createClientIndex
|
|
||||||
()
|
|
||||||
{
|
|
||||||
return new (nothrow) ClientIndex <CT, DIT> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
inline IDataItemIndex <CT, DIT> * IndexFactory <CT, DIT> :: createDataItemIndex
|
|
||||||
()
|
|
||||||
{
|
|
||||||
return new (nothrow) DataItemIndex <CT, DIT> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Explicit instantiation must occur in same namespace where class is defined
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
template class IndexFactory <IDataItemObserver *, DataItemId>;
|
|
||||||
template class IndexFactory <string, DataItemId>;
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/* 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 __INDEXFACTORY_H__
|
|
||||||
#define __INDEXFACTORY_H__
|
|
||||||
|
|
||||||
#include <IClientIndex.h>
|
|
||||||
#include <IDataItemIndex.h>
|
|
||||||
|
|
||||||
namespace loc_core
|
|
||||||
{
|
|
||||||
template <typename CT, typename DIT>
|
|
||||||
class IndexFactory {
|
|
||||||
|
|
||||||
public:
|
|
||||||
static IClientIndex <CT, DIT> * createClientIndex ();
|
|
||||||
static IDataItemIndex <CT, DIT> * createDataItemIndex ();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace loc_core
|
|
||||||
|
|
||||||
#endif // #ifndef __INDEXFACTORY_H__
|
|
23
gps/core/loc_core_log.cpp
Normal file → Executable file
23
gps/core/loc_core_log.cpp
Normal file → Executable file
|
@ -30,9 +30,10 @@
|
||||||
#define LOG_NDEBUG 0
|
#define LOG_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_core_log"
|
#define LOG_TAG "LocSvc_core_log"
|
||||||
|
|
||||||
|
#include <log_util.h>
|
||||||
#include <loc_log.h>
|
#include <loc_log.h>
|
||||||
#include <loc_core_log.h>
|
#include <loc_core_log.h>
|
||||||
#include <platform_lib_includes.h>
|
#include <loc_pla.h>
|
||||||
|
|
||||||
void LocPosMode::logv() const
|
void LocPosMode::logv() const
|
||||||
{
|
{
|
||||||
|
@ -100,26 +101,6 @@ const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
|
||||||
return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
|
return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
|
|
||||||
{
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_EPHEMERIS ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_ALMANAC ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_POSITION ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_TIME ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_IONO ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_UTC ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_HEALTH ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_SVDIR ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_SVSTEER ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_SADATA ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_RTI ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_CELLDB_INFO ),
|
|
||||||
NAME_VAL( LOC_GPS_DELETE_ALL)
|
|
||||||
};
|
|
||||||
static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
|
|
||||||
|
|
||||||
const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
|
const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
0
gps/core/loc_core_log.h
Normal file → Executable file
0
gps/core/loc_core_log.h
Normal file → Executable file
0
gps/core/observer/IDataItemObserver.h
Normal file → Executable file
0
gps/core/observer/IDataItemObserver.h
Normal file → Executable file
0
gps/core/observer/IDataItemSubscription.h
Normal file → Executable file
0
gps/core/observer/IDataItemSubscription.h
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue