diff --git a/Android.mk b/Android.mk old mode 100644 new mode 100755 diff --git a/AndroidProducts.mk b/AndroidProducts.mk old mode 100644 new mode 100755 index 25619b0..2cf6f24 --- a/AndroidProducts.mk +++ b/AndroidProducts.mk @@ -14,4 +14,4 @@ # limitations under the License. PRODUCT_MAKEFILES := \ - $(LOCAL_DIR)/full_gts3llte.mk + $(LOCAL_DIR)/lineage_gts3llte.mk diff --git a/BoardConfig.mk b/BoardConfig.mk index 967b083..9d38869 100755 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -1,5 +1,6 @@ # # Copyright (C) 2016 The CyanogenMod Project +# Copyright (C) 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. @@ -12,6 +13,7 @@ # 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. +# BOARD_VENDOR := samsung @@ -22,6 +24,9 @@ TARGET_SPECIFIC_HEADER_PATH := $(DEVICE_PATH)/include # Assert TARGET_OTA_ASSERT_DEVICE := gts3llte +# ADB Legacy Interface +TARGET_USES_LEGACY_ADB_INTERFACE := true + # Architecture TARGET_ARCH := arm64 TARGET_ARCH_VARIANT := armv8-a @@ -30,7 +35,7 @@ TARGET_CPU_ABI2 := TARGET_CPU_VARIANT := kryo 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_ABI2 := armeabi TARGET_2ND_CPU_VARIANT := kryo @@ -43,23 +48,29 @@ TARGET_NO_BOOTLOADER := true # Kernel 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_PAGESIZE := 4096 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 BOARD_CUSTOM_BOOTIMG := true BOARD_CUSTOM_BOOTIMG_MK := hardware/samsung/mkbootimg.mk TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-android- TARGET_KERNEL_CONFIG := lineage_gts3llte_defconfig +TARGET_COMPILE_WITH_MSM_KERNEL := true +#SELINUX_IGNORE_NEVERALLOWS := true + # Platform TARGET_BOARD_PLATFORM := msm8996 TARGET_BOARD_PLATFORM_GPU := qcom-adreno530 +# Properties +#BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true + # ANT+ -BOARD_ANT_WIRELESS_DEVICE := "qualcomm-uart" +BOARD_ANT_WIRELESS_DEVICE := "qualcomm-hidl" # Audio #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_USE_LL_AS_PRIMARY_OUTPUT := true #BOARD_SUPPORTS_SOUND_TRIGGER := true -BOARD_USES_ALSA_AUDIO := true +#BOARD_USES_ALSA_AUDIO := true #USE_CUSTOM_AUDIO_POLICY := 1 -#AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true +# Bionic +TARGET_NEEDS_LEGACY_MUTEX_HANDLE := true # Bluetooth BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth @@ -97,44 +109,66 @@ BOARD_HAVE_BLUETOOTH_QCOM := true QCOM_BT_USE_BTNV := true 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 USE_CAMERA_STUB := true USE_DEVICE_SPECIFIC_CAMERA := true TARGET_USES_MEDIA_EXTENSIONS := true # Charger -#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 +BOARD_CHARGER_ENABLE_SUSPEND := true # Display +BOARD_USES_ADRENO := true + MAX_VIRTUAL_DISPLAY_DIMENSION := 4096 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_HWC2 := true -TARGET_USES_ION := true TARGET_USES_OVERLAY := true -USE_OPENGL_RENDERER := true MAX_EGL_CACHE_KEY_SIZE := 12*1024 MAX_EGL_CACHE_SIZE := 2048*1024 -OVERRIDE_RS_DRIVER := libRSDriver_adreno.so - -VSYNC_EVENT_PHASE_OFFSET_NS := 2000000 +NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3 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 TARGET_HW_DISK_ENCRYPTION := true # 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_CACHEIMAGE_PARTITION_SIZE := 209715200 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := f2fs @@ -144,24 +178,17 @@ BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3072000000 #BOARD_SYSTEMIMAGE_PARTITION_SIZE := 4194304000 BOARD_USERDATAIMAGE_PARTITION_SIZE := 26226982912 BOARD_FLASH_BLOCK_SIZE := 131072 - -# Filesystem -TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/config.fs -TARGET_EXFAT_DRIVER := exfat +TARGET_USES_MKE2FS := true # Fingerprint 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 := \ /system/vendor/lib/libbauthserver.so|/vendor/lib/libbauthtzcommon_shim.so \ /system/vendor/lib64/libbauthserver.so|/vendor/lib64/libbauthtzcommon_shim.so 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 TARGET_PLATFORM_DEVICE_BASE := /devices/soc/ @@ -169,17 +196,13 @@ TARGET_PLATFORM_DEVICE_BASE := /devices/soc/ # Keymaster TARGET_PROVIDES_KEYMASTER := true -# Lineage Hardware -BOARD_HARDWARE_CLASS += \ - $(DEVICE_PATH)/lineagehw - # Power -#TARGET_HAS_NO_WIFI_STATS := true -TARGET_POWERHAL_VARIANT := qcom +TARGET_HAS_NO_WLAN_STATS := true +TARGET_USES_INTERACTION_BOOST := true # QCOM BOARD_USES_QCOM_HARDWARE := true -TARGET_USE_SDCLANG := true +#TARGET_USE_SDCLANG := true # Ramdisk BOARD_ROOT_EXTRA_FOLDERS := dsp efs firmware firmware-modem persist @@ -194,12 +217,15 @@ TARGET_USERIMAGES_USE_F2FS := true # Treble #PRODUCT_FULL_TREBLE_OVERRIDE := true -PRODUCT_VENDOR_MOVE_ENABLED := true +#PRODUCT_VENDOR_MOVE_ENABLED := true # RIL PROTOBUF_SUPPORTED := true TARGET_RIL_VARIANT := caf +# Security patch level - T825XXU2BRL2 +VENDOR_SECURITY_PATCH := 2018-12-01 + # SELinux include device/qcom/sepolicy/sepolicy.mk BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy @@ -221,4 +247,4 @@ WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_HAVE_SAMSUNG_WIFI := true # inherit from the proprietary version --include vendor/samsung/gts3llte/BoardConfigVendor.mk \ No newline at end of file +-include vendor/samsung/gts3llte/BoardConfigVendor.mk diff --git a/config.fs b/config.fs old mode 100644 new mode 100755 index 5625580..f1949c1 --- a/config.fs +++ b/config.fs @@ -1,14 +1,20 @@ -[AID_QCOM_DIAG] +[AID_VENDOR_QCOM_DIAG] value:2950 -[AID_QTI_DIAG] +[AID_VENDOR_QTI_DIAG] value:2901 -[AID_RFS] -value:2951 +[AID_VENDOR_QDSS] +value:2902 -[AID_RFS_SHARED] -value:2952 +[AID_VENDOR_RFS] +value:2903 + +[AID_VENDOR_RFS_SHARED] +value:2904 + +[AID_VENDOR_ADPL_ODL] +value:2905 [vendor/bin/wcnss_filter] mode: 0755 @@ -16,25 +22,19 @@ user: AID_BLUETOOTH group: AID_BLUETOOTH 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] mode: 0755 user: AID_BLUETOOTH group: AID_BLUETOOTH 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 user: AID_SYSTEM group: AID_SYSTEM caps: BLOCK_SUSPEND NET_ADMIN -[system/bin/cnss-daemon] +[vendor/bin/cnss-daemon] mode: 0755 user: AID_BLUETOOTH group: AID_BLUETOOTH @@ -46,48 +46,18 @@ user: AID_SYSTEM group: AID_SYSTEM 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] mode: 0755 user: AID_SYSTEM group: AID_SYSTEM 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] mode: 0755 user: AID_SYSTEM group: AID_SYSTEM 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] mode: 0755 user: AID_SYSTEM @@ -104,13 +74,7 @@ caps: NET_BIND_SERVICE mode: 0755 user: AID_SYSTEM group: AID_RADIO -caps: WAKE_ALARM - -[system/vendor/bin/imsrcsd] -mode: 0755 -user: AID_SYSTEM -group: AID_RADIO -caps: WAKE_ALARM +caps: NET_BIND_SERVICE BLOCK_SUSPEND WAKE_ALARM [vendor/bin/cnd] mode: 0755 @@ -118,23 +82,17 @@ user: AID_SYSTEM group: AID_SYSTEM 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] mode: 0755 user: AID_GPS group: AID_GPS caps: NET_BIND_SERVICE -[system/vendor/bin/slim_daemon] +[vendor/bin/loc_launcher] mode: 0755 user: AID_GPS group: AID_GPS -caps: NET_BIND_SERVICE +caps: SETUID SETGID [vendor/bin/xtwifi-client] mode: 0755 @@ -164,4 +122,4 @@ caps: 0 mode: 0771 user: AID_MEDIA group: AID_MEDIA -caps: 0 \ No newline at end of file +caps: 0 diff --git a/configs/audio/audio_platform_info.xml b/configs/audio/audio_platform_info.xml old mode 100644 new mode 100755 diff --git a/configs/audio/mixer_paths_tasha.xml b/configs/audio/mixer_paths_tasha.xml old mode 100644 new mode 100755 diff --git a/configs/compatibility_matrix.xml b/configs/compatibility_matrix.xml index 83eca8b..3082485 100644 --- a/configs/compatibility_matrix.xml +++ b/configs/compatibility_matrix.xml @@ -7,14 +7,14 @@ default - + android.hidl.allocator 1.0 @@ -55,4 +55,5 @@ default - \ No newline at end of file + + diff --git a/configs/data/dsi_config.xml b/configs/data/dsi_config.xml old mode 100644 new mode 100755 diff --git a/configs/data/netmgr_config.xml b/configs/data/netmgr_config.xml old mode 100644 new mode 100755 diff --git a/configs/data/qmi_config.xml b/configs/data/qmi_config.xml old mode 100644 new mode 100755 diff --git a/configs/manifest.xml b/configs/manifest.xml old mode 100644 new mode 100755 index 0b3863f..aec6b9a --- a/configs/manifest.xml +++ b/configs/manifest.xml @@ -1,3 +1,30 @@ + android.hardware.biometrics.fingerprint @@ -19,7 +46,7 @@ android.hardware.audio - hwbinder + passthrough 2.0 IDevicesFactory @@ -28,14 +55,14 @@ android.hardware.audio.effect - hwbinder + passthrough 2.0 IEffectsFactory default - - - - android.hardware.configstore + + + android.hardware.cas hwbinder 1.0 + + IMediaCasService + default + + + + android.hardware.configstore + hwbinder + 1.1 ISurfaceFlingerConfigs default @@ -69,17 +105,19 @@ ICryptoFactory default - widevine IDrmFactory default - widevine + @1.1::ICryptoFactory/clearkey + @1.1::IDrmFactory/clearkey + @1.1::ICryptoFactory/widevine + @1.1::IDrmFactory/widevine android.hardware.gatekeeper - hwbinder + passthrough 1.0 IGatekeeper @@ -93,8 +131,9 @@ IGnss default - gnss_vendor + @1.0::IGnss/default + @1.0::IGnss/gnss_vendor android.hardware.graphics.allocator @@ -126,7 +165,7 @@ android.hardware.health hwbinder - 1.0 + 2.0 IHealth default @@ -141,6 +180,15 @@ default + + android.hardware.light + passthrough + 2.0 + + ILight + default + + android.hardware.media.omx hwbinder @@ -166,7 +214,7 @@ android.hardware.power hwbinder - 1.0 + 1.1 IPower default @@ -179,10 +227,12 @@ IRadio slot1 + slot2 ISap slot1 + slot2 @@ -192,6 +242,7 @@ IOemHook slot1 + slot2 @@ -214,8 +265,8 @@ android.hardware.soundtrigger - hwbinder - 2.0 + passthrough + 2.1 ISoundTriggerHw default @@ -239,6 +290,15 @@ default + + android.hardware.usb + hwbinder + 1.0 + + IUsb + default + + android.hardware.vibrator hwbinder @@ -251,7 +311,7 @@ android.hardware.wifi hwbinder - 1.1 + 1.2 IWifi default @@ -260,12 +320,21 @@ android.hardware.wifi.supplicant hwbinder - 1.0 + 1.1 ISupplicant default + + com.qualcomm.qti.ant + hwbinder + 1.0 + + IAntHci + default + + com.qualcomm.qti.dpm.api hwbinder @@ -296,7 +365,7 @@ com.quicinc.cne.api hwbinder - 1.0 + 1.1 IApiService cnd @@ -305,7 +374,7 @@ com.quicinc.cne.server hwbinder - 2.0 + 2.2 IServer cnd @@ -340,10 +409,14 @@ vendor.lineage.livedisplay - hwbinder - 1.0 + passthrough + 2.0 - IColor + IDisplayModes + default + + + IPictureAdjustment default @@ -357,13 +430,51 @@ - vendor.qti.gnss + vendor.lineage.trust hwbinder 1.0 + + IUsbRestrict + default + + + + vendor.qti.gnss + hwbinder + 1.2 ILocHidlGnss gnss_vendor + @1.2::ILocHidlGnss/gnss_vendor + + + vendor.qti.gnss + hwbinder + 2.0 + + ILocHidlGnss + gnss_vendor + + @2.0::ILocHidlGnss/gnss_vendor + + + vendor.qti.hardware.alarm + hwbinder + 1.0 + + IAlarm + default + + + + vendor.qti.hardware.data.latency + hwbinder + 1.0 + + ILinkLatency + default + vendor.qti.hardware.iop diff --git a/configs/sec_config b/configs/sec_config index 67fecd6..742092a 100644 --- a/configs/sec_config +++ b/configs/sec_config @@ -270,6 +270,10 @@ 511:4294967295:1000:1006:1013:1021:1047 /* Allow RCS service to aquire net_raw permission */ 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 */ 3:4294967295:1001:1021:3004 2:4294967295:1000:1001:3004 @@ -320,5 +324,3 @@ 69:4294967295:1000 /* :: */ 57:4294967295:1000 -/* VSS GPS */ -232:4294967295:1001:3004:1021 diff --git a/configs/sec_config_oem b/configs/sec_config_oem deleted file mode 100644 index 2f44d5e..0000000 --- a/configs/sec_config_oem +++ /dev/null @@ -1,6 +0,0 @@ -/* Allow communication to some OEM - QMI services with radio privilages */ -/* Format is ::: */ -/* VSS */ -227:4294967295:1001:3004 -/*COEX*/ -34:4294967295:1001 diff --git a/configs/sensors/hals.conf b/configs/sensors/hals.conf old mode 100644 new mode 100755 index 5f3a14b..0b323a2 --- a/configs/sensors/hals.conf +++ b/configs/sensors/hals.conf @@ -1 +1 @@ -sensors.ssc.so +sensors.ssc.so \ No newline at end of file diff --git a/configs/thermal-engine-8996-lite.conf b/configs/thermal-engine-8996-lite.conf deleted file mode 100644 index c35a001..0000000 --- a/configs/thermal-engine-8996-lite.conf +++ /dev/null @@ -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 diff --git a/configs/vendor_framework_compatibility_matrix.xml b/configs/vendor_framework_compatibility_matrix.xml new file mode 100644 index 0000000..4e6dc7d --- /dev/null +++ b/configs/vendor_framework_compatibility_matrix.xml @@ -0,0 +1,262 @@ + + + + vendor.qti.hardware.perf + 1.0 + + IPerf + default + + + + vendor.display.color + 1.0-2 + + IDisplayColor + default + + + + vendor.display.postproc + 1.0 + + IDisplayPostproc + default + + + + vendor.display.config + 1.0-4 + + IDisplayConfig + default + + + + vendor.qti.hardware.qteeconnector + 1.0 + + IAppConnector + default + + + IGPAppConnector + default + + + + vendor.qti.hardware.factory + 1.0 + + IFactory + default + + + + com.qualcomm.qti.ant + 1.0 + + IAntHci + default + + + + com.qualcomm.qti.bluetooth_audio + 1.0 + + IBluetoothAudio + default + + + + com.qualcomm.qti.wifidisplayhal + 1.0 + + IHDCPSession + wifidisplayhdcphal + + + IDSManager + wifidisplaydshal + + + + android.hardware.gnss + 1.0-1 + + IGnss + default + + + + vendor.qti.hardware.alarm + 1.0 + + IAlarm + default + + + + vendor.qti.hardware.fm + 1.0 + + IFmHci + default + + + + vendor.qti.hardware.iop + 2.0 + + IIop + default + + + + vendor.qti.hardware.qdutils_disp + 1.0 + + IQdutilsDisp + default + + + + vendor.qti.hardware.sensorscalibrate + 1.0 + + ISensorsCalibrate + default + + + + vendor.qti.hardware.soter + 1.0 + + ISoter + default + + + + vendor.qti.hardware.tui_comm + 1.0 + + ITuiComm + default + + + + vendor.qti.hardware.vpp + 1.0-1 + + IHidlVppService + vppService + + + + android.hardware.wifi.supplicant + 1.0 + + ISupplicant + default + + + + vendor.qti.hardware.wigig.netperftuner + 1.0 + + INetPerfTuner + default + + + + vendor.qti.hardware.wigig.supptunnel + 1.0 + + ISuppTunnelProvider + default + + + + vendor.qti.imsrtpservice + 1.0 + + IRTPService + imsrtpservice + + + + vendor.qti.voiceprint + 1.0 + + IQtiVoicePrintService + default + + + + android.hardware.gnss + 1.0 + + IGnss + gnss_vendor + + + + vendor.qti.gnss + 1.0-2 + 2.0 + + ILocHidlGnss + gnss_vendor + + + + vendor.qti.hardware.wifi.supplicant + 2.0 + + ISupplicantVendor + default + + + + vendor.qti.hardware.wifi.hostapd + 1.0 + + IHostapdVendor + default + + + + vendor.qti.data.factory + 1.0 + + IFactory + default + + + diff --git a/device.mk b/device.mk old mode 100644 new mode 100755 index 9b9e0c9..2c4df58 --- a/device.mk +++ b/device.mk @@ -1,6 +1,6 @@ # # 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"); # 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 -# Overlay +# Overlays DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay # Screen density PRODUCT_AAPT_CONFIG := normal -PRODUCT_AAPT_PREF_CONFIG := xxhdpi +PRODUCT_AAPT_PREF_CONFIG := xxxhdpi # Boot animation TARGET_SCREEN_HEIGHT := 2048 TARGET_SCREEN_WIDTH := 1536 -#TARGET_BOOTANIMATION_HALF_RES := true +TARGET_BOOTANIMATION_HALF_RES := true # Device characteristics PRODUCT_CHARACTERISTICS := tablet -$(call inherit-product, frameworks/native/build/phone-xxhdpi-3072-dalvik-heap.mk) - -$(call inherit-product-if-exists, frameworks/native/build/phone-xxhdpi-3072-hwui-memory.mk) +# Dalvik +PRODUCT_PROPERTY_OVERRIDES += \ + 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 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.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_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \ frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \ frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \ frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \ @@ -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.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.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.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.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.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.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/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 PRODUCT_COPY_FILES += \ @@ -81,17 +85,14 @@ PRODUCT_COPY_FILES += \ # ANT+ PRODUCT_PACKAGES += \ AntHalService \ - com.dsi.ant.antradio_library \ - libantradio + com.dsi.ant.antradio_library # Audio PRODUCT_PACKAGES += \ android.hardware.audio@2.0-impl \ android.hardware.audio@2.0-service \ android.hardware.audio.effect@2.0-impl \ - android.hardware.soundtrigger@2.0-impl \ audio.a2dp.default \ - audio.primary.msm8996 \ audio.r_submix.default \ audio.usb.default \ libaudio-resampler \ @@ -102,33 +103,30 @@ PRODUCT_PACKAGES += \ libvolumelistener \ tinymix -PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/configs/audio/audio_effects.conf:system/etc/audio_effects.conf \ - $(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 +# audio.primary.msm8996 \ +# android.hardware.soundtrigger@2.0-impl \ -# Bluetooth -#PRODUCT_PACKAGES += \ -# android.hardware.bluetooth@1.0-impl \ -# android.hardware.bluetooth@1.0-service +#PRODUCT_COPY_FILES += \ +# $(LOCAL_PATH)/configs/audio/audio_effects.conf:system/etc/audio_effects.conf \ +# $(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 # Camera PRODUCT_PACKAGES += \ 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 +PRODUCT_PACKAGES += \ + libshims_cameraclient + PRODUCT_PACKAGES += \ Snap -# CNE +# Connectivity Engine support (CNE) PRODUCT_PACKAGES += \ libcnefeatureconfig @@ -139,6 +137,7 @@ PRODUCT_PACKAGES += \ android.hardware.graphics.composer@2.1-impl \ android.hardware.graphics.composer@2.1-service \ android.hardware.graphics.mapper@2.0-impl \ + android.hardware.configstore@1.1-service \ android.hardware.memtrack@1.0-impl \ android.hardware.memtrack@1.0-service \ copybit.msm8996 \ @@ -146,9 +145,12 @@ PRODUCT_PACKAGES += \ hwcomposer.msm8996 \ memtrack.msm8996 \ libdisplayconfig \ + libhwc2on1adapter \ + libgenlock \ liboverlay \ - libqdMetaData.system \ - libtinyxml + libtinyxml \ + libqdMetaData \ + libqdMetaData.system # Display PRODUCT_COPY_FILES += \ @@ -162,12 +164,12 @@ PRODUCT_PACKAGES += \ # DRM PRODUCT_PACKAGES += \ 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 PRODUCT_PACKAGES += \ android.hardware.biometrics.fingerprint@2.1-service \ - fingerprint.msm8996 \ libbauthtzcommon_shim # For config.fs @@ -184,7 +186,8 @@ PRODUCT_PACKAGES += \ android.hardware.gnss@1.0-impl-qti \ libcurl \ libgnss \ - libgnsspps + libgnsspps \ + libsensorndkbridge PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/gps/etc/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \ @@ -196,22 +199,29 @@ PRODUCT_COPY_FILES += \ # Healthd PRODUCT_PACKAGES += \ - android.hardware.health@1.0-impl \ - android.hardware.health@1.0-service + android.hardware.health@2.0-impl \ + android.hardware.health@2.0-service \ + charger_res_images # HIDL PRODUCT_PACKAGES += \ 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 PRODUCT_PACKAGES += \ ims-ext-common +# IPA Manager +PRODUCT_PACKAGES += \ + ipacm \ + IPACM_cfg.xml + # IPC router config PRODUCT_COPY_FILES += \ - $(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 + $(LOCAL_PATH)/configs/sec_config:$(TARGET_COPY_OUT_VENDOR)/etc/sec_config # IPv6 PRODUCT_PACKAGES += \ @@ -246,9 +256,9 @@ PRODUCT_PACKAGES += \ android.hardware.light@2.0-impl \ lights.MSM8996 -# LiveDisplay native +# LiveDisplay PRODUCT_PACKAGES += \ - vendor.lineage.livedisplay@1.0-service-sdm + vendor.lineage.livedisplay@2.0-service-sdm # Media PRODUCT_COPY_FILES += \ @@ -266,28 +276,19 @@ PRODUCT_PACKAGES += \ android.system.net.netd@1.0 \ libandroid_net \ netutils-wrapper-1.0 - + # OMX PRODUCT_PACKAGES += \ libc2dcolorconvert \ - libdashplayer \ - libdivxdrmdecrypt \ - libhypv_intercept \ - libmm-omxcore \ libextmedia_jni \ libOmxAacEnc \ libOmxAmrEnc \ libOmxCore \ libOmxEvrcEnc \ libOmxQcelp13Enc \ - libOmxSwVencMpeg4 \ - libOmxSwVencHevc \ libOmxVdec \ - libOmxVdecHevc \ libOmxVenc \ - libOmxVidcCommon \ - libstagefrighthw \ - libstagefright_soft_flacdec + libstagefrighthw # Power PRODUCT_PACKAGES += \ @@ -296,6 +297,10 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml +# QMI +PRODUCT_PACKAGES += \ + libjson + # RCS PRODUCT_PACKAGES += \ rcs_service_aidl \ @@ -310,7 +315,6 @@ PRODUCT_PACKAGES += \ init.qcom.power.rc \ init.qcom.usb.rc \ init.samsung.rc \ - init.target.rc \ ueventd.qcom.rc \ init.qcom.sh @@ -320,6 +324,8 @@ PRODUCT_PACKAGES += \ # RIL PRODUCT_PACKAGES += \ + android.hardware.radio@1.2 \ + android.hardware.radio.config@1.0 \ libprotobuf-cpp-full \ librmnetctl \ libxml2 @@ -328,11 +334,12 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ $(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 - + # Sensors PRODUCT_PACKAGES += \ - android.hardware.sensors@1.0-impl - + android.hardware.sensors@1.0-impl \ + android.hardware.sensors@1.0-service + # Sensors PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf \ @@ -340,17 +347,7 @@ PRODUCT_COPY_FILES += \ # Thermal engine 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 - -# 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 PRODUCT_PACKAGES += \ @@ -361,19 +358,30 @@ PRODUCT_BOOT_JARS += \ # TextClassifier 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 PRODUCT_PACKAGES += \ vndk-sp -# WCNSS -PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/wifi/WCNSS_cfg.dat:system/etc/firmware/wlan/qca_cld/WCNSS_cfg.dat \ - $(LOCAL_PATH)/wifi/WCNSS_qcom_cfg.ini:system/etc/firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini \ - $(LOCAL_PATH)/wifi/grippower.info:system/etc/firmware/wlan/qca_cld/grippower.info +# Vibrator +PRODUCT_PACKAGES += \ + android.hardware.vibrator@1.0-impl \ + android.hardware.vibrator@1.0-service + +# USB +PRODUCT_PACKAGES += \ + android.hardware.usb@1.0-service -# Wifi +# WiFi PRODUCT_PACKAGES += \ android.hardware.wifi@1.0-service \ 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/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 -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ +PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ persist.sys.usb.config=adb \ - ro.adb.secure=0 + ro.adb.secure=0 \ + ro.secure=0 # Root PRODUCT_PACKAGES += \ diff --git a/doze/Android.mk b/doze/Android.mk old mode 100644 new mode 100755 index 5eb8c1d..585b3dd --- a/doze/Android.mk +++ b/doze/Android.mk @@ -7,6 +7,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := SamsungDoze LOCAL_CERTIFICATE := platform +LOCAL_PRIVATE_PLATFORM_APIS := true LOCAL_PRIVILEGED_MODULE := true LOCAL_USE_AAPT2 := true @@ -17,10 +18,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \ android-support-v7-recyclerview \ android-support-v7-preference \ android-support-v7-appcompat \ - android-support-v14-preference \ - -LOCAL_STATIC_JAVA_LIBRARIES := \ - org.lineageos.platform.internal + android-support-v14-preference LOCAL_RESOURCE_DIR := \ $(LOCAL_PATH)/res \ diff --git a/doze/AndroidManifest.xml b/doze/AndroidManifest.xml old mode 100644 new mode 100755 index 3dbb0e0..9f60893 --- a/doze/AndroidManifest.xml +++ b/doze/AndroidManifest.xml @@ -27,14 +27,14 @@ + android:minSdkVersion="24" + android:targetSdkVersion="24"/> - + diff --git a/doze/res/color/switch_bar_bg.xml b/doze/res/color/switch_bar_bg.xml new file mode 100644 index 0000000..ba2dae1 --- /dev/null +++ b/doze/res/color/switch_bar_bg.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/doze/res/color/switchbar_switch_thumb_tint.xml b/doze/res/color/switchbar_switch_thumb_tint.xml new file mode 100644 index 0000000..d4bf9b3 --- /dev/null +++ b/doze/res/color/switchbar_switch_thumb_tint.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/doze/res/color/switchbar_switch_track_tint.xml b/doze/res/color/switchbar_switch_track_tint.xml new file mode 100644 index 0000000..ae45c7a --- /dev/null +++ b/doze/res/color/switchbar_switch_track_tint.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/doze/res/drawable/switchbar_background.xml b/doze/res/drawable/switchbar_background.xml index 314ed12..f210707 100644 --- a/doze/res/drawable/switchbar_background.xml +++ b/doze/res/drawable/switchbar_background.xml @@ -1,5 +1,5 @@ - - - - + + + diff --git a/doze/res/layout/switch_bar.xml b/doze/res/layout/switch_bar.xml index 7199174..9e11a0a 100644 --- a/doze/res/layout/switch_bar.xml +++ b/doze/res/layout/switch_bar.xml @@ -29,11 +29,12 @@ android:layout_width="0dp" android:layout_weight="1" android:layout_gravity="center_vertical" - android:paddingStart="48dp" + android:paddingStart="56dp" android:maxLines="2" android:ellipsize="end" android:textAppearance="@android:style/TextAppearance.Material.Title" - android:textColor="?android:attr/textColorPrimary" + android:textColor="@android:color/white" + android:textSize="18sp" android:textAlignment="viewStart" /> + android:theme="@style/Theme.Main.SwitchBar.Switch" /> diff --git a/doze/res/values/styles.xml b/doze/res/values/styles.xml index 082e53c..3443c0b 100644 --- a/doze/res/values/styles.xml +++ b/doze/res/values/styles.xml @@ -54,4 +54,9 @@ + + diff --git a/doze/res/xml/doze_settings.xml b/doze/res/xml/doze_settings.xml index 005c6ae..e00d61a 100644 --- a/doze/res/xml/doze_settings.xml +++ b/doze/res/xml/doze_settings.xml @@ -1,6 +1,7 @@ + + diff --git a/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java b/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java old mode 100644 new mode 100755 index 7a19669..cfd2fa0 --- a/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java +++ b/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java @@ -1,6 +1,6 @@ /* * 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"); * you may not use this file except in compliance with the License. @@ -29,10 +29,7 @@ public class BootCompletedReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { - if (Utils.isDozeEnabled(context) && Utils.sensorsEnabled(context)) { - if (DEBUG) Log.d(TAG, "Starting service"); - Utils.startService(context); - } + if (DEBUG) Log.d(TAG, "Received boot completed intent"); + Utils.checkDozeService(context); } - } diff --git a/doze/src/org/lineageos/settings/doze/DozeService.java b/doze/src/org/lineageos/settings/doze/DozeService.java index 2c88a83..5b161e2 100644 --- a/doze/src/org/lineageos/settings/doze/DozeService.java +++ b/doze/src/org/lineageos/settings/doze/DozeService.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2015 The CyanogenMod Project - * 2017 The LineageOS Project + * 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. @@ -25,22 +25,18 @@ import android.content.IntentFilter; import android.os.IBinder; import android.util.Log; -public class DozeService extends Service -{ +public class DozeService extends Service { private static final String TAG = "DozeService"; private static final boolean DEBUG = false; private ProximitySensor mProximitySensor; private TiltSensor mTiltSensor; - private SignificantSensor mSignificantSensor; @Override - public void onCreate() - { + public void onCreate() { if (DEBUG) Log.d(TAG, "Creating service"); mProximitySensor = new ProximitySensor(this); mTiltSensor = new TiltSensor(this); - mSignificantSensor = new SignificantSensor(this); IntentFilter screenStateFilter = new IntentFilter(Intent.ACTION_SCREEN_ON); screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF); @@ -48,62 +44,55 @@ public class DozeService extends Service } @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"); return START_STICKY; } @Override - public void onDestroy() - { + public void onDestroy() { if (DEBUG) Log.d(TAG, "Destroying service"); super.onDestroy(); this.unregisterReceiver(mScreenStateReceiver); mProximitySensor.disable(); mTiltSensor.disable(); - mSignificantSensor.disable(); } @Override - public IBinder onBind(Intent intent) - { + public IBinder onBind(Intent intent) { return null; } - private void onDisplayOn() - { + private void onDisplayOn() { if (DEBUG) Log.d(TAG, "Display on"); - if (Utils.pickUpEnabled(this)) - { + if (Utils.isPickUpEnabled(this)) { mTiltSensor.disable(); - mSignificantSensor.disable(); } - if (Utils.handwaveGestureEnabled(this) || Utils.pocketGestureEnabled(this)) + if (Utils.isHandwaveGestureEnabled(this) || + Utils.isPocketGestureEnabled(this)) { 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 - public void onReceive(Context context, Intent intent) - { - if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { onDisplayOn(); - else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) + } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { onDisplayOff(); + } } }; } diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java index 1798c10..e836de9 100644 --- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java +++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java @@ -1,6 +1,6 @@ /* * 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"); * 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.SharedPreferences; import android.os.Bundle; +import android.os.Handler; import android.support.v14.preference.PreferenceFragment; import android.support.v14.preference.SwitchPreference; import android.support.v7.preference.Preference; @@ -43,11 +44,16 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer CompoundButton.OnCheckedChangeListener { private TextView mTextView; + private View mSwitchBar; + + private SwitchPreference mAlwaysOnDisplayPreference; private SwitchPreference mPickUpPreference; private SwitchPreference mHandwavePreference; private SwitchPreference mPocketPreference; + private Handler mHandler = new Handler(); + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.doze_settings); @@ -62,22 +68,40 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer 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) getPreferenceScreen().findPreference(Utils.CATEG_PROX_SENSOR); mPickUpPreference = (SwitchPreference) findPreference(Utils.GESTURE_PICK_UP_KEY); mPickUpPreference.setEnabled(dozeEnabled); + mPickUpPreference.setOnPreferenceChangeListener(this); mHandwavePreference = (SwitchPreference) findPreference(Utils.GESTURE_HAND_WAVE_KEY); mHandwavePreference.setEnabled(dozeEnabled); + mHandwavePreference.setOnPreferenceChangeListener(this); mPocketPreference = (SwitchPreference) findPreference(Utils.GESTURE_POCKET_KEY); mPocketPreference.setEnabled(dozeEnabled); + mPocketPreference.setOnPreferenceChangeListener(this); // Hide proximity sensor related features if the device doesn't support them if (!Utils.getProxCheckBeforePulse(getActivity())) { 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 @@ -98,29 +122,45 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer mTextView.setText(getString(dozeEnabled ? R.string.switch_bar_on : R.string.switch_bar_off)); - View switchBar = view.findViewById(R.id.switch_bar); - Switch switchWidget = switchBar.findViewById(android.R.id.switch_widget); + mSwitchBar = view.findViewById(R.id.switch_bar); + Switch switchWidget = mSwitchBar.findViewById(android.R.id.switch_widget); switchWidget.setChecked(dozeEnabled); 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 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; } @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean b) { - Utils.enableDoze(b, getActivity()); + public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { + Utils.enableDoze(getActivity(), isChecked); 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); - mHandwavePreference.setEnabled(b); - mPocketPreference.setEnabled(b); + if (!isChecked) { + Utils.enableAlwaysOn(getActivity(), false); + mAlwaysOnDisplayPreference.setChecked(false); + } + mAlwaysOnDisplayPreference.setEnabled(isChecked); + + mPickUpPreference.setEnabled(isChecked); + mHandwavePreference.setEnabled(isChecked); + mPocketPreference.setEnabled(isChecked); } @Override diff --git a/doze/src/org/lineageos/settings/doze/ProximitySensor.java b/doze/src/org/lineageos/settings/doze/ProximitySensor.java index a036304..71594ff 100644 --- a/doze/src/org/lineageos/settings/doze/ProximitySensor.java +++ b/doze/src/org/lineageos/settings/doze/ProximitySensor.java @@ -24,6 +24,10 @@ import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.util.Log; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + public class ProximitySensor implements SensorEventListener { private static final boolean DEBUG = false; @@ -38,6 +42,7 @@ public class ProximitySensor implements SensorEventListener { private SensorManager mSensorManager; private Sensor mSensor; private Context mContext; + private ExecutorService mExecutorService; private boolean mSawNear = false; private long mInPocketTime = 0; @@ -46,11 +51,16 @@ public class ProximitySensor implements SensorEventListener { mContext = context; mSensorManager = mContext.getSystemService(SensorManager.class); mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY, false); + mExecutorService = Executors.newSingleThreadExecutor(); + } + + private Future submit(Runnable runnable) { + return mExecutorService.submit(runnable); } @Override public void onSensorChanged(SensorEvent event) { -/* boolean isNear = event.values[0] < mSensor.getMaximumRange(); + boolean isNear = event.values[0] < mSensor.getMaximumRange(); if (mSawNear && !isNear) { if (shouldPulse(event.timestamp)) { Utils.launchDozePulse(mContext); @@ -58,17 +68,17 @@ public class ProximitySensor implements SensorEventListener { } else { mInPocketTime = event.timestamp; } - mSawNear = isNear;*/ + mSawNear = isNear; } private boolean shouldPulse(long timestamp) { long delta = timestamp - mInPocketTime; - if (Utils.handwaveGestureEnabled(mContext) && Utils.pocketGestureEnabled(mContext)) { + if (Utils.isHandwaveGestureEnabled(mContext) && Utils.isPocketGestureEnabled(mContext)) { return true; - } else if (Utils.handwaveGestureEnabled(mContext)) { + } else if (Utils.isHandwaveGestureEnabled(mContext)) { return delta < HANDWAVE_MAX_DELTA_NS; - } else if (Utils.pocketGestureEnabled(mContext)) { + } else if (Utils.isPocketGestureEnabled(mContext)) { return delta >= POCKET_MIN_DELTA_NS; } return false; @@ -81,11 +91,16 @@ public class ProximitySensor implements SensorEventListener { protected void enable() { 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() { if (DEBUG) Log.d(TAG, "Disabling"); - mSensorManager.unregisterListener(this, mSensor); + submit(() -> { + mSensorManager.unregisterListener(this, mSensor); + }); } } diff --git a/doze/src/org/lineageos/settings/doze/SignificantSensor.java b/doze/src/org/lineageos/settings/doze/SignificantSensor.java deleted file mode 100644 index ab4e14c..0000000 --- a/doze/src/org/lineageos/settings/doze/SignificantSensor.java +++ /dev/null @@ -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); - } -} diff --git a/doze/src/org/lineageos/settings/doze/TiltSensor.java b/doze/src/org/lineageos/settings/doze/TiltSensor.java index 8741ccc..6598127 100644 --- a/doze/src/org/lineageos/settings/doze/TiltSensor.java +++ b/doze/src/org/lineageos/settings/doze/TiltSensor.java @@ -25,8 +25,12 @@ import android.hardware.SensorManager; import android.os.SystemClock; 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 String TAG = "TiltSensor"; @@ -36,47 +40,55 @@ public class TiltSensor implements SensorEventListener private SensorManager mSensorManager; private Sensor mSensor; private Context mContext; + private ExecutorService mExecutorService; private long mEntryTimestamp; - public TiltSensor(Context context) - { + public TiltSensor(Context context) { mContext = context; mSensorManager = mContext.getSystemService(SensorManager.class); mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_TILT_DETECTOR); + mExecutorService = Executors.newSingleThreadExecutor(); + } + + private Future submit(Runnable runnable) { + return mExecutorService.submit(runnable); } @Override - public void onSensorChanged(SensorEvent event) - { + 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) + long delta = SystemClock.elapsedRealtime() - mEntryTimestamp; + if (delta < MIN_PULSE_INTERVAL_MS) { 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 - public void onAccuracyChanged(Sensor sensor, int accuracy) - { + public void onAccuracyChanged(Sensor sensor, int accuracy) { /* Empty */ } - protected void enable() - { + 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(); + submit(() -> { + 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"); - mSensorManager.unregisterListener(this, mSensor); + submit(() -> { + mSensorManager.unregisterListener(this, mSensor); + }); } } diff --git a/doze/src/org/lineageos/settings/doze/Utils.java b/doze/src/org/lineageos/settings/doze/Utils.java index 2abec57..edcb60e 100644 --- a/doze/src/org/lineageos/settings/doze/Utils.java +++ b/doze/src/org/lineageos/settings/doze/Utils.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2015 The CyanogenMod Project - * 2017 The LineageOS Project + * Copyright (C) 2015 The CyanogenMod Project + * 2017-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. @@ -25,6 +25,9 @@ import android.support.v7.preference.PreferenceManager; import android.provider.Settings; 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; public final class Utils { @@ -34,6 +37,9 @@ public final class Utils { 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 GESTURE_PICK_UP_KEY = "gesture_pick_up"; @@ -53,7 +59,7 @@ public final class Utils { } protected static void checkDozeService(Context context) { - if (isDozeEnabled(context) && sensorsEnabled(context)) { + if (isDozeEnabled(context) && !isAlwaysOnEnabled(context) && sensorsEnabled(context)) { startService(context); } else { stopService(context); @@ -76,7 +82,7 @@ public final class Utils { 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(), DOZE_ENABLED, enable ? 1 : 0); } @@ -87,23 +93,43 @@ public final class Utils { new UserHandle(UserHandle.USER_CURRENT)); } - protected static boolean pickUpEnabled(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(GESTURE_PICK_UP_KEY, false); + protected static boolean enableAlwaysOn(Context context, boolean enable) { + return Settings.Secure.putIntForUser(context.getContentResolver(), + DOZE_ALWAYS_ON, enable ? 1 : 0, UserHandle.USER_CURRENT); } - protected static boolean handwaveGestureEnabled(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(GESTURE_HAND_WAVE_KEY, false); + protected static boolean isAlwaysOnEnabled(Context context) { + final boolean enabledByDefault = context.getResources() + .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) - .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) { - return pickUpEnabled(context) || handwaveGestureEnabled(context) - || pocketGestureEnabled(context); + return isPickUpEnabled(context) || isHandwaveGestureEnabled(context) + || isPocketGestureEnabled(context); } } diff --git a/full_gts3llte.mk b/full_gts3llte.mk deleted file mode 100644 index 960e595..0000000 --- a/full_gts3llte.mk +++ /dev/null @@ -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 diff --git a/gps/Android.mk b/gps/Android.mk old mode 100644 new mode 100755 index 3be1512..86d8174 --- a/gps/Android.mk +++ b/gps/Android.mk @@ -15,4 +15,7 @@ # 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)) diff --git a/gps/android/AGnss.cpp b/gps/android/AGnss.cpp old mode 100644 new mode 100755 index 3602e85..faaf75e --- a/gps/android/AGnss.cpp +++ b/gps/android/AGnss.cpp @@ -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 */ /* diff --git a/gps/android/AGnss.h b/gps/android/AGnss.h old mode 100644 new mode 100755 index ead6416..cdd5931 --- a/gps/android/AGnss.h +++ b/gps/android/AGnss.h @@ -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 */ /* @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H -#define ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H +#define ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H #include #include @@ -76,4 +76,4 @@ struct AGnss : public IAGnss { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H diff --git a/gps/android/AGnssRil.cpp b/gps/android/AGnssRil.cpp old mode 100644 new mode 100755 index d790bae..f4b9849 --- a/gps/android/AGnssRil.cpp +++ b/gps/android/AGnssRil.cpp @@ -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 */ /* diff --git a/gps/android/AGnssRil.h b/gps/android/AGnssRil.h old mode 100644 new mode 100755 index 61216d8..7f18c57 --- a/gps/android/AGnssRil.h +++ b/gps/android/AGnssRil.h @@ -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 */ /* diff --git a/gps/android/Android.mk b/gps/android/Android.mk old mode 100644 new mode 100755 index 5f17415..dc721db --- a/gps/android/Android.mk +++ b/gps/android/Android.mk @@ -2,8 +2,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 +LOCAL_VENDOR_MODULE := true LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := \ AGnss.cpp \ @@ -36,6 +35,7 @@ LOCAL_SHARED_LIBRARIES := \ libhidlbase \ libhidltransport \ libhwbinder \ + libcutils \ libutils \ android.hardware.gnss@1.0 \ @@ -43,7 +43,6 @@ LOCAL_SHARED_LIBRARIES += \ libloc_core \ libgps.utils \ libdl \ - libloc_pla \ liblocation_api \ LOCAL_CFLAGS += $(GNSS_CFLAGS) @@ -52,19 +51,15 @@ include $(BUILD_SHARED_LIBRARY) BUILD_GNSS_HIDL_SERVICE := true ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET), true) ifneq ($(LW_FEATURE_SET),true) -ifneq ($(TARGET_HAS_LOW_RAM),true) BUILD_GNSS_HIDL_SERVICE := false -endif # TARGET_HAS_LOW_RAM endif # LW_FEATURE_SET endif # BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET ifeq ($(BUILD_GNSS_HIDL_SERVICE), true) include $(CLEAR_VARS) 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_MODULE_OWNER := qti +LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc LOCAL_SRC_FILES := \ service.cpp \ diff --git a/gps/android/Gnss.cpp b/gps/android/Gnss.cpp old mode 100644 new mode 100755 index e3fd64e..c844118 --- a/gps/android/Gnss.cpp +++ b/gps/android/Gnss.cpp @@ -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 */ /* @@ -20,9 +20,13 @@ #define LOG_TAG "LocSvc_GnssInterface" +#include #include #include +#include #include "Gnss.h" +#include + typedef void* (getLocationInterface)(); namespace android { @@ -107,7 +111,7 @@ GnssInterface* Gnss::getGnssInterface() { return mGnssInterface; } -Return Gnss::setCallback(const sp& callback) { +Return Gnss::setCallback(const sp& callback) { ENTRY_LOG_CALLFLOW(); if (mGnssCbIface != nullptr) { mGnssCbIface->unlinkToDeath(mGnssDeathRecipient); @@ -251,7 +255,7 @@ Return Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs, } } -Return Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) { +Return Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) { ENTRY_LOG_CALLFLOW(); GnssAPIClient* api = getApi(); if (api) { @@ -260,8 +264,8 @@ Return Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) { return Void(); } -Return Gnss::setPositionMode(IGnss::GnssPositionMode mode, - IGnss::GnssPositionRecurrence recurrence, +Return Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode, + V1_0::IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs) { @@ -275,48 +279,49 @@ Return Gnss::setPositionMode(IGnss::GnssPositionMode mode, return retVal; } -Return> Gnss::getExtensionAGnss() { +Return> Gnss::getExtensionAGnss() { ENTRY_LOG_CALLFLOW(); mAGnssIface = new AGnss(this); return mAGnssIface; } -Return> Gnss::getExtensionGnssNi() { +Return> Gnss::getExtensionGnssNi() { ENTRY_LOG_CALLFLOW(); mGnssNi = new GnssNi(this); return mGnssNi; } -Return> Gnss::getExtensionGnssMeasurement() { +Return> Gnss::getExtensionGnssMeasurement() { ENTRY_LOG_CALLFLOW(); - mGnssMeasurement = new GnssMeasurement(); + if (mGnssMeasurement == nullptr) + mGnssMeasurement = new GnssMeasurement(); return mGnssMeasurement; } -Return> Gnss::getExtensionGnssConfiguration() { +Return> Gnss::getExtensionGnssConfiguration() { ENTRY_LOG_CALLFLOW(); mGnssConfig = new GnssConfiguration(this); return mGnssConfig; } -Return> Gnss::getExtensionGnssGeofencing() { +Return> Gnss::getExtensionGnssGeofencing() { ENTRY_LOG_CALLFLOW(); mGnssGeofencingIface = new GnssGeofencing(); return mGnssGeofencingIface; } -Return> Gnss::getExtensionGnssBatching() { +Return> Gnss::getExtensionGnssBatching() { mGnssBatching = new GnssBatching(); return mGnssBatching; } -Return> Gnss::getExtensionGnssDebug() { +Return> Gnss::getExtensionGnssDebug() { ENTRY_LOG_CALLFLOW(); mGnssDebug = new GnssDebug(this); return mGnssDebug; } -Return> Gnss::getExtensionAGnssRil() { +Return> Gnss::getExtensionAGnssRil() { mGnssRil = new AGnssRil(this); return mGnssRil; } diff --git a/gps/android/Gnss.h b/gps/android/Gnss.h old mode 100644 new mode 100755 index e4589d6..03ef170 --- a/gps/android/Gnss.h +++ b/gps/android/Gnss.h @@ -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 */ /* @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSS_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSS_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSS_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSS_H #include #include @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -42,34 +43,24 @@ namespace gnss { namespace V1_0 { namespace implementation { +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::hidl_vec; -using ::android::hardware::hidl_string; using ::android::sp; +using ::android::hardware::gnss::V1_0::GnssLocation; struct Gnss : public IGnss { 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 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. * These declarations were generated from Gnss.hal. */ - Return setCallback(const sp& callback) override; + Return setCallback(const sp& callback) override; Return start() override; Return stop() override; Return cleanup() override; @@ -79,30 +70,30 @@ struct Gnss : public IGnss { Return injectTime(int64_t timeMs, int64_t timeReferenceMs, int32_t uncertaintyMs) override; - Return deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override; - Return setPositionMode(IGnss::GnssPositionMode mode, - IGnss::GnssPositionRecurrence recurrence, + Return deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override; + Return setPositionMode(V1_0::IGnss::GnssPositionMode mode, + V1_0::IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs) override; - Return> getExtensionAGnss() override; - Return> getExtensionGnssNi() override; - Return> getExtensionGnssMeasurement() override; - Return> getExtensionGnssConfiguration() override; - Return> getExtensionGnssGeofencing() override; - Return> getExtensionGnssBatching() override; + Return> getExtensionAGnss() override; + Return> getExtensionGnssNi() override; + Return> getExtensionGnssMeasurement() override; + Return> getExtensionGnssConfiguration() override; + Return> getExtensionGnssGeofencing() override; + Return> getExtensionGnssBatching() override; - Return> getExtensionAGnssRil() override; + Return> getExtensionAGnssRil() override; - inline Return> getExtensionGnssNavigationMessage() override { + inline Return> getExtensionGnssNavigationMessage() override { return nullptr; } - inline Return> getExtensionXtra() override { + inline Return> getExtensionXtra() override { return nullptr; } - Return> getExtensionGnssDebug() override; + Return> getExtensionGnssDebug() override; // These methods are not part of the IGnss base class. GnssAPIClient* getApi(); @@ -110,6 +101,9 @@ struct Gnss : public IGnss { Return updateConfiguration(GnssConfig& gnssConfig); GnssInterface* getGnssInterface(); + // Callback for ODCPI request + void odcpiRequestCb(const OdcpiRequestInfo& request); + private: struct GnssDeathRecipient : hidl_death_recipient { GnssDeathRecipient(sp gnss) : mGnss(gnss) { @@ -132,8 +126,8 @@ struct Gnss : public IGnss { sp mGnssRil = nullptr; GnssAPIClient* mApi = nullptr; - sp mGnssCbIface = nullptr; - sp mGnssNiCbIface = nullptr; + sp mGnssCbIface = nullptr; + sp mGnssNiCbIface = nullptr; GnssConfig mPendingConfig; GnssInterface* mGnssInterface = nullptr; }; @@ -146,4 +140,4 @@ extern "C" IGnss* HIDL_FETCH_IGnss(const char* name); } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSS_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSS_H diff --git a/gps/android/GnssBatching.cpp b/gps/android/GnssBatching.cpp old mode 100644 new mode 100755 index 6ffadc9..3e5a9f4 --- a/gps/android/GnssBatching.cpp +++ b/gps/android/GnssBatching.cpp @@ -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 */ /* diff --git a/gps/android/GnssBatching.h b/gps/android/GnssBatching.h old mode 100644 new mode 100755 index de5d5c3..8fab857 --- a/gps/android/GnssBatching.h +++ b/gps/android/GnssBatching.h @@ -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 */ /* @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H #include #include @@ -77,4 +77,4 @@ struct GnssBatching : public IGnssBatching { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H diff --git a/gps/android/GnssConfiguration.cpp b/gps/android/GnssConfiguration.cpp old mode 100644 new mode 100755 index 51ee892..15153dd --- a/gps/android/GnssConfiguration.cpp +++ b/gps/android/GnssConfiguration.cpp @@ -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 */ /* diff --git a/gps/android/GnssConfiguration.h b/gps/android/GnssConfiguration.h old mode 100644 new mode 100755 index f9ea423..1629e06 --- a/gps/android/GnssConfiguration.h +++ b/gps/android/GnssConfiguration.h @@ -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 */ @@ -19,8 +19,8 @@ */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H #include #include @@ -68,4 +68,4 @@ struct GnssConfiguration : public IGnssConfiguration { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H diff --git a/gps/android/GnssDebug.cpp b/gps/android/GnssDebug.cpp old mode 100644 new mode 100755 index ff467d3..3d8e055 --- a/gps/android/GnssDebug.cpp +++ b/gps/android/GnssDebug.cpp @@ -30,8 +30,14 @@ namespace implementation { using ::android::hardware::hidl_vec; -#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000ULL) // 1/1/2017 00:00 GMT -#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns +#define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000) +#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000) +#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500) +#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180) + +#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT +#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns +#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss) { @@ -91,6 +97,40 @@ Return GnssDebug::getDebugData(getDebugData_cb _hidl_cb) 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 if (reports.mTime.mValid) { data.time.timeEstimate = reports.mTime.timeEstimate; @@ -98,10 +138,17 @@ Return GnssDebug::getDebugData(getDebugData_cb _hidl_cb) data.time.frequencyUncertaintyNsPerSec = reports.mTime.frequencyUncertaintyNsPerSec; } - else { + + if (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 diff --git a/gps/android/GnssDebug.h b/gps/android/GnssDebug.h old mode 100644 new mode 100755 index 7d29131..a7116cb --- a/gps/android/GnssDebug.h +++ b/gps/android/GnssDebug.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H #include @@ -56,4 +56,4 @@ private: } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H diff --git a/gps/android/GnssGeofencing.cpp b/gps/android/GnssGeofencing.cpp old mode 100644 new mode 100755 index 035a092..2a8ff88 --- a/gps/android/GnssGeofencing.cpp +++ b/gps/android/GnssGeofencing.cpp @@ -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 */ /* diff --git a/gps/android/GnssGeofencing.h b/gps/android/GnssGeofencing.h old mode 100644 new mode 100755 index 7af5f91..db5f9d2 --- a/gps/android/GnssGeofencing.h +++ b/gps/android/GnssGeofencing.h @@ -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 */ /* @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H #include #include @@ -88,4 +88,4 @@ struct GnssGeofencing : public IGnssGeofencing { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H diff --git a/gps/android/GnssMeasurement.cpp b/gps/android/GnssMeasurement.cpp old mode 100644 new mode 100755 index 8cbfabd..1c65bd6 --- a/gps/android/GnssMeasurement.cpp +++ b/gps/android/GnssMeasurement.cpp @@ -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 */ /* @@ -52,8 +52,9 @@ GnssMeasurement::~GnssMeasurement() { } // Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. + Return GnssMeasurement::setCallback( - const sp& callback) { + const sp& callback) { Return ret = IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC; @@ -72,9 +73,10 @@ Return GnssMeasurement::setCallback( } mGnssMeasurementCbIface = callback; - mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/); + mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0); return mApi->measurementSetCallback(callback); + } Return GnssMeasurement::close() { diff --git a/gps/android/GnssMeasurement.h b/gps/android/GnssMeasurement.h old mode 100644 new mode 100755 index 5073169..4247dbf --- a/gps/android/GnssMeasurement.h +++ b/gps/android/GnssMeasurement.h @@ -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 */ /* @@ -18,10 +18,11 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H #include +#include #include namespace android { @@ -47,8 +48,8 @@ struct GnssMeasurement : public IGnssMeasurement { * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. * These declarations were generated from IGnssMeasurement.hal. */ - Return setCallback( - const sp& callback) override; + Return setCallback( + const sp& callback) override; Return close() override; private: @@ -63,7 +64,7 @@ struct GnssMeasurement : public IGnssMeasurement { private: sp mGnssMeasurementDeathRecipient = nullptr; - sp mGnssMeasurementCbIface = nullptr; + sp mGnssMeasurementCbIface = nullptr; MeasurementAPIClient* mApi; }; @@ -73,4 +74,4 @@ struct GnssMeasurement : public IGnssMeasurement { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H diff --git a/gps/android/GnssNi.cpp b/gps/android/GnssNi.cpp old mode 100644 new mode 100755 index 4437932..d06cc20 --- a/gps/android/GnssNi.cpp +++ b/gps/android/GnssNi.cpp @@ -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 */ /* diff --git a/gps/android/GnssNi.h b/gps/android/GnssNi.h old mode 100644 new mode 100755 index f6fe0bb..90f62d5 --- a/gps/android/GnssNi.h +++ b/gps/android/GnssNi.h @@ -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 */ /* @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H -#define ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H +#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H +#define ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H #include #include @@ -72,4 +72,4 @@ struct GnssNi : public IGnssNi { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H +#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H diff --git a/gps/android/android.hardware.gnss@1.0-service-qti.rc b/gps/android/android.hardware.gnss@1.1-service-qti.rc old mode 100644 new mode 100755 similarity index 88% rename from gps/android/android.hardware.gnss@1.0-service-qti.rc rename to gps/android/android.hardware.gnss@1.1-service-qti.rc index d4d40fa..b5da6f9 --- a/gps/android/android.hardware.gnss@1.0-service-qti.rc +++ b/gps/android/android.hardware.gnss@1.1-service-qti.rc @@ -1,4 +1,4 @@ service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti - class main + class hal user gps group system gps radio diff --git a/gps/android/location_api/BatchingAPIClient.cpp b/gps/android/location_api/BatchingAPIClient.cpp old mode 100644 new mode 100755 index 0b66d38..264ab83 --- a/gps/android/location_api/BatchingAPIClient.cpp +++ b/gps/android/location_api/BatchingAPIClient.cpp @@ -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 * modification, are permitted provided that the following conditions are @@ -45,6 +45,10 @@ namespace gnss { namespace V1_0 { namespace implementation { +using ::android::hardware::gnss::V1_0::IGnssBatching; +using ::android::hardware::gnss::V1_0::IGnssBatchingCallback; +using ::android::hardware::gnss::V1_0::GnssLocation; + static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out, LocationCapabilitiesMask mask); @@ -153,7 +157,8 @@ void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMa 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); if (mGnssBatchingCbIface != nullptr && count > 0) { diff --git a/gps/android/location_api/BatchingAPIClient.h b/gps/android/location_api/BatchingAPIClient.h old mode 100644 new mode 100755 index c951a83..5d64df3 --- a/gps/android/location_api/BatchingAPIClient.h +++ b/gps/android/location_api/BatchingAPIClient.h @@ -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 * modification, are permitted provided that the following conditions are @@ -45,11 +45,11 @@ namespace implementation { class BatchingAPIClient : public LocationAPIClientBase { public: - BatchingAPIClient(const sp& callback); + BatchingAPIClient(const sp& callback); ~BatchingAPIClient(); int getBatchSize(); - int startSession(const IGnssBatching::Options& options); - int updateSessionOptions(const IGnssBatching::Options& options); + int startSession(const V1_0::IGnssBatching::Options& options); + int updateSessionOptions(const V1_0::IGnssBatching::Options& options); int stopSession(); void getBatchedLocation(int last_n_locations); void flushBatchedLocations(); @@ -61,9 +61,8 @@ public: void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final; private: - sp mGnssBatchingCbIface; + sp mGnssBatchingCbIface; uint32_t mDefaultId; - int mBatchSize; LocationCapabilitiesMask mLocationCapabilitiesMask; }; diff --git a/gps/android/location_api/GeofenceAPIClient.cpp b/gps/android/location_api/GeofenceAPIClient.cpp old mode 100644 new mode 100755 index 6167177..774a049 --- a/gps/android/location_api/GeofenceAPIClient.cpp +++ b/gps/android/location_api/GeofenceAPIClient.cpp @@ -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 * modification, are permitted provided that the following conditions are @@ -42,6 +42,8 @@ namespace gnss { namespace V1_0 { namespace implementation { +using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback; +using ::android::hardware::gnss::V1_0::GnssLocation; GeofenceAPIClient::GeofenceAPIClient(const sp& callback) : LocationAPIClientBase(), @@ -158,7 +160,7 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb( geofenceBreachNotification.ids[i], gnssLocation, transition, - static_cast(geofenceBreachNotification.timestamp)); + static_cast(geofenceBreachNotification.timestamp)); if (!r.isOk()) { LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s", __func__, r.description().c_str()); diff --git a/gps/android/location_api/GeofenceAPIClient.h b/gps/android/location_api/GeofenceAPIClient.h old mode 100644 new mode 100755 index f779bcb..dc99ddd --- a/gps/android/location_api/GeofenceAPIClient.h +++ b/gps/android/location_api/GeofenceAPIClient.h @@ -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 * modification, are permitted provided that the following conditions are @@ -45,7 +45,7 @@ using ::android::sp; class GeofenceAPIClient : public LocationAPIClientBase { public: - GeofenceAPIClient(const sp& callback); + GeofenceAPIClient(const sp& callback); virtual ~GeofenceAPIClient() = default; 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; private: - sp mGnssGeofencingCbIface; + sp mGnssGeofencingCbIface; }; } // namespace implementation diff --git a/gps/android/location_api/GnssAPIClient.cpp b/gps/android/location_api/GnssAPIClient.cpp old mode 100644 new mode 100755 index 2e44c2e..320ae15 --- a/gps/android/location_api/GnssAPIClient.cpp +++ b/gps/android/location_api/GnssAPIClient.cpp @@ -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 * modification, are permitted provided that the following conditions are @@ -43,6 +43,11 @@ namespace gnss { namespace V1_0 { namespace implementation { +using ::android::hardware::gnss::V1_0::IGnss; +using ::android::hardware::gnss::V1_0::IGnssCallback; +using ::android::hardware::gnss::V1_0::IGnssNiCallback; +using ::android::hardware::gnss::V1_0::GnssLocation; + static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out); GnssAPIClient::GnssAPIClient(const sp& gpsCb, @@ -160,6 +165,10 @@ bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode, mLocationOptions.size = sizeof(LocationOptions); mLocationOptions.minInterval = minIntervalMs; mLocationOptions.minDistance = preferredAccuracyMeters; + if (IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) { + mLocationOptions.minInterval = + std::numeric_limits::max(); + } if (mode == IGnss::GnssPositionMode::STANDALONE) mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE; else if (mode == IGnss::GnssPositionMode::MS_BASED) @@ -445,7 +454,7 @@ void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) android::hardware::hidl_string nmeaString; nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length); auto r = gnssCbIface->gnssNmeaCb( - static_cast(gnssNmeaNotification.timestamp), nmeaString); + static_cast(gnssNmeaNotification.timestamp), nmeaString); if (!r.isOk()) { LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__, gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str()); @@ -499,10 +508,10 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta { memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus)); out.numSvs = in.count; - if (out.numSvs > static_cast(GnssMax::SVS_COUNT)) { - LOC_LOGW("%s]: Too many satellites %zd. Clamps to %d.", - __FUNCTION__, out.numSvs, GnssMax::SVS_COUNT); - out.numSvs = static_cast(GnssMax::SVS_COUNT); + if (out.numSvs > static_cast(V1_0::GnssMax::SVS_COUNT)) { + LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.", + __FUNCTION__, out.numSvs, V1_0::GnssMax::SVS_COUNT); + out.numSvs = static_cast(V1_0::GnssMax::SVS_COUNT); } for (size_t i = 0; i < out.numSvs; i++) { IGnssCallback::GnssSvInfo& info = out.gnssSvList[i]; diff --git a/gps/android/location_api/GnssAPIClient.h b/gps/android/location_api/GnssAPIClient.h old mode 100644 new mode 100755 index b5cffb1..923cb48 --- a/gps/android/location_api/GnssAPIClient.h +++ b/gps/android/location_api/GnssAPIClient.h @@ -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 * modification, are permitted provided that the following conditions are @@ -30,6 +30,7 @@ #ifndef GNSS_API_CLINET_H #define GNSS_API_CLINET_H + #include #include #include @@ -47,28 +48,28 @@ using ::android::sp; class GnssAPIClient : public LocationAPIClientBase { public: - GnssAPIClient(const sp& gpsCb, - const sp& niCb); + GnssAPIClient(const sp& gpsCb, + const sp& niCb); virtual ~GnssAPIClient(); GnssAPIClient(const GnssAPIClient&) = delete; GnssAPIClient& operator=(const GnssAPIClient&) = delete; // for GpsInterface - void gnssUpdateCallbacks(const sp& gpsCb, - const sp& niCb); + void gnssUpdateCallbacks(const sp& gpsCb, + const sp& niCb); bool gnssStart(); bool gnssStop(); - bool gnssSetPositionMode(IGnss::GnssPositionMode mode, - IGnss::GnssPositionRecurrence recurrence, + bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode, + V1_0::IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs); // for GpsNiInterface - void gnssNiRespond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse); + void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse); // these apis using LocationAPIControlClient - void gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags); + void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags); void gnssEnable(LocationTechnologyType techType); void gnssDisable(); void gnssConfigurationUpdate(const GnssConfig& gnssConfig); @@ -89,12 +90,13 @@ public: void onStopTrackingCb(LocationError error) final; private: - sp mGnssCbIface; - sp mGnssNiCbIface; + sp mGnssCbIface; + sp mGnssNiCbIface; std::mutex mMutex; LocationAPIControlClient* mControlClient; LocationCapabilitiesMask mLocationCapabilitiesMask; bool mLocationCapabilitiesCached; + LocationOptions mLocationOptions; }; diff --git a/gps/android/location_api/LocationUtil.cpp b/gps/android/location_api/LocationUtil.cpp old mode 100644 new mode 100755 index 311c0b2..89681f2 --- a/gps/android/location_api/LocationUtil.cpp +++ b/gps/android/location_api/LocationUtil.cpp @@ -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 * modification, are permitted provided that the following conditions are @@ -35,6 +35,10 @@ namespace gnss { namespace V1_0 { namespace implementation { +using ::android::hardware::gnss::V1_0::GnssLocation; +using ::android::hardware::gnss::V1_0::GnssConstellationType; +using ::android::hardware::gnss::V1_0::GnssLocationFlags; + void convertGnssLocation(Location& in, GnssLocation& out) { memset(&out, 0, sizeof(GnssLocation)); @@ -63,7 +67,38 @@ void convertGnssLocation(Location& in, GnssLocation& out) out.verticalAccuracyMeters = in.verticalAccuracy; out.speedAccuracyMetersPerSecond = in.speedAccuracy; out.bearingAccuracyDegrees = in.bearingAccuracy; - out.timestamp = static_cast(in.timestamp); + out.timestamp = static_cast(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(in.timestamp); } void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out) diff --git a/gps/android/location_api/LocationUtil.h b/gps/android/location_api/LocationUtil.h old mode 100644 new mode 100755 index 44d5e02..9e0cd36 --- a/gps/android/location_api/LocationUtil.h +++ b/gps/android/location_api/LocationUtil.h @@ -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 * modification, are permitted provided that the following conditions are @@ -40,8 +40,9 @@ namespace gnss { namespace V1_0 { namespace implementation { -void convertGnssLocation(Location& in, GnssLocation& out); -void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out); +void convertGnssLocation(Location& in, V1_0::GnssLocation& out); +void convertGnssLocation(const V1_0::GnssLocation& in, Location& out); +void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out); void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); diff --git a/gps/android/location_api/MeasurementAPIClient.cpp b/gps/android/location_api/MeasurementAPIClient.cpp old mode 100644 new mode 100755 index 731c7ed..823851d --- a/gps/android/location_api/MeasurementAPIClient.cpp +++ b/gps/android/location_api/MeasurementAPIClient.cpp @@ -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 * modification, are permitted provided that the following conditions are @@ -42,10 +42,13 @@ namespace gnss { namespace V1_0 { namespace implementation { +using ::android::hardware::gnss::V1_0::IGnssMeasurement; +using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback; + static void convertGnssData(GnssMeasurementsNotification& in, - IGnssMeasurementCallback::GnssData& out); + V1_0::IGnssMeasurementCallback::GnssData& out); static void convertGnssMeasurement(GnssMeasurementsData& in, - IGnssMeasurementCallback::GnssMeasurement& out); + V1_0::IGnssMeasurementCallback::GnssMeasurement& out); static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out); MeasurementAPIClient::MeasurementAPIClient() : @@ -62,7 +65,7 @@ MeasurementAPIClient::~MeasurementAPIClient() // for GpsInterface Return -MeasurementAPIClient::measurementSetCallback(const sp& callback) +MeasurementAPIClient::measurementSetCallback(const sp& callback) { LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback); @@ -70,6 +73,12 @@ MeasurementAPIClient::measurementSetCallback(const sp& mGnssMeasurementCbIface = callback; mMutex.unlock(); + return startTracking(); +} + +Return +MeasurementAPIClient::startTracking() +{ LocationCallbacks locationCallbacks; memset(&locationCallbacks, 0, sizeof(LocationCallbacks)); locationCallbacks.size = sizeof(LocationCallbacks); @@ -115,15 +124,18 @@ void MeasurementAPIClient::measurementClose() { void MeasurementAPIClient::onGnssMeasurementsCb( GnssMeasurementsNotification gnssMeasurementsNotification) { - LOC_LOGD("%s]: (count: %zu active: %zu)", + LOC_LOGD("%s]: (count: %zu active: %d)", __FUNCTION__, gnssMeasurementsNotification.count, mTracking); if (mTracking) { mMutex.lock(); - auto gnssMeasurementCbIface(mGnssMeasurementCbIface); + sp gnssMeasurementCbIface = nullptr; + if (mGnssMeasurementCbIface != nullptr) { + gnssMeasurementCbIface = mGnssMeasurementCbIface; + } mMutex.unlock(); if (gnssMeasurementCbIface != nullptr) { - IGnssMeasurementCallback::GnssData gnssData; + V1_0::IGnssMeasurementCallback::GnssData gnssData; convertGnssData(gnssMeasurementsNotification, gnssData); auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData); if (!r.isOk()) { @@ -135,7 +147,7 @@ void MeasurementAPIClient::onGnssMeasurementsCb( } static void convertGnssMeasurement(GnssMeasurementsData& in, - IGnssMeasurementCallback::GnssMeasurement& out) + V1_0::IGnssMeasurementCallback::GnssMeasurement& out) { memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement)); 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, - IGnssMeasurementCallback::GnssData& out) + V1_0::IGnssMeasurementCallback::GnssData& out) { out.measurementCount = in.count; - if (out.measurementCount > static_cast(GnssMax::SVS_COUNT)) { - LOC_LOGW("%s]: Too many measurement %zd. Clamps to %d.", - __FUNCTION__, out.measurementCount, GnssMax::SVS_COUNT); - out.measurementCount = static_cast(GnssMax::SVS_COUNT); + if (out.measurementCount > static_cast(V1_0::GnssMax::SVS_COUNT)) { + LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.", + __FUNCTION__, out.measurementCount, V1_0::GnssMax::SVS_COUNT); + out.measurementCount = static_cast(V1_0::GnssMax::SVS_COUNT); } for (size_t i = 0; i < out.measurementCount; i++) { convertGnssMeasurement(in.measurements[i], out.measurements[i]); diff --git a/gps/android/location_api/MeasurementAPIClient.h b/gps/android/location_api/MeasurementAPIClient.h old mode 100644 new mode 100755 index 8de1326..08b4811 --- a/gps/android/location_api/MeasurementAPIClient.h +++ b/gps/android/location_api/MeasurementAPIClient.h @@ -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 * modification, are permitted provided that the following conditions are @@ -42,7 +42,6 @@ namespace gnss { namespace V1_0 { namespace implementation { -using ::android::hardware::gnss::V1_0::IGnssMeasurement; using ::android::sp; class MeasurementAPIClient : public LocationAPIClientBase @@ -54,16 +53,18 @@ public: MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete; // for GpsMeasurementInterface - Return measurementSetCallback( - const sp& callback); + Return measurementSetCallback( + const sp& callback); void measurementClose(); + Return startTracking(); // callbacks we are interested in void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final; private: - sp mGnssMeasurementCbIface; std::mutex mMutex; + sp mGnssMeasurementCbIface; + bool mTracking; }; diff --git a/gps/android/service.cpp b/gps/android/service.cpp old mode 100644 new mode 100755 index 5779e67..c03b7ea --- a/gps/android/service.cpp +++ b/gps/android/service.cpp @@ -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 */ /* @@ -18,9 +18,9 @@ * 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 +#include #include using android::hardware::gnss::V1_0::IGnss; diff --git a/gps/build/target_specific_features.mk b/gps/build/target_specific_features.mk new file mode 100755 index 0000000..943e231 --- /dev/null +++ b/gps/build/target_specific_features.mk @@ -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 diff --git a/gps/core/Android.mk b/gps/core/Android.mk old mode 100644 new mode 100755 index df16535..928edd4 --- a/gps/core/Android.mk +++ b/gps/core/Android.mk @@ -3,8 +3,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libloc_core -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 +LOCAL_VENDOR_MODULE := true LOCAL_MODULE_TAGS := optional ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true) @@ -17,8 +16,7 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ libgps.utils \ libdl \ - liblog \ - libloc_pla + liblog LOCAL_SRC_FILES += \ LocApiBase.cpp \ @@ -27,9 +25,6 @@ LOCAL_SRC_FILES += \ LocDualContext.cpp \ loc_core_log.cpp \ data-items/DataItemsFactoryProxy.cpp \ - data-items/common/ClientIndex.cpp \ - data-items/common/DataItemIndex.cpp \ - data-items/common/IndexFactory.cpp \ SystemStatusOsObserver.cpp \ SystemStatus.cpp @@ -43,6 +38,7 @@ LOCAL_C_INCLUDES:= \ $(LOCAL_PATH)/observer \ LOCAL_HEADER_LIBRARIES := \ + libutils_headers \ libgps.utils_headers \ libloc_pla_headers \ liblocation_api_headers diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp old mode 100644 new mode 100755 index 8af48fc..35e6585 --- a/gps/core/ContextBase.cpp +++ b/gps/core/ContextBase.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include 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'}, {"AGPS_CONFIG_INJECT", &mGps_conf.AGPS_CONFIG_INJECT, NULL, 'n'}, {"EXTERNAL_DR_ENABLED", &mGps_conf.EXTERNAL_DR_ENABLED, NULL, 'n'}, + {"SUPL_HOST", &mGps_conf.SUPL_HOST, NULL, 's'}, + {"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'}, }; const loc_param_s_type ContextBase::mSap_conf_table[] = @@ -98,6 +100,8 @@ void ContextBase::readConfig() mGps_conf.SUPL_VER = 0x10000; mGps_conf.SUPL_MODE = 0x1; mGps_conf.SUPL_ES = 0; + mGps_conf.SUPL_HOST[0] = 0; + mGps_conf.SUPL_PORT = 0; mGps_conf.CAPABILITIES = 0x7; /* LTE Positioning Profile configuration is disable by default*/ mGps_conf.LPP_PROFILE = 0; diff --git a/gps/core/ContextBase.h b/gps/core/ContextBase.h old mode 100644 new mode 100755 index 83de999..dc64b6a --- a/gps/core/ContextBase.h +++ b/gps/core/ContextBase.h @@ -36,7 +36,8 @@ #include #include -#define MAX_XTRA_SERVER_URL_LENGTH 256 +#define MAX_XTRA_SERVER_URL_LENGTH (256) +#define MAX_SUPL_SERVER_URL_LENGTH (256) /* GPS.conf support */ /* 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_UP_TECHNOLOGY; uint32_t EXTERNAL_DR_ENABLED; + char SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH]; + uint32_t SUPL_PORT; } loc_gps_cfg_s_type; /* NOTE: the implementaiton of the parser casts number diff --git a/gps/core/LBSProxyBase.h b/gps/core/LBSProxyBase.h old mode 100644 new mode 100755 diff --git a/gps/core/LocAdapterBase.cpp b/gps/core/LocAdapterBase.cpp old mode 100644 new mode 100755 index 3943819..d0da3da --- a/gps/core/LocAdapterBase.cpp +++ b/gps/core/LocAdapterBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { @@ -161,4 +161,8 @@ bool LocAdapterBase:: reportWwanZppFix(LocGpsLocation &/*zppLoc*/) DEFAULT_IMPL(false) +bool LocAdapterBase:: + reportOdcpiRequestEvent(OdcpiRequestInfo& /*request*/) +DEFAULT_IMPL(false) + } // namespace loc_core diff --git a/gps/core/LocAdapterBase.h b/gps/core/LocAdapterBase.h old mode 100644 new mode 100755 index e7beca8..35fc48e --- a/gps/core/LocAdapterBase.h +++ b/gps/core/LocAdapterBase.h @@ -153,6 +153,7 @@ public: virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements, int msInWeek); virtual bool reportWwanZppFix(LocGpsLocation &zppLoc); + virtual bool reportOdcpiRequestEvent(OdcpiRequestInfo& request); }; } // namespace loc_core diff --git a/gps/core/LocAdapterProxyBase.h b/gps/core/LocAdapterProxyBase.h old mode 100644 new mode 100755 diff --git a/gps/core/LocApiBase.cpp b/gps/core/LocApiBase.cpp old mode 100644 new mode 100755 index e0845de..426335d --- a/gps/core/LocApiBase.cpp +++ b/gps/core/LocApiBase.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include namespace loc_core { @@ -107,19 +107,16 @@ struct LocSsrMsg : public LocMsg { struct LocOpenMsg : public LocMsg { LocApiBase* mLocApi; - LOC_API_ADAPTER_EVENT_MASK_T mMask; - inline LocOpenMsg(LocApiBase* locApi, - LOC_API_ADAPTER_EVENT_MASK_T mask) : - LocMsg(), mLocApi(locApi), mMask(mask) + inline LocOpenMsg(LocApiBase* locApi) : + LocMsg(), mLocApi(locApi) { locallog(); } inline virtual void proc() const { - mLocApi->open(mMask); + mLocApi->open(mLocApi->getEvtMask()); } inline void locallog() const { - LOC_LOGV("%s:%d]: LocOpen Mask: %x\n", - __func__, __LINE__, mMask); + LOC_LOGv("LocOpen Mask: %" PRIx64 "\n", mLocApi->getEvtMask()); } inline virtual void log() const { locallog(); @@ -163,8 +160,7 @@ void LocApiBase::addAdapter(LocAdapterBase* adapter) for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) { if (mLocAdapters[i] == NULL) { mLocAdapters[i] = adapter; - mMsgTask->sendMsg(new LocOpenMsg(this, - (adapter->getEvtMask()))); + mMsgTask->sendMsg(new LocOpenMsg(this)); break; } } @@ -200,7 +196,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter) close(); } else { // 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() { - mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask())); + open(getEvtMask()); } void LocApiBase::handleEngineUpEvent() @@ -264,6 +260,12 @@ void LocApiBase::reportWwanZppFix(LocGpsLocation &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) { const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS", @@ -440,6 +442,10 @@ enum loc_api_adapter_err LocApiBase:: injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/) 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:: setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) diff --git a/gps/core/LocApiBase.h b/gps/core/LocApiBase.h old mode 100644 new mode 100755 index f66bfe1..6563dea --- a/gps/core/LocApiBase.h +++ b/gps/core/LocApiBase.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace loc_core { class ContextBase; @@ -134,6 +134,7 @@ public: void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek); void saveSupportedFeatureList(uint8_t *featureList); void reportWwanZppFix(LocGpsLocation &zppLoc); + void reportOdcpiRequest(OdcpiRequestInfo& request); // downward calls // All below functions are to be defined by adapter specific modules: @@ -153,6 +154,8 @@ public: setAPN(char* apn, int len); virtual enum loc_api_adapter_err injectPosition(double latitude, double longitude, float accuracy); + virtual enum loc_api_adapter_err + injectPosition(const Location& location); virtual enum loc_api_adapter_err setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty); virtual enum loc_api_adapter_err diff --git a/gps/core/LocDualContext.cpp b/gps/core/LocDualContext.cpp old mode 100644 new mode 100755 index fd3450d..180d9dc --- a/gps/core/LocDualContext.cpp +++ b/gps/core/LocDualContext.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/gps/core/LocDualContext.h b/gps/core/LocDualContext.h old mode 100644 new mode 100755 diff --git a/gps/core/SystemStatus.cpp b/gps/core/SystemStatus.cpp old mode 100644 new mode 100755 index 92ddeed..f4316ca --- a/gps/core/SystemStatus.cpp +++ b/gps/core/SystemStatus.cpp @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -120,6 +120,12 @@ public: double mAgcGal; // x16 int32_t mLeapSeconds;// x17 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 @@ -154,6 +160,12 @@ private: eMax0 = eAgcGal, eLeapSeconds = 23, eLeapSecUnc = 24, + eGloBpAmpI = 25, + eGloBpAmpQ = 26, + eBdsBpAmpI = 27, + eBdsBpAmpQ = 28, + eGalBpAmpI = 29, + eGalBpAmpQ = 30, eMax }; SystemStatusPQWM1 mM1; @@ -183,6 +195,12 @@ public: inline uint32_t getRecErrorRecovery() { return mM1.mRecErrorRecovery; } inline int32_t getLeapSeconds(){ return mM1.mLeapSeconds; } 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) : SystemStatusNmeaBase(str_in, len_in) @@ -219,6 +237,14 @@ public: mM1.mLeapSeconds = atoi(mField[eLeapSeconds].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 @@ -765,7 +791,13 @@ SystemStatusRfAndParams::SystemStatusRfAndParams(const SystemStatusPQWM1& nmea) mAgcGps(nmea.mAgcGps), mAgcGlo(nmea.mAgcGlo), 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) || (mAgcGlo != peer.mAgcGlo) || (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 true; @@ -1217,8 +1255,7 @@ IOsObserver* SystemStatus::getOsObserver() } SystemStatus::SystemStatus(const MsgTask* msgTask) : - mSysStatusObsvr(this, msgTask), - mConnected(false) + mSysStatusObsvr(this, msgTask) { int result = 0; ENTRY_LOG (); @@ -1268,17 +1305,10 @@ SystemStatus::SystemStatus(const MsgTask* msgTask) : /****************************************************************************** SystemStatus - storing dataitems ******************************************************************************/ -template -bool SystemStatus::setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s) -{ - TYPE_SYSTEMSTATUS_ITEM sout(s); - return setIteminReport(report, sout); -} - template -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(s.collate(report.back())))) { // there is no change - just update reported timestamp report.back().mUtcReported = s.mUtcReported; 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] 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 ret = false; if (!loc_nmea_is_debug(data, len)) { return false; } @@ -1332,43 +1361,43 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len) pthread_mutex_lock(&mMutexSystemStatus); // 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(); - ret |= setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s)); - ret |= setIteminReport(mCache.mXoState, SystemStatusXoState(s)); - ret |= setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s)); - ret |= setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s)); + setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s)); + setIteminReport(mCache.mXoState, SystemStatusXoState(s)); + setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s)); + setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s)); } else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mInjectedPosition, + setIteminReport(mCache.mInjectedPosition, SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mBestPosition, + setIteminReport(mCache.mBestPosition, SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mXtra, + setIteminReport(mCache.mXtra, SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mEphemeris, + setIteminReport(mCache.mEphemeris, SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mSvHealth, + setIteminReport(mCache.mSvHealth, SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mPdr, + setIteminReport(mCache.mPdr, SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mNavData, + setIteminReport(mCache.mNavData, SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mPositionFailure, + setIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get())); } else { @@ -1376,7 +1405,7 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len) } pthread_mutex_unlock(&mMutexSystemStatus); - return ret; + return true; } /****************************************************************************** @@ -1417,94 +1446,92 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem) switch(dataitem->getId()) { case AIRPLANEMODE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mAirplaneMode, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mAirplaneMode, + SystemStatusAirplaneMode(*(static_cast(dataitem)))); break; case ENH_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mENH, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mENH, + SystemStatusENH(*(static_cast(dataitem)))); break; case GPSSTATE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mGPSState, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mGPSState, + SystemStatusGpsState(*(static_cast(dataitem)))); break; case NLPSTATUS_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mNLPStatus, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mNLPStatus, + SystemStatusNLPStatus(*(static_cast(dataitem)))); break; case WIFIHARDWARESTATE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mWifiHardwareState, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mWifiHardwareState, + SystemStatusWifiHardwareState(*(static_cast(dataitem)))); break; case NETWORKINFO_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mNetworkInfo, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mNetworkInfo, + SystemStatusNetworkInfo(*(static_cast(dataitem)))); break; case RILSERVICEINFO_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mRilServiceInfo, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mRilServiceInfo, + SystemStatusServiceInfo(*(static_cast(dataitem)))); break; case RILCELLINFO_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mRilCellInfo, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mRilCellInfo, + SystemStatusRilCellInfo(*(static_cast(dataitem)))); break; case SERVICESTATUS_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mServiceStatus, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mServiceStatus, + SystemStatusServiceStatus(*(static_cast(dataitem)))); break; case MODEL_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mModel, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mModel, + SystemStatusModel(*(static_cast(dataitem)))); break; case MANUFACTURER_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mManufacturer, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mManufacturer, + SystemStatusManufacturer(*(static_cast(dataitem)))); break; case ASSISTED_GPS_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mAssistedGps, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mAssistedGps, + SystemStatusAssistedGps(*(static_cast(dataitem)))); break; case SCREEN_STATE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mScreenState, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mScreenState, + SystemStatusScreenState(*(static_cast(dataitem)))); break; case POWER_CONNECTED_STATE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mPowerConnectState, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mPowerConnectState, + SystemStatusPowerConnectState(*(static_cast(dataitem)))); break; case TIMEZONE_CHANGE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mTimeZoneChange, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mTimeZoneChange, + SystemStatusTimeZoneChange(*(static_cast(dataitem)))); break; case TIME_CHANGE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mTimeChange, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mTimeChange, + SystemStatusTimeChange(*(static_cast(dataitem)))); break; case WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID: - ret = setItemBaseinReport( - mCache.mWifiSupplicantStatus, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mWifiSupplicantStatus, + SystemStatusWifiSupplicantStatus(*(static_cast(dataitem)))); break; case SHUTDOWN_STATE_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mShutdownState, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mShutdownState, + SystemStatusShutdownState(*(static_cast(dataitem)))); break; case TAC_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mTac, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mTac, + SystemStatusTac(*(static_cast(dataitem)))); break; case MCCMNC_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mMccMnc, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mMccMnc, + SystemStatusMccMnc(*(static_cast(dataitem)))); break; case BTLE_SCAN_DATA_ITEM_ID: - ret = setItemBaseinReport(mCache.mBtDeviceScanDetail, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mBtDeviceScanDetail, + SystemStatusBtDeviceScanDetail(*(static_cast(dataitem)))); break; case BT_SCAN_DATA_ITEM_ID: - ret = setItemBaseinReport( - mCache.mBtLeDeviceScanDetail, - *(static_cast(dataitem))); + ret = setIteminReport(mCache.mBtLeDeviceScanDetail, + SystemStatusBtleDeviceScanDetail(*(static_cast(dataitem)))); break; default: break; @@ -1623,7 +1650,7 @@ bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) con @return true when successfully done ******************************************************************************/ -bool SystemStatus::setDefaultReport(void) +bool SystemStatus::setDefaultGnssEngineStates(void) { pthread_mutex_lock(&mMutexSystemStatus); @@ -1644,29 +1671,6 @@ bool SystemStatus::setDefaultReport(void) 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); return true; } @@ -1678,17 +1682,12 @@ bool SystemStatus::setDefaultReport(void) @return true when successfully done ******************************************************************************/ -bool SystemStatus::eventConnectionStatus(bool connected, uint8_t type) +bool SystemStatus::eventConnectionStatus(bool connected, int8_t type) { - if (connected != mConnected) { - mConnected = connected; + // send networkinof dataitem to systemstatus observer clients + SystemStatusNetworkInfo s(type, "", "", connected); + mSysStatusObsvr.notify({&s}); - // send networkinof dataitem to systemstatus observer clients - SystemStatusNetworkInfo s(type, "", "", false, connected, false); - list dl(0); - dl.push_back(&s); - mSysStatusObsvr.notify(dl); - } return true; } diff --git a/gps/core/SystemStatus.h b/gps/core/SystemStatus.h old mode 100644 new mode 100755 index 1bcef10..b2f4fb6 --- a/gps/core/SystemStatus.h +++ b/gps/core/SystemStatus.h @@ -30,9 +30,10 @@ #define __SYSTEM_STATUS__ #include -#include +#include #include -#include +#include +#include #include #include #include @@ -70,14 +71,17 @@ public: static const uint32_t maxItem = 5; SystemStatusItemBase() { - timeval tv; - gettimeofday(&tv, NULL); + struct timespec tv; + clock_gettime(CLOCK_MONOTONIC, &tv); mUtcTime.tv_sec = tv.tv_sec; - mUtcTime.tv_nsec = tv.tv_usec *1000ULL; + mUtcTime.tv_nsec = tv.tv_nsec; mUtcReported = mUtcTime; }; - virtual ~SystemStatusItemBase() { }; - virtual void dump(void) { }; + virtual ~SystemStatusItemBase() {}; + inline virtual SystemStatusItemBase& collate(SystemStatusItemBase&) { + return *this; + } + virtual void dump(void) {}; }; class SystemStatusLocation : public SystemStatusItemBase @@ -92,7 +96,7 @@ public: const GpsLocationExtended& locationEx) : mValid(true), mLocation(location), - mLocationEx(locationEx) { } + mLocationEx(locationEx) {} bool equals(const SystemStatusLocation& peer); void dump(void); }; @@ -152,6 +156,12 @@ public: double mAgcGlo; double mAgcBds; double mAgcGal; + uint32_t mGloBpAmpI; + uint32_t mGloBpAmpQ; + uint32_t mBdsBpAmpI; + uint32_t mBdsBpAmpQ; + uint32_t mGalBpAmpI; + uint32_t mGalBpAmpQ; inline SystemStatusRfAndParams() : mPgaGain(0), mGpsBpAmpI(0), @@ -165,7 +175,13 @@ public: mAgcGps(0), mAgcGlo(0), mAgcBds(0), - mAgcGal(0) {} + mAgcGal(0), + mGloBpAmpI(0), + mGloBpAmpQ(0), + mBdsBpAmpI(0), + mBdsBpAmpQ(0), + mGalBpAmpI(0), + mGalBpAmpQ(0) {} inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea); bool equals(const SystemStatusRfAndParams& peer); void dump(void); @@ -444,38 +460,49 @@ public: class SystemStatusNetworkInfo : public SystemStatusItemBase, public NetworkInfoDataItemBase { + NetworkInfoDataItemBase* mSrcObjPtr; public: inline SystemStatusNetworkInfo( int32_t type=0, std::string typeName="", string subTypeName="", - bool available=false, bool connected=false, bool roaming=false) : NetworkInfoDataItemBase( + (NetworkType)type, type, typeName, subTypeName, - available, + connected && (!roaming), connected, - roaming) {} + roaming), + mSrcObjPtr(nullptr) {} inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) : - NetworkInfoDataItemBase(itemBase) { + NetworkInfoDataItemBase(itemBase), + mSrcObjPtr((NetworkInfoDataItemBase*)&itemBase) { mType = itemBase.getType(); } inline bool equals(const SystemStatusNetworkInfo& peer) { - if ((mType == peer.mType) && - (mTypeName == peer.mTypeName) && - (mSubTypeName == peer.mSubTypeName) && - (mAvailable == peer.mAvailable) && - (mConnected == peer.mConnected) && - (mRoaming == peer.mRoaming)) { - return true; + return (mAllTypes == peer.mAllTypes); + } + inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) { + uint64_t allTypes = (static_cast(curInfo)).mAllTypes; + if (mConnected) { + mAllTypes |= allTypes; + } 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 { - 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() {} inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) : RilServiceInfoDataItemBase(itemBase) {} - inline bool equals(const SystemStatusServiceInfo& /*peer*/) { - return true; + inline bool equals(const SystemStatusServiceInfo& peer) { + return static_cast(peer) == + static_cast(*this); } }; @@ -500,8 +528,9 @@ public: RilCellInfoDataItemBase() {} inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) : RilCellInfoDataItemBase(itemBase) {} - inline bool equals(const SystemStatusRilCellInfo& /*peer*/) { - return true; + inline bool equals(const SystemStatusRilCellInfo& peer) { + return static_cast(peer) == + static_cast(*this); } }; @@ -770,13 +799,9 @@ private: // Data members static pthread_mutex_t mMutexSystemStatus; SystemStatusReports mCache; - bool mConnected; - - template - bool setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s); template - 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 template @@ -796,8 +821,8 @@ public: bool eventDataItemNotify(IDataItemCore* dataitem); bool setNmeaString(const char *data, uint32_t len); bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const; - bool setDefaultReport(void); - bool eventConnectionStatus(bool connected, uint8_t type); + bool setDefaultGnssEngineStates(void); + bool eventConnectionStatus(bool connected, int8_t type); }; } // namespace loc_core diff --git a/gps/core/SystemStatusOsObserver.cpp b/gps/core/SystemStatusOsObserver.cpp old mode 100644 new mode 100755 index 541b5fd..8127e86 --- a/gps/core/SystemStatusOsObserver.cpp +++ b/gps/core/SystemStatusOsObserver.cpp @@ -32,25 +32,20 @@ #include #include #include -#include -#include -#include #include namespace loc_core { -SystemStatusOsObserver::SystemStatusOsObserver( - SystemStatus* systemstatus, const MsgTask* msgTask) : - mSystemStatus(systemstatus), - mAddress("SystemStatusOsObserver"), - mClientIndex(IndexFactory :: createClientIndex()), - mDataItemIndex(IndexFactory :: createDataItemIndex()) -{ - mContext.mMsgTask = msgTask; +template +COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) { + COUT outContainer(0); + for (auto item : inContainer) { + outContainer.insert(outContainer.begin(), item); + } + return outContainer; } -SystemStatusOsObserver::~SystemStatusOsObserver() -{ +SystemStatusOsObserver::~SystemStatusOsObserver() { // Close data-item library handle DataItemsFactoryProxy::closeDataItemLibraryHandle(); @@ -62,290 +57,238 @@ SystemStatusOsObserver::~SystemStatusOsObserver() } mDataItemCache.clear(); - delete mClientIndex; - delete mDataItemIndex; } 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", - mSubscribeReqCache.size(), mReqDataCache.size()); - - // we have received the subscription object. process cached requests - // process - subscribe request cache - for (auto each : mSubscribeReqCache) { - 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& l, IDataItemObserver* client) -{ - ObserverReqCache::iterator dicIter = reqCache.find(client); - if (dicIter != reqCache.end()) { - // found - list 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(); + if (!mContext.mSSObserver->mDataItemToClients.empty()) { + list dis( + containerTransfer, list>( + mContext.mSSObserver->mDataItemToClients.getKeys())); + mContext.mSubscriptionObj->subscribe(dis, mContext.mSSObserver); + mContext.mSubscriptionObj->requestData(dis, mContext.mSSObserver); + } } - } - else { - // not found - reqCache[client] = l; + }; + + if (nullptr == subscriptionObj) { + LOC_LOGw("subscriptionObj is NULL"); + } else { + mContext.mMsgTask->sendMsg(new SetSubsObj(mContext, subscriptionObj)); } } /****************************************************************************** IDataItemSubscription Overrides ******************************************************************************/ -void SystemStatusOsObserver::subscribe( - const list& l, IDataItemObserver* client) +void SystemStatusOsObserver::subscribe(const list& 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 { - HandleSubscribeReq(SystemStatusOsObserver* parent, - const list& l, IDataItemObserver* client) : - mParent(parent), mClient(client), mDataItemList(l) {} - virtual ~HandleSubscribeReq() {} + inline HandleSubscribeReq(SystemStatusOsObserver* parent, + list& l, IDataItemObserver* client, bool requestData) : + mParent(parent), mClient(client), + mDataItemSet(containerTransfer, unordered_set>(l)), + mToRequestData(requestData) {} + void proc() const { + unordered_set dataItemsToSubscribe(0); + mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe); + mParent->mClientToDataItems.add(mClient, mDataItemSet); - if (mDataItemList.empty()) { - LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting"); - return; - } + mParent->sendCachedDataItems(mDataItemSet, mClient); - // Handle First Response - list pendingFirstResponseList(0); - 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 yetToSubscribeDataItemsList(0); - mParent->mDataItemIndex->add(mClient, mDataItemList, yetToSubscribeDataItemsList); - - // Send subscription list to framework - if (!yetToSubscribeDataItemsList.empty()) { - mParent->mContext.mSubscriptionObj->subscribe(yetToSubscribeDataItemsList, mParent); + // Send subscription set to framework + if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToSubscribe.empty()) { LOC_LOGD("Subscribe Request sent to framework for the following"); - mParent->logMe(yetToSubscribeDataItemsList); + mParent->logMe(dataItemsToSubscribe); + + if (mToRequestData) { + mParent->mContext.mSubscriptionObj->requestData( + containerTransfer, list>( + std::move(dataItemsToSubscribe)), + mParent); + } else { + mParent->mContext.mSubscriptionObj->subscribe( + containerTransfer, list>( + std::move(dataItemsToSubscribe)), + mParent); + } } } - SystemStatusOsObserver* mParent; + mutable SystemStatusOsObserver* mParent; IDataItemObserver* mClient; - const list mDataItemList; + const unordered_set 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&)l, client, toRequestData)); + } } void SystemStatusOsObserver::updateSubscription( const list& l, IDataItemObserver* client) { - if (nullptr == mContext.mSubscriptionObj) { - LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__); - return; - } - struct HandleUpdateSubscriptionReq : public LocMsg { HandleUpdateSubscriptionReq(SystemStatusOsObserver* parent, - const list& l, IDataItemObserver* client) : - mParent(parent), mClient(client), mDataItemList(l) {} - virtual ~HandleUpdateSubscriptionReq() {} + list& l, IDataItemObserver* client) : + mParent(parent), mClient(client), + mDataItemSet(containerTransfer, unordered_set>(l)) {} + void proc() const { - if (mDataItemList.empty()) { - LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting"); - return; - } - - list currentlySubscribedList(0); - mParent->mClientIndex->getSubscribedList(mClient, currentlySubscribedList); - - list removeDataItemList(0); - set_difference(currentlySubscribedList.begin(), currentlySubscribedList.end(), - mDataItemList.begin(), mDataItemList.end(), - inserter(removeDataItemList,removeDataItemList.begin())); - - // Handle First Response - list pendingFirstResponseList(0); - mParent->mClientIndex->add(mClient, mDataItemList, pendingFirstResponseList); + unordered_set dataItemsToSubscribe(0); + unordered_set dataItemsToUnsubscribe(0); + unordered_set clients({mClient}); + // below removes clients from all entries keyed with the return of the + // mClientToDataItems.update() call. If leaving an empty set of clients as the + // result, the entire entry will be removed. dataItemsToUnsubscribe will be + // populated to keep the keys of the removed entries. + mParent->mDataItemToClients.trimOrRemove( + // this call updates map; removes + // the DataItemId's that are not new to the clietn from mDataItemSet; + // and returns a set of mDataItemSet's that are no longer used by client. + // This unused set of mDataItemSet's is passed to trimOrRemove method of + // map to remove the client from the + // corresponding entries, and gets a set of the entries that are + // removed from the map as a result. + mParent->mClientToDataItems.update(mClient, + (unordered_set&)mDataItemSet), + clients, &dataItemsToUnsubscribe, nullptr); + // below adds mClient to map, and populates + // new keys added to that map, which are DataItemIds to be subscribed. + mParent->mDataItemToClients.add(mDataItemSet, clients, &dataItemsToSubscribe); // Send First Response - mParent->sendFirstResponse(pendingFirstResponseList, mClient); + mParent->sendCachedDataItems(mDataItemSet, mClient); - list yetToSubscribeDataItemsList(0); - mParent->mDataItemIndex->add( - mClient, mDataItemList, yetToSubscribeDataItemsList); + if (nullptr != mParent->mContext.mSubscriptionObj) { + // Send subscription set to framework + if (!dataItemsToSubscribe.empty()) { + LOC_LOGD("Subscribe Request sent to framework for the following"); + mParent->logMe(dataItemsToSubscribe); - // Send subscription list to framework - if (!yetToSubscribeDataItemsList.empty()) { - mParent->mContext.mSubscriptionObj->subscribe( - yetToSubscribeDataItemsList, mParent); - LOC_LOGD("Subscribe Request sent to framework for the following"); - mParent->logMe(yetToSubscribeDataItemsList); - } + mParent->mContext.mSubscriptionObj->subscribe( + containerTransfer, list>( + std::move(dataItemsToSubscribe)), + mParent); + } - list unsubscribeList(0); - list unused(0); - mParent->mClientIndex->remove(mClient, removeDataItemList, unused); - - if (!mParent->mClientIndex->isSubscribedClient(mClient)) { - mParent->mDataItemIndex->remove( - list (1,mClient), unsubscribeList); - } - if (!unsubscribeList.empty()) { // Send unsubscribe to framework - mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent); - LOC_LOGD("Unsubscribe Request sent to framework for the following"); - mParent->logMe(unsubscribeList); + if (!dataItemsToUnsubscribe.empty()) { + LOC_LOGD("Unsubscribe Request sent to framework for the following"); + mParent->logMe(dataItemsToUnsubscribe); + + mParent->mContext.mSubscriptionObj->unsubscribe( + containerTransfer, list>( + std::move(dataItemsToUnsubscribe)), + mParent); + } } } SystemStatusOsObserver* mParent; IDataItemObserver* mClient; - const list mDataItemList; + unordered_set mDataItemSet; }; - mContext.mMsgTask->sendMsg(new (nothrow) HandleUpdateSubscriptionReq(this, l, client)); -} -void SystemStatusOsObserver::requestData( - const list& l, IDataItemObserver* client) -{ - if (nullptr == mContext.mSubscriptionObj) { - LOC_LOGD("%s]: Subscription object is NULL. Caching requests", __func__); - cacheObserverRequest(mReqDataCache, l, client); - return; + if (l.empty() || nullptr == client) { + LOC_LOGw("Data item set is empty or client is nullptr"); + } else { + mContext.mMsgTask->sendMsg( + new HandleUpdateSubscriptionReq(this, (list&)l, client)); } - - struct HandleRequestData : public LocMsg { - HandleRequestData(SystemStatusOsObserver* parent, - const list& 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 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 mDataItemList; - }; - mContext.mMsgTask->sendMsg(new (nothrow) HandleRequestData(this, l, client)); } void SystemStatusOsObserver::unsubscribe( const list& l, IDataItemObserver* client) { - if (nullptr == mContext.mSubscriptionObj) { - LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__); - return; - } struct HandleUnsubscribeReq : public LocMsg { HandleUnsubscribeReq(SystemStatusOsObserver* parent, - const list& l, IDataItemObserver* client) : - mParent(parent), mClient(client), mDataItemList(l) {} - virtual ~HandleUnsubscribeReq() {} + list& l, IDataItemObserver* client) : + mParent(parent), mClient(client), + mDataItemSet(containerTransfer, unordered_set>(l)) {} + void proc() const { - if (mDataItemList.empty()) { - LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting"); - return; - } + unordered_set dataItemsUnusedByClient(0); + unordered_set clientToRemove(0); + mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove, + &dataItemsUnusedByClient); + unordered_set dataItemsToUnsubscribe(0); + mParent->mDataItemToClients.trimOrRemove(dataItemsUnusedByClient, {mClient}, + &dataItemsToUnsubscribe, nullptr); - list unsubscribeList(0); - list unused(0); - mParent->mClientIndex->remove(mClient, mDataItemList, unused); - - for (auto each : mDataItemList) { - list clientListSubs(0); - list clientListOut(0); - mParent->mDataItemIndex->remove( - each, list (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); + if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToUnsubscribe.empty()) { 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, list>( + std::move(dataItemsToUnsubscribe)), + mParent); } } SystemStatusOsObserver* mParent; IDataItemObserver* mClient; - const list mDataItemList; + unordered_set 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&)l, 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 { HandleUnsubscribeAllReq(SystemStatusOsObserver* parent, IDataItemObserver* client) : mParent(parent), mClient(client) {} - virtual ~HandleUnsubscribeAllReq() {} - void proc() const { - list clients(1, mClient); - list unsubscribeList(0); - if(0 == mParent->mClientIndex->remove(mClient)) { - return; - } - mParent->mDataItemIndex->remove(clients, unsubscribeList); - 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"); - mParent->logMe(unsubscribeList); + void proc() const { + unordered_set diByClient = mParent->mClientToDataItems.getValSet(mClient); + if (!diByClient.empty()) { + unordered_set dataItemsToUnsubscribe; + mParent->mClientToDataItems.remove(mClient); + mParent->mDataItemToClients.trimOrRemove(diByClient, {mClient}, + &dataItemsToUnsubscribe, nullptr); + + if (!dataItemsToUnsubscribe.empty() && + nullptr != mParent->mContext.mSubscriptionObj) { + + LOC_LOGD("Unsubscribe Request sent to framework for the following data items"); + mParent->logMe(dataItemsToUnsubscribe); + + // Send unsubscribe to framework + mParent->mContext.mSubscriptionObj->unsubscribe( + containerTransfer, list>( + std::move(dataItemsToUnsubscribe)), + mParent); + } } } SystemStatusOsObserver* mParent; 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& dlist) { - list 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 { - HandleNotify(SystemStatusOsObserver* parent, const list& l) : - mParent(parent), mDList(l) {} - virtual ~HandleNotify() { - for (auto each : mDList) { - delete each; + HandleNotify(SystemStatusOsObserver* parent, vector& v) : + mParent(parent), mDiVec(std::move(v)) {} + + inline virtual ~HandleNotify() { + for (auto item : mDiVec) { + delete item; } } + void proc() const { // Update Cache with received data items and prepare // list of data items to be sent. - list dataItemIdsToBeSent(0); - for (auto item : mDList) { - bool dataItemUpdated = false; - mParent->updateCache(item, dataItemUpdated); - if (dataItemUpdated) { - dataItemIdsToBeSent.push_back(item->getId()); + unordered_set dataItemIdsToBeSent(0); + for (auto item : mDiVec) { + if (mParent->updateCache(item)) { + dataItemIdsToBeSent.insert(item->getId()); } } // Send data item to all subscribed clients - list clientList(0); + unordered_set clientSet(0); for (auto each : dataItemIdsToBeSent) { - list clients(0); - mParent->mDataItemIndex->getListOfSubscribedClients(each, clients); - for (auto each_cient: clients) { - clientList.push_back(each_cient); + auto clients = mParent->mDataItemToClients.getValSetPtr(each); + if (nullptr != clients) { + clientSet.insert(clients->begin(), clients->end()); } } - clientList.unique(); - for (auto client : clientList) { - list dataItemIdsSubscribedByThisClient(0); - list dataItemIdsToBeSentForThisClient(0); - mParent->mClientIndex->getSubscribedList( - client, dataItemIdsSubscribedByThisClient); - dataItemIdsSubscribedByThisClient.sort(); - dataItemIdsToBeSent.sort(); + for (auto client : clientSet) { + unordered_set dataItemIdsForThisClient( + mParent->mClientToDataItems.getValSet(client)); + for (auto itr = dataItemIdsForThisClient.begin(); + itr != dataItemIdsForThisClient.end(); ) { + if (dataItemIdsToBeSent.find(*itr) == dataItemIdsToBeSent.end()) { + itr = dataItemIdsForThisClient.erase(itr); + } else { + itr++; + } + } - set_intersection(dataItemIdsToBeSent.begin(), - dataItemIdsToBeSent.end(), - dataItemIdsSubscribedByThisClient.begin(), - dataItemIdsSubscribedByThisClient.end(), - inserter(dataItemIdsToBeSentForThisClient, - dataItemIdsToBeSentForThisClient.begin())); - - mParent->sendCachedDataItems(dataItemIdsToBeSentForThisClient, client); - dataItemIdsSubscribedByThisClient.clear(); - dataItemIdsToBeSentForThisClient.clear(); + mParent->sendCachedDataItems(dataItemIdsForThisClient, client); } } SystemStatusOsObserver* mParent; - const list mDList; + const vector mDiVec; }; - mContext.mMsgTask->sendMsg(new (nothrow) HandleNotify(this, dataItemList)); + + if (!dlist.empty()) { + vector 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 - map::iterator citer = mActiveRequestCount.find(dit); + DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit); if (citer == mActiveRequestCount.end()) { // Data item not found in map // Add reference count as 1 and add dataitem to map @@ -482,7 +422,7 @@ void SystemStatusOsObserver::turnOff(DataItemId dit) } // Check if data item exists in mActiveRequestCount - map::iterator citer = mActiveRequestCount.find(dit); + DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit); if (citer != mActiveRequestCount.end()) { // found 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 ******************************************************************************/ -void SystemStatusOsObserver::sendFirstResponse( - const list& l, IDataItemObserver* to) -{ - if (l.empty()) { - LOC_LOGV("list is empty. Nothing to do. Exiting"); - return; - } - - string clientName; - to->getName(clientName); - list dataItems(0); - - for (auto each : l) { - map::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( - const list& l, IDataItemObserver* to) + const unordered_set& s, IDataItemObserver* to) { - string clientName; - to->getName(clientName); - list dataItems(0); + if (nullptr == to) { + LOC_LOGv("client pointer is NULL."); + } else { + string clientName; + to->getName(clientName); + list dataItems(0); - for (auto each : l) { - string dv; - IDataItemCore* di = mDataItemCache[each]; - di->stringify(dv); - LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str()); - dataItems.push_back(di); + for (auto each : s) { + auto citer = mDataItemCache.find(each); + if (citer != mDataItemCache.end()) { + string dv; + citer->second->stringify(dv); + LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str()); + dataItems.push_front(citer->second); + } + } + + if (dataItems.empty()) { + LOC_LOGv("No items to notify."); + } else { + to->notify(dataItems); + } } - to->notify(dataItems); } -void SystemStatusOsObserver::updateCache(IDataItemCore* d, bool& dataItemUpdated) +bool SystemStatusOsObserver::updateCache(IDataItemCore* d) { - if (nullptr == d) { - return; - } + bool dataItemUpdated = false; - // Check if data item exists in cache - map::iterator citer = - mDataItemCache.find(d->getId()); - if (citer == mDataItemCache.end()) { - // New data item; not found in cache - IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(d->getId()); - if (nullptr == dataitem) { - return; + // Request systemstatus to record this dataitem in its cache + // if the return is false, it means that SystemStatus is not + // handling it, so SystemStatusOsObserver also doesn't. + // So it has to be true to proceed. + if (nullptr != d && mSystemStatus->eventDataItemNotify(d)) { + auto citer = mDataItemCache.find(d->getId()); + if (citer == mDataItemCache.end()) { + // New data item; not found in cache + IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(d->getId()); + if (nullptr != dataitem) { + // Copy the contents of the data item + dataitem->copy(d); + // Insert in mDataItemCache + mDataItemCache.insert(std::make_pair(d->getId(), dataitem)); + dataItemUpdated = true; + } + } else { + // Found in cache; Update cache if necessary + citer->second->copy(d, &dataItemUpdated); } - // Copy the contents of the data item - dataitem->copy(d); - pair 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) { + LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated); } } - if (dataItemUpdated) { - LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated); - } + return dataItemUpdated; } } // namespace loc_core diff --git a/gps/core/SystemStatusOsObserver.h b/gps/core/SystemStatusOsObserver.h old mode 100644 new mode 100755 index fa114ee..fd60606 --- a/gps/core/SystemStatusOsObserver.h +++ b/gps/core/SystemStatusOsObserver.h @@ -39,7 +39,9 @@ #include #include #include -#include +#include +#include +#include namespace loc_core { @@ -47,86 +49,123 @@ namespace loc_core SystemStatusOsObserver ******************************************************************************/ using namespace std; +using namespace loc_util; // Forward Declarations class IDataItemCore; -template class IClientIndex; -template class IDataItemIndex; +class SystemStatus; +class SystemStatusOsObserver; +typedef map> ObserverReqCache; +typedef LocUnorderedSetMap ClientToDataItems; +typedef LocUnorderedSetMap DataItemToClients; +typedef unordered_map DataItemIdToCore; +typedef unordered_map DataItemIdToInt; -struct SystemContext { +struct ObserverContext { IDataItemSubscription* mSubscriptionObj; IFrameworkActionReq* mFrameworkActionReqObj; const MsgTask* mMsgTask; + SystemStatusOsObserver* mSSObserver; - inline SystemContext() : - mSubscriptionObj(NULL), - mFrameworkActionReqObj(NULL), - mMsgTask(NULL) {} + inline ObserverContext(const MsgTask* msgTask, SystemStatusOsObserver* observer) : + mSubscriptionObj(NULL), mFrameworkActionReqObj(NULL), + mMsgTask(msgTask), mSSObserver(observer) {} }; -typedef map> ObserverReqCache; - // Clients wanting to get data from OS/Framework would need to // subscribe with OSObserver using IDataItemSubscription interface. // Such clients would need to implement IDataItemObserver interface // to receive data when it becomes available. -class SystemStatus; class SystemStatusOsObserver : public IOsObserver { public: // ctor - SystemStatusOsObserver( - SystemStatus* systemstatus, const MsgTask* msgTask); + inline SystemStatusOsObserver(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 ~SystemStatusOsObserver(); + template + static COUT containerTransfer(CINT& s); + template + inline static COUT containerTransfer(CINT&& s) { + return containerTransfer(s); + } + // To set the subscription object virtual void setSubscriptionObj(IDataItemSubscription* subscriptionObj); // To set the framework action request object inline void setFrameworkActionReqObj(IFrameworkActionReq* frameworkActionReqObj) { mContext.mFrameworkActionReqObj = frameworkActionReqObj; +#ifdef USE_GLIB + if (mBackHaulConnectReqCount > 0) { + connectBackhaul(); + mBackHaulConnectReqCount = 0; + } +#endif } // IDataItemSubscription Overrides - virtual void subscribe(const list& l, IDataItemObserver* client); - virtual void updateSubscription(const list& l, IDataItemObserver* client); - virtual void requestData(const list& l, IDataItemObserver* client); - virtual void unsubscribe(const list& l, IDataItemObserver* client); - virtual void unsubscribeAll(IDataItemObserver* client); + inline virtual void subscribe(const list& l, IDataItemObserver* client) override { + subscribe(l, client, false); + } + virtual void updateSubscription(const list& l, IDataItemObserver* client) override; + inline virtual void requestData(const list& l, IDataItemObserver* client) override { + subscribe(l, client, true); + } + virtual void unsubscribe(const list& l, IDataItemObserver* client) override; + virtual void unsubscribeAll(IDataItemObserver* client) override; // IDataItemObserver Overrides - virtual void notify(const list& dlist); - inline virtual void getName(string& name) { + virtual void notify(const list& dlist) override; + inline virtual void getName(string& name) override { name = mAddress; } // IFrameworkActionReq Overrides - virtual void turnOn(DataItemId dit, int timeOut = 0); - virtual void turnOff(DataItemId dit); + virtual void turnOn(DataItemId dit, int timeOut = 0) override; + virtual void turnOff(DataItemId dit) override; +#ifdef USE_GLIB + virtual bool connectBackhaul() override; + virtual bool disconnectBackhaul(); +#endif private: SystemStatus* mSystemStatus; - SystemContext mContext; + ObserverContext mContext; const string mAddress; - IClientIndex* mClientIndex; - IDataItemIndex* mDataItemIndex; - map mDataItemCache; - map mActiveRequestCount; + ClientToDataItems mClientToDataItems; + DataItemToClients mDataItemToClients; + DataItemIdToCore mDataItemCache; + DataItemIdToInt mActiveRequestCount; // Cache the subscribe and requestData till subscription obj is obtained - ObserverReqCache mSubscribeReqCache; - ObserverReqCache mReqDataCache; void cacheObserverRequest(ObserverReqCache& reqCache, const list& l, IDataItemObserver* client); +#ifdef USE_GLIB + // Cache the framework action request for connect/disconnect + int mBackHaulConnectReqCount; +#endif + + void subscribe(const list& l, IDataItemObserver* client, bool toRequestData); // Helpers - void sendFirstResponse(const list& l, IDataItemObserver* to); - void sendCachedDataItems(const list& l, IDataItemObserver* to); - void updateCache(IDataItemCore* d, bool& dataItemUpdated); - inline void logMe(const list& l) { - for (auto id : l) { - LOC_LOGD("DataItem %d", id); + void sendCachedDataItems(const unordered_set& s, IDataItemObserver* to); + bool updateCache(IDataItemCore* d); + inline void logMe(const unordered_set& l) { + IF_LOC_LOGD { + for (auto id : l) { + LOC_LOGD("DataItem %d", id); + } } } }; diff --git a/gps/core/UlpProxyBase.h b/gps/core/UlpProxyBase.h old mode 100644 new mode 100755 diff --git a/gps/core/data-items/DataItemConcreteTypesBase.h b/gps/core/data-items/DataItemConcreteTypesBase.h old mode 100644 new mode 100755 index df3bf9a..bcb8d72 --- a/gps/core/data-items/DataItemConcreteTypesBase.h +++ b/gps/core/data-items/DataItemConcreteTypesBase.h @@ -221,9 +221,22 @@ protected: class NetworkInfoDataItemBase : public IDataItemCore { public: + enum NetworkType { + TYPE_MOBILE, + TYPE_WIFI, + TYPE_ETHERNET, + TYPE_BLUETOOTH, + TYPE_MMS, + TYPE_SUPL, + TYPE_DUN, + TYPE_HIPRI, + TYPE_WIMAX, + TYPE_UNKNOWN, + }; NetworkInfoDataItemBase( - int32_t type, string typeName, string subTypeName, + NetworkType initialType, int32_t type, string typeName, string subTypeName, bool available, bool connected, bool roaming ): + mAllTypes(typeToAllTypes(initialType)), mType(type), mTypeName(typeName), mSubTypeName(subTypeName), @@ -235,22 +248,12 @@ public: inline virtual DataItemId getId() { return mId; } virtual void stringify(string& /*valueStr*/) {} 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 { return (NetworkType)mType; } -// Data members + inline uint64_t getAllTypes() { return mAllTypes; } + // Data members + uint64_t mAllTypes; int32_t mType; string mTypeName; string mSubTypeName; @@ -259,7 +262,9 @@ public: bool mRoaming; protected: DataItemId mId; - + inline uint64_t typeToAllTypes(NetworkType type) { + return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ? 0 : (1< #include #include -#include +#include +#include namespace loc_core { @@ -68,7 +69,7 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id) getConcreteDIFunc = (get_concrete_data_item_fn * ) dlsym(dataItemLibHandle, DATA_ITEMS_GET_CONCRETE_DI); 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); } else { diff --git a/gps/core/data-items/DataItemsFactoryProxy.h b/gps/core/data-items/DataItemsFactoryProxy.h old mode 100644 new mode 100755 diff --git a/gps/core/data-items/IDataItemCore.h b/gps/core/data-items/IDataItemCore.h old mode 100644 new mode 100755 diff --git a/gps/core/data-items/common/ClientIndex.cpp b/gps/core/data-items/common/ClientIndex.cpp deleted file mode 100644 index ffb5e1d..0000000 --- a/gps/core/data-items/common/ClientIndex.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace loc_core; - -template -inline ClientIndex :: ClientIndex () {} - -template -inline ClientIndex :: ~ClientIndex () {} - -template -bool ClientIndex :: isSubscribedClient (CT client) { - bool result = false; - ENTRY_LOG (); - typename map < CT, list > :: iterator it = - mDataItemsPerClientMap.find (client); - if (it != mDataItemsPerClientMap.end ()) { - result = true; - } - EXIT_LOG_WITH_ERROR ("%d",result); - return result; -} - -template -void ClientIndex :: getSubscribedList (CT client, list & out) { - ENTRY_LOG (); - typename map < CT, list > :: iterator it = - mDataItemsPerClientMap.find (client); - if (it != mDataItemsPerClientMap.end ()) { - out = it->second; - } - EXIT_LOG_WITH_ERROR ("%d",0); -} - -template -int ClientIndex :: remove (CT client) { - int result = 0; - ENTRY_LOG (); - mDataItemsPerClientMap.erase (client); - EXIT_LOG_WITH_ERROR ("%d",result); - return result; -} - -template -void ClientIndex :: remove (const list & r, list & out) { - ENTRY_LOG (); - typename map < CT, list > :: iterator dicIter = - mDataItemsPerClientMap.begin (); - while (dicIter != mDataItemsPerClientMap.end()) { - typename list :: const_iterator it = r.begin (); - for (; it != r.end (); ++it) { - typename list :: 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 -void ClientIndex :: remove -( - CT client, - const list & r, - list & out -) -{ - ENTRY_LOG (); - typename map < CT, list > :: 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 :: 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 -void ClientIndex :: add -( - CT client, - const list & l, - list & out -) -{ - ENTRY_LOG (); - list difference; - typename map < CT, list > :: 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 > 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 ; - template class ClientIndex ; -} diff --git a/gps/core/data-items/common/ClientIndex.h b/gps/core/data-items/common/ClientIndex.h deleted file mode 100644 index feccb05..0000000 --- a/gps/core/data-items/common/ClientIndex.h +++ /dev/null @@ -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 -#include -#include - -using loc_core::IClientIndex; - -namespace loc_core -{ - -template - -class ClientIndex : public IClientIndex { - -public: - - ClientIndex (); - - ~ClientIndex (); - - bool isSubscribedClient (CT client); - - void getSubscribedList (CT client, std :: list & out); - - int remove (CT client); - - void remove (const std :: list & r, std :: list & out); - - void remove (CT client, const std :: list & r, std :: list & out); - - void add (CT client, const std :: list & l, std :: list & out); - -private: - //Data members - std :: map < CT , std :: list > mDataItemsPerClientMap; -}; - -} // namespace loc_core - -#endif // #ifndef __CLIENTINDEX_H__ diff --git a/gps/core/data-items/common/DataItemIndex.cpp b/gps/core/data-items/common/DataItemIndex.cpp deleted file mode 100644 index 7869b43..0000000 --- a/gps/core/data-items/common/DataItemIndex.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace loc_core; - -template -inline DataItemIndex :: DataItemIndex () {} - -template -inline DataItemIndex :: ~DataItemIndex () {} - -template -void DataItemIndex :: getListOfSubscribedClients - ( - DIT id, - list & out -) -{ - typename map < DIT, list > :: iterator cdiIter = - mClientsPerDataItemMap.find (id); - if (cdiIter != mClientsPerDataItemMap.end ()) { - out = cdiIter->second; - } -} - - -template -int DataItemIndex :: remove (DIT id) { - int result = 0; - ENTRY_LOG (); - mClientsPerDataItemMap.erase (id); - EXIT_LOG_WITH_ERROR ("%d",result); - return result; -} - -template -void DataItemIndex :: remove (const list & r, list & out) { - ENTRY_LOG (); - typename map < DIT, list > :: iterator cdiIter = - mClientsPerDataItemMap.begin (); - while (cdiIter != mClientsPerDataItemMap.end()) { - typename list :: const_iterator it = r.begin (); - for (; it != r.end (); ++it) { - typename list :: 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 -void DataItemIndex :: remove -( - DIT id, - const list & r, - list & out -) -{ - ENTRY_LOG (); - - typename map < DIT, list > :: 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 :: 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 -void DataItemIndex :: add -( - DIT id, - const list & l, - list & out -) -{ - ENTRY_LOG (); - list difference; - typename map < DIT, list > :: 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 > cndipair (id, out); - mClientsPerDataItemMap.insert (cndipair); - } - EXIT_LOG_WITH_ERROR ("%d",0); -} - -template -void DataItemIndex :: add -( - CT client, - const list & l, - list & out -) -{ - ENTRY_LOG (); - typename map < DIT, list > :: iterator cdiIter; - typename list :: 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 > cndiPair (*it, list (1, client)); - mClientsPerDataItemMap.insert (cndiPair); - } else { - typename list :: 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 ; - template class DataItemIndex ; -} diff --git a/gps/core/data-items/common/DataItemIndex.h b/gps/core/data-items/common/DataItemIndex.h deleted file mode 100644 index d72e89e..0000000 --- a/gps/core/data-items/common/DataItemIndex.h +++ /dev/null @@ -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 -#include -#include - -using loc_core::IDataItemIndex; - -namespace loc_core -{ - -template - -class DataItemIndex : public IDataItemIndex { - -public: - - DataItemIndex (); - - ~DataItemIndex (); - - void getListOfSubscribedClients (DIT id, std :: list & out); - - int remove (DIT id); - - void remove (const std :: list & r, std :: list & out); - - void remove (DIT id, const std :: list & r, std :: list & out); - - void add (DIT id, const std :: list & l, std :: list & out); - - void add (CT client, const std :: list & l, std :: list & out); - -private: - std :: map < DIT, std :: list > mClientsPerDataItemMap; -}; - -} // namespace loc_core - -#endif // #ifndef __DATAITEMINDEX_H__ diff --git a/gps/core/data-items/common/IClientIndex.h b/gps/core/data-items/common/IClientIndex.h deleted file mode 100644 index 0272e7b..0000000 --- a/gps/core/data-items/common/IClientIndex.h +++ /dev/null @@ -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 - -namespace loc_core -{ - -template - -class IClientIndex { -public: - - // Checks if client is subscribed - virtual bool isSubscribedClient (CT client) = 0; - - // gets subscription list - virtual void getSubscribedList (CT client, std :: list & 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 & r, - std :: list & 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 & r, - std :: list & out - ) = 0; - - // adds/modifies entry in map and returns new data items added. - virtual void add - ( - CT client, - const std :: list & l, - std :: list & out - ) = 0; - - // dtor - virtual ~IClientIndex () {} -}; - -} // namespace loc_core - -#endif // #ifndef __ICLIENTINDEX_H__ diff --git a/gps/core/data-items/common/IDataItemIndex.h b/gps/core/data-items/common/IDataItemIndex.h deleted file mode 100644 index 9185582..0000000 --- a/gps/core/data-items/common/IDataItemIndex.h +++ /dev/null @@ -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 - -namespace loc_core -{ - -template - -class IDataItemIndex { - -public: - - // gets std :: list of subscribed clients - virtual void getListOfSubscribedClients - ( - DIT id, - std :: list & 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 & r, - std :: list & 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 & r, - std :: list & out - ) = 0; - - // adds/modifies entry and returns new clients added - virtual void add - ( - DIT id, - const std :: list & l, - std :: list & out - ) = 0; - - // adds/modifies entry and returns yet to subscribe list of data items - virtual void add - ( - CT client, - const std :: list & l, - std :: list & out - ) = 0; - - // dtor - virtual ~IDataItemIndex () {} -}; - -} // namespace loc_core - -#endif // #ifndef __IDATAITEMINDEX_H__ - diff --git a/gps/core/data-items/common/IndexFactory.cpp b/gps/core/data-items/common/IndexFactory.cpp deleted file mode 100644 index cf49475..0000000 --- a/gps/core/data-items/common/IndexFactory.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using loc_core::IClientIndex; -using loc_core::IDataItemIndex; -using loc_core::IDataItemObserver; -using namespace loc_core; - -template -inline IClientIndex * IndexFactory :: createClientIndex -() -{ - return new (nothrow) ClientIndex (); -} - -template -inline IDataItemIndex * IndexFactory :: createDataItemIndex -() -{ - return new (nothrow) DataItemIndex (); -} - -// Explicit instantiation must occur in same namespace where class is defined -namespace loc_core -{ - template class IndexFactory ; - template class IndexFactory ; -} diff --git a/gps/core/data-items/common/IndexFactory.h b/gps/core/data-items/common/IndexFactory.h deleted file mode 100644 index 9a2070e..0000000 --- a/gps/core/data-items/common/IndexFactory.h +++ /dev/null @@ -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 -#include - -namespace loc_core -{ -template -class IndexFactory { - -public: - static IClientIndex * createClientIndex (); - static IDataItemIndex * createDataItemIndex (); -}; - -} // namespace loc_core - -#endif // #ifndef __INDEXFACTORY_H__ diff --git a/gps/core/loc_core_log.cpp b/gps/core/loc_core_log.cpp old mode 100644 new mode 100755 index 5a627dd..67d68f0 --- a/gps/core/loc_core_log.cpp +++ b/gps/core/loc_core_log.cpp @@ -30,9 +30,10 @@ #define LOG_NDEBUG 0 #define LOG_TAG "LocSvc_core_log" +#include #include #include -#include +#include 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); } - - -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*/) { return NULL; diff --git a/gps/core/loc_core_log.h b/gps/core/loc_core_log.h old mode 100644 new mode 100755 diff --git a/gps/core/observer/IDataItemObserver.h b/gps/core/observer/IDataItemObserver.h old mode 100644 new mode 100755 diff --git a/gps/core/observer/IDataItemSubscription.h b/gps/core/observer/IDataItemSubscription.h old mode 100644 new mode 100755 diff --git a/gps/core/observer/IFrameworkActionReq.h b/gps/core/observer/IFrameworkActionReq.h old mode 100644 new mode 100755 index c7b3ebd..4be947f --- a/gps/core/observer/IFrameworkActionReq.h +++ b/gps/core/observer/IFrameworkActionReq.h @@ -70,6 +70,24 @@ public: */ virtual void turnOff (DataItemId dit) = 0; +#ifdef USE_GLIB + /** + * @brief Setup WWAN backhaul + * @details Setup WWAN backhaul + * + * @param None + */ + virtual bool connectBackhaul() = 0; + + /** + * @brief Disconnects the WWANbackhaul + * @details Disconnects the WWANbackhaul, only if it was setup by us + * + * @param None + */ + virtual bool disconnectBackhaul() = 0; +#endif + /** * @brief Destructor * @details Destructor diff --git a/gps/core/observer/IOsObserver.h b/gps/core/observer/IOsObserver.h old mode 100644 new mode 100755 index 3db8a85..40d7671 --- a/gps/core/observer/IOsObserver.h +++ b/gps/core/observer/IOsObserver.h @@ -90,6 +90,10 @@ public: // IFrameworkActionReq Overrides inline virtual void turnOn (DataItemId /*dit*/, int /*timeOut*/){} inline virtual void turnOff (DataItemId /*dit*/) {} +#ifdef USE_GLIB + inline virtual bool connectBackhaul() {} + inline virtual bool disconnectBackhaul() {} +#endif /** * @brief Destructor diff --git a/gps/etc/flp.conf b/gps/etc/flp.conf old mode 100644 new mode 100755 diff --git a/gps/etc/gps.conf b/gps/etc/gps.conf old mode 100644 new mode 100755 index 7b29e3f..fd98cbf --- a/gps/etc/gps.conf +++ b/gps/etc/gps.conf @@ -208,10 +208,17 @@ MISSING_PULSE_TIME_DELTA = 900 # This settings enables time uncertainty propagation # logic incase of missing PPS pulse PROPAGATION_TIME_UNCERTAINTY = 1 -XTRA_TEST_ENABLED = 1 -XTRA_THROTTLE_ENABLED = 0 -#################################### -#system time injection -#################################### -XTRA_SYSTEM_TIME_INJECT = 1 +####################################### +# APN / IP Type Configuration +# APN and IP Type to use for setting +# up WWAN call. +# Use below values for IP Type: +# v4 = 4 +# v6 = 6 +# v4v6 = 10 +####################################### +# INTERNET_APN = abc.xyz +# INTERNET_IP_TYPE = 4 +# SUPL_APN = abc.xyz +# SUPL_IP_TYPE = 4 diff --git a/gps/etc/izat.conf b/gps/etc/izat.conf index fd35d54..fceb95c 100644 --- a/gps/etc/izat.conf +++ b/gps/etc/izat.conf @@ -39,26 +39,28 @@ LPPE_SRN_DATA_SCAN_INJECT_TIME=2 # otherwise OSNLP is used. NLP_MODE = 1 NLP_MODE_EMERGENCY = 2 -NLP_TOLERANCE_TIME_FIRST = 5000 +NLP_TOLERANCE_TIME_FIRST = 2000 NLP_TOLERANCE_TIME_AFTER = 20000 NLP_THRESHOLD = 3 NLP_ACCURACY_MULTIPLE = 2 NLP_COMBO_MODE_USES_QNP_WITH_NO_EULA_CONSENT = 1 ######################################### -# NLP PACKAGE AND ACTION SETTINGS +# NLP PACKAGE SETTINGS ######################################### -# OSNLP_PACKAGE/OSNLP_ACTION: name/action of default NLP package +# OSNLP_PACKAGE: name of default NLP package OSNLP_PACKAGE = com.google.android.gms -OSNLP_ACTION = com.android.location.service.v3.NetworkLocationProvider -# REGION_OSNLP_PACKAGE/REGION_OSNLP_ACTION: -# These two values will be used as alternative +# REGION_OSNLP_PACKAGE: +# This value will be used as alternative # for particular region where default NLP is not functional. #REGION_OSNLP_PACKAGE = com.google.android.gms #REGION_OSNLP_ACTION = com.android.location.service.v3.NetworkLocationProvider # Threshold period for ZPP triggers -ZPP_TRIGGER_THRESHOLD=60000 +ZPP_TRIGGER_THRESHOLD=86400000 +# Accuracy threshold for ZPP positions +# less accurate positions are ignored +ZPP_ACCURACY_THRESHOLD=20000 ################################### # GEOFENCE SERVICES @@ -102,12 +104,12 @@ GTP_CELL_PROC=MODEM #GTP_CELL valid modes: # DISABLED # BASIC -GTP_CELL=DISABLED +GTP_CELL=BASIC #GTP_WIFI valid modes: # DISABLED # BASIC -GTP_WIFI=DISABLED +GTP_WIFI=BASIC #GTP_WAA valid modes: # DISABLED @@ -183,12 +185,8 @@ PREMIUM_FEATURE=0 IZAT_FEATURE_MASK=0 PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=automotive -#Valyes for LEAN_TARGETS can be: -#ENABLED -> if this process is supposed to run on lean and mean targets -#DISABLED -> if this process is to be disabled on lean and mean targets PROCESS_NAME=garden_app PROCESS_ARGUMENT=-l 0 -T 1 PROCESS_STATE=DISABLED @@ -197,7 +195,6 @@ PREMIUM_FEATURE=0 IZAT_FEATURE_MASK=0 PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=automotive PROCESS_NAME=gpsone_daemon @@ -208,51 +205,46 @@ PREMIUM_FEATURE=0 IZAT_FEATURE_MASK=0 PLATFORMS=msm7630_fusion BASEBAND=svlte2a sglte sglte2 -LEAN_TARGETS=DISABLED HARDWARE_TYPE=all PROCESS_NAME=lowi-server PROCESS_ARGUMENT= PROCESS_STATE=ENABLED -PROCESS_GROUPS=gps net_admin wifi inet oem_2950 +PROCESS_GROUPS=gps net_admin wifi inet oem_2901 PREMIUM_FEATURE=0 IZAT_FEATURE_MASK=0xf303 PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=all PROCESS_NAME=xtwifi-inet-agent PROCESS_ARGUMENT= -PROCESS_STATE=ENABLED +PROCESS_STATE=DISABLED PROCESS_GROUPS=inet gps PREMIUM_FEATURE=1 IZAT_FEATURE_MASK=0xf0f PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=all PROCESS_NAME=xtwifi-client PROCESS_ARGUMENT= -PROCESS_STATE=ENABLED -PROCESS_GROUPS=wifi inet gps oem_2952 system wakelock +PROCESS_STATE=DISABLED +PROCESS_GROUPS=wifi inet gps system oem_2904 PREMIUM_FEATURE=1 IZAT_FEATURE_MASK=0xf0f PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=all PROCESS_NAME=slim_daemon PROCESS_ARGUMENT= -PROCESS_STATE=DISABLED -PROCESS_GROUPS=gps oem_2950 can +PROCESS_STATE=ENABLED +PROCESS_GROUPS=gps oem_2901 can PREMIUM_FEATURE=1 IZAT_FEATURE_MASK=0xf0 PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=all PROCESS_NAME=xtra-daemon @@ -263,18 +255,4 @@ PREMIUM_FEATURE=0 IZAT_FEATURE_MASK=0 PLATFORMS=all BASEBAND=all -LEAN_TARGETS=DISABLED HARDWARE_TYPE=all - -################################################## -# The name of process which launches XTRA client. -# Default process name in software which launches -# XTRA client is system-server. Uncomment the below -# to set the desired process which will start the -# XTRA client. -################################################## -# XC20_LAUNCH_PROCESS_NAME=garden_app - -#Accuracy threshold for ZPP positions -# less accurate positions are ignored -ZPP_ACCURACY_THRESHOLD=1000 diff --git a/gps/etc/lowi.conf b/gps/etc/lowi.conf old mode 100644 new mode 100755 diff --git a/gps/etc/sap.conf b/gps/etc/sap.conf old mode 100644 new mode 100755 index 372eb49..b10ce74 --- a/gps/etc/sap.conf +++ b/gps/etc/sap.conf @@ -27,7 +27,7 @@ SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH=25 # Sensor Control Mode (0=AUTO, 1=FORCE_ON) # used in loc_eng_reinit -SENSOR_CONTROL_MODE=1 +SENSOR_CONTROL_MODE=0 # Enable or Disable Sensors for GPS use (0=Enable, 1=Disable) # used in loc_eng_reinit diff --git a/gps/etc/xtwifi.conf b/gps/etc/xtwifi.conf old mode 100644 new mode 100755 diff --git a/gps/gnss/Agps.cpp b/gps/gnss/Agps.cpp old mode 100644 new mode 100755 index 72ce293..6ce0c34 --- a/gps/gnss/Agps.cpp +++ b/gps/gnss/Agps.cpp @@ -30,7 +30,7 @@ #define LOG_TAG "LocSvc_Agps" #include -#include +#include #include #include diff --git a/gps/gnss/Agps.h b/gps/gnss/Agps.h old mode 100644 new mode 100755 index 2f89c8c..703a475 --- a/gps/gnss/Agps.h +++ b/gps/gnss/Agps.h @@ -34,7 +34,8 @@ #include #include #include -#include +#include +#include /* ATL callback function pointers * Passed in by Adapter to AgpsManager */ @@ -277,34 +278,29 @@ public: mAgnssNif(NULL), mInternetNif(NULL), mDsNif(NULL) {} /* Register callbacks */ - void registerCallbacks( - AgnssStatusIpV4Cb frameworkStatusV4Cb, - - AgpsAtlOpenStatusCb atlOpenStatusCb, + inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb, AgpsAtlCloseStatusCb atlCloseStatusCb, - AgpsDSClientInitFn dsClientInitFn, AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn, AgpsDSClientStopDataCallFn dsClientStopDataCallFn, AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn, AgpsDSClientReleaseFn dsClientReleaseFn, - - SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn ){ - - mFrameworkStatusV4Cb = frameworkStatusV4Cb; + SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn) { mAtlOpenStatusCb = atlOpenStatusCb; mAtlCloseStatusCb = atlCloseStatusCb; - mDSClientInitFn = dsClientInitFn; mDSClientOpenAndStartDataCallFn = dsClientOpenAndStartDataCallFn; mDSClientStopDataCallFn = dsClientStopDataCallFn; mDSClientCloseDataCallFn = dsClientCloseDataCallFn; mDSClientReleaseFn = dsClientReleaseFn; - mSendMsgToAdapterQueueFn = sendMsgToAdapterQueueFn; } + inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) { + mFrameworkStatusV4Cb = frameworkStatusV4Cb; + } + /* Create all AGPS state machines */ void createAgpsStateMachines(); diff --git a/gps/gnss/Android.mk b/gps/gnss/Android.mk old mode 100644 new mode 100755 index 25c9b49..4c11778 --- a/gps/gnss/Android.mk +++ b/gps/gnss/Android.mk @@ -3,8 +3,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libgnss -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 +LOCAL_VENDOR_MODULE := true LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ diff --git a/gps/gnss/GnssAdapter.cpp b/gps/gnss/GnssAdapter.cpp old mode 100644 new mode 100755 index cdda01d..751c148 --- a/gps/gnss/GnssAdapter.cpp +++ b/gps/gnss/GnssAdapter.cpp @@ -74,12 +74,79 @@ GnssAdapter::GnssAdapter() : mNiData(), mAgpsManager(), mAgpsCbInfo(), + mOdcpiRequestCb(nullptr), + mOdcpiRequestActive(false), + mOdcpiTimer(this), + mOdcpiRequest(), mSystemStatus(SystemStatus::getInstance(mMsgTask)), - mServerUrl(""), + mServerUrl(":"), mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask) { LOC_LOGD("%s]: Constructor %p", __func__, this); mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID; + + pthread_condattr_t condAttr; + pthread_condattr_init(&condAttr); + pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC); + pthread_cond_init(&mNiData.session.tCond, &condAttr); + pthread_cond_init(&mNiData.sessionEs.tCond, &condAttr); + pthread_condattr_destroy(&condAttr); + + /* Set ATL open/close callbacks */ + AgpsAtlOpenStatusCb atlOpenStatusCb = + [this](int handle, int isSuccess, char* apn, + AGpsBearerType bearerType, AGpsExtType agpsType) { + + mLocApi->atlOpenStatus( + handle, isSuccess, apn, bearerType, agpsType); + }; + AgpsAtlCloseStatusCb atlCloseStatusCb = + [this](int handle, int isSuccess) { + + mLocApi->atlCloseStatus(handle, isSuccess); + }; + + /* Register DS Client APIs */ + AgpsDSClientInitFn dsClientInitFn = + [this](bool isDueToSSR) { + + return mLocApi->initDataServiceClient(isDueToSSR); + }; + + AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn = + [this] { + + return mLocApi->openAndStartDataCall(); + }; + + AgpsDSClientStopDataCallFn dsClientStopDataCallFn = + [this] { + + mLocApi->stopDataCall(); + }; + + AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn = + [this] { + + mLocApi->closeDataCall(); + }; + + AgpsDSClientReleaseFn dsClientReleaseFn = + [this] { + + mLocApi->releaseDataServiceClient(); + }; + + /* Send Msg function */ + SendMsgToAdapterMsgQueueFn sendMsgFn = + [this](LocMsg* msg) { + + sendMsg(msg); + }; + mAgpsManager.registerATLCallbacks(atlOpenStatusCb, atlCloseStatusCb, + dsClientInitFn, dsClientOpenAndStartDataCallFn, dsClientStopDataCallFn, + dsClientCloseDataCallFn, dsClientReleaseFn, sendMsgFn); + readConfigCommand(); setConfigCommand(); initDefaultAgpsCommand(); @@ -522,6 +589,38 @@ GnssAdapter::readConfigCommand() } } +LocationError +GnssAdapter::setSuplHostServer(const char* server, int port) +{ + LocationError locErr = LOCATION_ERROR_SUCCESS; + if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) { + char serverUrl[MAX_URL_LEN] = {}; + int32_t length = -1; + const char noHost[] = "NONE"; + + locErr = LOCATION_ERROR_INVALID_PARAMETER; + + if ((NULL == server) || (server[0] == 0) || + (strncasecmp(noHost, server, sizeof(noHost)) == 0)) { + serverUrl[0] = '\0'; + length = 0; + } else if (port > 0) { + length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", server, port); + } + + if (length >= 0 && strncasecmp(getServerUrl().c_str(), + serverUrl, sizeof(serverUrl)) != 0) { + setServerUrl(serverUrl); + locErr = mLocApi->setServer(serverUrl, length); + if (locErr != LOCATION_ERROR_SUCCESS) { + LOC_LOGE("%s]:Error while setting SUPL_HOST server:%s", + __func__, serverUrl); + } + } + } + return locErr; +} + void GnssAdapter::setConfigCommand() { @@ -541,6 +640,8 @@ GnssAdapter::setConfigCommand() mApi.setLPPConfig(mAdapter.convertLppProfile(ContextBase::mGps_conf.LPP_PROFILE)); mApi.setAGLONASSProtocol(ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT); } + mAdapter.setSuplHostServer(ContextBase::mGps_conf.SUPL_HOST, + ContextBase::mGps_conf.SUPL_PORT); mApi.setSensorControlConfig(ContextBase::mSap_conf.SENSOR_USAGE, ContextBase::mSap_conf.SENSOR_PROVIDER); mApi.setLPPeProtocolCp( @@ -683,30 +784,8 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config) } if (mConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) { if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) { - if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) { - char serverUrl[MAX_URL_LEN] = {}; - int32_t length = 0; - const char noHost[] = "NONE"; - if (NULL == mConfig.assistanceServer.hostName || - strncasecmp(noHost, - mConfig.assistanceServer.hostName, - sizeof(noHost)) == 0) { - err = LOCATION_ERROR_INVALID_PARAMETER; - } else { - length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", - mConfig.assistanceServer.hostName, - mConfig.assistanceServer.port); - } - - if (length > 0 && strncasecmp(mAdapter.getServerUrl().c_str(), - serverUrl, sizeof(serverUrl)) != 0) { - mAdapter.setServerUrl(serverUrl); - err = mApi.setServer(serverUrl, length); - } - - } else { - err = LOCATION_ERROR_SUCCESS; - } + err = mAdapter.setSuplHostServer(mConfig.assistanceServer.hostName, + mConfig.assistanceServer.port); } else if (GNSS_ASSISTANCE_TYPE_C2K == mConfig.assistanceServer.type) { if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) { struct in_addr addr; @@ -859,7 +938,7 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data) mAdapter.reportResponse(err, mSessionId); SystemStatus* s = mAdapter.getSystemStatus(); if ((nullptr != s) && (mData.deleteAll)) { - s->setDefaultReport(); + s->setDefaultGnssEngineStates(); } } }; @@ -868,6 +947,26 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data) return sessionId; } +void +GnssAdapter::gnssUpdateXtraThrottleCommand(const bool enabled) +{ + LOC_LOGD("%s] enabled:%d", __func__, enabled); + + struct UpdateXtraThrottleMsg : public LocMsg { + GnssAdapter& mAdapter; + const bool mEnabled; + inline UpdateXtraThrottleMsg(GnssAdapter& adapter, const bool enabled) : + LocMsg(), + mAdapter(adapter), + mEnabled(enabled) {} + inline virtual void proc() const { + mAdapter.mXtraObserver.updateXtraThrottle(mEnabled); + } + }; + + sendMsg(new UpdateXtraThrottleMsg(*this, enabled)); +} + void GnssAdapter::injectLocationCommand(double latitude, double longitude, float accuracy) { @@ -1077,7 +1176,16 @@ GnssAdapter::updateClientsEventMask() mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT; - LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%x", __func__, mask); + LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%" PRIu64 "", __func__, mask); + } + + if (mAgpsCbInfo.statusV4Cb != NULL) { + mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST; + } + + // Add ODCPI handling + if (nullptr != mOdcpiRequestCb) { + mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI; } updateEvtMask(mask, LOC_REGISTRATION_MASK_SET); @@ -1105,6 +1213,9 @@ GnssAdapter::restartSessions() { LOC_LOGD("%s]: ", __func__); + // odcpi session is no longer active after restart + mOdcpiRequestActive = false; + if (mTrackingSessions.empty()) { return; } @@ -1943,7 +2054,8 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation, inline virtual void proc() const { // extract bug report info - this returns true if consumed by systemstatus SystemStatus* s = mAdapter.getSystemStatus(); - if ((nullptr != s) && (LOC_SESS_SUCCESS == mStatus)){ + if ((nullptr != s) && + ((LOC_SESS_SUCCESS == mStatus) || (LOC_SESS_INTERMEDIATE == mStatus))){ s->eventPosition(mUlpLocation, mLocationExtended); } mAdapter.reportPosition(mUlpLocation, mLocationExtended, mStatus, mTechMask); @@ -1953,34 +2065,41 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation, sendMsg(new MsgReportPosition(*this, ulpLocation, locationExtended, status, techMask)); } +bool +GnssAdapter::needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, + LocPosTechMask techMask) { + bool reported = false; + if (LOC_SESS_SUCCESS == status) { + // this is a final fix + LocPosTechMask mask = + LOC_POS_TECH_MASK_SATELLITE | LOC_POS_TECH_MASK_SENSORS | LOC_POS_TECH_MASK_HYBRID; + // it is a Satellite fix or a sensor fix + reported = (mask & techMask); + } else if (LOC_SESS_INTERMEDIATE == status && + LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS) { + // this is a intermediate fix and we accepte intermediate + + // it is NOT the case that + // there is inaccuracy; and + // we care about inaccuracy; and + // the inaccuracy exceeds our tolerance + reported = !((ulpLocation.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ACCURACY) && + (ContextBase::mGps_conf.ACCURACY_THRES != 0) && + (ulpLocation.gpsLocation.accuracy > ContextBase::mGps_conf.ACCURACY_THRES)); + } + + return reported; +} + void GnssAdapter::reportPosition(const UlpLocation& ulpLocation, const GpsLocationExtended& locationExtended, enum loc_sess_status status, LocPosTechMask techMask) { - bool reported = false; - // what's in the if is... (line by line) - // 1. this is a final fix; and - // 1.1 it is a Satellite fix; or - // 1.2 it is a sensor fix - // 2. (must be intermediate fix... implicit) - // 2.1 we accepte intermediate; and - // 2.2 it is NOT the case that - // 2.2.1 there is inaccuracy; and - // 2.2.2 we care about inaccuracy; and - // 2.2.3 the inaccuracy exceeds our tolerance - if ((LOC_SESS_SUCCESS == status && - ((LOC_POS_TECH_MASK_SATELLITE | - LOC_POS_TECH_MASK_SENSORS | - LOC_POS_TECH_MASK_HYBRID) & - techMask)) || - (LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS && - !((ulpLocation.gpsLocation.flags & - LOC_GPS_LOCATION_HAS_ACCURACY) && - (ContextBase::mGps_conf.ACCURACY_THRES != 0) && - (ulpLocation.gpsLocation.accuracy > - ContextBase::mGps_conf.ACCURACY_THRES)))) { + bool reported = needReport(ulpLocation, status, techMask); + if (reported) { if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA) { mGnssSvIdUsedInPosAvail = true; mGnssSvIdUsedInPosition = locationExtended.gnss_sv_used_ids; @@ -1997,7 +2116,6 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation, it->second.gnssLocationInfoCb(locationInfo); } } - reported = true; } if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER && !mTrackingSessions.empty()) { @@ -2224,14 +2342,14 @@ static void* niThreadProc(void *args) NiSession* pSession = (NiSession*)args; int rc = 0; /* return code from pthread calls */ - struct timeval present_time; + struct timespec present_time; struct timespec expire_time; pthread_mutex_lock(&pSession->tLock); /* Calculate absolute expire time */ - gettimeofday(&present_time, NULL); + clock_gettime(CLOCK_MONOTONIC, &present_time); expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft; - expire_time.tv_nsec = present_time.tv_usec * 1000; + expire_time.tv_nsec = present_time.tv_nsec; LOC_LOGD("%s]: time out set for abs time %ld with delay %d sec", __func__, (long)expire_time.tv_sec, pSession->respTimeLeft); @@ -2356,7 +2474,7 @@ void GnssAdapter::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements, int msInWeek) { - LOC_LOGD("%s]: ", __func__); + LOC_LOGD("%s]: msInWeek=%d", __func__, msInWeek); struct MsgReportGnssMeasurementData : public LocMsg { GnssAdapter& mAdapter; @@ -2407,19 +2525,170 @@ GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial) mUlpProxy->reportSvPolynomial(svPolynomial); } +bool +GnssAdapter::reportOdcpiRequestEvent(OdcpiRequestInfo& request) +{ + struct MsgReportOdcpiRequest : public LocMsg { + GnssAdapter& mAdapter; + OdcpiRequestInfo mOdcpiRequest; + inline MsgReportOdcpiRequest(GnssAdapter& adapter, OdcpiRequestInfo& request) : + LocMsg(), + mAdapter(adapter), + mOdcpiRequest(request) {} + inline virtual void proc() const { + mAdapter.reportOdcpiRequest(mOdcpiRequest); + } + }; + + sendMsg(new MsgReportOdcpiRequest(*this, request)); + return true; +} + +void GnssAdapter::reportOdcpiRequest(const OdcpiRequestInfo& request) +{ + if (nullptr != mOdcpiRequestCb) { + LOC_LOGd("request: type %d, tbf %d, isEmergency %d" + " requestActive: %d timerActive: %d", + request.type, request.tbfMillis, request.isEmergencyMode, + mOdcpiRequestActive, mOdcpiTimer.isActive()); + // ODCPI START and ODCPI STOP from modem can come in quick succession + // so the mOdcpiTimer helps avoid spamming the framework as well as + // extending the odcpi session past 30 seconds if needed + if (ODCPI_REQUEST_TYPE_START == request.type) { + if (false == mOdcpiRequestActive && false == mOdcpiTimer.isActive()) { + mOdcpiRequestCb(request); + mOdcpiRequestActive = true; + mOdcpiTimer.start(); + // if the current active odcpi session is non-emergency, and the new + // odcpi request is emergency, replace the odcpi request with new request + // and restart the timer + } else if (false == mOdcpiRequest.isEmergencyMode && + true == request.isEmergencyMode) { + mOdcpiRequestCb(request); + mOdcpiRequestActive = true; + if (true == mOdcpiTimer.isActive()) { + mOdcpiTimer.restart(); + } else { + mOdcpiTimer.start(); + } + // if ODCPI request is not active but the timer is active, then + // just update the active state and wait for timer to expire + // before requesting new ODCPI to avoid spamming ODCPI requests + } else if (false == mOdcpiRequestActive && true == mOdcpiTimer.isActive()) { + mOdcpiRequestActive = true; + } + mOdcpiRequest = request; + // the request is being stopped, but allow timer to expire first + // before stopping the timer just in case more ODCPI requests come + // to avoid spamming more odcpi requests to the framework + } else { + mOdcpiRequestActive = false; + } + } else { + LOC_LOGw("ODCPI request not supported"); + } +} + +void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback) +{ + struct MsgInitOdcpi : public LocMsg { + GnssAdapter& mAdapter; + OdcpiRequestCallback mOdcpiCb; + inline MsgInitOdcpi(GnssAdapter& adapter, + const OdcpiRequestCallback& callback) : + LocMsg(), + mAdapter(adapter), + mOdcpiCb(callback) {} + inline virtual void proc() const { + mAdapter.initOdcpi(mOdcpiCb); + } + }; + + sendMsg(new MsgInitOdcpi(*this, callback)); +} + +void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback) +{ + mOdcpiRequestCb = callback; + + /* Register for WIFI request */ + updateEvtMask(LOC_API_ADAPTER_BIT_REQUEST_WIFI, + LOC_REGISTRATION_MASK_ENABLED); +} + +void GnssAdapter::injectOdcpiCommand(const Location& location) +{ + struct MsgInjectOdcpi : public LocMsg { + GnssAdapter& mAdapter; + Location mLocation; + inline MsgInjectOdcpi(GnssAdapter& adapter, const Location& location) : + LocMsg(), + mAdapter(adapter), + mLocation(location) {} + inline virtual void proc() const { + mAdapter.injectOdcpi(mLocation); + } + }; + + sendMsg(new MsgInjectOdcpi(*this, location)); +} + +void GnssAdapter::injectOdcpi(const Location& location) +{ + LOC_LOGd("ODCPI Injection: requestActive: %d timerActive: %d" + "lat %.7f long %.7f", + mOdcpiRequestActive, mOdcpiTimer.isActive(), + location.latitude, location.longitude); + + loc_api_adapter_err err = mLocApi->injectPosition(location); + if (LOC_API_ADAPTER_ERR_SUCCESS != err) { + LOC_LOGe("Inject Position API error %d", err); + } +} + +// Called in the context of LocTimer thread +void OdcpiTimer::timeOutCallback() +{ + if (nullptr != mAdapter) { + mAdapter->odcpiTimerExpireEvent(); + } +} + +// Called in the context of LocTimer thread +void GnssAdapter::odcpiTimerExpireEvent() +{ + struct MsgOdcpiTimerExpire : public LocMsg { + GnssAdapter& mAdapter; + inline MsgOdcpiTimerExpire(GnssAdapter& adapter) : + LocMsg(), + mAdapter(adapter) {} + inline virtual void proc() const { + mAdapter.odcpiTimerExpire(); + } + }; + sendMsg(new MsgOdcpiTimerExpire(*this)); +} +void GnssAdapter::odcpiTimerExpire() +{ + LOC_LOGd("requestActive: %d timerActive: %d", + mOdcpiRequestActive, mOdcpiTimer.isActive()); + + // if ODCPI request is still active after timer + // expires, request again and restart timer + if (mOdcpiRequestActive) { + mOdcpiRequestCb(mOdcpiRequest); + mOdcpiTimer.restart(); + } else { + mOdcpiTimer.stop(); + } +} + void GnssAdapter::initDefaultAgps() { LOC_LOGD("%s]: ", __func__); - LocationCapabilitiesMask mask = getCapabilities(); - if (!(mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT) && - !(mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)) { - LOC_LOGI("%s]: Target does not support MSB and MSA.", __func__); - return; - } - void *handle = nullptr; if ((handle = dlopen("libloc_net_iface.so", RTLD_NOW)) == nullptr) { - LOC_LOGE("%s]: libloc_net_iface.so not found !", __func__); + LOC_LOGD("%s]: libloc_net_iface.so not found !", __func__); return; } @@ -2437,7 +2706,7 @@ void GnssAdapter::initDefaultAgps() { return; } - initAgpsCommand(cbInfo); + initAgps(cbInfo); } void GnssAdapter::initDefaultAgpsCommand() { @@ -2448,7 +2717,6 @@ void GnssAdapter::initDefaultAgpsCommand() { inline MsgInitDefaultAgps(GnssAdapter& adapter) : LocMsg(), mAdapter(adapter) { - LOC_LOGV("MsgInitDefaultAgps"); } inline virtual void proc() const { mAdapter.initDefaultAgps(); @@ -2459,141 +2727,53 @@ void GnssAdapter::initDefaultAgpsCommand() { } /* INIT LOC AGPS MANAGER */ + +void GnssAdapter::initAgps(const AgpsCbInfo& cbInfo) { + LOC_LOGD("%s]: mAgpsCbInfo.cbPriority - %d; cbInfo.cbPriority - %d", + __func__, mAgpsCbInfo.cbPriority, cbInfo.cbPriority) + + if (!((ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB) || + (ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA))) { + return; + } + + if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) { + return; + } else { + mAgpsCbInfo = cbInfo; + + mAgpsManager.registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb); + + mAgpsManager.createAgpsStateMachines(); + + /* Register for AGPS event mask */ + updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST, + LOC_REGISTRATION_MASK_ENABLED); + } +} + void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){ - LOC_LOGI("GnssAdapter::initAgpsCommand"); - /* Set ATL open/close callbacks */ - AgpsAtlOpenStatusCb atlOpenStatusCb = - [this](int handle, int isSuccess, char* apn, - AGpsBearerType bearerType, AGpsExtType agpsType) { - - mLocApi->atlOpenStatus( - handle, isSuccess, apn, bearerType, agpsType); - }; - AgpsAtlCloseStatusCb atlCloseStatusCb = - [this](int handle, int isSuccess) { - - mLocApi->atlCloseStatus(handle, isSuccess); - }; - - /* Register DS Client APIs */ - AgpsDSClientInitFn dsClientInitFn = - [this](bool isDueToSSR) { - - return mLocApi->initDataServiceClient(isDueToSSR); - }; - - AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn = - [this] { - - return mLocApi->openAndStartDataCall(); - }; - - AgpsDSClientStopDataCallFn dsClientStopDataCallFn = - [this] { - - mLocApi->stopDataCall(); - }; - - AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn = - [this] { - - mLocApi->closeDataCall(); - }; - - AgpsDSClientReleaseFn dsClientReleaseFn = - [this] { - - mLocApi->releaseDataServiceClient(); - }; - - /* Send Msg function */ - SendMsgToAdapterMsgQueueFn sendMsgFn = - [this](LocMsg* msg) { - - sendMsg(msg); - }; - /* Message to initialize AGPS module */ struct AgpsMsgInit: public LocMsg { - - AgpsManager* mAgpsManager; - - AgnssStatusIpV4Cb mFrameworkStatusV4Cb; - - AgpsAtlOpenStatusCb mAtlOpenStatusCb; - AgpsAtlCloseStatusCb mAtlCloseStatusCb; - - AgpsDSClientInitFn mDSClientInitFn; - AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn; - AgpsDSClientStopDataCallFn mDSClientStopDataCallFn; - AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn; - AgpsDSClientReleaseFn mDSClientReleaseFn; - - SendMsgToAdapterMsgQueueFn mSendMsgFn; + const AgpsCbInfo mCbInfo; GnssAdapter& mAdapter; - inline AgpsMsgInit(AgpsManager* agpsManager, - AgnssStatusIpV4Cb frameworkStatusV4Cb, - AgpsAtlOpenStatusCb atlOpenStatusCb, - AgpsAtlCloseStatusCb atlCloseStatusCb, - AgpsDSClientInitFn dsClientInitFn, - AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn, - AgpsDSClientStopDataCallFn dsClientStopDataCallFn, - AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn, - AgpsDSClientReleaseFn dsClientReleaseFn, - SendMsgToAdapterMsgQueueFn sendMsgFn, + inline AgpsMsgInit(const AgpsCbInfo& cbInfo, GnssAdapter& adapter) : - LocMsg(), mAgpsManager(agpsManager), mFrameworkStatusV4Cb( - frameworkStatusV4Cb), mAtlOpenStatusCb(atlOpenStatusCb), mAtlCloseStatusCb( - atlCloseStatusCb), mDSClientInitFn(dsClientInitFn), mDSClientOpenAndStartDataCallFn( - dsClientOpenAndStartDataCallFn), mDSClientStopDataCallFn( - dsClientStopDataCallFn), mDSClientCloseDataCallFn( - dsClientCloseDataCallFn), mDSClientReleaseFn( - dsClientReleaseFn), mSendMsgFn(sendMsgFn), - mAdapter(adapter) { - + LocMsg(), mCbInfo(cbInfo), mAdapter(adapter) { LOC_LOGV("AgpsMsgInit"); } inline virtual void proc() const { - LOC_LOGV("AgpsMsgInit::proc()"); - - mAgpsManager->registerCallbacks(mFrameworkStatusV4Cb, mAtlOpenStatusCb, - mAtlCloseStatusCb, mDSClientInitFn, - mDSClientOpenAndStartDataCallFn, mDSClientStopDataCallFn, - mDSClientCloseDataCallFn, mDSClientReleaseFn, mSendMsgFn); - - mAgpsManager->createAgpsStateMachines(); - - /* Register for AGPS event mask */ - mAdapter.updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST, - LOC_REGISTRATION_MASK_ENABLED); + mAdapter.initAgps(mCbInfo); } }; - if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) { - LOC_LOGI("Higher priority AGPS CB already registered (%d > %d) !", - mAgpsCbInfo.cbPriority, cbInfo.cbPriority); - return; - } else { - mAgpsCbInfo = cbInfo; - LOC_LOGI("Registering AGPS CB %p with priority %d", - mAgpsCbInfo.statusV4Cb, mAgpsCbInfo.cbPriority); - } - /* Send message to initialize AGPS Manager */ - sendMsg(new AgpsMsgInit( - &mAgpsManager, - (AgnssStatusIpV4Cb)cbInfo.statusV4Cb, - atlOpenStatusCb, atlCloseStatusCb, - dsClientInitFn, dsClientOpenAndStartDataCallFn, - dsClientStopDataCallFn, dsClientCloseDataCallFn, - dsClientReleaseFn, - sendMsgFn, - *this)); + sendMsg(new AgpsMsgInit(cbInfo, *this)); } /* GnssAdapter::requestATL @@ -2993,6 +3173,9 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r) r.mLocation.mLocation.longitude = (double)(reports.mBestPosition.back().mBestLon) * RAD2DEG; r.mLocation.mLocation.altitude = reports.mBestPosition.back().mBestAlt; + r.mLocation.mLocation.accuracy = + (double)(reports.mBestPosition.back().mBestHepe); + r.mLocation.mUtcReported = reports.mBestPosition.back().mUtcReported; } else { @@ -3018,8 +3201,8 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r) (int64_t)(reports.mTimeAndClock.back().mGpsTowMs); r.mTime.timeUncertaintyNs = - (float)((reports.mTimeAndClock.back().mTimeUnc + - reports.mTimeAndClock.back().mLeapSecUnc)*1000); + ((float)(reports.mTimeAndClock.back().mTimeUnc) + + (float)(reports.mTimeAndClock.back().mLeapSecUnc))*1000.0f; r.mTime.frequencyUncertaintyNsPerSec = (float)(reports.mTimeAndClock.back().mClockFreqBiasUnc); LOC_LOGV("getDebugReport - timeestimate=%" PRIu64 " unc=%f frequnc=%f", @@ -3052,12 +3235,12 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m systemstatus->getReport(reports, true); if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) && - reports.mTimeAndClock.back().mTimeValid && (abs(msInWeek - (int)reports.mTimeAndClock.back().mGpsTowMs) < 2000)) { for (size_t i = 0; i < measurements.count; i++) { switch (measurements.measurements[i].svType) { case GNSS_SV_TYPE_GPS: + case GNSS_SV_TYPE_QZSS: measurements.measurements[i].agcLevelDb = reports.mRfAndParams.back().mAgcGps; measurements.measurements[i].flags |= @@ -3085,7 +3268,6 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT; break; - case GNSS_SV_TYPE_QZSS: case GNSS_SV_TYPE_SBAS: case GNSS_SV_TYPE_UNKNOWN: default: diff --git a/gps/gnss/GnssAdapter.h b/gps/gnss/GnssAdapter.h old mode 100644 new mode 100755 index e7605f9..0609e6d --- a/gps/gnss/GnssAdapter.h +++ b/gps/gnss/GnssAdapter.h @@ -43,9 +43,39 @@ #define MAX_SATELLITES_IN_USE 12 #define LOC_NI_NO_RESPONSE_TIME 20 #define LOC_GPS_NI_RESPONSE_IGNORE 4 +#define ODCPI_EXPECTED_INJECTION_TIME_MS 10000 class GnssAdapter; +class OdcpiTimer : public LocTimer { +public: + OdcpiTimer(GnssAdapter* adapter) : + LocTimer(), mAdapter(adapter), mActive(false) {} + + inline void start() { + mActive = true; + LocTimer::start(ODCPI_EXPECTED_INJECTION_TIME_MS, false); + } + inline void stop() { + mActive = false; + LocTimer::stop(); + } + inline void restart() { + stop(); + start(); + } + inline bool isActive() { + return mActive; + } + +private: + // Override + virtual void timeOutCallback() override; + + GnssAdapter* mAdapter; + bool mActive; +}; + typedef struct { pthread_t thread; /* NI thread */ uint32_t respTimeLeft; /* examine time for NI response */ @@ -81,6 +111,7 @@ namespace loc_core { } class GnssAdapter : public LocAdapterBase { + /* ==== ULP ============================================================================ */ UlpProxyBase* mUlpProxy; @@ -102,10 +133,18 @@ class GnssAdapter : public LocAdapterBase { /* ==== NI ============================================================================= */ NiData mNiData; - /* ==== AGPS ========================================================*/ + /* ==== AGPS =========================================================================== */ // This must be initialized via initAgps() AgpsManager mAgpsManager; AgpsCbInfo mAgpsCbInfo; + void initAgps(const AgpsCbInfo& cbInfo); + + /* ==== ODCPI ========================================================================== */ + OdcpiRequestCallback mOdcpiRequestCb; + bool mOdcpiRequestActive; + OdcpiTimer mOdcpiTimer; + OdcpiRequestInfo mOdcpiRequest; + void odcpiTimerExpire(); /* === SystemStatus ===================================================================== */ SystemStatus* mSystemStatus; @@ -151,6 +190,7 @@ public: LocationCallbacks getClientCallbacks(LocationAPI* client); LocationCapabilitiesMask getCapabilities(); void broadcastCapabilities(LocationCapabilitiesMask); + LocationError setSuplHostServer(const char* server, int port); /* ==== TRACKING ======================================================================= */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */ @@ -198,6 +238,7 @@ public: void setConfigCommand(); uint32_t* gnssUpdateConfigCommand(GnssConfig config); uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data); + void gnssUpdateXtraThrottleCommand(const bool enabled); void initDefaultAgpsCommand(); void initAgpsCommand(const AgpsCbInfo& cbInfo); @@ -206,6 +247,15 @@ public: void dataConnClosedCommand(AGpsExtType agpsType); void dataConnFailedCommand(AGpsExtType agpsType); + /* ========= ODCPI ===================================================================== */ + /* ======== COMMANDS ====(Called from Client Thread)==================================== */ + void initOdcpiCommand(const OdcpiRequestCallback& callback); + void injectOdcpiCommand(const Location& location); + /* ======== UTILITIES ================================================================== */ + void initOdcpi(const OdcpiRequestCallback& callback); + void injectOdcpi(const Location& location); + void odcpiTimerExpireEvent(); + /* ======== RESPONSES ================================================================== */ void reportResponse(LocationError err, uint32_t sessionId); void reportResponse(size_t count, LocationError* errs, uint32_t* ids); @@ -239,8 +289,11 @@ public: virtual bool requestSuplES(int connHandle); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); + virtual bool reportOdcpiRequestEvent(OdcpiRequestInfo& request); /* ======== UTILITIES ================================================================= */ + bool needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, LocPosTechMask techMask); void reportPosition(const UlpLocation &ulpLocation, const GpsLocationExtended &locationExtended, enum loc_sess_status status, @@ -249,6 +302,7 @@ public: void reportNmea(const char* nmea, size_t length); bool requestNiNotify(const GnssNiNotification& notify, const void* data); void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements); + void reportOdcpiRequest(const OdcpiRequestInfo& request); /*======== GNSSDEBUG ================================================================*/ bool getDebugReport(GnssDebugReport& report); diff --git a/gps/gnss/XtraSystemStatusObserver.cpp b/gps/gnss/XtraSystemStatusObserver.cpp old mode 100644 new mode 100755 index 2855c0d..de7d49a --- a/gps/gnss/XtraSystemStatusObserver.cpp +++ b/gps/gnss/XtraSystemStatusObserver.cpp @@ -51,94 +51,121 @@ using namespace loc_core; -#define XTRA_HAL_SOCKET_NAME "/data/vendor/location/xtra/socket_hal_xtra" +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "LocSvc_XSSO" bool XtraSystemStatusObserver::updateLockStatus(uint32_t lock) { + mGpsLock = lock; + + if (!mReqStatusReceived) { + return true; + } + stringstream ss; ss << "gpslock"; ss << " " << lock; - ss << "\n"; // append seperator - return ( sendEvent(ss) ); + return ( send(LOC_IPC_XTRA, ss.str()) ); } -bool XtraSystemStatusObserver::updateConnectionStatus(bool connected, uint32_t type) { +bool XtraSystemStatusObserver::updateConnections(uint64_t allConnections) { + mIsConnectivityStatusKnown = true; + mConnections = allConnections; + + if (!mReqStatusReceived) { + return true; + } + stringstream ss; ss << "connection"; - ss << " " << (connected ? "1" : "0"); - ss << " " << (int)type; - ss << "\n"; // append seperator - return ( sendEvent(ss) ); + ss << " " << mConnections; + return ( send(LOC_IPC_XTRA, ss.str()) ); } + bool XtraSystemStatusObserver::updateTac(const string& tac) { + mTac = tac; + + if (!mReqStatusReceived) { + return true; + } + stringstream ss; ss << "tac"; ss << " " << tac.c_str(); - ss << "\n"; // append seperator - return ( sendEvent(ss) ); + return ( send(LOC_IPC_XTRA, ss.str()) ); } bool XtraSystemStatusObserver::updateMccMnc(const string& mccmnc) { + mMccmnc = mccmnc; + + if (!mReqStatusReceived) { + return true; + } + stringstream ss; ss << "mncmcc"; ss << " " << mccmnc.c_str(); - ss << "\n"; // append seperator - return ( sendEvent(ss) ); + return ( send(LOC_IPC_XTRA, ss.str()) ); } -bool XtraSystemStatusObserver::sendEvent(const stringstream& event) { - int socketFd = createSocket(); - if (socketFd < 0) { - LOC_LOGe("XTRA unreachable. sending failed."); - return false; +bool XtraSystemStatusObserver::updateXtraThrottle(const bool enabled) { + mXtraThrottle = enabled; + + if (!mReqStatusReceived) { + return true; } - const string& data = event.str(); - int remain = data.length(); - ssize_t sent = 0; - while (remain > 0 && - (sent = ::send(socketFd, data.c_str() + (data.length() - remain), - remain, MSG_NOSIGNAL)) > 0) { - remain -= sent; - } - - if (sent < 0) { - LOC_LOGe("sending error. reason:%s", strerror(errno)); - } - - closeSocket(socketFd); - - return (remain == 0); + stringstream ss; + ss << "xtrathrottle"; + ss << " " << (enabled ? 1 : 0); + return ( send(LOC_IPC_XTRA, ss.str()) ); } +inline bool XtraSystemStatusObserver::onStatusRequested(int32_t xtraStatusUpdated) { + mReqStatusReceived = true; -int XtraSystemStatusObserver::createSocket() { - int socketFd = -1; - - if ((socketFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - LOC_LOGe("create socket error. reason:%s", strerror(errno)); - - } else { - const char* socketPath = XTRA_HAL_SOCKET_NAME ; - struct sockaddr_un addr = { .sun_family = AF_UNIX }; - snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socketPath); - - if (::connect(socketFd, (struct sockaddr*)&addr, sizeof(addr)) < 0) { - LOC_LOGe("cannot connect to XTRA. reason:%s", strerror(errno)); - if (::close(socketFd)) { - LOC_LOGe("close socket error. reason:%s", strerror(errno)); - } - socketFd = -1; - } + if (xtraStatusUpdated) { + return true; } - return socketFd; + stringstream ss; + + ss << "respondStatus" << endl; + (mGpsLock == -1 ? ss : ss << mGpsLock) << endl << mConnections << endl + << mTac << endl << mMccmnc << endl << mIsConnectivityStatusKnown; + + return ( send(LOC_IPC_XTRA, ss.str()) ); } -void XtraSystemStatusObserver::closeSocket(const int socketFd) { - if (socketFd >= 0) { - if(::close(socketFd)) { - LOC_LOGe("close socket error. reason:%s", strerror(errno)); - } +void XtraSystemStatusObserver::onReceive(const std::string& data) { + if (!strncmp(data.c_str(), "ping", sizeof("ping") - 1)) { + LOC_LOGd("ping received"); + +#ifdef USE_GLIB + } else if (!strncmp(data.c_str(), "connectBackhaul", sizeof("connectBackhaul") - 1)) { + mSystemStatusObsrvr->connectBackhaul(); + + } else if (!strncmp(data.c_str(), "disconnectBackhaul", sizeof("disconnectBackhaul") - 1)) { + mSystemStatusObsrvr->disconnectBackhaul(); +#endif + + } else if (!strncmp(data.c_str(), "requestStatus", sizeof("requestStatus") - 1)) { + int32_t xtraStatusUpdated = 0; + sscanf(data.c_str(), "%*s %d", &xtraStatusUpdated); + + struct HandleStatusRequestMsg : public LocMsg { + XtraSystemStatusObserver& mXSSO; + int32_t mXtraStatusUpdated; + inline HandleStatusRequestMsg(XtraSystemStatusObserver& xsso, + int32_t xtraStatusUpdated) : + mXSSO(xsso), mXtraStatusUpdated(xtraStatusUpdated) {} + inline void proc() const override { mXSSO.onStatusRequested(mXtraStatusUpdated); } + }; + mMsgTask->sendMsg(new (nothrow) HandleStatusRequestMsg(*this, xtraStatusUpdated)); + + } else { + LOC_LOGw("unknown event: %s", data.c_str()); } } @@ -170,11 +197,11 @@ void XtraSystemStatusObserver::getName(string& name) void XtraSystemStatusObserver::notify(const list& dlist) { - struct handleOsObserverUpdateMsg : public LocMsg { + struct HandleOsObserverUpdateMsg : public LocMsg { XtraSystemStatusObserver* mXtraSysStatObj; list mDataItemList; - inline handleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs, + inline HandleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs, const list& dataItemList) : mXtraSysStatObj(xtraSysStatObs) { for (auto eachItem : dataItemList) { @@ -190,7 +217,7 @@ void XtraSystemStatusObserver::notify(const list& dlist) } } - inline ~handleOsObserverUpdateMsg() { + inline ~HandleOsObserverUpdateMsg() { for (auto each : mDataItemList) { delete each; } @@ -204,8 +231,7 @@ void XtraSystemStatusObserver::notify(const list& dlist) { NetworkInfoDataItemBase* networkInfo = static_cast(each); - mXtraSysStatObj->updateConnectionStatus(networkInfo->mConnected, - networkInfo->mType); + mXtraSysStatObj->updateConnections(networkInfo->getAllTypes()); } break; @@ -231,7 +257,5 @@ void XtraSystemStatusObserver::notify(const list& dlist) } } }; - mMsgTask->sendMsg(new (nothrow) handleOsObserverUpdateMsg(this, dlist)); + mMsgTask->sendMsg(new (nothrow) HandleOsObserverUpdateMsg(this, dlist)); } - - diff --git a/gps/gnss/XtraSystemStatusObserver.h b/gps/gnss/XtraSystemStatusObserver.h old mode 100644 new mode 100755 index 42f49b5..af0789b --- a/gps/gnss/XtraSystemStatusObserver.h +++ b/gps/gnss/XtraSystemStatusObserver.h @@ -31,41 +31,67 @@ #include #include +#include +#include using namespace std; using loc_core::IOsObserver; using loc_core::IDataItemObserver; using loc_core::IDataItemCore; +using loc_util::LocIpc; - -class XtraSystemStatusObserver : public IDataItemObserver { +class XtraSystemStatusObserver : public IDataItemObserver, public LocIpc{ public : // constructor & destructor inline XtraSystemStatusObserver(IOsObserver* sysStatObs, const MsgTask* msgTask): - mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask) { + mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask), + mGpsLock(-1), mConnections(0), mXtraThrottle(true), mReqStatusReceived(false), + mDelayLocTimer(*this), mIsConnectivityStatusKnown (false) { subscribe(true); + startListeningNonBlocking(LOC_IPC_HAL); + mDelayLocTimer.start(100 /*.1 sec*/, false); + } + inline virtual ~XtraSystemStatusObserver() { + subscribe(false); + stopListening(); } - inline XtraSystemStatusObserver() {}; - inline virtual ~XtraSystemStatusObserver() { subscribe(false); } // IDataItemObserver overrides inline virtual void getName(string& name); virtual void notify(const list& dlist); bool updateLockStatus(uint32_t lock); - bool updateConnectionStatus(bool connected, uint32_t type); + bool updateConnections(uint64_t allConnections); bool updateTac(const string& tac); bool updateMccMnc(const string& mccmnc); + bool updateXtraThrottle(const bool enabled); inline const MsgTask* getMsgTask() { return mMsgTask; } void subscribe(bool yes); +protected: + void onReceive(const std::string& data) override; + private: - int createSocket(); - void closeSocket(const int32_t socketFd); - bool sendEvent(const stringstream& event); IOsObserver* mSystemStatusObsrvr; const MsgTask* mMsgTask; + int32_t mGpsLock; + uint64_t mConnections; + string mTac; + string mMccmnc; + bool mXtraThrottle; + bool mReqStatusReceived; + bool mIsConnectivityStatusKnown; + class DelayLocTimer : public LocTimer { + XtraSystemStatusObserver& mXSSO; + public: + DelayLocTimer(XtraSystemStatusObserver& xsso) : mXSSO(xsso) {} + void timeOutCallback() override { + mXSSO.send(LOC_IPC_XTRA, "halinit"); + } + } mDelayLocTimer; + + bool onStatusRequested(int32_t xtraStatusUpdated); }; #endif diff --git a/gps/gnss/location_gnss.cpp b/gps/gnss/location_gnss.cpp old mode 100644 new mode 100755 index b5623e1..21763dd --- a/gps/gnss/location_gnss.cpp +++ b/gps/gnss/location_gnss.cpp @@ -45,6 +45,7 @@ static void stopTracking(LocationAPI* client, uint32_t id); static void gnssNiResponse(LocationAPI* client, uint32_t id, GnssNiResponse response); static uint32_t gnssDeleteAidingData(GnssAidingData& data); +static void gnssUpdateXtraThrottle(const bool enabled); static void setControlCallbacks(LocationControlCallbacks& controlCallbacks); static uint32_t enable(LocationTechnologyType techType); @@ -59,7 +60,10 @@ static void agpsDataConnOpen(AGpsExtType agpsType, const char* apnName, int apnL static void agpsDataConnClosed(AGpsExtType agpsType); static void agpsDataConnFailed(AGpsExtType agpsType); static void getDebugReport(GnssDebugReport& report); -static void updateConnectionStatus(bool connected, uint8_t type); +static void updateConnectionStatus(bool connected, int8_t type); + +static void odcpiInit(const OdcpiRequestCallback& callback); +static void odcpiInject(const Location& location); static const GnssInterface gGnssInterface = { sizeof(GnssInterface), @@ -77,6 +81,7 @@ static const GnssInterface gGnssInterface = { disable, gnssUpdateConfig, gnssDeleteAidingData, + gnssUpdateXtraThrottle, injectLocation, injectTime, agpsInit, @@ -85,6 +90,8 @@ static const GnssInterface gGnssInterface = { agpsDataConnFailed, getDebugReport, updateConnectionStatus, + odcpiInit, + odcpiInject, }; #ifndef DEBUG_X86 @@ -203,6 +210,13 @@ static uint32_t gnssDeleteAidingData(GnssAidingData& data) } } +static void gnssUpdateXtraThrottle(const bool enabled) +{ + if (NULL != gGnssAdapter) { + gGnssAdapter->gnssUpdateXtraThrottleCommand(enabled); + } +} + static void injectLocation(double latitude, double longitude, float accuracy) { if (NULL != gGnssAdapter) { @@ -251,8 +265,23 @@ static void getDebugReport(GnssDebugReport& report) { } } -static void updateConnectionStatus(bool connected, uint8_t type) { +static void updateConnectionStatus(bool connected, int8_t type) { if (NULL != gGnssAdapter) { gGnssAdapter->getSystemStatus()->eventConnectionStatus(connected, type); } } + +static void odcpiInit(const OdcpiRequestCallback& callback) +{ + if (NULL != gGnssAdapter) { + gGnssAdapter->initOdcpiCommand(callback); + } +} + +static void odcpiInject(const Location& location) +{ + if (NULL != gGnssAdapter) { + gGnssAdapter->injectOdcpiCommand(location); + } +} + diff --git a/gps/gnsspps/Android.mk b/gps/gnsspps/Android.mk old mode 100644 new mode 100755 diff --git a/gps/gnsspps/gnsspps.c b/gps/gnsspps/gnsspps.c old mode 100644 new mode 100755 index f92a862..70b23f5 --- a/gps/gnsspps/gnsspps.c +++ b/gps/gnsspps/gnsspps.c @@ -25,7 +25,7 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/gps/gnsspps/gnsspps.h b/gps/gnsspps/gnsspps.h old mode 100644 new mode 100755 diff --git a/gps/gnsspps/timepps.h b/gps/gnsspps/timepps.h old mode 100644 new mode 100755 diff --git a/gps/location/Android.mk b/gps/location/Android.mk old mode 100644 new mode 100755 index cd620ce..a4abdfc --- a/gps/location/Android.mk +++ b/gps/location/Android.mk @@ -3,8 +3,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := liblocation_api -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 +LOCAL_VENDOR_MODULE := true LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ diff --git a/gps/location/LocationAPI.cpp b/gps/location/LocationAPI.cpp old mode 100644 new mode 100755 index 21d2de0..0111a9c --- a/gps/location/LocationAPI.cpp +++ b/gps/location/LocationAPI.cpp @@ -29,7 +29,8 @@ #include #include -#include +#include +#include #include #include diff --git a/gps/location/LocationAPI.h b/gps/location/LocationAPI.h old mode 100644 new mode 100755 diff --git a/gps/location/LocationAPIClientBase.cpp b/gps/location/LocationAPIClientBase.cpp old mode 100644 new mode 100755 index 50b4b83..626968c --- a/gps/location/LocationAPIClientBase.cpp +++ b/gps/location/LocationAPIClientBase.cpp @@ -29,12 +29,12 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_APIClientBase" -#include +#include +#include #include #include #include "LocationAPIClientBase.h" -#define FLP_CONF_FILE "/etc/flp.conf" #define GEOFENCE_SESSION_ID 0xFFFFFFFF #define CONFIG_SESSION_ID 0xFFFFFFFF @@ -153,7 +153,6 @@ uint32_t LocationAPIControlClient::locAPIGnssUpdateConfig(GnssConfig config) memcpy(&mConfig, &config, sizeof(GnssConfig)); - uint32_t session = 0; uint32_t* idArray = mLocationControlAPI->gnssUpdateConfig(config); LOC_LOGV("%s:%d] gnssUpdateConfig return array: %p", __FUNCTION__, __LINE__, idArray); if (idArray != nullptr) { @@ -365,7 +364,7 @@ int32_t LocationAPIClientBase::locAPIGetBatchSize() { {"BATCH_SIZE", &mBatchSize, nullptr, 'n'}, }; - UTIL_READ_CONF(FLP_CONF_FILE, flp_conf_param_table); + UTIL_READ_CONF(LOC_PATH_FLP_CONF, flp_conf_param_table); if (mBatchSize < 0) { // set mBatchSize to 0 if we got an illegal value from config file mBatchSize = 0; @@ -562,10 +561,16 @@ uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t co if (mLocationAPI) { if (mSessionBiDict.hasId(id)) { SessionEntity entity = mSessionBiDict.getExtById(id); - uint32_t batchingSession = entity.batchingSession; - mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this)); - mLocationAPI->getBatchedLocations(batchingSession, count); - retVal = LOCATION_ERROR_SUCCESS; + if (entity.sessionMode != SESSION_MODE_ON_FIX) { + uint32_t batchingSession = entity.batchingSession; + mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this)); + mLocationAPI->getBatchedLocations(batchingSession, count); + retVal = LOCATION_ERROR_SUCCESS; + } else { + LOC_LOGE("%s:%d] Unsupported for session id: %d, mode is SESSION_MODE_ON_FIX", + __FUNCTION__, __LINE__, id); + retVal = LOCATION_ERROR_NOT_SUPPORTED; + } } else { retVal = LOCATION_ERROR_ID_UNKNOWN; LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, id); @@ -614,26 +619,24 @@ void LocationAPIClientBase::locAPIRemoveGeofences(size_t count, uint32_t* ids) } if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) { + BiDict* removedGeofenceBiDict = + new BiDict(); size_t j = 0; - uint32_t id_cb; - LocationError err; for (size_t i = 0; i < count; i++) { sessions[j] = mGeofenceBiDict.getSession(ids[i]); - id_cb = ids[i]; if (sessions[j] > 0) { + GeofenceBreachTypeMask type = mGeofenceBiDict.getExtBySession(sessions[j]); mGeofenceBiDict.rmBySession(sessions[j]); - err = LOCATION_ERROR_SUCCESS; - onRemoveGeofencesCb(1, &err, &id_cb); + removedGeofenceBiDict->set(ids[i], sessions[j], type); j++; - } else { - err = LOCATION_ERROR_ID_UNKNOWN; - onRemoveGeofencesCb(1, &err, &id_cb); } } - if (j > 0) { - mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this)); + mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this, + removedGeofenceBiDict)); mLocationAPI->removeGeofences(j, sessions); + } else { + delete(removedGeofenceBiDict); } } else { LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, diff --git a/gps/location/LocationAPIClientBase.h b/gps/location/LocationAPIClientBase.h old mode 100644 new mode 100755 index c6ea05c..4bd1466 --- a/gps/location/LocationAPIClientBase.h +++ b/gps/location/LocationAPIClientBase.h @@ -36,6 +36,8 @@ #include #include "LocationAPI.h" +#include +#include enum SESSION_MODE { SESSION_MODE_NONE = 0, @@ -469,11 +471,24 @@ private: class RemoveGeofencesRequest : public LocationAPIRequest { public: - RemoveGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {} + RemoveGeofencesRequest(LocationAPIClientBase& API, + BiDict* removedGeofenceBiDict) : + mAPI(API), mRemovedGeofenceBiDict(removedGeofenceBiDict) {} inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) { - // No need to handle collectiveResponse, cbs already notified + if (nullptr != mRemovedGeofenceBiDict) { + uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count); + for (size_t i = 0; i < count; i++) { + ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]); + } + mAPI.onRemoveGeofencesCb(count, errors, ids); + free(ids); + delete(mRemovedGeofenceBiDict); + } else { + LOC_LOGE("%s:%d] Unable to access removed geofences data.", __FUNCTION__, __LINE__); + } } LocationAPIClientBase& mAPI; + BiDict* mRemovedGeofenceBiDict; }; class ModifyGeofencesRequest : public LocationAPIRequest { diff --git a/gps/location/location_interface.h b/gps/location/location_interface.h old mode 100644 new mode 100755 index 33ec29e..9229052 --- a/gps/location/location_interface.h +++ b/gps/location/location_interface.h @@ -48,6 +48,7 @@ struct GnssInterface { void (*disable)(uint32_t id); uint32_t* (*gnssUpdateConfig)(GnssConfig config); uint32_t (*gnssDeleteAidingData)(GnssAidingData& data); + void (*gnssUpdateXtraThrottle)(const bool enabled); void (*injectLocation)(double latitude, double longitude, float accuracy); void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty); void (*agpsInit)(const AgpsCbInfo& cbInfo); @@ -55,7 +56,9 @@ struct GnssInterface { void (*agpsDataConnClosed)(AGpsExtType agpsType); void (*agpsDataConnFailed)(AGpsExtType agpsType); void (*getDebugReport)(GnssDebugReport& report); - void (*updateConnectionStatus)(bool connected, uint8_t type); + void (*updateConnectionStatus)(bool connected, int8_t type); + void (*odcpiInit)(const OdcpiRequestCallback& callback); + void (*odcpiInject)(const Location& location); }; struct FlpInterface { diff --git a/gps/pla/Android.mk b/gps/pla/Android.mk new file mode 100755 index 0000000..5f80b04 --- /dev/null +++ b/gps/pla/Android.mk @@ -0,0 +1,24 @@ +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 + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE := libloc_pla_headers +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/android +include $(BUILD_HEADER_LIBRARY) diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h b/gps/pla/android/loc_pla.h old mode 100644 new mode 100755 similarity index 69% rename from gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h rename to gps/pla/android/loc_pla.h index 677bc81..9caae73 --- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h +++ b/gps/pla/android/loc_pla.h @@ -26,19 +26,33 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __LOC_STUB_GETTID_H__ -#define __LOC_STUB_GETTID_H__ +#ifndef __LOC_PLA__ +#define __LOC_PLA__ -#include +#ifdef __cplusplus +#include +#define uptimeMillis android::uptimeMillis +#endif #ifdef __cplusplus extern "C" { #endif -pid_t gettid(void); +#include +#include +#include + +#define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf" +#define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf" +#define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf" +#define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf" +#define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf" +#define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf" +#define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf" +#define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf" #ifdef __cplusplus } -#endif +#endif /*__cplusplus */ -#endif /* __LOC_STUB_GETTID_H__ */ +#endif /* __LOC_PLA__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h b/gps/pla/oe/loc_pla.h old mode 100644 new mode 100755 similarity index 65% rename from gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h rename to gps/pla/oe/loc_pla.h index ed2041f..3ca1964 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h +++ b/gps/pla/oe/loc_pla.h @@ -26,19 +26,42 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __PLATFORM_LIB_PROPERTY_SERVICE_H__ -#define __PLATFORM_LIB_PROPERTY_SERVICE_H__ +#ifndef __LOC_PLA__ +#define __LOC_PLA__ #ifdef __cplusplus +#include +#define uptimeMillis android::uptimeMillis + extern "C" { #endif -#ifndef PROPERTY_VALUE_MAX -#define PROPERTY_VALUE_MAX 92 + +#include +#include +#include +#include +#include +#include +#ifndef OFF_TARGET +#include +#define strlcat g_strlcat +#define strlcpy g_strlcpy +#else +#define strlcat strncat +#define strlcpy strncpy #endif -int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value); + +#define LOC_PATH_GPS_CONF_STR "/etc/gps.conf" +#define LOC_PATH_IZAT_CONF_STR "/etc/izat.conf" +#define LOC_PATH_FLP_CONF_STR "/etc/flp.conf" +#define LOC_PATH_LOWI_CONF_STR "/etc/lowi.conf" +#define LOC_PATH_SAP_CONF_STR "/etc/sap.conf" +#define LOC_PATH_APDR_CONF_STR "/etc/apdr.conf" +#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf" +#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf" #ifdef __cplusplus } -#endif /* __cplusplus */ +#endif /*__cplusplus */ -#endif /* __PLATFORM_LIB_PROPERTY_SERVICE_H__ */ +#endif /* __LOC_PLA__ */ diff --git a/gps/utils/Android.mk b/gps/utils/Android.mk old mode 100644 new mode 100755 index b1e8b41..6b84a2b --- a/gps/utils/Android.mk +++ b/gps/utils/Android.mk @@ -2,12 +2,12 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) + ## Libs LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ - liblog \ - libloc_pla + liblog LOCAL_SRC_FILES += \ loc_log.cpp \ @@ -15,13 +15,13 @@ LOCAL_SRC_FILES += \ msg_q.c \ linked_list.c \ loc_target.cpp \ - platform_lib_abstractions/elapsed_millis_since_boot.cpp \ LocHeap.cpp \ LocTimer.cpp \ LocThread.cpp \ MsgTask.cpp \ loc_misc_utils.cpp \ - loc_nmea.cpp + loc_nmea.cpp \ + LocIpc.cpp # Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true LOCAL_CFLAGS += \ @@ -36,14 +36,16 @@ LOCAL_LDFLAGS += -Wl,--export-dynamic ## Includes LOCAL_HEADER_LIBRARIES := \ + libutils_headers \ libloc_pla_headers \ liblocation_api_headers LOCAL_MODULE := libgps.utils -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 +LOCAL_VENDOR_MODULE := true LOCAL_MODULE_TAGS := optional +LOCAL_PRELINK_MODULE := false + LOCAL_CFLAGS += $(GNSS_CFLAGS) include $(BUILD_SHARED_LIBRARY) @@ -52,5 +54,3 @@ include $(CLEAR_VARS) LOCAL_MODULE := libgps.utils_headers LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) include $(BUILD_HEADER_LIBRARY) - -include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, platform_lib_abstractions)) diff --git a/gps/utils/LocHeap.cpp b/gps/utils/LocHeap.cpp old mode 100644 new mode 100755 diff --git a/gps/utils/LocHeap.h b/gps/utils/LocHeap.h old mode 100644 new mode 100755 diff --git a/gps/utils/LocIpc.cpp b/gps/utils/LocIpc.cpp new file mode 100755 index 0000000..675664a --- /dev/null +++ b/gps/utils/LocIpc.cpp @@ -0,0 +1,237 @@ +/* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include "LocIpc.h" + +namespace loc_util { + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "LocSvc_LocIpc" + +#define LOC_MSG_BUF_LEN 8192 +#define LOC_MSG_HEAD "$MSGLEN$" +#define LOC_MSG_ABORT "LocIpcMsg::ABORT" + +class LocIpcRunnable : public LocRunnable { +friend LocIpc; +public: + LocIpcRunnable(LocIpc& locIpc, const std::string& ipcName) + : mLocIpc(locIpc), mIpcName(ipcName) {} + bool run() override { + if (!mLocIpc.startListeningBlocking(mIpcName)) { + LOC_LOGe("listen to socket failed"); + } + + return false; + } +private: + LocIpc& mLocIpc; + const std::string mIpcName; +}; + +bool LocIpc::startListeningNonBlocking(const std::string& name) { + mRunnable = new LocIpcRunnable(*this, name); + std::string threadName("LocIpc-"); + threadName.append(name); + return mThread.start(threadName.c_str(), mRunnable); +} + +bool LocIpc::startListeningBlocking(const std::string& name) { + + int fd = socket(AF_UNIX, SOCK_DGRAM, 0); + if (fd < 0) { + LOC_LOGe("create socket error. reason:%s", strerror(errno)); + return false; + } + + if ((unlink(name.c_str()) < 0) && (errno != ENOENT)) { + LOC_LOGw("unlink socket error. reason:%s", strerror(errno)); + } + + struct sockaddr_un addr = { .sun_family = AF_UNIX }; + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", name.c_str()); + + umask(0157); + + if (::bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) { + LOC_LOGe("bind socket error. reason:%s", strerror(errno)); + ::close(fd); + fd = -1; + return false; + } + + mIpcFd = fd; + + // inform that the socket is ready to receive message + onListenerReady(); + + ssize_t nBytes = 0; + std::string msg = ""; + std::string abort = LOC_MSG_ABORT; + while (1) { + msg.resize(LOC_MSG_BUF_LEN); + nBytes = ::recvfrom(mIpcFd, (void*)(msg.data()), msg.size(), 0, NULL, NULL); + if (nBytes < 0) { + break; + } else if (nBytes == 0) { + continue; + } + + if (strncmp(msg.data(), abort.c_str(), abort.length()) == 0) { + LOC_LOGi("recvd abort msg.data %s", msg.data()); + break; + } + + if (strncmp(msg.data(), LOC_MSG_HEAD, sizeof(LOC_MSG_HEAD) - 1)) { + // short message + msg.resize(nBytes); + onReceive(msg); + } else { + // long message + size_t msgLen = 0; + sscanf(msg.data(), LOC_MSG_HEAD"%zu", &msgLen); + msg.resize(msgLen); + size_t msgLenReceived = 0; + while ((msgLenReceived < msgLen) && (nBytes > 0)) { + nBytes = recvfrom(mIpcFd, (void*)&(msg[msgLenReceived]), + msg.size() - msgLenReceived, 0, NULL, NULL); + msgLenReceived += nBytes; + } + if (nBytes > 0) { + onReceive(msg); + } else { + break; + } + } + } + + if (mStopRequested) { + mStopRequested = false; + return true; + } else { + LOC_LOGe("cannot read socket. reason:%s", strerror(errno)); + (void)::close(mIpcFd); + mIpcFd = -1; + return false; + } +} + +void LocIpc::stopListening() { + + const char *socketName = nullptr; + mStopRequested = true; + + if (mRunnable) { + std::string abort = LOC_MSG_ABORT; + socketName = (reinterpret_cast(mRunnable))->mIpcName.c_str(); + send(socketName, abort); + mRunnable = nullptr; + } + + if (mIpcFd >= 0) { + if (::close(mIpcFd)) { + LOC_LOGe("cannot close socket:%s", strerror(errno)); + } + mIpcFd = -1; + } + + //delete from the file system at the end + if (socketName) { + unlink(socketName); + } +} + +bool LocIpc::send(const char name[], const std::string& data) { + return send(name, (const uint8_t*)data.c_str(), data.length()); +} + +bool LocIpc::send(const char name[], const uint8_t data[], uint32_t length) { + + bool result = true; + int fd = ::socket(AF_UNIX, SOCK_DGRAM, 0); + if (fd < 0) { + LOC_LOGe("create socket error. reason:%s", strerror(errno)); + return false; + } + + struct sockaddr_un addr = { .sun_family = AF_UNIX }; + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", name); + + result = sendData(fd, addr, data, length); + + (void)::close(fd); + return result; +} + + +bool LocIpc::sendData(int fd, const sockaddr_un &addr, const uint8_t data[], uint32_t length) { + + bool result = true; + + if (length <= LOC_MSG_BUF_LEN) { + if (::sendto(fd, data, length, 0, + (struct sockaddr*)&addr, sizeof(addr)) < 0) { + LOC_LOGe("cannot send to socket. reason:%s", strerror(errno)); + result = false; + } + } else { + std::string head = LOC_MSG_HEAD; + head.append(std::to_string(length)); + if (::sendto(fd, head.c_str(), head.length(), 0, + (struct sockaddr*)&addr, sizeof(addr)) < 0) { + LOC_LOGe("cannot send to socket. reason:%s", strerror(errno)); + result = false; + } else { + size_t sentBytes = 0; + while(sentBytes < length) { + size_t partLen = length - sentBytes; + if (partLen > LOC_MSG_BUF_LEN) { + partLen = LOC_MSG_BUF_LEN; + } + ssize_t rv = ::sendto(fd, data + sentBytes, partLen, 0, + (struct sockaddr*)&addr, sizeof(addr)); + if (rv < 0) { + LOC_LOGe("cannot send to socket. reason:%s", strerror(errno)); + result = false; + break; + } + sentBytes += rv; + } + } + } + return result; +} + +} diff --git a/gps/utils/LocIpc.h b/gps/utils/LocIpc.h new file mode 100755 index 0000000..364093b --- /dev/null +++ b/gps/utils/LocIpc.h @@ -0,0 +1,153 @@ +/* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __LOC_SOCKET__ +#define __LOC_SOCKET__ + +#include +#include +#include +#include +#include +#include + +namespace loc_util { + +class LocIpcSender; + +class LocIpc { +friend LocIpcSender; +public: + inline LocIpc() : mIpcFd(-1), mStopRequested(false), mRunnable(nullptr) {} + inline virtual ~LocIpc() { stopListening(); } + + // Listen for new messages in current thread. Calling this funciton will + // block current thread. The listening can be stopped by calling stopListening(). + // + // Argument name is the path of the unix local socket to be listened. + // The function will return true on success, and false on failure. + bool startListeningBlocking(const std::string& name); + + // Create a new LocThread and listen for new messages in it. + // Calling this function will return immediately and won't block current thread. + // The listening can be stopped by calling stopListening(). + // + // Argument name is the path of the unix local socket to be be listened. + // The function will return true on success, and false on failure. + bool startListeningNonBlocking(const std::string& name); + + // Stop listening to new messages. + void stopListening(); + + // Send out a message. + // Call this function to send a message in argument data to socket in argument name. + // + // Argument name contains the name of the target unix socket. data contains the + // message to be sent out. Convert your message to a string before calling this function. + // The function will return true on success, and false on failure. + static bool send(const char name[], const std::string& data); + static bool send(const char name[], const uint8_t data[], uint32_t length); + +protected: + // Callback function for receiving incoming messages. + // Override this function in your derived class to process incoming messages. + // For each received message, this callback function will be called once. + // This callback function will be called in the calling thread of startListeningBlocking + // or in the new LocThread created by startListeningNonBlocking. + // + // Argument data contains the received message. You need to parse it. + inline virtual void onReceive(const std::string& /*data*/) {} + + // LocIpc client can overwrite this function to get notification + // when the socket for LocIpc is ready to receive messages. + inline virtual void onListenerReady() {} + +private: + static bool sendData(int fd, const sockaddr_un& addr, + const uint8_t data[], uint32_t length); + + int mIpcFd; + bool mStopRequested; + LocThread mThread; + LocRunnable *mRunnable; +}; + +class LocIpcSender { +public: + // Constructor of LocIpcSender class + // + // Argument destSocket contains the full path name of destination socket. + // This class hides generated fd and destination address object from user. + inline LocIpcSender(const char* destSocket): + LocIpcSender(std::make_shared(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) { + if (-1 == *mSocket) { + mSocket = nullptr; + } + } + + // Replicate a new LocIpcSender object with new destination socket. + inline LocIpcSender* replicate(const char* destSocket) { + return (nullptr == mSocket) ? nullptr : new LocIpcSender(mSocket, destSocket); + } + + inline ~LocIpcSender() { + if (nullptr != mSocket && mSocket.unique()) { + ::close(*mSocket); + } + } + + // Send out a message. + // Call this function to send a message + // + // Argument data and length contains the message to be sent out. + // Return true when succeeded + inline bool send(const uint8_t data[], uint32_t length) { + bool rtv = false; + if (nullptr != mSocket && nullptr != data) { + rtv = LocIpc::sendData(*mSocket, mDestAddr, data, length); + } + return rtv; + } + +private: + std::shared_ptr mSocket; + struct sockaddr_un mDestAddr; + + inline LocIpcSender( + const std::shared_ptr& mySocket, const char* destSocket) : mSocket(mySocket) { + if ((nullptr != mSocket) && (-1 != *mSocket) && (nullptr != destSocket)) { + mDestAddr.sun_family = AF_UNIX; + snprintf(mDestAddr.sun_path, sizeof(mDestAddr.sun_path), "%s", destSocket); + } + } +}; + +} + +#endif //__LOC_SOCKET__ diff --git a/gps/utils/LocSharedLock.h b/gps/utils/LocSharedLock.h old mode 100644 new mode 100755 diff --git a/gps/utils/LocThread.cpp b/gps/utils/LocThread.cpp old mode 100644 new mode 100755 index d112f61..c1052cb --- a/gps/utils/LocThread.cpp +++ b/gps/utils/LocThread.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include class LocThreadDelegate { LocRunnable* mRunnable; diff --git a/gps/utils/LocThread.h b/gps/utils/LocThread.h old mode 100644 new mode 100755 diff --git a/gps/utils/LocTimer.cpp b/gps/utils/LocTimer.cpp old mode 100644 new mode 100755 index 5b653eb..93775d0 --- a/gps/utils/LocTimer.cpp +++ b/gps/utils/LocTimer.cpp @@ -27,13 +27,15 @@ * */ +#include #include #include #include #include -#include #include #include +#include +#include #include #include #include diff --git a/gps/utils/LocTimer.h b/gps/utils/LocTimer.h old mode 100644 new mode 100755 index c6a6362..abc7f64 --- a/gps/utils/LocTimer.h +++ b/gps/utils/LocTimer.h @@ -31,7 +31,7 @@ #define __LOC_TIMER_CPP_H__ #include -#include +#include // opaque class to provide service implementation. class LocTimerDelegate; diff --git a/gps/utils/LocUnorderedSetMap.h b/gps/utils/LocUnorderedSetMap.h new file mode 100755 index 0000000..8748134 --- /dev/null +++ b/gps/utils/LocUnorderedSetMap.h @@ -0,0 +1,192 @@ +/* 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 __LOC_UNORDERDED_SETMAP_H__ +#define __LOC_UNORDERDED_SETMAP_H__ + +#include +#include +#include + +using std::unordered_set; +using std::unordered_map; + +namespace loc_util { + +// Trim from *fromSet* any elements that also exist in *rVals*. +// The optional *goneVals*, if not null, will be populated with removed elements. +template +inline static void trimSet(unordered_set& fromSet, const unordered_set& rVals, + unordered_set* goneVals) { + for (auto val : rVals) { + if (fromSet.erase(val) > 0 && nullptr != goneVals) { + goneVals->insert(val); + } + } +} + +// this method is destructive to the input unordered_sets. +// the return set is the interset extracted out from the two input sets, *s1* and *s2*. +// *s1* and *s2* will be left with the intersect removed from them. +template +static unordered_set removeAndReturnInterset(unordered_set& s1, unordered_set& s2) { + unordered_set common(0); + for (auto b = s2.begin(); b != s2.end(); b++) { + auto a = find(s1.begin(), s1.end(), *b); + if (a != s1.end()) { + // this is a common item of both l1 and l2, remove from both + // but after we add to common + common.insert(*a); + s1.erase(a); + s2.erase(b); + } + } + return common; +} + +template +class LocUnorderedSetMap { + unordered_map> mMap; + + + // Trim the VALs pointed to by *iter*, with everything that also exist in *rVals*. + // If the set becomes empty, remove the map entry. *goneVals*, if not null, records + // the trimmed VALs. + bool trimOrRemove(typename unordered_map>::iterator iter, + const unordered_set& rVals, unordered_set* goneVals) { + trimSet(iter->second, rVals, goneVals); + bool removeEntry = (iter->second.empty()); + if (removeEntry) { + mMap.erase(iter); + } + return removeEntry; + } + +public: + inline LocUnorderedSetMap() {} + inline LocUnorderedSetMap(size_t size) : mMap(size) {} + + inline bool empty() { return mMap.empty(); } + + // This gets the raw pointer to the VALs pointed to by *key* + // If the entry is not in the map, nullptr will be returned. + inline unordered_set* getValSetPtr(const KEY& key) { + auto entry = mMap.find(key); + return (entry != mMap.end()) ? &(entry->second) : nullptr; + } + + // This gets a copy of VALs pointed to by *key* + // If the entry is not in the map, an empty set will be returned. + inline unordered_set getValSet(const KEY& key) { + auto entry = mMap.find(key); + return (entry != mMap.end()) ? entry->second : unordered_set(0); + } + + // This gets all the KEYs from the map + inline unordered_set getKeys() { + unordered_set keys(0); + for (auto entry : mMap) { + keys.insert(entry.first); + } + return keys; + } + + inline bool remove(const KEY& key) { + return mMap.erase(key) > 0; + } + + // This looks into all the entries keyed by *keys*. Remove any VALs from the entries + // that also exist in *rVals*. If the entry is left with an empty set, the entry will + // be removed. The optional parameters *goneKeys* and *goneVals* will record the KEYs + // (or entries) and the collapsed VALs removed from the map, respectively. + inline void trimOrRemove(unordered_set&& keys, const unordered_set& rVals, + unordered_set* goneKeys, unordered_set* goneVals) { + trimOrRemove(keys, rVals, goneKeys, goneVals); + } + inline void trimOrRemove(unordered_set& keys, const unordered_set& rVals, + unordered_set* goneKeys, unordered_set* goneVals) { + for (auto key : keys) { + auto iter = mMap.find(key); + if (iter != mMap.end() && trimOrRemove(iter, rVals, goneVals) && nullptr != goneKeys) { + goneKeys->insert(iter->first); + } + } + } + + // This adds all VALs from *newVals* to the map entry keyed by *key*. Or if it + // doesn't exist yet, add the set to the map. + bool add(const KEY& key, const unordered_set& newVals) { + bool newEntryAdded = false; + if (!newVals.empty()) { + auto iter = mMap.find(key); + if (iter != mMap.end()) { + iter->second.insert(newVals.begin(), newVals.end()); + } else { + mMap[key] = newVals; + newEntryAdded = true; + } + } + return newEntryAdded; + } + + // This adds to each of entries in the map keyed by *keys* with the VALs in the + // *enwVals*. If there new entries added (new key in *keys*), *newKeys*, if not + // null, would be populated with those keys. + inline void add(const unordered_set& keys, const unordered_set&& newVals, + unordered_set* newKeys) { + add(keys, newVals, newKeys); + } + inline void add(const unordered_set& keys, const unordered_set& newVals, + unordered_set* newKeys) { + for (auto key : keys) { + if (add(key, newVals) && nullptr != newKeys) { + newKeys->insert(key); + } + } + } + + // This puts *newVals* into the map keyed by *key*, and returns the VALs that are + // in effect removed from the keyed VAL set in the map entry. + // This call would also remove those same VALs from *newVals*. + inline unordered_set update(const KEY& key, unordered_set& newVals) { + unordered_set goneVals(0); + + if (newVals.empty()) { + mMap.erase(key); + } else { + auto curVals = mMap[key]; + mMap[key] = newVals; + goneVals = removeAndReturnInterset(curVals, newVals); + } + return goneVals; + } +}; + +} // namespace loc_util + +#endif // #ifndef __LOC_UNORDERDED_SETMAP_H__ diff --git a/gps/utils/MsgTask.cpp b/gps/utils/MsgTask.cpp old mode 100644 new mode 100755 index 80abeec..eaead5c --- a/gps/utils/MsgTask.cpp +++ b/gps/utils/MsgTask.cpp @@ -32,8 +32,9 @@ #include #include #include +#include #include -#include +#include static void LocMsgDestroy(void* msg) { delete (LocMsg*)msg; @@ -82,7 +83,7 @@ void MsgTask::sendMsg(const LocMsg* msg) const { void MsgTask::prerun() { // make sure we do not run in background scheduling group - platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); + set_sched_policy(gettid(), SP_FOREGROUND); } bool MsgTask::run() { diff --git a/gps/utils/MsgTask.h b/gps/utils/MsgTask.h old mode 100644 new mode 100755 diff --git a/gps/utils/gps_extended.h b/gps/utils/gps_extended.h old mode 100644 new mode 100755 diff --git a/gps/utils/gps_extended_c.h b/gps/utils/gps_extended_c.h old mode 100644 new mode 100755 index f87a942..5479bec --- a/gps/utils/gps_extended_c.h +++ b/gps/utils/gps_extended_c.h @@ -115,7 +115,9 @@ enum loc_registration_mask_status { typedef enum { LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support ODCPI version 2 feature */ LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02, /**< Support Wifi AP data inject version 2 feature */ - LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02 /**< Support debug NMEA feature */ + LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02, /**< Support debug NMEA feature */ + LOC_SUPPORTED_FEATURE_GNSS_ONLY_POSITION_REPORT, /**< Support GNSS Only position reports */ + LOC_SUPPORTED_FEATURE_FDCL /**< Support FDCL */ } loc_supported_feature_enum; typedef struct { @@ -308,6 +310,10 @@ typedef uint32_t GpsLocationExtendedFlags; #define GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA 0x10000 /** GpsLocationExtended has GPS Time */ #define GPS_LOCATION_EXTENDED_HAS_GPS_TIME 0x20000 +/** GpsLocationExtended has Extended Dilution of Precision */ +#define GPS_LOCATION_EXTENDED_HAS_EXT_DOP 0x40000 +/** GpsLocationExtended has Elapsed Time */ +#define GPS_LOCATION_EXTENDED_HAS_ELAPSED_TIME 0x80000 typedef uint32_t LocNavSolutionMask; /* Bitmask to specify whether SBAS ionospheric correction is used */ @@ -393,6 +399,29 @@ typedef struct { float pitch; }LocPositionDynamics; +typedef struct { + + /** Position dilution of precision. + Range: 1 (highest accuracy) to 50 (lowest accuracy) */ + float PDOP; + + /** Horizontal dilution of precision. + Range: 1 (highest accuracy) to 50 (lowest accuracy) */ + float HDOP; + + /** Vertical dilution of precision. + Range: 1 (highest accuracy) to 50 (lowest accuracy) */ + float VDOP; + + /** geometric dilution of precision. + Range: 1 (highest accuracy) to 50 (lowest accuracy) */ + float GDOP; + + /** time dilution of precision. + Range: 1 (highest accuracy) to 50 (lowest accuracy) */ + float TDOP; +}LocExtDOP; + /* GPS Time structure */ typedef struct { @@ -451,6 +480,10 @@ typedef struct { LocPositionDynamics bodyFrameData; /** GPS Time */ GPSTimeStruct gpsTime; + /** Elapsed Time */ + int64_t elapsedTime; + /** Dilution of precision associated with this position*/ + LocExtDOP extDOP; } GpsLocationExtended; enum loc_sess_status { @@ -559,7 +592,8 @@ enum loc_api_adapter_event_index { LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report LOC_API_ADAPTER_REQUEST_SRN_DATA, // request srn data from AP LOC_API_ADAPTER_REQUEST_POSITION_INJECTION, // Position injection request - LOC_API_ADAPTER_BATCH_STATUS, // batch status + LOC_API_ADAPTER_BATCH_STATUS, // batch status + LOC_API_ADAPTER_FDCL_SERVICE_REQ, // FDCL service request LOC_API_ADAPTER_EVENT_MAX }; @@ -595,9 +629,10 @@ enum loc_api_adapter_event_index { #define LOC_API_ADAPTER_BIT_REQUEST_SRN_DATA (1< OdcpiRequestCallback; + /* * Callback with AGNSS(IpV4) status information. * @@ -1282,6 +1331,9 @@ typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr); +/* Shared resources of LocIpc */ +#define LOC_IPC_HAL "/dev/socket/location/socket_hal" +#define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra" #ifdef __cplusplus } diff --git a/gps/utils/linked_list.c b/gps/utils/linked_list.c old mode 100644 new mode 100755 index 33185d0..02e1463 --- a/gps/utils/linked_list.c +++ b/gps/utils/linked_list.c @@ -26,14 +26,15 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define LOG_TAG "LocSvc_utils_ll" + #include "linked_list.h" #include #include - -#define LOG_TAG "LocSvc_utils_ll" -#include #include #include +#include +#include typedef struct list_element { struct list_element* next; diff --git a/gps/utils/linked_list.h b/gps/utils/linked_list.h old mode 100644 new mode 100755 diff --git a/gps/utils/loc_cfg.cpp b/gps/utils/loc_cfg.cpp old mode 100644 new mode 100755 index d2364f6..d7adad1 --- a/gps/utils/loc_cfg.cpp +++ b/gps/utils/loc_cfg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, 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 @@ -37,13 +37,16 @@ #include #include #include +#include +#include #include -#include +#include +#include #include #ifdef USE_GLIB #include #endif -#include "platform_lib_includes.h" +#include "log_util.h" /*============================================================================= * @@ -54,12 +57,14 @@ /* Parameter data */ static uint32_t DEBUG_LEVEL = 0xff; static uint32_t TIMESTAMP = 0; +static uint32_t LOC_MODEM_EMULATOR = 0; /* Parameter spec table */ static const loc_param_s_type loc_param_table[] = { - {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, - {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, + {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, + {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, + {"LOC_MODEM_EMULATOR", &LOC_MODEM_EMULATOR, NULL, 'n'}, }; static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type); @@ -71,6 +76,28 @@ typedef struct loc_param_v_type double param_double_value; }loc_param_v_type; +// Reference below arrays wherever needed to avoid duplicating +// same conf path string over and again in location code. +const char LOC_PATH_GPS_CONF[] = LOC_PATH_GPS_CONF_STR; +const char LOC_PATH_IZAT_CONF[] = LOC_PATH_IZAT_CONF_STR; +const char LOC_PATH_FLP_CONF[] = LOC_PATH_FLP_CONF_STR; +const char LOC_PATH_LOWI_CONF[] = LOC_PATH_LOWI_CONF_STR; +const char LOC_PATH_SAP_CONF[] = LOC_PATH_SAP_CONF_STR; +const char LOC_PATH_APDR_CONF[] = LOC_PATH_APDR_CONF_STR; +const char LOC_PATH_XTWIFI_CONF[] = LOC_PATH_XTWIFI_CONF_STR; +const char LOC_PATH_QUIPC_CONF[] = LOC_PATH_QUIPC_CONF_STR; + +/*=========================================================================== +FUNCTION loc_modem_emulator_enabled + +DESCRIPTION + Provides access to Modem Emulator config item. +===========================================================================*/ +uint32_t loc_modem_emulator_enabled() +{ + return LOC_MODEM_EMULATOR; +} + /*=========================================================================== FUNCTION loc_set_config_entry @@ -381,9 +408,6 @@ void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_ta uint32_t table_length) { FILE *conf_fp = NULL; - char *lasts; - loc_param_v_type config_value; - uint32_t i; if((conf_fp = fopen(conf_file_name, "r")) != NULL) { @@ -398,3 +422,718 @@ void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_ta /* Initialize logging mechanism with parsed data */ loc_logger_init(DEBUG_LEVEL, TIMESTAMP); } + +/*============================================================================= + * + * Define and Structures for Parsing Location Process Configuration File + * + *============================================================================*/ +#define MAX_NUM_STRINGS 20 + +//We can have 8 masks for now +#define CONFIG_MASK_TARGET_ALL 0X01 +#define CONFIG_MASK_TARGET_FOUND 0X02 +#define CONFIG_MASK_TARGET_CHECK 0X03 +#define CONFIG_MASK_BASEBAND_ALL 0X04 +#define CONFIG_MASK_BASEBAND_FOUND 0X08 +#define CONFIG_MASK_BASEBAND_CHECK 0x0c +#define CONFIG_MASK_AUTOPLATFORM_ALL 0x10 +#define CONFIG_MASK_AUTOPLATFORM_FOUND 0x20 +#define CONFIG_MASK_AUTOPLATFORM_CHECK 0x30 + +#define LOC_FEATURE_MASK_GTP_WIFI_BASIC 0x01 +#define LOC_FEATURE_MASK_GTP_WIFI_PREMIUM 0X02 +#define LOC_FEATURE_MASK_GTP_CELL_BASIC 0X04 +#define LOC_FEATURE_MASK_GTP_CELL_PREMIUM 0X08 +#define LOC_FEATURE_MASK_GTP_AP_CELL_BASIC LOC_FEATURE_MASK_GTP_CELL_BASIC +#define LOC_FEATURE_MASK_GTP_AP_CELL_PREMIUM LOC_FEATURE_MASK_GTP_CELL_PREMIUM +#define LOC_FEATURE_MASK_SAP_BASIC 0x40 +#define LOC_FEATURE_MASK_SAP_PREMIUM 0X80 +#define LOC_FEATURE_MASK_GTP_WAA_BASIC 0X100 +#define LOC_FEATURE_MASK_GTP_WAA_PREMIUM 0x200 +#define LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC 0X400 +#define LOC_FEATURE_MASK_GTP_MODEM_CELL_PREMIUM 0X800 +#define LOC_FEATURE_MASK_ODCPI 0x1000 +#define LOC_FEATURE_MASK_FREE_WIFI_SCAN_INJECT 0x2000 +#define LOC_FEATURE_MASK_SUPL_WIFI 0x4000 +#define LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO 0x8000 + +typedef struct { + char proc_name[LOC_MAX_PARAM_STRING]; + char proc_argument[LOC_MAX_PARAM_STRING]; + char proc_status[LOC_MAX_PARAM_STRING]; + char group_list[LOC_MAX_PARAM_STRING]; + unsigned int premium_feature; + unsigned int loc_feature_mask; + char platform_list[LOC_MAX_PARAM_STRING]; + char baseband[LOC_MAX_PARAM_STRING]; + unsigned int sglte_target; + char feature_gtp_cell_proc[LOC_MAX_PARAM_STRING]; + char feature_gtp_waa[LOC_MAX_PARAM_STRING]; + char feature_gtp_cell[LOC_MAX_PARAM_STRING]; + char feature_gtp_wifi[LOC_MAX_PARAM_STRING]; + char feature_sap[LOC_MAX_PARAM_STRING]; + char feature_odcpi[LOC_MAX_PARAM_STRING]; + char feature_free_wifi_scan_inject[LOC_MAX_PARAM_STRING]; + char feature_supl_wifi[LOC_MAX_PARAM_STRING]; + char feature_wifi_supplicant_info[LOC_MAX_PARAM_STRING]; + char auto_platform[LOC_MAX_PARAM_STRING]; +} loc_launcher_conf; + +/* process configuration parameters */ +static loc_launcher_conf conf; + +/* gps.conf Parameter spec table */ +static const loc_param_s_type gps_conf_parameter_table[] = { + {"SGLTE_TARGET", &conf.sglte_target, NULL, 'n'}, +}; + +/* location feature conf, e.g.: izat.conf feature mode table*/ +static const loc_param_s_type loc_feature_conf_table[] = { + {"GTP_CELL_PROC", &conf.feature_gtp_cell_proc, NULL, 's'}, + {"GTP_CELL", &conf.feature_gtp_cell, NULL, 's'}, + {"GTP_WIFI", &conf.feature_gtp_wifi, NULL, 's'}, + {"GTP_WAA", &conf.feature_gtp_waa, NULL, 's'}, + {"SAP", &conf.feature_sap, NULL, 's'}, + {"ODCPI", &conf.feature_odcpi, NULL, 's'}, + {"FREE_WIFI_SCAN_INJECT", &conf.feature_free_wifi_scan_inject, NULL, 's'}, + {"SUPL_WIFI", &conf.feature_supl_wifi, NULL, 's'}, + {"WIFI_SUPPLICANT_INFO", &conf.feature_wifi_supplicant_info, NULL, 's'}, +}; + +/* location process conf, e.g.: izat.conf Parameter spec table */ +static const loc_param_s_type loc_process_conf_parameter_table[] = { + {"PROCESS_NAME", &conf.proc_name, NULL, 's'}, + {"PROCESS_ARGUMENT", &conf.proc_argument, NULL, 's'}, + {"PROCESS_STATE", &conf.proc_status, NULL, 's'}, + {"PROCESS_GROUPS", &conf.group_list, NULL, 's'}, + {"PREMIUM_FEATURE", &conf.premium_feature, NULL, 'n'}, + {"IZAT_FEATURE_MASK", &conf.loc_feature_mask, NULL, 'n'}, + {"PLATFORMS", &conf.platform_list, NULL, 's'}, + {"BASEBAND", &conf.baseband, NULL, 's'}, + {"HARDWARE_TYPE", &conf.auto_platform, NULL, 's'}, +}; + +/*=========================================================================== +FUNCTION loc_read_process_conf + +DESCRIPTION + Parse the specified conf file and return info for the processes defined. + The format of the file should conform with izat.conf. + +PARAMETERS: + conf_file_name: configuration file to read + process_count_ptr: pointer to store number of processes defined in the conf file. + process_info_table_ptr: pointer to store the process info table. + +DEPENDENCIES + The file must be in izat.conf format. + +RETURN VALUE + 0: success + none-zero: failure + +SIDE EFFECTS + N/A + +NOTES: + On success, memory pointed by (*process_info_table_ptr) must be freed. +===========================================================================*/ +int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_ptr, + loc_process_info_s_type** process_info_table_ptr) { + loc_process_info_s_type *child_proc = nullptr; + volatile int i=0; + unsigned int j=0; + gid_t gid_list[LOC_PROCESS_MAX_NUM_GROUPS]; + char *split_strings[MAX_NUM_STRINGS]; + int name_length=0, group_list_length=0, platform_length=0, baseband_length=0, ngroups=0, ret=0; + int auto_platform_length = 0; + int group_index=0, nstrings=0, status_length=0; + FILE* conf_fp = nullptr; + char platform_name[PROPERTY_VALUE_MAX], baseband_name[PROPERTY_VALUE_MAX]; + char autoplatform_name[PROPERTY_VALUE_MAX]; + unsigned int loc_service_mask=0; + char config_mask = 0; + unsigned char proc_list_length=0; + int gtp_cell_ap_enabled = 0; + char arg_gtp_waa[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--"; + char arg_gtp_ap_cell[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--"; + char arg_gtp_modem_cell[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--"; + char arg_gtp_wifi[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--"; + char arg_sap[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--"; + char arg_disabled[LOC_PROCESS_MAX_ARG_STR_LENGTH] = LOC_FEATURE_MODE_DISABLED; + char arg_basic[LOC_PROCESS_MAX_ARG_STR_LENGTH] = LOC_FEATURE_MODE_BASIC; + char arg_premium[LOC_PROCESS_MAX_ARG_STR_LENGTH] = LOC_FEATURE_MODE_PREMIUM; + + if (process_count_ptr == NULL || process_info_table_ptr == NULL) { + return -1; + } + + //Read gps.conf and fill parameter table + UTIL_READ_CONF(LOC_PATH_GPS_CONF, gps_conf_parameter_table); + + //Form argument strings + strlcat(arg_gtp_waa, LOC_FEATURE_GTP_WAA, LOC_PROCESS_MAX_ARG_STR_LENGTH-3); + strlcat(arg_gtp_ap_cell, LOC_FEATURE_GTP_AP_CELL, LOC_PROCESS_MAX_ARG_STR_LENGTH-3); + strlcat(arg_gtp_modem_cell, LOC_FEATURE_GTP_MODEM_CELL, LOC_PROCESS_MAX_ARG_STR_LENGTH-3); + strlcat(arg_gtp_wifi, LOC_FEATURE_GTP_WIFI, LOC_PROCESS_MAX_ARG_STR_LENGTH-3); + strlcat(arg_sap, LOC_FEATURE_SAP, LOC_PROCESS_MAX_ARG_STR_LENGTH-3); + + //Get platform name from ro.board.platform property + loc_get_platform_name(platform_name, sizeof(platform_name)); + //Get baseband name from ro.baseband property + loc_get_target_baseband(baseband_name, sizeof(baseband_name)); + //Identify if this is an automotive platform + loc_get_auto_platform_name(autoplatform_name,sizeof(autoplatform_name)); + + UTIL_READ_CONF(conf_file_name, loc_feature_conf_table); + + //Set service mask for GTP_WIFI + if(strcmp(conf.feature_gtp_wifi, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: GTP WIFI DISABLED", __func__, __LINE__); + } + else if(strcmp(conf.feature_gtp_wifi, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting GTP WIFI to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC; + } + //conf file has a garbage value + else { + LOC_LOGE("%s:%d]: Unrecognized value for GTP WIFI Mode."\ + " Setting GTP WIFI to default mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC; + } + + //Set service mask for GTP_CELL + //Using a temp variable here to indicate wheter GTP cell is + //enabled on the AP or modem. This variable will be used in + //further checks below. An alternative was to compare the + //string again in each place which would've been more expensive + if(strcmp(conf.feature_gtp_cell_proc, "AP") == 0) { + gtp_cell_ap_enabled = 1; + } + + if(strcmp(conf.feature_gtp_cell, "PREMIUM") == 0) { + LOC_LOGE("%s:%d]: Error: location feature GTP CELL does not support PREMIUM mode" \ + " available modes are BASIC and DISABLED. Starting feature in BASIC mode", + __func__, __LINE__); + if(gtp_cell_ap_enabled) { + loc_service_mask |= LOC_FEATURE_MASK_GTP_AP_CELL_BASIC; + } + else { + loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC; + } + } + else if(strcmp(conf.feature_gtp_cell, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting GTP CELL to mode: BASIC", __func__, __LINE__); + if(gtp_cell_ap_enabled) { + loc_service_mask |= LOC_FEATURE_MASK_GTP_AP_CELL_BASIC; + } + else { + loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC; + } + } + else if(strcmp(conf.feature_gtp_cell, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: GTP CELL DISABLED", __func__, __LINE__); + } + //conf file has a garbage value + else { + LOC_LOGE("%s:%d]: Unrecognized value for GTP CELL Mode." \ + " Setting GTP CELL to default mode: BASIC", __func__, __LINE__); + if(gtp_cell_ap_enabled) { + loc_service_mask |= LOC_FEATURE_MASK_GTP_AP_CELL_BASIC; + } + else { + loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC; + } + } + + //Set service mask for GTP_WAA + if(strcmp(conf.feature_gtp_waa, "PREMIUM") == 0) { + LOC_LOGE("%s:%d]: Error: location feature GTP WAA does not support PREMIUM mode" \ + " available modes are BASIC and DISABLED. Starting feature in BASIC mode", + __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_GTP_WAA_BASIC; + } + else if(strcmp(conf.feature_gtp_waa, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting GTP WAA to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_GTP_WAA_BASIC; + } + else if(strcmp(conf.feature_gtp_waa, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: GTP WAA DISABLED", __func__, __LINE__); + } + //conf file has a garbage value + else { + LOC_LOGE("%s:%d]: Unrecognized value for GTP WAA Mode."\ + " Setting GTP WAA to default mode: DISABLED", __func__, __LINE__); + } + + //Set service mask for SAP + if(strcmp(conf.feature_sap, "PREMIUM") == 0) { + LOC_LOGD("%s:%d]: Setting SAP to mode: PREMIUM", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_SAP_PREMIUM; + } + else if(strcmp(conf.feature_sap, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting SAP to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_SAP_BASIC; + } + else if(strcmp(conf.feature_sap, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: Setting SAP to mode: DISABLED", __func__, __LINE__); + } + else { + LOC_LOGE("%s:%d]: Unrecognized value for SAP Mode."\ + " Setting SAP to default mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_SAP_BASIC; + } + + // Set service mask for ODCPI + if(strcmp(conf.feature_odcpi, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting ODCPI to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_ODCPI; + } + else if(strcmp(conf.feature_odcpi, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: Setting ODCPI to mode: DISABLED", __func__, __LINE__); + } + else if(strcmp(conf.feature_odcpi, "PREMIUM") == 0) { + LOC_LOGD("%s:%d]: Unrecognized value for ODCPI mode."\ + "Setting ODCPI to default mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_ODCPI; + } + + // Set service mask for FREE_WIFI_SCAN_INJECT + if(strcmp(conf.feature_free_wifi_scan_inject, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting FREE_WIFI_SCAN_INJECT to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_FREE_WIFI_SCAN_INJECT; + } + else if(strcmp(conf.feature_free_wifi_scan_inject, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: Setting FREE_WIFI_SCAN_INJECT to mode: DISABLED", __func__, __LINE__); + } + else if(strcmp(conf.feature_free_wifi_scan_inject, "PREMIUM") == 0) { + LOC_LOGD("%s:%d]: Unrecognized value for FREE_WIFI_SCAN_INJECT mode."\ + "Setting FREE_WIFI_SCAN_INJECT to default mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_FREE_WIFI_SCAN_INJECT; + } + + // Set service mask for SUPL_WIFI + if(strcmp(conf.feature_supl_wifi, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting SUPL_WIFI to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_SUPL_WIFI; + } + else if(strcmp(conf.feature_supl_wifi, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: Setting SUPL_WIFI to mode: DISABLED", __func__, __LINE__); + } + else if(strcmp(conf.feature_supl_wifi, "PREMIUM") == 0) { + LOC_LOGD("%s:%d]: Unrecognized value for SUPL_WIFI mode."\ + "Setting SUPL_WIFI to default mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_SUPL_WIFI; + } + + // Set service mask for WIFI_SUPPLICANT_INFO + if(strcmp(conf.feature_wifi_supplicant_info, "BASIC") == 0) { + LOC_LOGD("%s:%d]: Setting WIFI_SUPPLICANT_INFO to mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO; + } + else if(strcmp(conf.feature_wifi_supplicant_info, "DISABLED") == 0) { + LOC_LOGD("%s:%d]: Setting WIFI_SUPPLICANT_INFO to mode: DISABLED", __func__, __LINE__); + } + else if(strcmp(conf.feature_wifi_supplicant_info, "PREMIUM") == 0) { + LOC_LOGD("%s:%d]: Unrecognized value for WIFI_SUPPLICANT_INFO mode."\ + "Setting LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO to default mode: BASIC", __func__, __LINE__); + loc_service_mask |= LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO; + } + + LOC_LOGD("%s:%d]: loc_service_mask: %x\n", __func__, __LINE__, loc_service_mask); + + if((conf_fp = fopen(conf_file_name, "r")) == NULL) { + LOC_LOGE("%s:%d]: Error opening %s %s\n", __func__, + __LINE__, conf_file_name, strerror(errno)); + ret = -1; + goto err; + } + + //Parse through the file to find out how many processes are to be launched + proc_list_length = 0; + do { + conf.proc_name[0] = 0; + //Here note that the 3rd parameter is passed as 1. + //This is so that only the first parameter in the table which is "PROCESS_NAME" + //is read. We do not want to read the entire block of parameters at this time + //since we are only counting the number of processes to launch. + //Therefore, only counting the occurrences of PROCESS_NAME parameter + //should suffice + if(loc_read_conf_r(conf_fp, loc_process_conf_parameter_table, 1)) { + LOC_LOGE("%s:%d]: Unable to read conf file. Failing\n", __func__, __LINE__); + ret = -1; + goto err; + } + name_length=(int)strlen(conf.proc_name); + if(name_length) { + proc_list_length++; + LOC_LOGD("Process name:%s", conf.proc_name); + } + } while(name_length); + LOC_LOGD("Process cnt = %d", proc_list_length); + + child_proc = (loc_process_info_s_type *)calloc(proc_list_length, sizeof(loc_process_info_s_type)); + if(child_proc == NULL) { + LOC_LOGE("%s:%d]: ERROR: Malloc returned NULL\n", __func__, __LINE__); + ret = -1; + goto err; + } + + //Move file descriptor to the beginning of the file + //so that the parameters can be read + rewind(conf_fp); + + for(j=0; j LOC_MAX_PARAM_STRING) { + LOC_LOGE("%s:%d]: i: %d; Length of name parameter too long. Max length: %d", + __func__, __LINE__, i, LOC_MAX_PARAM_STRING); + continue; + } + strlcpy(child_proc[j].name[0], conf.proc_name, sizeof (child_proc[j].name[0])); + + child_proc[j].num_groups = 0; + ngroups = loc_util_split_string(conf.group_list, split_strings, MAX_NUM_STRINGS, ' '); +#ifdef __ANDROID__ + for(i=0; ipw_gid; + child_proc[j].num_groups++; + LOC_LOGD("%s:%d]:Group %s = %d matches child_group: %d\n", + __func__, __LINE__, split_strings[i], + pwd->pw_gid,child_proc[j].group_list[i]); + } + } +#endif + nstrings = loc_util_split_string(conf.platform_list, split_strings, MAX_NUM_STRINGS, ' '); + if(strcmp("all", split_strings[0]) == 0) { + if (nstrings == 1 || (nstrings == 2 && (strcmp("exclude", split_strings[1]) == 0))) { + LOC_LOGD("%s:%d]: Enabled for all targets\n", __func__, __LINE__); + config_mask |= CONFIG_MASK_TARGET_ALL; + } + else if (nstrings > 2 && (strcmp("exclude", split_strings[1]) == 0)) { + config_mask |= CONFIG_MASK_TARGET_FOUND; + for (i=2; i 2 && (strcmp("exclude", split_strings[1]) == 0)) { + config_mask |= CONFIG_MASK_BASEBAND_FOUND; + for (i=2; i #include +#include +#include +#include #define LOC_MAX_PARAM_NAME 80 #define LOC_MAX_PARAM_STRING 80 #define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING) +#define LOC_FEATURE_MODE_DISABLED "DISABLED" +#define LOC_FEATURE_MODE_BASIC "BASIC" +#define LOC_FEATURE_MODE_PREMIUM "PREMIUM" + +#define LOC_FEATURE_GTP_AP_CELL "gtp-ap-cell" +#define LOC_FEATURE_GTP_MODEM_CELL "gtp-modem-cell" +#define LOC_FEATURE_GTP_CELL_ENH "gtp-cell-enh" +#define LOC_FEATURE_GTP_WIFI "gtp-wifi" +#define LOC_FEATURE_GTP_WAA "gtp-waa" +#define LOC_FEATURE_SAP "sap" + +#define LOC_PROCESS_MAX_NUM_GROUPS 20 +#define LOC_PROCESS_MAX_NUM_ARGS 25 +#define LOC_PROCESS_MAX_ARG_STR_LENGTH 32 + #define UTIL_UPDATE_CONF(conf_data, len, config_table) \ loc_update_conf((conf_data), (len), (config_table), \ sizeof(config_table) / sizeof(config_table[0])) @@ -62,6 +80,23 @@ typedef struct 'f' for double */ } loc_param_s_type; +typedef enum { + ENABLED, + RUNNING, + DISABLED, + DISABLED_FROM_CONF +} loc_process_e_status; + +typedef struct { + loc_process_e_status proc_status; + pid_t proc_id; + char name[2][LOC_MAX_PARAM_STRING]; + gid_t group_list[LOC_PROCESS_MAX_NUM_GROUPS]; + unsigned char num_groups; + char args[LOC_PROCESS_MAX_NUM_ARGS][LOC_PROCESS_MAX_ARG_STR_LENGTH]; + char argumentString[LOC_MAX_PARAM_STRING]; +} loc_process_info_s_type; + /*============================================================================= * * MODULE EXTERNAL DATA @@ -84,6 +119,22 @@ int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, uint32_t table_length); int loc_update_conf(const char* conf_data, int32_t length, const loc_param_s_type* config_table, uint32_t table_length); + +// Below are the location conf file paths +extern const char LOC_PATH_GPS_CONF[]; +extern const char LOC_PATH_IZAT_CONF[]; +extern const char LOC_PATH_FLP_CONF[]; +extern const char LOC_PATH_LOWI_CONF[]; +extern const char LOC_PATH_SAP_CONF[]; +extern const char LOC_PATH_APDR_CONF[]; +extern const char LOC_PATH_XTWIFI_CONF[]; +extern const char LOC_PATH_QUIPC_CONF[]; + +int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_ptr, + loc_process_info_s_type** process_info_table_ptr); + +uint32_t loc_modem_emulator_enabled(); + #ifdef __cplusplus } #endif diff --git a/gps/utils/loc_gps.h b/gps/utils/loc_gps.h old mode 100644 new mode 100755 diff --git a/gps/utils/loc_log.cpp b/gps/utils/loc_log.cpp old mode 100644 new mode 100755 index 9fad9e6..ab28998 --- a/gps/utils/loc_log.cpp +++ b/gps/utils/loc_log.cpp @@ -32,9 +32,10 @@ #include #include #include +#include "log_util.h" #include "loc_log.h" #include "msg_q.h" -#include +#include #define BUFFER_SIZE 120 diff --git a/gps/utils/loc_log.h b/gps/utils/loc_log.h old mode 100644 new mode 100755 diff --git a/gps/utils/loc_misc_utils.cpp b/gps/utils/loc_misc_utils.cpp old mode 100644 new mode 100755 index fd3ee6b..b7c8406 --- a/gps/utils/loc_misc_utils.cpp +++ b/gps/utils/loc_misc_utils.cpp @@ -30,7 +30,7 @@ #define LOG_TAG "LocSvc_misc_utils" #include #include -#include +#include #include #include diff --git a/gps/utils/loc_misc_utils.h b/gps/utils/loc_misc_utils.h old mode 100644 new mode 100755 diff --git a/gps/utils/loc_nmea.cpp b/gps/utils/loc_nmea.cpp old mode 100644 new mode 100755 index eb193cc..558dc65 --- a/gps/utils/loc_nmea.cpp +++ b/gps/utils/loc_nmea.cpp @@ -31,7 +31,8 @@ #define LOG_TAG "LocSvc_nmea" #include #include -#include +#include +#include #define GLONASS_SV_ID_OFFSET 64 #define MAX_SATELLITES_IN_USE 12 @@ -51,6 +52,7 @@ typedef struct loc_nmea_sv_meta_s uint32_t mask; uint32_t svCount; uint32_t svIdOffset; + uint32_t signalId; uint32_t systemId; } loc_nmea_sv_meta; @@ -71,8 +73,6 @@ typedef struct loc_sv_cache_info_s float vdop; } loc_sv_cache_info; -static loc_sv_cache_info sv_cache_info; - /*=========================================================================== FUNCTION loc_nmea_sv_meta_init @@ -90,6 +90,7 @@ SIDE EFFECTS ===========================================================================*/ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta, + loc_sv_cache_info& sv_cache_info, GnssSvType svType, bool needCombine) { @@ -103,6 +104,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta, sv_meta.talker[1] = 'P'; sv_meta.mask = sv_cache_info.gps_used_mask; sv_meta.svCount = sv_cache_info.gps_count; + sv_meta.signalId = 1; sv_meta.systemId = SYSTEM_ID_GPS; break; case GNSS_SV_TYPE_GLONASS: @@ -112,6 +114,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta, sv_meta.svCount = sv_cache_info.glo_count; // GLONASS SV ids are from 65-96 sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET; + sv_meta.signalId = 1; sv_meta.systemId = SYSTEM_ID_GLONASS; break; case GNSS_SV_TYPE_GALILEO: @@ -119,6 +122,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta, sv_meta.talker[1] = 'A'; sv_meta.mask = sv_cache_info.gal_used_mask; sv_meta.svCount = sv_cache_info.gal_count; + sv_meta.signalId = 7; sv_meta.systemId = SYSTEM_ID_GALILEO; break; case GNSS_SV_TYPE_QZSS: @@ -127,6 +131,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta, sv_meta.mask = sv_cache_info.qzss_used_mask; sv_meta.svCount = sv_cache_info.qzss_count; // QZSS SV ids are from 193-197. So keep svIdOffset 0 + sv_meta.signalId = 0; sv_meta.systemId = SYSTEM_ID_QZSS; break; case GNSS_SV_TYPE_BEIDOU: @@ -135,6 +140,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta, sv_meta.mask = sv_cache_info.bds_used_mask; sv_meta.svCount = sv_cache_info.bds_count; // BDS SV ids are from 201-235. So keep svIdOffset 0 + sv_meta.signalId = 0; sv_meta.systemId = SYSTEM_ID_BEIDOU; break; default: @@ -260,13 +266,14 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende fixType = '3'; // 3D fix // Start printing the sentence - // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v*cc + // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v,s*cc // a : Mode : A : Automatic, allowed to automatically switch 2D/3D // x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix) // xx : 12 SV ID // p.p : Position DOP (Dilution of Precision) // h.h : Horizontal DOP // v.v : Vertical DOP + // s : GNSS System Id // cc : Checksum value length = snprintf(pMarker, lengthRemaining, "$%sGSA,A,%c,", talker, fixType); @@ -329,7 +336,7 @@ DESCRIPTION Generate NMEA GSV sentences generated based on sv report Currently below sentences are generated: - $GPGSV: GPS Satellites in View - - $GNGSV: GLONASS Satellites in View + - $GLGSV: GLONASS Satellites in View - $GAGSV: GALILEO Satellites in View DEPENDENCIES @@ -368,7 +375,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify, if (svCount <= 0) { // no svs in view, so just send a blank $--GSV sentence - snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,", talker); + snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,%d", talker, sv_meta_p->signalId); length = loc_nmea_put_checksum(sentence, bufSize); nmeaArraystr.push_back(sentence); return; @@ -430,15 +437,10 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify, } - // The following entries are specific to QZSS and BDS - if ((sv_meta_p->svType == GNSS_SV_TYPE_QZSS) || - (sv_meta_p->svType == GNSS_SV_TYPE_BEIDOU)) - { - // last one is System id and second last is Signal Id which is always zero - length = snprintf(pMarker, lengthRemaining,",%d,%d",0,sv_meta_p->systemId); - pMarker += length; - lengthRemaining -= length; - } + // append signalId + length = snprintf(pMarker, lengthRemaining,",%d",sv_meta_p->signalId); + pMarker += length; + lengthRemaining -= length; length = loc_nmea_put_checksum(sentence, bufSize); nmeaArraystr.push_back(sentence); @@ -495,7 +497,20 @@ void loc_nmea_generate_pos(const UlpLocation &location, int utcMinutes = pTm->tm_min; int utcSeconds = pTm->tm_sec; int utcMSeconds = (location.gpsLocation.timestamp)%1000; + loc_sv_cache_info sv_cache_info = {}; + if (GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA & locationExtended.flags) { + sv_cache_info.gps_used_mask = + (uint32_t)locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask; + sv_cache_info.glo_used_mask = + (uint32_t)locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask; + sv_cache_info.gal_used_mask = + (uint32_t)locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask; + sv_cache_info.qzss_used_mask = + (uint32_t)locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask; + sv_cache_info.bds_used_mask = + (uint32_t)locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask; + } if (generate_nmea) { char talker[3] = {'G', 'P', '\0'}; uint32_t svUsedCount = 0; @@ -506,7 +521,8 @@ void loc_nmea_generate_pos(const UlpLocation &location, // ------------------- count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GPS, true), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS, true), + nmeaArraystr); if (count > 0) { svUsedCount += count; @@ -519,7 +535,8 @@ void loc_nmea_generate_pos(const UlpLocation &location, // ------------------- count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GLONASS, true), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS, true), + nmeaArraystr); if (count > 0) { svUsedCount += count; @@ -532,7 +549,8 @@ void loc_nmea_generate_pos(const UlpLocation &location, // ------------------- count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GALILEO, true), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO, true), + nmeaArraystr); if (count > 0) { svUsedCount += count; @@ -545,7 +563,8 @@ void loc_nmea_generate_pos(const UlpLocation &location, // -------------------------- count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS, false), + nmeaArraystr); if (count > 0) { svUsedCount += count; @@ -556,7 +575,8 @@ void loc_nmea_generate_pos(const UlpLocation &location, // ---$PQGSA/$GNGSA (BEIDOU)--- // ---------------------------- count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU, false), + nmeaArraystr); if (count > 0) { svUsedCount += count; @@ -787,6 +807,14 @@ void loc_nmea_generate_pos(const UlpLocation &location, else // A means autonomous length = snprintf(pMarker, lengthRemaining, "%c", 'A'); + pMarker += length; + lengthRemaining -= length; + + // hardcode Navigation Status field to 'V' + length = snprintf(pMarker, lengthRemaining, ",%c", 'V'); + pMarker += length; + lengthRemaining -= length; + length = loc_nmea_put_checksum(sentence, sizeof(sentence)); nmeaArraystr.push_back(sentence); @@ -920,13 +948,6 @@ void loc_nmea_generate_pos(const UlpLocation &location, length = loc_nmea_put_checksum(sentence, sizeof(sentence)); nmeaArraystr.push_back(sentence); - - // clear the cache so they can't be used again - sv_cache_info.gps_used_mask = 0; - sv_cache_info.glo_used_mask = 0; - sv_cache_info.gal_used_mask = 0; - sv_cache_info.qzss_used_mask = 0; - sv_cache_info.bds_used_mask = 0; } //Send blank NMEA reports for non-final fixes else { @@ -946,7 +967,7 @@ void loc_nmea_generate_pos(const UlpLocation &location, length = loc_nmea_put_checksum(sentence, sizeof(sentence)); nmeaArraystr.push_back(sentence); - strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence)); + strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N,V", sizeof(sentence)); length = loc_nmea_put_checksum(sentence, sizeof(sentence)); nmeaArraystr.push_back(sentence); @@ -982,27 +1003,11 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify, ENTRY_LOG(); char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0}; - char* pMarker = sentence; - int lengthRemaining = sizeof(sentence); - int length = 0; int svCount = svNotify.count; - int sentenceCount = 0; - int sentenceNumber = 1; int svNumber = 1; + loc_sv_cache_info sv_cache_info = {}; //Count GPS SVs for saparating GPS from GLONASS and throw others - - sv_cache_info.gps_used_mask = 0; - sv_cache_info.glo_used_mask = 0; - sv_cache_info.gal_used_mask = 0; - sv_cache_info.qzss_used_mask = 0; - sv_cache_info.bds_used_mask = 0; - - sv_cache_info.gps_count = 0; - sv_cache_info.glo_count = 0; - sv_cache_info.gal_count = 0; - sv_cache_info.qzss_count = 0; - sv_cache_info.bds_count = 0; for(svNumber=1; svNumber <= svCount; svNumber++) { if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svNumber - 1].type) { @@ -1072,35 +1077,38 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify, // ------------------ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GPS, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS, false), nmeaArraystr); // ------------------ // ------$GLGSV------ // ------------------ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GLONASS, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS, false), + nmeaArraystr); // ------------------ // ------$GAGSV------ // ------------------ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GALILEO, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO, false), + nmeaArraystr); // ------------------------- // ------$PQGSV (QZSS)------ // ------------------------- loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS, false), nmeaArraystr); // --------------------------- // ------$PQGSV (BEIDOU)------ // --------------------------- loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence), - loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr); + loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU, false), + nmeaArraystr); EXIT_LOG(%d, 0); } diff --git a/gps/utils/loc_nmea.h b/gps/utils/loc_nmea.h old mode 100644 new mode 100755 diff --git a/gps/utils/loc_target.cpp b/gps/utils/loc_target.cpp old mode 100644 new mode 100755 index cf42932..569f3a7 --- a/gps/utils/loc_target.cpp +++ b/gps/utils/loc_target.cpp @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -34,10 +35,10 @@ #include #include #include -#include +#include #include "loc_target.h" #include "loc_log.h" -#include +#include #define APQ8064_ID_1 "109" #define APQ8064_ID_2 "153" @@ -205,17 +206,3 @@ detected: LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } - -/*Reads the property ro.lean to identify if this is a lean target - Returns: - 0 if not a lean and mean target - 1 if this is a lean and mean target -*/ -int loc_identify_lean_target() -{ - int ret = 0; - char lean_target[PROPERTY_VALUE_MAX]; - property_get("ro.lean", lean_target, ""); - LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target); - return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX)); -} diff --git a/gps/utils/loc_target.h b/gps/utils/loc_target.h old mode 100644 new mode 100755 index 47a67d9..172b475 --- a/gps/utils/loc_target.h +++ b/gps/utils/loc_target.h @@ -55,12 +55,6 @@ void loc_get_platform_name(char *platform_name, int array_length); of atleast PROPERTY_VALUE_MAX*/ void loc_get_auto_platform_name(char *platform_name, int array_length); -/*Reads the property ro.lean to identify if this is a lean target - Returns: - 0 if not a lean and mean target - 1 if this is a lean and mean target*/ -int loc_identify_lean_target(); - /* Please remember to update 'target_name' in loc_log.cpp, if do any changes to this enum. */ typedef enum { diff --git a/gps/utils/loc_timer.h b/gps/utils/loc_timer.h old mode 100644 new mode 100755 index 25fd179..fff0c46 --- a/gps/utils/loc_timer.h +++ b/gps/utils/loc_timer.h @@ -34,7 +34,8 @@ extern "C" { #endif /* __cplusplus */ #include -#include +#include +#include /* user_data: client context pointer, passthrough. Originally received from calling client when loc_timer_start() is called. diff --git a/gps/utils/log_util.h b/gps/utils/log_util.h old mode 100644 new mode 100755 index 7eb338a..feb4d3c --- a/gps/utils/log_util.h +++ b/gps/utils/log_util.h @@ -30,22 +30,23 @@ #ifndef __LOG_UTIL_H__ #define __LOG_UTIL_H__ -#ifndef USE_GLIB +#if defined (USE_ANDROID_LOGGING) || defined (ANDROID) +// Android and LE targets with logcat support #include -#endif /* USE_GLIB */ - -#ifdef USE_GLIB +#elif defined (USE_GLIB) +// LE targets with no logcat support #include +#include #include #include +#include #ifndef LOG_TAG #define LOG_TAG "GPS_UTILS" +#endif /* LOG_TAG */ -#endif // LOG_TAG - -#endif /* USE_GLIB */ +#endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */ #ifdef __cplusplus extern "C" @@ -140,6 +141,7 @@ extern char* get_timestamp(char* str, unsigned long buf_size); #define LOC_LOG_HEAD(fmt) "%s:%d] " fmt #define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) #define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) +#define LOC_LOGi(fmt,...) LOC_LOGI(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) #define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) #define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) diff --git a/gps/utils/msg_q.c b/gps/utils/msg_q.c old mode 100644 new mode 100755 index e8b4ffe..76c1478 --- a/gps/utils/msg_q.c +++ b/gps/utils/msg_q.c @@ -26,14 +26,14 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "msg_q.h" - #define LOG_TAG "LocSvc_utils_q" -#include -#include "linked_list.h" #include #include #include +#include +#include +#include "linked_list.h" +#include "msg_q.h" typedef struct msg_q { void* msg_list; /* Linked list to store information */ diff --git a/gps/utils/msg_q.h b/gps/utils/msg_q.h old mode 100644 new mode 100755 diff --git a/gps/utils/platform_lib_abstractions/Android.mk b/gps/utils/platform_lib_abstractions/Android.mk deleted file mode 100644 index 5053e7d..0000000 --- a/gps/utils/platform_lib_abstractions/Android.mk +++ /dev/null @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff --git a/gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp deleted file mode 100644 index 6c183a8..0000000 --- a/gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2013, 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 -#include -#include "platform_lib_time.h" - -int64_t systemTime(int /*clock*/) -{ - struct timeval t; - t.tv_sec = t.tv_usec = 0; - gettimeofday(&t, NULL); - return t.tv_sec*1000000LL + t.tv_usec; -} - - -int64_t elapsedMillisSinceBoot() -{ - int64_t t_us = systemTime(0); - return (int64_t) t_us / 1000LL; -} diff --git a/gps/utils/platform_lib_abstractions/loc_pla/Android.mk b/gps/utils/platform_lib_abstractions/loc_pla/Android.mk deleted file mode 100644 index 5053e7d..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/Android.mk +++ /dev/null @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h deleted file mode 100644 index 340c3c5..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2014, 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 __PLATFORM_LIB_GETTID_H__ -#define __PLATFORM_LIB_GETTID_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif -#ifdef USE_GLIB -const char* getprogname(); -#endif /* USE_GLIB */ - -pid_t platform_lib_abstraction_gettid(); -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* __PLATFORM_LIB_GETTID_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h deleted file mode 100644 index ebb7119..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2014, 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 __PLATFORM_LIB_INCLUDES_H__ -#define __PLATFORM_LIB_INCLUDES_H__ - -#include "platform_lib_gettid.h" -#include "platform_lib_log_util.h" -#include "platform_lib_macros.h" -#include "platform_lib_property_service.h" -#include "platform_lib_sched_policy.h" -#include "platform_lib_time.h" - -#endif /* __PLATFORM_LIB_INCLUDES_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h deleted file mode 100644 index 26d3c29..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (c) 2011-2014 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 __PLATFORM_LIB_LOG_UTIL_H__ -#define __PLATFORM_LIB_LOG_UTIL_H__ - -#include "platform_lib_macros.h" - -#ifndef USE_GLIB -#include -#else - -#include -#include -#include -#include -#include -#include - -#ifndef LOG_TAG -#define LOG_TAG "GPS_UTILS" -#endif /* LOG_TAG */ - -#ifdef __cplusplus -extern "C" -{ -#endif -/*============================================================================= - * - * LOC LOGGER TYPE DECLARATION - * - *============================================================================*/ -/* LOC LOGGER */ -typedef struct loc_logger_s -{ - unsigned long DEBUG_LEVEL; - unsigned long TIMESTAMP; -} loc_logger_s_type; - -/*============================================================================= - * - * EXTERNAL DATA - * - *============================================================================*/ -extern loc_logger_s_type loc_logger; - -// Logging Improvements -extern const char *loc_logger_boolStr[]; - -extern const char *boolStr[]; -extern const char VOID_RET[]; -extern const char FROM_AFW[]; -extern const char TO_MODEM[]; -extern const char FROM_MODEM[]; -extern const char TO_AFW[]; -extern const char EXIT_TAG[]; -extern const char ENTRY_TAG[]; -extern const char EXIT_ERROR_TAG[]; - -/*============================================================================= - * - * MODULE EXPORTED FUNCTIONS - * - *============================================================================*/ -void loc_logger_init(unsigned long debug, unsigned long timestamp); -char* get_timestamp(char* str, unsigned long buf_size); - -#ifndef DEBUG_DMN_LOC_API - -/* LOGGING MACROS */ -/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp - if that value remains unchanged, it means gps.conf did not - provide a value and we default to the initial value to use - Android's logging levels*/ -#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) -#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) -#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) -#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) -#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) - -#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); } -#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); } -#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); } -#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); } -#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); } - -#else /* DEBUG_DMN_LOC_API */ - -#define LOC_LOGE(...) ALOGE(__VA_ARGS__) -#define LOC_LOGW(...) ALOGW(__VA_ARGS__) -#define LOC_LOGI(...) ALOGI(__VA_ARGS__) -#define LOC_LOGD(...) ALOGD(__VA_ARGS__) -#define LOC_LOGV(...) ALOGV(__VA_ARGS__) - -#endif /* DEBUG_DMN_LOC_API */ - -/*============================================================================= - * - * LOGGING IMPROVEMENT MACROS - * - *============================================================================*/ -#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \ - do { \ - if (loc_logger.TIMESTAMP) { \ - char ts[32]; \ - LOC_LOG("[%s] %s %s line %d " #SPEC, \ - get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \ - } else { \ - LOC_LOG("%s %s line %d " #SPEC, \ - ID, WHAT, __LINE__, VAL); \ - } \ - } while(0) - -#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt -#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL) -#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL) -#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL) - -#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "") -#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL) -#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \ - if (VAL != 0) { \ - LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \ - } else { \ - LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \ - } - - -// Used for logging callflow from Android Framework -#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "") -// Used for logging callflow to Modem -#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL) -// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "") -#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL) -// Used for logging callflow to Android Framework -#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL) - -#ifdef __cplusplus -} -#endif - -#endif /* USE_GLIB */ - -#endif /* __PLATFORM_LIB_LOG_UTIL_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h deleted file mode 100644 index d0795eb..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2014, 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 __PLATFORM_LIB_MACROS_H__ -#define __PLATFORM_LIB_MACROS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef USE_GLIB -#include -#include -#include -#ifndef OFF_TARGET -#include -#define strlcat g_strlcat -#define strlcpy g_strlcpy -#else -#define strlcat strncat -#define strlcpy strncpy -#endif - -#define TS_PRINTF(format, x...) \ -{ \ - struct timeval tv; \ - struct timezone tz; \ - int hh, mm, ss; \ - gettimeofday(&tv, &tz); \ - hh = tv.tv_sec/3600%24; \ - mm = (tv.tv_sec%3600)/60; \ - ss = tv.tv_sec%60; \ - fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \ -} - -#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) - -#endif /* USE_GLIB */ - - -// Below are the location conf file paths -extern const char LOC_PATH_GPS_CONF[]; -extern const char LOC_PATH_IZAT_CONF[]; -extern const char LOC_PATH_FLP_CONF[]; -extern const char LOC_PATH_LOWI_CONF[]; -extern const char LOC_PATH_SAP_CONF[]; -extern const char LOC_PATH_APDR_CONF[]; -extern const char LOC_PATH_XTWIFI_CONF[]; -extern const char LOC_PATH_QUIPC_CONF[]; - - -#ifdef __cplusplus -} -#endif /*__cplusplus */ - -#endif /* __PLATFORM_LIB_MACROS_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h deleted file mode 100644 index d10f151..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2014, 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 __PLATFORM_LIB_SCHED_POLICY_H__ -#define __PLATFORM_LIB_SCHED_POLICY_H__ - -#ifdef __cplusplus -extern "C" { -#endif -typedef enum { - PLA_SP_BACKGROUND = 0, - PLA_SP_FOREGROUND = 1, -} PLASchedPolicy; - -int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __PLATFORM_LIB_SCHED_POLICY_H__ */ - diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h deleted file mode 100644 index ae25ae6..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2014, 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 __PLATFORM_LIB_TIME_H__ -#define __PLATFORM_LIB_TIME_H__ - -#include -int64_t platform_lib_abstraction_elapsed_millis_since_boot(); -int64_t platform_lib_abstraction_elapsed_micros_since_boot(); - -#endif /* __PLATFORM_LIB_TIME_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk b/gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk deleted file mode 100644 index d7aea94..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk +++ /dev/null @@ -1,60 +0,0 @@ -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 - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -## Libs -LOCAL_SHARED_LIBRARIES := \ - libutils \ - libcutils \ - liblog \ - libloc_stub - -LOCAL_SRC_FILES += \ - platform_lib_gettid.cpp \ - platform_lib_log_util.cpp \ - platform_lib_property_service.cpp \ - platform_lib_sched_policy.cpp \ - platform_lib_time.cpp - -LOCAL_CFLAGS += \ - -fno-short-enums \ - -D_ANDROID_ \ - -std=c++11 - -## Includes -LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/../include -LOCAL_HEADER_LIBRARIES := \ - libgps.utils_headers \ - libloc_stub_headers - -LOCAL_MODULE := libloc_pla -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 -LOCAL_MODULE_TAGS := optional - -LOCAL_CFLAGS += $(GNSS_CFLAGS) -include $(BUILD_SHARED_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libloc_pla_headers -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include -include $(BUILD_HEADER_LIBRARY) diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp deleted file mode 100644 index 1b7aa32..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2014, 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 "platform_lib_gettid.h" - -#ifdef USE_GLIB -#include - -#include -const char* getprogname() { - return program_invocation_short_name; -} - -#else -#include -#endif /* USE_GLIB */ - -pid_t platform_lib_abstraction_gettid() -{ - return gettid(); -} diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp deleted file mode 100644 index 3cb51a3..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2014, 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 "platform_lib_log_util.h" -#include "platform_lib_macros.h" - -char * get_timestamp(char *str, unsigned long buf_size) -{ - struct timeval tv; - struct timezone tz; - int hh, mm, ss; - gettimeofday(&tv, &tz); - hh = tv.tv_sec/3600%24; - mm = (tv.tv_sec%3600)/60; - ss = tv.tv_sec%60; - snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec); - return str; -} - -// Below are the location conf file paths -#ifdef __ANDROID__ - -#define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf" -#define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf" -#define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf" -#define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf" -#define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf" -#define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf" -#define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf" -#define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf" - -#else - -#define LOC_PATH_GPS_CONF_STR "/etc/gps.conf" -#define LOC_PATH_IZAT_CONF_STR "/etc/izat.conf" -#define LOC_PATH_FLP_CONF_STR "/etc/flp.conf" -#define LOC_PATH_LOWI_CONF_STR "/etc/lowi.conf" -#define LOC_PATH_SAP_CONF_STR "/etc/sap.conf" -#define LOC_PATH_APDR_CONF_STR "/etc/apdr.conf" -#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf" -#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf" - -#endif // __ANDROID__ - -// Reference below arrays wherever needed to avoid duplicating -// same conf path string over and again in location code. -const char LOC_PATH_GPS_CONF[] = LOC_PATH_GPS_CONF_STR; -const char LOC_PATH_IZAT_CONF[] = LOC_PATH_IZAT_CONF_STR; -const char LOC_PATH_FLP_CONF[] = LOC_PATH_FLP_CONF_STR; -const char LOC_PATH_LOWI_CONF[] = LOC_PATH_LOWI_CONF_STR; -const char LOC_PATH_SAP_CONF[] = LOC_PATH_SAP_CONF_STR; -const char LOC_PATH_APDR_CONF[] = LOC_PATH_APDR_CONF_STR; -const char LOC_PATH_XTWIFI_CONF[] = LOC_PATH_XTWIFI_CONF_STR; -const char LOC_PATH_QUIPC_CONF[] = LOC_PATH_QUIPC_CONF_STR; diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp deleted file mode 100644 index dccdebc..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2014, 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. - */ -#ifdef USE_GLIB -#include -#else -#include -#endif /* USE_GLIB */ - -#include "platform_lib_property_service.h" - -int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value) -{ - return property_get(key, value, default_value); -} diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp deleted file mode 100644 index ba6b350..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2014, 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 "platform_lib_sched_policy.h" - -#ifdef USE_GLIB -#include -#else -#include -#endif /* USE_GLIB */ - -int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy) -{ - return set_sched_policy(tid, (SchedPolicy)policy); -} - diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp deleted file mode 100644 index 3dcd4d3..0000000 --- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2014, 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 "platform_lib_time.h" - -#ifdef USE_GLIB -#include -#else -#include -#include - -#endif /* USE_GLIB */ - -int64_t platform_lib_abstraction_elapsed_millis_since_boot() -{ -#ifdef USE_GLIB - - return elapsedMillisSinceBoot(); - -#else - - //return android::nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME))/1000; - return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME))/1000; -#endif -} -int64_t platform_lib_abstraction_elapsed_micros_since_boot() -{ -#ifdef USE_GLIB - return elapsedMicrosSinceBoot(); - -#else - //return android::nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME)); - return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME)); -#endif -} diff --git a/gps/utils/platform_lib_abstractions/loc_stub/Android.mk b/gps/utils/platform_lib_abstractions/loc_stub/Android.mk deleted file mode 100644 index 5053e7d..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/Android.mk +++ /dev/null @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h deleted file mode 100644 index c8764ee..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __LOC_STUB_ANDROID_RUNTIME_H__ -#define __LOC_STUB_ANDROID_RUNTIME_H__ - -#include - -namespace android { - -class AndroidRuntime -{ -public: - /** create a new thread that is visible from Java */ - static pthread_t createJavaThread(const char* name, void (*start)(void *), - void* arg); -}; - -} -#endif /* __LOC_STUB_ANDROID_RUNTIME_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h deleted file mode 100644 index 3677cdf..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __LOC_STUB_PROPERTY_SERVICE_H__ -#define __LOC_STUB_PROPERTY_SERVICE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -int property_get(const char *key, char *value, const char *default_value); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LOC_STUB_PROPERTY_SERVICE_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h deleted file mode 100644 index a42b117..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __LOC_STUB_SCHED_POLICY_H__ -#define __LOC_STUB_SCHED_POLICY_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - SP_BACKGROUND = 0, - SP_FOREGROUND = 1, -} SchedPolicy; - -/*=========================================================================== -FUNCTION set_sched_policy - -DESCRIPTION - Local copy of this function which bypasses android set_sched_policy - -DEPENDENCIES - None - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -int set_sched_policy(int tid, SchedPolicy policy); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LOC_STUB_SCHED_POLICY_H__ */ - diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h deleted file mode 100644 index f00a49b..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __LOC_STUB_TIME_H__ -#define __LOC_STUB_TIME_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int64_t systemTime(int clock); -int64_t elapsedMillisSinceBoot(); -int64_t elapsedMicrosSinceBoot(); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LOC_STUB_TIME_H__ */ diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk b/gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk deleted file mode 100644 index 0356fb2..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -## Libs -LOCAL_SHARED_LIBRARIES := \ - libutils \ - libcutils \ - liblog - -LOCAL_SRC_FILES += \ - loc_stub_android_runtime.cpp \ - loc_stub_gettid.cpp \ - loc_stub_property_service.cpp \ - loc_stub_sched_policy.cpp \ - loc_stub_time.cpp - -LOCAL_CFLAGS += \ - -fno-short-enums \ - -D_ANDROID_ \ - -std=c++11 - - -LOCAL_LDFLAGS += -Wl,--export-dynamic - -## Includes -LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/../include \ - -LOCAL_MODULE := libloc_stub -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 -LOCAL_MODULE_TAGS := optional - -LOCAL_CFLAGS += $(GNSS_CFLAGS) -include $(BUILD_SHARED_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libloc_stub_headers -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include -include $(BUILD_HEADER_LIBRARY) diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp deleted file mode 100644 index 068df4e..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2014, 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 "loc_stub_android_runtime.h" - -namespace android { - -pthread_t AndroidRuntime::createJavaThread(const char* /*name*/, - void (*start)(void *), void* arg) -{ - pthread_t threadId = 0; - pthread_create(&threadId, NULL, (void *(*)(void*))start, arg); - return threadId; -} - -} diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp deleted file mode 100644 index 55ef48a..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2014, 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 "loc_stub_gettid.h" -#include -#include - -// Required for off-target environment to compile properly -pid_t gettid(void) -{ - return syscall(SYS_gettid); -} diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp deleted file mode 100644 index 907ab02..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2014, 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 "loc_stub_property_service.h" -#include -#include - -int property_get(const char *key, char * value, const char */*default_value*/) -{ - /* This will disable gps interface - value[0] = '1'; - */ - if (strcmp(key, "ro.baseband") == 0) { - memcpy(value, "msm", 4); - } - return 0; -} diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp deleted file mode 100644 index 5e26245..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2014, 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 "loc_stub_sched_policy.h" - -/*=========================================================================== -FUNCTION set_sched_policy - -DESCRIPTION - Local copy of this function which bypasses android set_sched_policy - -DEPENDENCIES - None - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -int set_sched_policy(int /*tid*/, SchedPolicy /*policy*/) -{ - return 0; -} diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp deleted file mode 100644 index 48149a6..0000000 --- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2014, 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 "loc_stub_time.h" -#include -#include -#include - -int64_t systemTime(int /*clock*/) -{ - struct timeval t; - t.tv_sec = t.tv_usec = 0; - gettimeofday(&t, NULL); - return t.tv_sec*1000000LL + t.tv_usec; -} - -int64_t elapsedMicrosSinceBoot() -{ - struct timespec ts; - int64_t time_ms = 0; - clock_gettime(CLOCK_BOOTTIME, &ts); - time_ms += (ts.tv_sec * 1000000000LL); /* Seconds to nanoseconds */ - time_ms += ts.tv_nsec; /* Add Nanoseconds */ - return time_ms; -} - -int64_t elapsedMillisSinceBoot() -{ - return (int64_t) (elapsedMicrosSinceBoot() /1000000LL); -} diff --git a/lineage.mk b/lineage.mk deleted file mode 100644 index 1333ca3..0000000 --- a/lineage.mk +++ /dev/null @@ -1,17 +0,0 @@ -$(call inherit-product, device/samsung/gts3llte/full_gts3llte.mk) - -# Inherit some common Lineage stuff. -$(call inherit-product, vendor/lineage/config/common_full_phone.mk) - -PRODUCT_NAME := lineage_gts3llte -PRODUCT_BRAND := samsung -PRODUCT_MANUFACTURER := samsung -PRODUCT_DEVICE := gts3llte -PRODUCT_MODEL := SM-T825 - -PRODUCT_GMS_CLIENTID_BASE := android-samsung - -BUILD_FINGERPRINT := samsung/gts3lltexx/gts3llte:8.0.0/R16NW/T825XXU1BRE2:user/release-keys - -PRODUCT_BUILD_PROP_OVERRIDES += \ - PRODUCT_NAME=gts3lltexx diff --git a/lineage_gts3llte.mk b/lineage_gts3llte.mk new file mode 100755 index 0000000..76e1f26 --- /dev/null +++ b/lineage_gts3llte.mk @@ -0,0 +1,28 @@ +# 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) + +# Inherit some common Lineage stuff. +$(call inherit-product, vendor/lineage/config/common_full_phone.mk) + +# Device identifier. This must come after all inclusions. +PRODUCT_NAME := lineage_gts3llte +PRODUCT_DEVICE := gts3llte +PRODUCT_BRAND := Samsung +PRODUCT_MODEL := SM-T825 +PRODUCT_MANUFACTURER := Samsung + +PRODUCT_GMS_CLIENTID_BASE := android-samsung + +PRODUCT_BUILD_PROP_OVERRIDES += \ + TARGET_DEVICE="gts3llte" \ + PRODUCT_NAME="gts3llte" \ + PRIVATE_BUILD_DESC="gts3lltexx-user 8.0.0 R16NW T825XXU2BRL2 release-keys" + +# Set BUILD_FINGERPRINT variable to be picked up by both system and vendor build.prop +BUILD_FINGERPRINT := "samsung/gts3lltexx/gts3llte:8.0.0/R16NW/T825XXU2BRL2:user/release-keys" + +TARGET_VENDOR := Samsung diff --git a/lineagehw/org/lineageos/hardware/KeyDisabler.java b/lineagehw/src/org/lineageos/hardware/KeyDisabler.java similarity index 100% rename from lineagehw/org/lineageos/hardware/KeyDisabler.java rename to lineagehw/src/org/lineageos/hardware/KeyDisabler.java diff --git a/lineagehw/org/lineageos/hardware/VibratorHW.java b/lineagehw/src/org/lineageos/hardware/VibratorHW.java similarity index 100% rename from lineagehw/org/lineageos/hardware/VibratorHW.java rename to lineagehw/src/org/lineageos/hardware/VibratorHW.java diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml old mode 100644 new mode 100755 index 2b371e7..54ad39f --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -265,12 +265,20 @@ 50 - - + com.android.systemui/com.android.systemui.doze.DozeService - true + + + true 3300 diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml new file mode 100755 index 0000000..1c5ecc6 --- /dev/null +++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml @@ -0,0 +1,24 @@ + + + + + true + + + diff --git a/overlay/lineage-sdk/lineage/res/res/values/config.xml b/overlay/lineage-sdk/lineage/res/res/values/config.xml new file mode 100755 index 0000000..42103f5 --- /dev/null +++ b/overlay/lineage-sdk/lineage/res/res/values/config.xml @@ -0,0 +1,154 @@ + + + + + 0 + + + 83 + + + 65 + + + + + + + + + + + + + + diff --git a/overlay/packages/apps/Snap/res/values/config.xml b/overlay/packages/apps/Snap/res/values/config.xml old mode 100644 new mode 100755 diff --git a/overlay/packages/apps/Snap/res/values/qcomstrings.xml b/overlay/packages/apps/Snap/res/values/qcomstrings.xml old mode 100644 new mode 100755 diff --git a/overlay/packages/services/Telecomm/res/values/config.xml b/overlay/packages/services/Telecomm/res/values/config.xml old mode 100644 new mode 100755 diff --git a/rootdir/Android.mk b/rootdir/Android.mk old mode 100644 new mode 100755 index 0d2923b..e7bd6b7 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -26,14 +26,6 @@ LOCAL_SRC_FILES := etc/init.samsung.rc LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) include $(BUILD_PREBUILT) -include $(CLEAR_VARS) -LOCAL_MODULE := init.target.rc -LOCAL_MODULE_TAGS := optional eng -LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := etc/init.target.rc -LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) -include $(BUILD_PREBUILT) - include $(CLEAR_VARS) LOCAL_MODULE := init.qcom.usb.rc LOCAL_MODULE_TAGS := optional eng diff --git a/rootdir/etc/init.qcom.power.rc b/rootdir/etc/init.qcom.power.rc old mode 100644 new mode 100755 index 96281b4..80d1dde --- a/rootdir/etc/init.qcom.power.rc +++ b/rootdir/etc/init.qcom.power.rc @@ -70,7 +70,7 @@ on charger write /sys/devices/system/cpu/cpu2/online 0 write /sys/devices/system/cpu/cpu3/online 0 write /sys/module/msm_thermal/parameters/enabled "N" - start hvdcp_opti + start vendor.hvdcp_opti start thermal-engine on enable-low-power @@ -97,7 +97,7 @@ on enable-low-power write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 19000 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 79000 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 307200 - write /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif 1 + write /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif 0 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/enable_prediction 1 # Bring CPU2 online @@ -107,16 +107,16 @@ on enable-low-power write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "interactive" write /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_sched_load 1 write /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_migration_notif 1 - write /sys/devices/system/cpu/cpu2/cpufreq/interactive/above_hispeed_delay "19000 1400000:39000 1700000:19000 2100000:79000" + write /sys/devices/system/cpu/cpu2/cpufreq/interactive/above_hispeed_delay "19000 1400000:39000 1700000:39000 2100000:79000" write /sys/devices/system/cpu/cpu2/cpufreq/interactive/go_hispeed_load 90 write /sys/devices/system/cpu/cpu2/cpufreq/interactive/timer_rate 20000 write /sys/devices/system/cpu/cpu2/cpufreq/interactive/hispeed_freq 1248000 write /sys/devices/system/cpu/cpu2/cpufreq/interactive/io_is_busy 1 - write /sys/devices/system/cpu/cpu2/cpufreq/interactive/target_loads "85 1500000:90 1800000:70 2100000:95" + write /sys/devices/system/cpu/cpu2/cpufreq/interactive/target_loads "85 1500000:90 1800000:95 2100000:99" write /sys/devices/system/cpu/cpu2/cpufreq/interactive/min_sample_time 19000 - write /sys/devices/system/cpu/cpu2/cpufreq/interactive/max_freq_hysteresis 79000 + write /sys/devices/system/cpu/cpu2/cpufreq/interactive/max_freq_hysteresis 39000 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 307200 - write /sys/devices/system/cpu/cpu2/cpufreq/interactive/ignore_hispeed_on_notif 1 + write /sys/devices/system/cpu/cpu2/cpufreq/interactive/ignore_hispeed_on_notif 0 write /sys/devices/system/cpu/cpu2/cpufreq/interactive/enable_prediction 1 # Re-enable thermal hotplug @@ -177,6 +177,12 @@ on property:sys.boot_completed=1 # Start I/O prefetcher service start iop + # Update cpusets now that boot is complete and we want better load balancing + write /dev/cpuset/top-app/cpus 0-3 + write /dev/cpuset/foreground/cpus 0-2 + write /dev/cpuset/background/cpus 0 + write /dev/cpuset/system-background/cpus 0-2 + on property:init.svc.recovery=running trigger enable-low-power @@ -191,7 +197,7 @@ service energy-awareness /vendor/bin/energy-awareness group system oneshot -service hvdcp_opti /vendor/bin/hvdcp_opti +service vendor.hvdcp_opti /vendor/bin/hvdcp_opti class main user root group system wakelock diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc old mode 100644 new mode 100755 index 07bc191..6eeef73 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -1,4 +1,4 @@ -# Copyright (c) 2009-2012, 2014-2017, The Linux Foundation. All rights reserved. +# Copyright (c) 2009-2012, 2014-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: @@ -27,7 +27,6 @@ import init.qcom.power.rc import init.qcom.usb.rc -import init.target.rc import init.samsung.rc on early-init @@ -36,18 +35,11 @@ on early-init chown root system /dev/kmsg chmod 0620 /dev/kmsg - symlink /data/tombstones /tombstones - # ZRAM setup write /sys/block/zram0/comp_algorithm lz4 write /proc/sys/vm/page-cluster 0 on init - # Set permissions for persist partition - mkdir /persist 0771 root system - - symlink /sdcard /storage/sdcard0 - # Create cgroup mount point for memory mkdir /sys/fs/cgroup/memory/bg 0750 root system write /sys/fs/cgroup/memory/bg/memory.swappiness 140 @@ -63,6 +55,17 @@ on fs mount_all /vendor/etc/fstab.qcom + # Set permissions for persist partition + chown root system /mnt/vendor/persist + chmod 0771 /mnt/vendor/persist + mkdir /mnt/vendor/persist/bluetooth 0770 bluetooth bluetooth + mkdir /mnt/vendor/persist/bms 0700 root system + mkdir /mnt/vendor/persist/data 0700 system system + mkdir /mnt/vendor/persist/display 0770 system graphics + mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system + mkdir /mnt/vendor/persist/time 0770 system system + restorecon_recursive /mnt/vendor/persist + on late-fs # boot time fs tune write /sys/block/sda/queue/iostats 0 @@ -95,19 +98,14 @@ on post-fs-data mkdir /data/misc/camera 0770 camera camera mkdir /data/vendor/camera 0770 camera camera - mkdir /data/media 0770 media_rw media_rw - chown media_rw media_rw /data/media - mkdir /data/vendor/ramdump 0771 root system mkdir /data/vendor/bluetooth 0770 bluetooth bluetooth mkdir /data/vendor/ramdump/bluetooth 0770 bluetooth bluetooth # Create the directories used by the Wireless subsystem - mkdir /data/misc/wifi 0770 wifi wifi - mkdir /data/misc/wifi/sockets 0770 wifi wifi - mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi - mkdir /data/misc/dhcp 0770 dhcp dhcp - chown dhcp dhcp /data/misc/dhcp + mkdir /data/vendor/wifi 0770 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi # Create netmgr log dir mkdir /data/vendor/netmgr 0770 radio radio @@ -118,8 +116,8 @@ on post-fs-data chmod 0770 /data/vendor/ipa # Create the directories used by CnE subsystem - mkdir /data/connectivity 0771 system system - chown system system /data/connectivity + mkdir /data/vendor/connectivity 0771 radio radio + chown radio radio /data/vendor/connectivity # Create directory used by audio subsystem mkdir /data/vendor/misc/audio 0770 audio audio @@ -131,10 +129,16 @@ on post-fs-data # Create directory for radio mkdir /data/vendor/radio 0770 system radio + # Create directory for modem_config + mkdir /data/vendor/modem_config 0570 radio root + # Create directories for Location services mkdir /data/vendor/location 0770 gps gps mkdir /data/vendor/location/mq 0770 gps gps mkdir /data/vendor/location/xtwifi 0770 gps gps + mkdir /dev/socket/location 0770 gps gps + mkdir /dev/socket/location/mq 0770 gps gps + mkdir /dev/socket/location/xtra 0770 gps gps # SSC/SLPI sensors mkdir /persist/sensors @@ -154,8 +158,8 @@ on post-fs-data chown root system /dev/sensors chmod 0660 /dev/sensors - # Create /data/time folder for time-services - mkdir /data/time/ 0700 system system + # Create /data/vendor/time folder for time-services + mkdir /data/vendor/time 0700 system system setprop vold.post_fs_data_done 1 @@ -169,7 +173,7 @@ on post-fs-data mkdir /data/nfc/param 0770 nfc nfc # Create IOP deamon related dirs - mkdir /data/vendor/iop 0770 root system + mkdir /data/vendor/iop 0700 root system # Mark the copy complete flag to not completed write /data/vendor/radio/copy_complete 0 @@ -318,7 +322,7 @@ on property:sys.boot_completed=1 on property:persist.env.fastdorm.enabled=true setprop persist.radio.data_no_toggle 1 -service cnd /vendor/bin/cnd +service vendor.cnd /vendor/bin/cnd class main user system group system wifi inet radio wakelock net_admin @@ -334,7 +338,7 @@ service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" user root oneshot -service rmt_storage /vendor/bin/rmt_storage +service vendor.rmt_storage /vendor/bin/rmt_storage class core user root group system wakelock @@ -342,60 +346,60 @@ service rmt_storage /vendor/bin/rmt_storage ioprio rt 0 writepid /dev/cpuset/system-background/tasks -service tftp_server /vendor/bin/tftp_server +service vendor.tftp_server /vendor/bin/tftp_server class core user root writepid /dev/cpuset/system-background/tasks -on property:wc_transport.start_hci=true - start start_hci_filter +on property:vendor.wc_transport.start_hci=true + start vendor.start_hci_filter -on property:wc_transport.start_hci=false - stop start_hci_filter +on property:vendor.wc_transport.start_hci=false + stop vendor.start_hci_filter -service start_hci_filter /vendor/bin/wcnss_filter +service vendor.start_hci_filter /vendor/bin/wcnss_filter class late_start user bluetooth - group bluetooth oem_2950 + group bluetooth diag system wakelock disabled -on property:wc_transport.start_root=true - start hci_filter_root +on property:vendor.wc_transport.start_root=true + start vendor.hci_filter_root -on property:wc_transport.start_root=false - stop hci_filter_root +on property:vendor.wc_transport.start_root=false + stop vendor.hci_filter_root -service hci_filter_root /vendor/bin/wcnss_filter +service vendor.hci_filter_root /vendor/bin/wcnss_filter class late_start user bluetooth group bluetooth oem_2950 system disabled -service atfwd /vendor/bin/ATFWD-daemon +service vendor.atfwd /vendor/bin/ATFWD-daemon class late_start user system group system radio writepid /dev/cpuset/system-background/tasks -service netmgrd /vendor/bin/netmgrd +service vendor.netmgrd /vendor/bin/netmgrd class main user root group root wifi wakelock radio inet writepid /dev/cpuset/system-background/tasks -service ipacm /vendor/bin/ipacm +service vendor.ipacm /vendor/bin/ipacm class main user radio group radio inet writepid /dev/cpuset/system-background/tasks -service qti /vendor/bin/qti +service vendor.dataqti /vendor/bin/qti class main user radio - group radio oem_2950 usb + group radio oem_2901 diag usb writepid /dev/cpuset/system-background/tasks -service sensors /vendor/bin/sensors.qcom +service vendor.sensors /vendor/bin/sensors.qcom class core user system group system @@ -404,9 +408,9 @@ service sensors /vendor/bin/sensors.qcom capabilities NET_BIND_SERVICE writepid /dev/cpuset/system-background/tasks -on property:ro.use_data_netmgrd=false +on property:ro.vendor.use_data_netmgrd=false # netmgr not supported on specific target - stop netmgrd + stop vendor.netmgrd # Adjust socket buffer to enlarge TCP receive window for high bandwidth # but only if ro.data.large_tcp_window_size property is set. @@ -417,16 +421,14 @@ on property:sys.sysctl.tcp_adv_win_scale=* write /proc/sys/net/ipv4/tcp_adv_win_scale ${sys.sysctl.tcp_adv_win_scale} service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ - -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ - -I/vendor/etc/wifi/p2p_supplicant_overlay.conf -N \ - -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ - -I/vendor/etc/wifi/wpa_supplicant_overlay.conf \ - -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \ - -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 + -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 \ + -g@android:wpa_wlan0 # we will start as root and wpa_supplicant will switch to user wifi # after setting up the capabilities required for WEXT # user wifi # group wifi inet keystore + interface android.hardware.wifi.supplicant@1.0::ISupplicant default + interface android.hardware.wifi.supplicant@1.1::ISupplicant default class main socket wpa_wlan0 dgram 660 wifi wifi disabled @@ -436,14 +438,15 @@ service cnss-daemon /vendor/bin/cnss-daemon -n -l class late_start user system group system inet net_admin wifi + capabilities NET_ADMIN -on property:sys.shutdown.requested=* +on property:sys.powerctl=* stop cnss-daemon service loc_launcher /vendor/bin/loc_launcher - #loc_launcher will start as root and set its uid to gps class late_start - group gps inet diag wifi + user gps + group gps writepid /dev/cpuset/system-background/tasks service qcom-sh /vendor/bin/init.qcom.sh @@ -451,20 +454,18 @@ service qcom-sh /vendor/bin/init.qcom.sh user root oneshot -service panel-sh /vendor/bin/init.panel.sh - class core - user root - oneshot +on property:ro.vendor.ril.mbn_copy_completed=1 + write /data/vendor/radio/copy_complete 1 on property:ro.data.large_tcp_window_size=true # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB) write /proc/sys/net/ipv4/tcp_adv_win_scale 2 -service ril-daemon2 /vendor/bin/hw/rild -c 2 - class main - user radio - group radio cache inet misc audio log readproc wakelock oem_2901 - capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW +#service ril-daemon2 /vendor/bin/hw/rild -c 2 +# class main +# user radio +# group radio cache inet misc audio log readproc wakelock +# capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW service qseecomd /vendor/bin/qseecomd class core @@ -505,18 +506,6 @@ on property:init.svc.per_mgr=running on property:sys.shutdown.requested=* stop per_proxy -service readfem /vendor/bin/readfem - class main - user root - group root oem_2950 - oneshot - -service readmac /vendor/bin/readmac - class main - user root - group root oem_2950 - oneshot - service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine-8996.conf} class main user root @@ -524,7 +513,7 @@ service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/ven socket thermal-recv-client stream 0660 system system socket thermal-recv-passive-client stream 0666 system system socket thermal-send-rule stream 0660 system system - group root + group system root diag writepid /dev/cpuset/system-background/tasks service adsprpcd /vendor/bin/adsprpcd @@ -532,14 +521,16 @@ service adsprpcd /vendor/bin/adsprpcd user media group media -service imsqmidaemon /vendor/bin/imsqmidaemon +# imsdatadaemon starts with root and UID will be downgraded to SYSTEM. +service vendor.imsqmidaemon /vendor/bin/imsqmidaemon class main user system socket ims_qmid stream 0660 system radio group radio log diag writepid /dev/cpuset/system-background/tasks -service imsdatadaemon /vendor/bin/imsdatadaemon +# imsdatadaemon starts with root and UID will be downgraded to SYSTEM. +service vendor.imsdatadaemon /vendor/bin/imsdatadaemon class main user system socket ims_datad stream 0660 system radio @@ -548,9 +539,9 @@ service imsdatadaemon /vendor/bin/imsdatadaemon disabled on property:vendor.ims.QMI_DAEMON_STATUS=1 - start imsdatadaemon + start vendor.imsdatadaemon -service ims_rtp_daemon /vendor/bin/ims_rtp_daemon +service vendor.ims_rtp_daemon /vendor/bin/ims_rtp_daemon class main user system group radio diag inet log @@ -564,35 +555,18 @@ service vendor.imsrcsservice /vendor/bin/imsrcsd disabled on property:vendor.ims.DATA_DAEMON_STATUS=1 - start ims_rtp_daemon + start vendor.ims_rtp_daemon start vendor.imsrcsservice service ppd /vendor/bin/mm-pp-dpps - class late_start + class hal user system group system graphics socket pps stream 0660 system system - disabled - -on property:init.svc.surfaceflinger=stopped - stop ppd - -on property:init.svc.surfaceflinger=running - start ppd on property:init.svc.surfaceflinger=restarting - stop hwcomposer-2-1 - start hwcomposer-2-1 - stop ppd - -on property:init.svc.zygote=stopped - stop ppd - -on property:init.svc.zygote=running - start ppd - -on property:init.svc.zygote=restarting - stop ppd + stop vendor.hwcomposer-2-1 + start vendor.hwcomposer-2-1 on property:slpi.restart=1 write /sys/kernel/debug/msm_subsys/slpi restart diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh old mode 100644 new mode 100755 index b6474e2..e0b454a --- a/rootdir/etc/init.qcom.sh +++ b/rootdir/etc/init.qcom.sh @@ -26,10 +26,6 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# Set shared buttons and touchpanel nodes ownership (these are proc_symlinks to the real sysfs nodes) -chown -LR system.system /proc/buttons -chown -LR system.system /proc/touchpanel - # # Make modem config folder and copy firmware config to that folder for RIL # diff --git a/rootdir/etc/init.qcom.usb.rc b/rootdir/etc/init.qcom.usb.rc old mode 100644 new mode 100755 diff --git a/rootdir/etc/init.samsung.rc b/rootdir/etc/init.samsung.rc old mode 100644 new mode 100755 index 4030ab4..be08ff0 --- a/rootdir/etc/init.samsung.rc +++ b/rootdir/etc/init.samsung.rc @@ -276,3 +276,7 @@ on boot #Meta event chown system radio /sys/class/sensors/sensor_dev/flush + +service wifiloader /system/bin/wifiloader + class main + oneshot diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc deleted file mode 100644 index a159620..0000000 --- a/rootdir/etc/init.target.rc +++ /dev/null @@ -1,531 +0,0 @@ -# Copyright (c) 2013-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. -# -# - -on early-init - mkdir /firmware 0771 system system - mkdir /bt_firmware 0771 system system - mkdir /firmware-modem 0771 system system - symlink /data/tombstones /tombstones - mkdir /dsp 0771 media media - -on fs - wait /dev/block/platform/soc/${ro.boot.bootdevice} - symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice - mount_all /vendor/etc/fstab.qcom - swapon_all /vendor/etc/fstab.qcom - - # Keeping following partitions outside fstab file. As user may not have - # these partition flashed on the device. Failure to mount any partition in fstab file - # results in failure to launch late-start class. - - wait /dev/block/bootdevice/by-name/cache - mount ext4 /dev/block/bootdevice/by-name/cache /cache nosuid nodev noatime noauto_da_alloc,discard,journal_async_commit,errors=panic - - wait /dev/block/bootdevice/by-name/persist - mount ext4 /dev/block/bootdevice/by-name/persist /persist noatime nosuid nodev barrier=1 - mkdir /persist/data 0700 system system - mkdir /persist/bms 0700 root system - restorecon_recursive /persist - - wait /dev/block/bootdevice/by-name/efs - mount ext4 /dev/block/bootdevice/by-name/efs /efs nosuid nodev noatime noauto_da_alloc,discard,journal_async_commit,errors=panic - chown radio system /efs - chmod 0771 /efs - restorecon -R /efs - - wait /dev/block/bootdevice/by-name/dsp - mount ext4 /dev/block/bootdevice/by-name/dsp /dsp ro nosuid nodev barrier=1 - - wait /dev/block/bootdevice/by-name/apnhlos - mount vfat /dev/block/bootdevice/by-name/apnhlos /firmware ro shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 - - wait /dev/block/bootdevice/by-name/modem - mount vfat /dev/block/bootdevice/by-name/modem /firmware-modem ro shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 - - wait /dev/block/bootdevice/by-name/bluetooth - mount vfat /dev/block/bootdevice/by-name/bluetooth /bt_firmware ro shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 - -on init - write /sys/module/qpnp_rtc/parameters/poweron_alarm 1 - write /sys/power/cpufreq_max_limit 1920000 - -on post-fs-data - mkdir /data/tombstones 0771 system system - mkdir /tombstones/modem 0771 system system - mkdir /tombstones/lpass 0771 system system - mkdir /tombstones/wcnss 0771 system system - mkdir /tombstones/dsps 0771 system system - mkdir /persist/data/sfs 0700 system system - mkdir /persist/data/tz 0700 system system - mkdir /persist/qti_fp 0700 system system - mkdir /data/misc/dts 0770 media audio - mkdir /data/misc/seemp 0700 system system - mkdir /data/usf 0700 system system - mkdir /data/misc/tloc/ 0700 system drmrpc - mkdir /data/misc/qvr 0770 system system - mkdir /data/misc/audio_pp 0771 media audio - - # Add a cpuset for the camera daemon - # We want all cores for camera - mkdir /dev/cpuset/camera-daemon - write /dev/cpuset/camera-daemon/cpus 0-3 - write /dev/cpuset/camera-daemon/mems 0 - chown cameraserver cameraserver /dev/cpuset/camera-daemon - chown cameraserver cameraserver /dev/cpuset/camera-daemon/tasks - chmod 0660 /dev/cpuset/camera-daemon/tasks - -#Create folder for mm-qcamera-daemon -mkdir /data/vendor/camera 0770 camera camera - -on property:init.svc.bootanim=running - write /sys/class/leds/wled/brightness 4095 - -on boot - start rmt_storage - start rfs_access - -# BarTender - mkdir /dev/cpuctl/bg_cached - chown system system /dev/cpuctl/bg_cached/tasks - chown system system /dev/cpuctl/bg_cached/cpu.cfs_period_us - chown system system /dev/cpuctl/bg_cached/cpu.cfs_quota_us - chmod 0666 /dev/cpuctl/bg_cached/tasks - chmod 0664 /dev/cpuctl/bg_cached/cpu.cfs_period_us - chmod 0664 /dev/cpuctl/bg_cached/cpu.cfs_quota_us - write /dev/cpuctl/bg_cached/cpu.rt_runtime_us 10000 - write /dev/cpuctl/bg_cached/cpu.rt_period_us 1000000 - write /dev/cpuctl/bg_cached/cpu.cfs_period_us 20000 - write /dev/cpuctl/bg_cached/cpu.cfs_quota_us 10000 - - mkdir /dev/cpuctl/bg_abnormal - chown system system /dev/cpuctl/bg_abnormal/tasks - chown system system /dev/cpuctl/bg_abnormal/cpu.cfs_period_us - chown system system /dev/cpuctl/bg_abnormal/cpu.cfs_quota_us - chmod 0666 /dev/cpuctl/bg_abnormal/tasks - chmod 0664 /dev/cpuctl/bg_abnormal/cpu.cfs_period_us - chmod 0664 /dev/cpuctl/bg_abnormal/cpu.cfs_quota_us - write /dev/cpuctl/bg_abnormal/cpu.rt_runtime_us 10000 - write /dev/cpuctl/bg_abnormal/cpu.rt_period_us 1000000 - write /dev/cpuctl/bg_abnormal/cpu.cfs_period_us 20000 - write /dev/cpuctl/bg_abnormal/cpu.cfs_quota_us 10000 - - mkdir /dev/cpuset/cached - write /dev/cpuset/cached/cpus 1-3 - copy /dev/cpuset/mems /dev/cpuset/cached/mems - mkdir /dev/cpuset/abnormal - write /dev/cpuset/abnormal/cpus 1-3 - copy /dev/cpuset/mems /dev/cpuset/abnormal/mems - - # change permissions for BarTender's cpusets we'll touch at runtime - chown system system /dev/cpuset/cached - chown system system /dev/cpuset/abnormal - chown system system /dev/cpuset/cached/tasks - chown system system /dev/cpuset/abnormal/tasks - chown system system /dev/cpuset/cached/cpus - chown system system /dev/cpuset/abnormal/cpus - chmod 0664 /dev/cpuset/cached/tasks - chmod 0664 /dev/cpuset/abnormal/tasks - chmod 0664 /dev/cpuset/cached/cpus - chmod 0664 /dev/cpuset/abnormal/cpus - - #CPUSET(8996) - chown system system /dev/cpuset/top-app/cpus - chown system system /dev/cpuset/foreground/cpus - chown system system /dev/cpuset/background/cpus - chown system system /dev/cpuset/system-background/cpus - chown system system /dev/cpuset/surfaceflinger/cpus - chmod 664 /dev/cpuset/top-app/cpus - chmod 664 /dev/cpuset/foreground/cpus - chmod 664 /dev/cpuset/background/cpus - chmod 664 /dev/cpuset/system-background/cpus - chmod 664 /dev/cpuset/surfaceflinger/cpus - write /dev/cpuset/top-app/cpus 0-3 - write /dev/cpuset/top-app/mems 0 - write /dev/cpuset/foreground/cpus 0-3 - write /dev/cpuset/foreground/mems 0 - write /dev/cpuset/background/cpus 1-3 - write /dev/cpuset/background/mems 0 - write /dev/cpuset/system-background/cpus 0-1 - write /dev/cpuset/system-background/mems 0 - write /dev/cpuset/surfaceflinger/cpus 0-2,4-7 - write /dev/cpuset/surfaceflinger/mems 0 - -# access permission for secure touch - chmod 0660 /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch_enable - chmod 0440 /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch - chown system drmrpc /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch_enable - chown system drmrpc /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch - write /proc/sys/kernel/sched_boost 1 - write /sys/devices/soc/75ba000.i2c/i2c-12/12-0020/input/input0/update_fw 1 - chmod 0660 /sys/module/app_setting/parameters/lib_name - chown system system /sys/module/app_setting/parameters/lib_name - -#start camera server as daemon -service qcamerasvr /system/vendor/bin/mm-qcamera-daemon - class late_start - user camera - group camera system inet input graphics - -#fingerprint service -service fingerprintd /system/bin/fingerprintd - class late_start - user system - group system - -service qfp-daemon /system/vendor/bin/qfp-daemon - class late_start - user system - group system drmrpc diag input - -service fps_hal /system/vendor/bin/fingerprint.qcom - class late_start - user system - group system input - -service qvrd /system/vendor/bin/qvrservice - class late_start - user system - group system camera graphics - socket qvrservice stream 0666 system system - -#Start up peripheral manager -service per_mgr /vendor/bin/pm-service - class core - user system - group system net_raw - ioprio rt 4 - -service per_proxy /vendor/bin/pm-proxy - class core - user system - group system - disabled - -on property:init.svc.per_mgr=running - start per_proxy - -on property:sys.shutdown.requested=* - stop per_proxy - -service mdm_launcher /system/bin/sh init.mdm.sh - class core - oneshot - -service mdm_helper /system/bin/mdm_helper - class core - group root system - disabled -## Allow usb charging to be disabled peristently -#on property:persist.usb.chgdisabled=1 -# write /sys/class/power_supply/battery/charging_enabled 0 -# -#on property:persist.usb.chgdisabled=0 -# write /sys/class/power_supply/battery/charging_enabled 1 -# -#service qrngd /system/bin/qrngd -f -# class main -# user root -# group root -# -#service qrngp /system/bin/qrngp -# class main -# user root -# group root -# oneshot -# disabled -# -#on property:sys.boot_completed=1 -# start qrngp - -service qseecomd /vendor/bin/qseecomd - class core - user root - group root - -service gamed /system/vendor/bin/gamed - class main - user system - group system - disabled - socket gamed seqpacket 0640 system system - -service seempd /system/vendor/bin/seempd - class late_start - user system - group system - socket seempdw dgram 0666 system system - -service secotad /system/vendor/bin/secotad - class late_start - user system - group system - -#service mpdecision /system/vendor/bin/mpdecision --avg_comp -# user root -# disabled -# -#service qosmgrd /system/bin/qosmgr /system/etc/qosmgr_rules.xml -# user system -# group system -# disabled -# -service thermal-engine /system/vendor/bin/thermal-engine - class main - user root - socket thermal-send-client stream 0666 system system - socket thermal-recv-client stream 0660 system system - socket thermal-recv-passive-client stream 0666 system system - socket thermal-send-rule stream 0660 system system - group root - socket thermal-send-client stream 0666 system system - socket thermal-recv-client stream 0660 system system - socket thermal-recv-passive-client stream 0666 system system - -#service security-check1 /sbin/security_boot_check system -# class core -# oneshot -# -#service security-check2 /sbin/security_boot_check recovery -# class core -# oneshot -# -service time_daemon /system/vendor/bin/time_daemon - class late_start - user root - group root - -service adsprpcd /system/vendor/bin/adsprpcd - class main - user media - group media - -service audiod /system/vendor/bin/audiod - class late_start - user system - group system - - -service usf_tester /system/vendor/bin/usf_tester - user system - group system inet - disabled - oneshot - -service usf_epos /system/vendor/bin/usf_epos - class main - user system - group system inet - disabled - oneshot - -service usf_gesture /system/vendor/bin/usf_gesture - user system - group system inet - disabled - oneshot - -service usf_sync_gesture /system/vendor/bin/usf_sync_gesture - user system - group system inet audio - disabled - oneshot - -service usf_p2p /system/vendor/bin/usf_p2p - user system - group system inet - disabled - oneshot - -service usf_hovering /system/vendor/bin/usf_hovering - user system - group system inet - disabled - oneshot - -service usf_proximity /system/vendor/bin/usf_proximity - class late_start - user system - group system inet audio - -service usf_pairing /system/vendor/bin/usf_pairing - user system - group system inet - disabled - oneshot - -service usf_sw_calib /system/vendor/bin/usf_sw_calib - user system - group system inet - disabled - oneshot - -service usf-post-boot /system/vendor/bin/sh /system/etc/usf_post_boot.sh - class late_start - user root - disabled - oneshot - -on property:init.svc.bootanim=stopped - start usf-post-boot - -service imsqmidaemon /system/vendor/bin/imsqmidaemon - class main - user system - socket ims_qmid stream 0660 system radio - group radio log diag - -service imsdatadaemon /system/vendor/bin/imsdatadaemon - class main - user system - socket ims_datad stream 0660 system radio - group system wifi radio inet log diag - disabled - -service pd_mapper /system/vendor/bin/pd-mapper - class core - disabled - -on property:persist.sys.pd_enable=1 - start pd_mapper - write /sys/class/service_locator/service_locator_status 1 - -on property:persist.sys.pd_enable=0 - write /sys/class/service_locator/service_locator_status 0 - -# -## QCA1530 SoC late_start group trigger -#service gnss-init /system/vendor/bin/gnss.qca1530.sh init -# class late_start -# oneshot -# -on property:vendor.ims.QMI_DAEMON_STATUS=1 - start imsdatadaemon - -service ims_rtp_daemon /system/vendor/bin/ims_rtp_daemon - class main - user system - group radio diag inet log - disabled - -service vendor.imsrcsservice /system/vendor/bin/imsrcsd - class main - user system - group radio diag inet log - disabled - -on property:vendor.ims.DATA_DAEMON_STATUS=1 - start ims_rtp_daemon - start vendor.imsrcsservice - -service dts_configurator /system/vendor/bin/dts_configurator - class late_start - user system - group system media audio - oneshot - -service dtseagleservice /system/vendor/bin/dts_eagle_service - class late_start - user system - group audio media - disabled - -on property:init.svc.dts_configurator=stopped - start dtseagleservice - -on property:init.svc.surfaceflinger=stopped - stop ppd - -on property:init.svc.surfaceflinger=running - start ppd - -on property:init.svc.surfaceflinger=restarting - stop ppd - -on property:init.svc.zygote=stopped - stop ppd - -on property:init.svc.zygote=running - start ppd - -on property:init.svc.zygote=restarting - stop ppd - -service tlocd /system/bin/tloc_daemon - class late_start - user system - group drmrpc gps net_raw - -service energy-awareness /system/vendor/bin/energy-awareness - class main - user root - group system - oneshot - -service mdtpd /system/vendor/bin/mdtpd - class late_start - user root - group system radio drmrpc - -on charger - write /sys/devices/system/cpu/cpu2/online 0 - write /sys/devices/system/cpu/cpu3/online 0 - write /sys/module/lpm_levels/parameters/sleep_disabled 0 - wait /dev/block/bootdevice/by-name/system - mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1 - -# LPM (samsung charger) -#service lpm /system/bin/lpm -# class charger -# critical - -service dhcpcd_eth0 /system/vendor/bin/dhcpcd -ABKLG - class late_start - disabled - oneshot - -service iprenew_eth0 /system/vendor/bin/dhcpcd -n - class late_start - disabled - oneshot - -service ppd /vendor/bin/mm-pp-dpps - class late_start - user system - group system graphics - socket pps stream 0660 system system - disabled - -#service sec-sh /system/bin/sh /system/etc/init.sec.boot.sh -# class main -# user root -# oneshot - -service wifiloader /system/bin/wifiloader - class main - oneshot diff --git a/rootdir/etc/ueventd.qcom.rc b/rootdir/etc/ueventd.qcom.rc old mode 100644 new mode 100755 index 9d9f24a..af774af --- a/rootdir/etc/ueventd.qcom.rc +++ b/rootdir/etc/ueventd.qcom.rc @@ -26,7 +26,7 @@ # # the DIAG device node is not world writable/readable. -/dev/diag 0660 system oem_2950 +/dev/diag 0660 system oem_2901 /dev/genlock 0666 system system /dev/wlan 0660 wifi wifi @@ -35,7 +35,7 @@ /dev/kgsl-2d0 0666 root root /dev/kgsl-2d1 0666 root root /dev/ion 0664 system system -/dev/rtc0 0660 system system +/dev/rtc0 0640 system system /dev/smd0 0660 system system /dev/smd4 0660 system system /dev/smd_cxm_qmi 0640 radio radio diff --git a/rr.mk b/rr.mk deleted file mode 100644 index d530ff7..0000000 --- a/rr.mk +++ /dev/null @@ -1,20 +0,0 @@ -$(call inherit-product, device/samsung/gts3llte/full_gts3llte.mk) - -# Inherit some common RR stuff. -$(call inherit-product, vendor/rr/config/common_full_phone.mk) - -PRODUCT_NAME := rr_gts3llte -PRODUCT_BRAND := samsung -PRODUCT_MANUFACTURER := samsung -PRODUCT_DEVICE := gts3llte -PRODUCT_MODEL := SM-T825 - -PRODUCT_GMS_CLIENTID_BASE := android-samsung - -BUILD_FINGERPRINT := samsung/gts3lltexx/gts3llte:8.0.0/R16NW/T825XXU1BRE2:user/release-keys - -PRODUCT_BUILD_PROP_OVERRIDES += \ - PRODUCT_NAME=gts3lltexx - -# Root -WITH_SU := true diff --git a/seccomp_policy/mediacodec.policy b/seccomp_policy/mediacodec.policy index 81d042b..73f7379 100644 --- a/seccomp_policy/mediacodec.policy +++ b/seccomp_policy/mediacodec.policy @@ -7,6 +7,5 @@ recvfrom: 1 _llseek: 1 sysinfo: 1 getcwd: 1 -getdents64: 1 inotify_init1: 1 inotify_add_watch: 1 diff --git a/seccomp_policy/mediaextractor.policy b/seccomp_policy/mediaextractor.policy index 77c1e2a..0fcf604 100644 --- a/seccomp_policy/mediaextractor.policy +++ b/seccomp_policy/mediaextractor.policy @@ -2,3 +2,4 @@ # extension of services/mediaextractor/minijail/seccomp_policy/mediaextractor-seccomp-arm.policy readlinkat: 1 pread64: 1 +mremap: 1 diff --git a/sepolicy/add.te b/sepolicy/add.te new file mode 100755 index 0000000..bc8e705 --- /dev/null +++ b/sepolicy/add.te @@ -0,0 +1,2 @@ +#============= sensors ============== +allow sensors efs_file:dir search; diff --git a/sepolicy/add1.te b/sepolicy/add1.te new file mode 100755 index 0000000..4536de5 --- /dev/null +++ b/sepolicy/add1.te @@ -0,0 +1,100 @@ +#============= rfs_access ============== +allow rfs_access self:capability dac_override; + +#============= system_app ============== +allow system_app proc_pagetypeinfo:file { getattr open read }; + +#============= atfwd ============== +allow atfwd sysfs:file { open read }; + +#============= audioserver ============== +allow audioserver vendor_data_file:dir { add_name write }; +allow audioserver vendor_data_file:file { getattr append create open read }; + +#============= cameraserver ============== +allow cameraserver default_prop:property_service set; +allow cameraserver mm-qcamerad:unix_dgram_socket sendto; +allow cameraserver sysfs:file { getattr open read }; + +#============= fsck ============== +allow fsck block_device:blk_file { open read write }; +allow fsck mnt_vendor_file:dir getattr; +allow fsck e2fsck_device:blk_file ioctl; + +#============= hal_bluetooth_qti ============== +allow hal_bluetooth_qti default_prop:property_service set; + +#============= hal_fingerprint_default ============== +allow hal_fingerprint_default fingerprintd_data_file:dir write; + +#============= hal_gnss_qti ============== +allow hal_gnss_qti sysfs:file { read open }; + +#============= hal_health_default ============== +allow hal_health_default sysfs:file { getattr open read }; + +#============= hal_perf_default ============== +allow hal_perf_default default_prop:property_service set; +allow hal_perf_default self:capability dac_override; + +#============= healthd ============== +allow healthd sysfs:file { getattr open read }; + +#============= init ============== +allow init hal_drm_hwservice:hwservice_manager add; +allow init proc:file { open write }; +allow init sysfs:file { open setattr write }; +allow init sysfs_boot_adsp:file { open setattr }; +allow init sysfs_cpu_boost:file { open write }; +allow init sysfs_devices_system_cpu:file write; +allow init sysfs_lowmemorykiller:file { open write }; +allow init sysfs_msm_perf:file setattr; +allow init sysfs_msm_power:file { open write }; +allow init sysfs_poweron_alarm:file { open write }; +allow init sysfs_slpi:file open; +allow init sysfs_thermal:file write; +allow init vendor_file:file execute_no_trans; +allow init sysfs_devfreq:file { open write }; +allow init vndbinder_device:chr_file read; +allow init shell_exec:file execute_no_trans; +allow init sysfs_ea:file setattr; +allow init sysfs_camera:file setattr; +allow init sysfs_lib:file setattr; +allow init sysfs_sensors:lnk_file read; +allow init sysfs_wlan_fwpath:file setattr; + +#============= netmgrd ============== +allow netmgrd sysfs:file { open read }; + +#============= mm-qcamerad ============== +allow mm-qcamerad vendor_default_prop:property_service set; +allow mm-qcamerad default_prop:property_service set; + +#============= rild ============== +allow rild system_prop:property_service set; + +#============= sensors ============== +allow sensors sysfs:file { open read }; + +#============= location ============== +allow location sysfs:file { open read }; + +#============= system_server ============== +allow system_server dalvikcache_data_file:file execute; +allow system_server sensors_persist_file:dir search; +allow system_server sensors_persist_file:file { open read }; +allow system_server vendor_camera_prop:file { getattr open read }; + +#============= tee ============== +allow tee system_prop:property_service set; + +#============= time_daemon ============== +allow time_daemon sysfs:file { open read }; +allow time_daemon time_data_file:dir { add_name write }; +allow time_daemon time_data_file:file { create open read write }; + +#============= vold ============== +allow vold mnt_vendor_file:dir { open read ioctl }; + +#============= webview_zygote ============== +allow webview_zygote zygote:unix_dgram_socket write; diff --git a/sepolicy/add2.te b/sepolicy/add2.te new file mode 100755 index 0000000..d6feedd --- /dev/null +++ b/sepolicy/add2.te @@ -0,0 +1,50 @@ +#============= cnd ============== +allow cnd default_android_hwservice:hwservice_manager add; + +#============= hal_rcsservice ============== +allow hal_rcsservice sysfs:file { open read }; + +#============= ims ============== +allow ims sysfs:file { open read }; + +#============= netmgrd ============== +allow netmgrd default_prop:property_service set; +allow netmgrd init:unix_stream_socket connectto; +allow netmgrd property_socket:sock_file write; + +#============= rmt_storage ============== +allow rmt_storage debugfs:file { open write }; + +#============= shell ============== +allow shell hal_telephony_hwservice:hwservice_manager add; +allow shell hidl_base_hwservice:hwservice_manager add; +allow shell kernel:system syslog_read; +allow shell rild_exec:file execute_no_trans; +allow shell self:socket getattr; +allow shell sysfs:file { open read }; +allow shell vendor_per_mgr_service:service_manager find; + +#============= hal_dpmQmiMgr ============== +allow hal_dpmQmiMgr sysfs:file { open read }; + +#============= hal_imsrtp ============== +allow hal_imsrtp sysfs:file { open read }; + +#============= init ============== +allow init node:tcp_socket node_bind; +allow init self:tcp_socket bind; +allow init diag_device:chr_file { read write ioctl }; + +#============= sensors ============== +allow sensors self:capability dac_override; + +#============= thermal-engine ============== +allow thermal-engine self:capability dac_override; + +#============= qti_init_shell ============== +allow qti_init_shell self:capability dac_override; +allow qti_init_shell system_data_file:dir { add_name create write read open getattr setattr }; +allow qti_init_shell vendor_radio_data_file:dir { add_name create write read open getattr setattr }; + +#============= init ============== +allow init sysfs:file read; diff --git a/sepolicy/add3.te b/sepolicy/add3.te new file mode 100755 index 0000000..35b2e6b --- /dev/null +++ b/sepolicy/add3.te @@ -0,0 +1,37 @@ +#============= audioserver ============== +allow audioserver vendor_audio_data_file:dir { add_name write }; +allow audioserver vendor_audio_data_file:file { append create open read getattr }; + +#============= shell ============== +allow shell self:socket { read write ioctl create }; +allow shell sysfs:file getattr; +allow shell vendor_radio_data_file:dir getattr; +allow shell vendor_radio_prop:file { getattr open read }; +allow shell vndbinder_device:chr_file { ioctl open read write }; +allow shell vndservicemanager:binder call; +allow shell vendor_per_mgr:binder { transfer call }; +allow shell radio_prop:property_service set; +allow shell vendor_radio_prop:property_service set; + +#============= vndservicemanager ============== +allow vndservicemanager shell:dir search; +allow vndservicemanager shell:file { open read }; +allow vndservicemanager shell:process getattr; +allow vndservicemanager shell:binder transfer; + +#============= gallery_app ============== +allow gallery_app vendor_camera_prop:file { getattr open read }; + +#============= hal_memtrack_default ============== +allow hal_memtrack_default debugfs:file { getattr open read }; + +#============= snap_app ============== +allow snap_app vendor_camera_prop:file { getattr open }; + +#============= tee ============== +allow tee gatekeeper_data_file:dir { add_name open write }; +allow tee gatekeeper_data_file:file getattr; +allow tee system_data_file:dir { open read }; + +#============= hal_gnss_qti ============== +allow hal_gnss_qti qmuxd_socket:dir write; diff --git a/sepolicy/add4.te b/sepolicy/add4.te new file mode 100755 index 0000000..ed00838 --- /dev/null +++ b/sepolicy/add4.te @@ -0,0 +1,22 @@ +#============= qti_init_shell ============== +allow qti_init_shell sysfs:file { setattr write }; +allow qti_init_shell sysfs_devfreq:file setattr; +allow qti_init_shell sysfs_devices_system_cpu:file setattr; +allow qti_init_shell sysfs_msm_power:file setattr; +allow qti_init_shell vendor_radio_data_file:file { create read open write getattr setattr }; +allow qti_init_shell default_prop:property_service set; +allow qti_init_shell kmsg_device:chr_file { open write }; +allow qti_init_shell system_prop:property_service set; + +#============= hal_gnss_qti ============== +allow hal_gnss_qti qmuxd_socket:dir { add_name remove_name }; +allow hal_gnss_qti qmuxd_socket:sock_file { create unlink }; + +#============= snap_app ============== +allow snap_app vendor_camera_prop:file read; + +#============= snap_app ============== +allow snap_app vendor_camera_prop:file read; + +#============= tee ============== +allow tee gatekeeper_data_file:file { create write }; diff --git a/sepolicy/add5.te b/sepolicy/add5.te new file mode 100755 index 0000000..b91082e --- /dev/null +++ b/sepolicy/add5.te @@ -0,0 +1,33 @@ +#============= dataservice_app ============== +allow dataservice_app default_android_hwservice:hwservice_manager find; + +#============= hal_sensors_default ============== +allow hal_sensors_default sysfs:file { open read }; + +#============= qti ============== +allow qti sysfs:file { open read }; + +#============= surfaceflinger ============== +allow surfaceflinger default_android_service:service_manager { add find }; +allow surfaceflinger hal_display_config_hwservice:hwservice_manager add; + +#============= cnd ============== +allow cnd sysfs:file { open read }; + +#============= hal_sensors_default ============== +allow hal_sensors_default sysfs:file { getattr write }; + +#============= audioserver ============== +allow audioserver vendor_audio_data_file:dir search; +allow audioserver efs_file:dir search; + +#============= qti_init_shell ============== +allow qti_init_shell ctl_start_prop:property_service set; +allow qti_init_shell ctl_stop_prop:property_service set; +allow qti_init_shell vendor_radio_data_file:dir search; + +#============= surfaceflinger ============== +allow surfaceflinger sysfs_leds:dir search; +allow surfaceflinger mnt_vendor_file:dir search; +allow surfaceflinger display_vendor_data_file:dir search; +allow surfaceflinger persist_display_file:dir search; diff --git a/sepolicy/add_p.te b/sepolicy/add_p.te new file mode 100755 index 0000000..6ee79a8 --- /dev/null +++ b/sepolicy/add_p.te @@ -0,0 +1,32 @@ +#============= system_server ============== +allow system_server mnt_vendor_file:dir search; + +#============= crash_dump ============== +allow crash_dump init:process ptrace; + +#============= init ============== +allow init vndbinder_device:chr_file { open read write ioctl }; + +#============= mm-qcamerad ============== +allow mm-qcamerad sysfs_leds:dir search; + +#============= priv_app ============== +allow priv_app firmware_file:filesystem getattr; +allow priv_app su_exec:file { open read }; +allow priv_app sysfs:file { open read }; + +#============= system_server ============== +allow system_server thermal_service:service_manager find; +allow system_server vfat:dir { open read }; + +#============= untrusted_app ============== +allow untrusted_app proc_tty_drivers:file read; +allow untrusted_app selinuxfs:file read; +allow untrusted_app serialno_prop:file read; + +#============= untrusted_app_27 ============== +allow untrusted_app_27 proc:file read; +allow untrusted_app_27 sysfs_net:dir search; + +#============= hal_bluetooth_qti ============== +allow hal_bluetooth_qti bluetooth_data_file:dir search; diff --git a/sepolicy/adsprpcd.te b/sepolicy/adsprpcd.te old mode 100644 new mode 100755 diff --git a/sepolicy/audioserver.te b/sepolicy/audioserver.te old mode 100644 new mode 100755 diff --git a/sepolicy/bluetooth.te b/sepolicy/bluetooth.te old mode 100644 new mode 100755 diff --git a/sepolicy/cameraserver.te b/sepolicy/cameraserver.te old mode 100644 new mode 100755 diff --git a/sepolicy/device.te b/sepolicy/device.te old mode 100644 new mode 100755 index 5a4f4ab..e98552f --- a/sepolicy/device.te +++ b/sepolicy/device.te @@ -3,3 +3,6 @@ type efs_block_device, dev_type; # Fingerprint type vfsspi_device, dev_type; + +# e2fsck +type e2fsck_device, dev_type; diff --git a/sepolicy/energyawareness.te b/sepolicy/energyawareness.te old mode 100644 new mode 100755 diff --git a/sepolicy/file.te b/sepolicy/file.te old mode 100644 new mode 100755 index ae05941..1136e17 --- a/sepolicy/file.te +++ b/sepolicy/file.te @@ -1,3 +1,5 @@ +type camera_socket, file_type, data_file_type; +type debugfs_rmt, debugfs_type, fs_type; type app_efs_file, file_type; type sysfs_mdnie, fs_type, sysfs_type; type biometrics_data_file, file_type, data_file_type; diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts old mode 100644 new mode 100755 index 5ac611e..f8c6cd6 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -21,6 +21,11 @@ # TimeKeep /system/bin/timekeep u:object_r:timekeep_exec:s0 +/data/camera(/.*)? u:object_r:camera_socket:s0 + +# Data vendor files +/data/vendor/misc/audio(/.*)? u:object_r:vendor_audio_data_file:s0 + /dev/mobicore u:object_r:tee_device:s0 /dev/mobicore-user u:object_r:tee_device:s0 @@ -30,5 +35,12 @@ /system/bin/wifiloader u:object_r:wifiloader_exec:s0 +/vendor/bin/factory.adsp u:object_r:wifiloader_exec:s0 + /system/vendor/bin/hw/vendor\.samsung\.hardware\.biometrics\.fingerprint@2\.1-service u:object_r:hal_fingerprint_default_exec:s0 +/dev/block/mmcblk0p27 u:object_r:e2fsck_device:s0 + +# HALs +/(vendor|system/vendor)/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.drm@1\.1-service\.widevine u:object_r:hal_drm_widevine_exec:s0 diff --git a/sepolicy/fingerprintd.te b/sepolicy/fingerprintd.te old mode 100644 new mode 100755 diff --git a/sepolicy/fsck.te b/sepolicy/fsck.te old mode 100644 new mode 100755 index 3e0605f..9d69b1e --- a/sepolicy/fsck.te +++ b/sepolicy/fsck.te @@ -3,3 +3,5 @@ allow fsck block_device:blk_file { ioctl }; allow fsck cache_file:dir getattr; allow fsck persist_file:dir getattr; allow fsck efs_file:dir getattr; + +allow fsck e2fsck_device:blk_file { open read write }; diff --git a/sepolicy/genfs_contexts b/sepolicy/genfs_contexts new file mode 100755 index 0000000..f94e9eb --- /dev/null +++ b/sepolicy/genfs_contexts @@ -0,0 +1 @@ +genfscon debugfs /rmt_storage u:object_r:debugfs_rmt:s0 diff --git a/sepolicy/hal_bluetooth_default.te b/sepolicy/hal_bluetooth_default.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_bluetooth_qti.te b/sepolicy/hal_bluetooth_qti.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_camera_default.te b/sepolicy/hal_camera_default.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_drm_widevine.te b/sepolicy/hal_drm_widevine.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_fingerprint_default.te b/sepolicy/hal_fingerprint_default.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_keymaster_default.te b/sepolicy/hal_keymaster_default.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_perf_default.te b/sepolicy/hal_perf_default.te old mode 100644 new mode 100755 diff --git a/sepolicy/hal_wifi_default.te b/sepolicy/hal_wifi_default.te old mode 100644 new mode 100755 diff --git a/sepolicy/hvdcp.te b/sepolicy/hvdcp.te old mode 100644 new mode 100755 index f353d70..9ab5058 --- a/sepolicy/hvdcp.te +++ b/sepolicy/hvdcp.te @@ -1,2 +1,3 @@ allow hvdcp sysfs:file { open read }; allow hvdcp sysfs:dir write; +allow hvdcp self:capability dac_override; diff --git a/sepolicy/hwservice_contexts b/sepolicy/hwservice_contexts old mode 100644 new mode 100755 index 0a04a99..4912d12 --- a/sepolicy/hwservice_contexts +++ b/sepolicy/hwservice_contexts @@ -1,2 +1 @@ vendor.samsung.hardware.biometrics.fingerprint::ISecBiometricsFingerprint u:object_r:hal_fingerprint_hwservice:s0 - diff --git a/sepolicy/hwservicemanager.te b/sepolicy/hwservicemanager.te old mode 100644 new mode 100755 diff --git a/sepolicy/init.te b/sepolicy/init.te old mode 100644 new mode 100755 diff --git a/sepolicy/installd.te b/sepolicy/installd.te old mode 100644 new mode 100755 diff --git a/sepolicy/kernel.te b/sepolicy/kernel.te old mode 100644 new mode 100755 diff --git a/sepolicy/keystore.te b/sepolicy/keystore.te old mode 100644 new mode 100755 diff --git a/sepolicy/location.te b/sepolicy/location.te old mode 100644 new mode 100755 diff --git a/sepolicy/loop.te b/sepolicy/loop.te new file mode 100755 index 0000000..27c486c --- /dev/null +++ b/sepolicy/loop.te @@ -0,0 +1 @@ +allow kernel {tmpfs system_block_device}:blk_file read; diff --git a/sepolicy/mediacodec.te b/sepolicy/mediacodec.te old mode 100644 new mode 100755 diff --git a/sepolicy/mediaextractor.te b/sepolicy/mediaextractor.te old mode 100644 new mode 100755 diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te old mode 100644 new mode 100755 diff --git a/sepolicy/mm-qcamerad.te b/sepolicy/mm-qcamerad.te old mode 100644 new mode 100755 index c80e27f..41472fd --- a/sepolicy/mm-qcamerad.te +++ b/sepolicy/mm-qcamerad.te @@ -1,9 +1,14 @@ +allow mm-qcamerad camera_data_file:sock_file { create unlink }; +allow mm-qcamerad camera_data_file:dir search; + +allow mm-qcamerad camera_socket:dir w_dir_perms; +allow mm-qcamerad camera_socket:sock_file { create unlink write }; + allow mm-qcamerad dsp_file:dir r_dir_perms; allow mm-qcamerad dsp_file:file r_file_perms; allow mm-qcamerad unlabeled:file { getattr open read }; allow mm-qcamerad sysfs:file { getattr open read write }; allow mm-qcamerad camera_data_file:sock_file { create unlink }; -allow mm-qcamerad camera_socket:dir read; allow mm-qcamerad system_prop:property_service set; allow mm-qcamerad sysfs_camera:dir search; -allow mm-qcamerad sysfs_camera:file { getattr open read write }; +allow mm-qcamerad sysfs_camera:file { getattr open read write }; \ No newline at end of file diff --git a/sepolicy/netd.te b/sepolicy/netd.te old mode 100644 new mode 100755 diff --git a/sepolicy/netmgrd.te b/sepolicy/netmgrd.te old mode 100644 new mode 100755 diff --git a/sepolicy/netutils_wrapper.te b/sepolicy/netutils_wrapper.te old mode 100644 new mode 100755 index f65dbea..0cac4aa --- a/sepolicy/netutils_wrapper.te +++ b/sepolicy/netutils_wrapper.te @@ -1,2 +1,2 @@ -allow netutils_wrapper data_test_data_file:file { read write }; +#allow netutils_wrapper data_test_data_file:file { read write }; allow netutils_wrapper netmgrd:netlink_socket { read write }; diff --git a/sepolicy/per_mgr.te b/sepolicy/per_mgr.te deleted file mode 100644 index df65c24..0000000 --- a/sepolicy/per_mgr.te +++ /dev/null @@ -1,3 +0,0 @@ -allow per_mgr self:capability net_raw; -allow per_mgr unlabeled:file { getattr open read }; -allow per_mgr servicemanager:binder { call transfer }; diff --git a/sepolicy/perfd.te b/sepolicy/perfd.te old mode 100644 new mode 100755 diff --git a/sepolicy/priv_app.te b/sepolicy/priv_app.te old mode 100644 new mode 100755 diff --git a/sepolicy/property.te b/sepolicy/property.te old mode 100644 new mode 100755 diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts old mode 100644 new mode 100755 index 62283e5..8833024 --- a/sepolicy/property_contexts +++ b/sepolicy/property_contexts @@ -1,3 +1,10 @@ persist.sys.timeadjust u:object_r:timekeep_prop:s0 service.camera.hdmi_preview u:object_r:camera_prop:s0 storage.efs_sync.done u:object_r:rmt_storage_prop:s0 + +ro.sys.oem.sno u:object_r:system_radio_prop:s0 +sys.fake_bs_flag0 u:object_r:system_radio_prop:s0 +sys.fake_bs_flag1 u:object_r:system_radio_prop:s0 + +ro.min_freq_0 u:object_r:freq_prop:s0 +ro.min_freq_4 u:object_r:freq_prop:s0 diff --git a/sepolicy/qti_init_shell.te b/sepolicy/qti_init_shell.te old mode 100644 new mode 100755 index f951db2..8396939 --- a/sepolicy/qti_init_shell.te +++ b/sepolicy/qti_init_shell.te @@ -1,3 +1,3 @@ -allow qti_init_shell rootfs:file entrypoint; -allow qti_init_shell shell_exec:file { getattr read }; -allow qti_init_shell toolbox_exec:file getattr; +#allow qti_init_shell rootfs:file entrypoint; +#allow qti_init_shell shell_exec:file { getattr read }; +#allow qti_init_shell toolbox_exec:file getattr; diff --git a/sepolicy/radio.te b/sepolicy/radio.te old mode 100644 new mode 100755 diff --git a/sepolicy/rfs_access.te b/sepolicy/rfs_access.te old mode 100644 new mode 100755 diff --git a/sepolicy/rild.te b/sepolicy/rild.te old mode 100644 new mode 100755 index 2fac85e..34bb1a9 --- a/sepolicy/rild.te +++ b/sepolicy/rild.te @@ -1,4 +1,4 @@ -set_prop(rild, net_radio_prop) +set_prop(rild, system_radio_prop) allow rild unlabeled:dir search; allow rild unlabeled:file { getattr open read write }; diff --git a/sepolicy/rmt_storage.te b/sepolicy/rmt_storage.te old mode 100644 new mode 100755 index b2c3d68..86c1790 --- a/sepolicy/rmt_storage.te +++ b/sepolicy/rmt_storage.te @@ -1,2 +1,5 @@ +allow rmt_storage debugfs_rmt:dir search; +allow rmt_storage debugfs_rmt:file rw_file_perms; + set_prop(rmt_storage, rmt_storage_prop) allow rmt_storage self:capability net_raw; diff --git a/sepolicy/sensors.te b/sepolicy/sensors.te old mode 100644 new mode 100755 diff --git a/sepolicy/sensors_device.te b/sepolicy/sensors_device.te old mode 100644 new mode 100755 diff --git a/sepolicy/servicemanager.te b/sepolicy/servicemanager.te deleted file mode 100644 index 066555e..0000000 --- a/sepolicy/servicemanager.te +++ /dev/null @@ -1,3 +0,0 @@ -allow servicemanager per_mgr:dir search; -allow servicemanager per_mgr:file { open read }; -allow servicemanager per_mgr:process getattr; diff --git a/sepolicy/surfaceflinger.te b/sepolicy/surfaceflinger.te old mode 100644 new mode 100755 diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te old mode 100644 new mode 100755 diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te old mode 100644 new mode 100755 diff --git a/sepolicy/tbaseLoader.te b/sepolicy/tbaseLoader.te old mode 100644 new mode 100755 diff --git a/sepolicy/tee.te b/sepolicy/tee.te old mode 100644 new mode 100755 diff --git a/sepolicy/thermal-engine.te b/sepolicy/thermal-engine.te old mode 100644 new mode 100755 diff --git a/sepolicy/time_daemon.te b/sepolicy/time_daemon.te old mode 100644 new mode 100755 diff --git a/sepolicy/timekeep.te b/sepolicy/timekeep.te old mode 100644 new mode 100755 index c2fa482..8a5be9f --- a/sepolicy/timekeep.te +++ b/sepolicy/timekeep.te @@ -1,5 +1,5 @@ #type timekeep, domain, domain_deprecated; -type timekeep, domain; +type timekeep, domain, coredomain; type timekeep_exec, exec_type, file_type; # Started by init diff --git a/sepolicy/toolbox.te b/sepolicy/toolbox.te old mode 100644 new mode 100755 index 2c124bf..c68807e --- a/sepolicy/toolbox.te +++ b/sepolicy/toolbox.te @@ -1,8 +1,8 @@ -allow toolbox ctl_netmgrd_prop:property_service set; -allow toolbox ctl_qmuxd_prop:property_service set; +#allow toolbox ctl_netmgrd_prop:property_service set; +#allow toolbox ctl_qmuxd_prop:property_service set; allow toolbox init:fifo_file { getattr write }; -allow toolbox ipacm-diag_prop:property_service set; -allow toolbox ipacm_prop:property_service set; +#allow toolbox ipacm-diag_prop:property_service set; +#allow toolbox ipacm_prop:property_service set; allow toolbox ctl_default_prop:property_service set; allow toolbox init:unix_stream_socket connectto; allow toolbox property_socket:sock_file write; diff --git a/sepolicy/untrusted_app_25.te b/sepolicy/untrusted_app_25.te old mode 100644 new mode 100755 index d194a4d..5bc7e45 --- a/sepolicy/untrusted_app_25.te +++ b/sepolicy/untrusted_app_25.te @@ -1,6 +1,6 @@ allow untrusted_app_25 proc_stat:file { open read }; -allow untrusted_app_25 wcnss_prop:file open; -allow untrusted_app_25 wififtmd_prop:file { getattr open }; +#allow untrusted_app_25 wcnss_prop:file open; +#allow untrusted_app_25 wififtmd_prop:file { getattr open }; allow untrusted_app_25 mnt_media_rw_file:dir getattr; allow untrusted_app_25 rootfs:dir read; allow untrusted_app_25 sysfs:file read; diff --git a/sepolicy/vold.te b/sepolicy/vold.te old mode 100644 new mode 100755 diff --git a/sepolicy/wcnss_service.te b/sepolicy/wcnss_service.te old mode 100644 new mode 100755 diff --git a/sepolicy/wifiloader.te b/sepolicy/wifiloader.te old mode 100644 new mode 100755 diff --git a/sepolicy/zygote.te b/sepolicy/zygote.te old mode 100644 new mode 100755 diff --git a/system.prop b/system.prop old mode 100644 new mode 100755 index d4d0a67..18850a3 --- a/system.prop +++ b/system.prop @@ -1,49 +1,20 @@ -# Art -ro.sys.fw.dex2oat_thread_count=4 - -ro.qualcomm.cabl=0 - -qcom.bluetooth.soc=rome - -#Enable offload audio video playback by default -av.offload.enable=true - # enable navigation bar qemu.hw.mainkeys=1 -#property to enable fingerprint -persist.qfp=false - -#Disable rotator split feature -sdm.debug.disable_rotator_split=1 - -# For QQ P170316-06174/P170301-02869 -ro.qq.camera.sensor=3 -camera.disable_zsl_mode=1 - -persist.camera.preview.ubwc=0 -persist.camera.video.ubwc=0 - -persist.camera.HAL3.enabled=1 - -ro.product.first_api_level=24 - -ro.security.icd.flagmode=multi -ro.smps.enable=true - +# Audio af.fast_track_multiplier=1 +audio.deep_buffer.media=true +audio.offload.buffer.size.kb=64 +audio.offload.video=true audio_hal.period_size=192 ro.qc.sdk.audio.fluencetype=none persist.audio.fluence.voicecall=true persist.audio.fluence.voicerec=false persist.audio.fluence.speaker=true tunnel.audio.encode=false -audio.offload.buffer.size.kb=64 -audio.offload.video=true audio.offload.pcm.16bit.enable=true audio.offload.pcm.24bit.enable=true audio.offload.track.enable=true -audio.deep_buffer.media=true media.stagefright.audio.sink=280 use.voice.path.for.pcm.voip=true audio.offload.multiaac.enable=true @@ -55,46 +26,10 @@ ro.qc.sdk.audio.ssr=false audio.offload.gapless.enabled=true audio.safx.pbe.enabled=true audio.parser.ip.buffer.size=262144 -qcom.hw.aac.encoder=true -use.qti.sw.alac.decoder=false -use.qti.sw.ape.decoder=false -flac.sw.decoder.24bit.support=false ro.audio.monitorRotation=true -ro.qcom.hdr.config=/system/vendor/etc/hdr_tm_config.xml - -# Display -ro.sf.lcd_density=320 -ro.sf.hwrotation=90 -lockscreen.rot_override=true - -#Graphics properties -debug.sf.enable_hwc_vds=1 -debug.sf.hw=1 -debug.sf.latch_unsignaled=1 -debug.egl.hw=1 -debug.gralloc.enable_fb_ubwc=1 -sdm.debug.disable_skip_validate=1 -sys.disable_ext_animation=1 - -#Disable rotator split feature -sdm.debug.disable_rotator_split=1 - -#property to enable VDS WFD solution -persist.hwc.enable_vds=1 - -# Property to enable display default color mode -vendor.display.enable_default_color_mode=1 - -# OpenGLES -ro.opengles.version=196610 - -# Perf -ro.vendor.extension_library=libqti-perfd-client.so - -# Time services -persist.timed.enable=true - +# Bluetooth +qcom.bluetooth.soc=rome ro.qualcomm.bluetooth.opp=true ro.qualcomm.bluetooth.ftp=true ro.qualcomm.bluetooth.nap=false @@ -105,14 +40,70 @@ ro.qualcomm.bluetooth.hfp=false ro.qualcomm.bluetooth.pbap=true ro.qualcomm.bluetooth.map=true + +# Camera +persist.camera.gyro.disable=0 +persist.camera.imglib.fddsp=1 + +# CNE +persist.vendor.cne.feature=1 + +# Data modules +persist.data.iwlan.enable=true +persist.data.mode=concurrent +persist.data.netmgrd.qos.enable=true +ro.use_data_netmgrd=true + +# Display (Qualcomm AD) +ro.qualcomm.cabl=0 +ro.qcom.ad=1 + +# DRM +drm.service.enabled=true + +# FRP ro.hardware.keystore=mdfpp ro.hardware.gatekeeper=mdfpp +#property to enable fingerprint +persist.qfp=false + +# Graphics +debug.egl.hw=1 +debug.gralloc.enable_fb_ubwc=1 +debug.sf.hw=1 +debug.sf.latch_unsignaled=1 +dev.pm.dyn_samplingrate=1 +persist.demo.hdmirotationlock=false +persist.hwc.enable_vds=1 +persist.sys.wfd.virtual=0 +ro.opengles.version=196610 +sdm.debug.disable_rotator_split=1 +sdm.debug.disable_skip_validate=1 +sdm.perf_hint_window=50 + +ro.sf.lcd_density=320 +lockscreen.rot_override=true + +# IMS +persist.dbg.volte_avail_ovr=1 +persist.dbg.vt_avail_ovr=1 + +# Media +vendor.vidc.enc.disable.pq=true +vidc.enc.dcvs.extra-buff-count=2 + +# Memory optimizations +ro.vendor.qti.sys.fw.bservice_enable=true + +# Perf +ro.vendor.extension_library=libqti-perfd-client.so +ro.vendor.qti.sys.fw.bg_apps_limit=60 + # Radio persist.data.netmgrd.qos.enable=true persist.data.qmi.adb_logmask=0 persist.radio.add_power_save=1 -#rild.libpath=/system/vendor/lib64/libsec-ril.so rild.libpath=/vendor/lib64/libril-qc-qmi-1.so ro.telephony.mms_data_profile=5 ro.ril.telephony.data_reg_resp_strings=7 @@ -148,8 +139,8 @@ persist.data.df.mux_count=8 persist.data.df.iwlan_mux=9 persist.data.df.dev_name=rmnet_usb0 -# Adreno -ro.qcom.adreno.qgl.ShaderStorageImageExtendedFormats=0 +# TimeService +persist.timed.enable=true # Wifi wifi.interface=wlan0 diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100755 index 0000000..e66b9c5 --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1 @@ +add_lunch_combo lineage_gts3llte-userdebug diff --git a/vndk/Android.mk b/vndk/Android.mk old mode 100644 new mode 100755 index 1386fa5..0c74963 --- a/vndk/Android.mk +++ b/vndk/Android.mk @@ -2,6 +2,8 @@ LOCAL_PATH := $(call my-dir) include $(LOCAL_PATH)/vndk-sp-libs.mk +vndk_sp_dir := vndk-sp-$(PLATFORM_VNDK_VERSION) + define define-vndk-sp-lib include $$(CLEAR_VARS) LOCAL_MODULE := $1.vndk-sp-gen @@ -12,7 +14,7 @@ LOCAL_MULTILIB := first LOCAL_MODULE_TAGS := optional LOCAL_INSTALLED_MODULE_STEM := $1.so LOCAL_MODULE_SUFFIX := .so -LOCAL_MODULE_RELATIVE_PATH := vndk-sp +LOCAL_MODULE_RELATIVE_PATH := $(vndk_sp_dir) include $$(BUILD_PREBUILT) ifneq ($$(TARGET_2ND_ARCH),) @@ -26,7 +28,7 @@ LOCAL_MULTILIB := 32 LOCAL_MODULE_TAGS := optional LOCAL_INSTALLED_MODULE_STEM := $1.so LOCAL_MODULE_SUFFIX := .so -LOCAL_MODULE_RELATIVE_PATH := vndk-sp +LOCAL_MODULE_RELATIVE_PATH := $(vndk_sp_dir) include $$(BUILD_PREBUILT) endif # TARGET_TRANSLATE_2ND_ARCH is not true endif # TARGET_2ND_ARCH is not empty @@ -34,9 +36,18 @@ endef $(foreach lib,$(VNDK_SP_LIBRARIES),\ $(eval $(call define-vndk-sp-lib,$(lib)))) +$(foreach lib,$(EXTRA_VENDOR_LIBRARIES),\ + $(eval $(call define-vndk-lib,$(lib),vndk-ext-gen,,true))) +$(foreach lib,$(HW_VENDOR_LIBRARIES),\ + $(eval $(call define-vndk-lib,$(lib),vndk-hw-gen,hw,true))) include $(CLEAR_VARS) LOCAL_MODULE := vndk-sp LOCAL_MODULE_TAGS := optional -LOCAL_REQUIRED_MODULES := $(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES)) +LOCAL_REQUIRED_MODULES := \ + $(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES)) \ + $(addsuffix .vndk-ext-gen,$(EXTRA_VENDOR_LIBRARIES)) \ + $(addsuffix .vndk-hw-gen,$(HW_VENDOR_LIBRARIES)) include $(BUILD_PHONY_PACKAGE) + +vndk_sp_dir := diff --git a/vndk/vndk-sp-libs.mk b/vndk/vndk-sp-libs.mk old mode 100644 new mode 100755 index bd5299e..8ff5a43 --- a/vndk/vndk-sp-libs.mk +++ b/vndk/vndk-sp-libs.mk @@ -1,7 +1,12 @@ VNDK_SP_LIBRARIES := \ + android.hardware.camera.device@1.0 \ + android.hardware.camera.provider@2.4-impl \ + android.hardware.camera.provider@2.4 \ android.hardware.graphics.allocator@2.0 \ android.hardware.graphics.mapper@2.0 \ + android.hardware.graphics.mapper@2.1 \ android.hardware.graphics.common@1.0 \ + android.hardware.graphics.common@1.1 \ android.hardware.renderscript@1.0 \ android.hidl.memory@1.0 \ libRSCpuRef \ @@ -24,4 +29,42 @@ VNDK_SP_LIBRARIES := \ liblzma \ libpng \ libunwind \ - libutils + libunwindstack \ + libutils \ + libutilscallstack \ + libdexfile \ + libz + +EXTRA_VENDOR_LIBRARIES := \ + android.hidl.base@1.0 \ + android.hidl.manager@1.0 \ + android.hardware.camera.device@1.0 \ + android.hardware.camera.device@3.2 \ + android.hardware.camera.device@3.3 \ + android.hardware.camera.provider@2.4 \ + libcamera_metadata \ + libfmq \ + android.hardware.camera.common@1.0 \ + android.hardware.configstore@1.0 \ + android.hardware.configstore-utils \ + android.hidl.allocator@1.0 \ + android.hidl.memory@1.0 \ + libbinder \ + libui + +HW_VENDOR_LIBRARIES := \ + android.hidl.base@1.0 \ + android.hidl.manager@1.0 \ + android.hardware.camera.device@1.0 \ + android.hardware.camera.device@3.2 \ + android.hardware.camera.device@3.3 \ + android.hardware.camera.provider@2.4 \ + libcamera_metadata \ + libfmq \ + android.hardware.camera.common@1.0 \ + android.hardware.configstore@1.0 \ + android.hardware.configstore-utils \ + android.hidl.allocator@1.0 \ + android.hidl.memory@1.0 \ + libbinder \ + libui diff --git a/wifi/WCNSS_cfg.dat b/wifi/WCNSS_cfg.dat deleted file mode 100644 index 08aaf2b..0000000 Binary files a/wifi/WCNSS_cfg.dat and /dev/null differ diff --git a/wifi/WCNSS_qcom_cfg.ini b/wifi/WCNSS_qcom_cfg.ini old mode 100644 new mode 100755 index 0fba249..00d2125 --- a/wifi/WCNSS_qcom_cfg.ini +++ b/wifi/WCNSS_qcom_cfg.ini @@ -7,11 +7,12 @@ gEnableImps=1 # Enable/Disable Idle Scan + gEnableIdleScan=0 # Increase sleep duration (seconds) during IMPS -# 0 implies no periodic wake up from IMPS. Periodic wakeup is +# 0 implies no periodic wake up from IMPS. Periodic wakeup is # unnecessary if Idle Scan is disabled. gImpsModSleepTime=0 @@ -25,6 +26,7 @@ gEnableBmps=1 gEnableSuspend=3 + # Phy Mode (auto, b, g, n, etc) # Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac # 1 = 11abg, 2 = 11b, 3 = 11g, 5 = 11g only, 6 = 11n only @@ -182,7 +184,7 @@ gMaxNeighborReqTries=3 FastRoamEnabled=1 #Check if the AP to which we are roaming is better than current AP in terms of RSSI. -#Checking is disabled if set to Zero.Otherwise it will use this value as to how better +#Checking is disabled if set to Zero.Otherwise it will use this value as to how better #the RSSI of the new/roamable AP should be for roaming RoamRssiDiff=3 @@ -228,6 +230,15 @@ gAPAutoShutOff=0 gWlanAutoShutdown = 0 +# SAP auto channel selection configuration + +# 0 = disable auto channel selection + +# 1 = enable auto channel selection, channel provided by supplicant will be ignored + +gApAutoChannelSelection=0 + + # Listen Energy Detect Mode Configuration # Valid values 0-128 @@ -277,8 +288,23 @@ enableBeaconEarlyTermination=0 beaconEarlyTerminationWakeInterval=3 +#SOFTAP Channel Range selection + +gAPChannelSelectStartChannel=1 + +gAPChannelSelectEndChannel=11 + + +#SOFTAP Channel Range selection Operating band + +# 0:2.4GHZ 1: LOW-5GHZ 2:MID-5GHZ 3:HIGH-5GHZ 4: 4.9HZ BAND + +gAPChannelSelectOperatingBand=0 + + #Channel Bonding gChannelBondingMode5GHz=1 +gChannelBondingMode24GHz=1 #Enable Keep alive with non-zero period value @@ -299,17 +325,9 @@ gStaKeepAlivePeriod = 30 #gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period #where we send NULL frame. -gApLinkMonitorPeriod = 30 +#gApLinkMonitorPeriod = 10 -gGoLinkMonitorPeriod = 10 - -#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not. -#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod. - - -gGoKeepAlivePeriod = 3 - -gApKeepAlivePeriod = 10 +#gGoLinkMonitorPeriod = 10 #If set will start with active scan after driver load, otherwise will start with @@ -323,11 +341,9 @@ gEnableBypass11d=1 gEnableDFSChnlScan=1 -# Enable DFS channel roam -# 0: DISABLE, 1: ENABLED_NORMAL, 2: ENABLED_ACTIVE -gAllowDFSChannelRoam=1 gVhtChannelWidth=2 +gEnableLogp=1 # Enable Automatic Tx Power control @@ -349,40 +365,31 @@ gVhtTxMCS=2 # VHT Tx/Rx MCS values for 2x2 # Valid values are 0,1,2. If commented out, the default value is 0. # 0=MCS0-7, 1=MCS0-8, 2=MCS0-9 +gEnable2x2=1 gVhtRxMCS2x2=2 gVhtTxMCS2x2=2 +# Enable Tx beamforming +gTxBFEnable=1 -# Valid chain mask values -# 01 - enables chain0 -# 02 - enables chain1 -# 03 - enables both chain 0 and chain 1 -# if set to 0 or 1 then all vdevs comes up in 1x1 mode in that band. -gChainMask_2g=3 -gChainMask_5g=3 +# Enable Tx beamforming in VHT20MHz +# Valid values are 0,1. If commented out, the default value is 0. +# 0=disable, 1=enable +gEnableTxBFin20MHz=1 -# NSS cfg bit definition. -# STA BIT[0:1] -# SAP BIT[2:3] -# P2P_GO BIT[4:5] -# P2P_CLIENT BIT[6:7] -# IBSS BIT[8:9] -# TDLS BIT[10:11] -# P2P_DEVICE BIT[12:13] -# OCB BIT[14:15] -# Valid values are 1 or 2 for each two bit configuration. -# if 2-bit value is set to 1 then the corresponidng vdev comes up in 1x1 mode -# in the band, if set to 2 then that vdev comes up in 2x2 mode in that band. -gVdevTypeNss_2g=43690 -gVdevTypeNss_5g=43690 - -gTxChainMask1ss=0 +# Set txchainmask and rxchainmask +# These parameters are used only if gEnable2x2 is 0 +# Valid values are 1,2 +# Set gSetTxChainmask1x1=1 or gSetRxChainmask1x1=1 to select chain0. +# Set gSetTxChainmask1x1=2 or gSetRxChainmask1x1=2 to select chain1. +gSetTxChainmask1x1=1 +gSetRxChainmask1x1=1 # Scan Timing Parameters # gPassiveMaxChannelTime=110 # gPassiveMinChannelTime=60 -gActiveMaxChannelTime=80 -gActiveMinChannelTime=60 +gActiveMaxChannelTime=40 +gActiveMinChannelTime=20 #If set to 0, MCC is not allowed. gEnableMCCMode=1 @@ -390,7 +397,7 @@ gEnableMCCMode=1 # MCC to SCC Switch mode: 0-Disable 1-Enable 2-Force SCC if same band gWlanMccToSccSwitchMode = 0 -# 1=enable STBC; 0=disable STBC +# 1=enable STBC; 0=disable STBC gEnableRXSTBC=1 # 1=enable tx STBC; 0=disable @@ -399,18 +406,17 @@ gEnableTXSTBC=1 # 1=enable rx LDPC; 0=disable gEnableRXLDPC=1 -# Enable Tx beamforming in VHT20MHz -# Valid values are 0,1. If commented out, the default value is 0. -# 0=disable, 1=enable -gEnableTxBFin20MHz=1 +# Enable or Disable txLdpc capability +# 0 - disable, 1 - HT LDPC enable, 2 - VHT LDPC enable, 3 - HT & VHT LDPC enable +gTxLdpcEnable=3 # Enable Active mode offload gEnableActiveModeOffload=1 -#Enable Scan Results Aging based on timer +#Enable Scan Results Aging based on timer #Timer value is in seconds #If Set to 0 it will not enable the feature -gScanAgingTime=0 +gScanAgingTime=30 #Enable Scan Results Aging based on number of scans gScanResultAgeCount=1 @@ -425,10 +431,6 @@ gThermalMitigationEnable=0 gEnableFastRoamInConcurrency=1 -#List of Country codes for which 11ac needs to be disabled -#Each country code must be delimited by comma(,) -gListOfNon11acCountryCode=RU,UA,ZA - #Maxium Channel time in msec gMaxMediumTime = 6000 @@ -449,7 +451,7 @@ gFlexConnectPowerFactor=0 gNumChanCombinedConc=60 #Enable Power Save offload -gEnablePowerSaveOffload=2 +gEnablePowerSaveOffload=1 #Enable firmware uart print gEnablefwprint=0 @@ -461,21 +463,32 @@ gFwDebugLogLevel=4 gFwDebugModuleLoglevel=1,0,2,0,4,0,5,0,6,0,7,4,8,0,9,0,11,0,13,0,17,0,18,0,19,0,27,0,29,0,31,0,35,0,36,0,38,0 #IPA config -gIPAConfig=0 +#gIPAEnable=0x00 gIPADescSize=800 gIPAPreFilterEnable=1 gIPARMEnable=1 gIPAIPv6Enable=1 +gIPAConfig=0x1d +IpaUcOffloadEnabled=1 +gIpaUcStaOffload=0 +gIPAHighBandwidthMbps=800 +gIPAMediumBandwidthMbps=400 +gIPALowBandwidthMbps=200 #P2P Listen offload gEnableP2pListenOffload=1 +# Maximum Receive AMPDU size (VHT only. Valid values: 0->8k 1->16k 2->32k 3->64k 4->128k) +gVhtAmpduLenExponent=7 + # Maximum MPDU length (VHT only. Valid values: 0->3895 octets, 1->7991 octets, 2->11454 octets) gVhtMpduLen=2 # Maximum number of wow filters required #gMaxWoWFilters=22 +gActiveBpfMode=1 + # WOW Enable/Disable. # 0 - Disable both magic pattern match and pattern byte match. # 1 - Enable magic pattern match on all interfaces. @@ -495,17 +508,13 @@ isP2pDeviceAddrAdministrated=1 # 0: no rx thread, no RPS, for MDM # 1: RX thread # 2: RPS -rxhandle=2 - -# Set RPS CPU MAP as 0xe for the 4 RX queues -# This allows use of CPU1-CPU3 but not CPU0 for 4 RX queues -rpsRxQueueCpuMapList=c +rxhandle=1 # Remove Overlap channel restriction gEnableOverLapCh=0 #Enable VHT on 2.4Ghz -gEnableVhtFor24GHzBand=0 +gEnableVhtFor24GHzBand=1 #Enable or Disable 5G early beacon termination gEnable5gEBT=1 @@ -522,67 +531,66 @@ gEnable5gEBT=1 ssdp = 0 -#Enable Memory Deep Sleep -gEnableMemDeepSleep=1 # Bus bandwidth threshold values in terms of number of packets gBusBandwidthHighThreshold=2000 gBusBandwidthMediumThreshold=500 gBusBandwidthLowThreshold=150 -# IPA bandwidth voting -gIPAHighBandwidthMbps=800 -gIPAMediumBandwidthMbps=400 -gIPALowBandwidthMbps=200 - # Bus bandwidth compute timeout value in ms gBusBandwidthComputeInterval=100 # Regulatory Setting; 0=STRICT; 1=CUSTOM gRegulatoryChangeCountry=1 -# RA filtering rate limit param, the current value would not -# help if the lifetime in RA is less than 3*60=3min. Then -# we need to change it, though it is uncommon. -# gRAFilterEnable=0 -gRArateLimitInterval=600 # Maximum number of concurrent connections gMaxConcurrentActiveSessions=2 -# Disable/Enable GreenAP -# 0 to disable, 1 to enable, default: 1 -gEnableGreenAp=1 - # Radar PRI multiplier gDFSradarMappingPriMultiplier=4 -gPNOScanSupport=0 +gPNOScanSupport=1 + +# Perform PNO fast scan this many number of times +gPNOScanTimerRepeatValue=6 + +# PNO slow scan period = gPNOSlowScanMultiplier times PNO fast scan period +# Example: fast scan period is passed from framework (default = 10 sec), then +# PNO slow scan period = 60 sec. +gPNOSlowScanMultiplier=6 # Enable/Disable RX full reorder offload gReorderOffloadSupported=1 -# Enable/Disable LPASS support -# 0 to disable, 1 to enable -gEnableLpassSupport=0 - -# Whether userspace country code setting shld have priority +# userspace country code setting shld take priority gCountryCodePriority=1 +# Enable/Disable LPASS support +# 0 to disable, 1 to enable +gEnableLpassSupport=1 + # Enable(1)/Disable(0) SIFS burst -gEnableSifsBurst=3 +gEnableSifsBurst=1 + +# Enable or Disable Multi-user MIMO +# 1=Enable (default), 0=Disable +gEnableMuBformee=1 # Enable/Disable channel avoidance for SAP in SCC scenario # 0 - disable # 1 - enable gSapSccChanAvoidance=0 +# RA filtering rate limit param, the current value would not +# help if the lifetime in RA is less than 3*60=3min. Then +# we need to change it, though it is uncommon. +# Enable RA filtering offload +gRAFilterEnable=1 +gRArateLimitInterval=300 + # Inactivity time (in ms) to end TX Service Period while in IBSS power save mode gIbssTxSpEndInactivityTime=10 -# Enable/Disable Roaming Offload Support (a.k.a Key Management Offload) -# 0 to disable, 1 to enable -gRoamOffloadEnabled=0 - # Enable support for TDLS # 0 - disable # 1 - enable @@ -615,26 +623,14 @@ gTDLSExternalControl=1 # TDLS connection. gEnableTDLSOffChannel=1 -gTDLSTxStatsPeriod=5000 -gTDLSTxPacketThreshold=200 -gTDLSDiscoveryPeriod=20000 - -IpaUcOffloadEnabled=1 -gIpaUcStaOffload=1 +gEnableTDLSScan=1 +gTDLSTxPacketThreshold=10 +gTDLSIdlePacketThreshold=1 gEnableSelfRecovery=1 -# Enable or Disable Random MAC (Spoofing) -# 1=Enable, 0=Disable (default) -gEnableMacAddrSpoof=0 - -# Enable Auto suspend feature -# When this feature is enabled, it will shutdown the PCIe link -# when inactivity is detected in STA disconnected mode. -# 0 - disable -# 1 - enable -gEnableBusAutoSuspend=0 - +#Enable MC address filtering offload +gMCAddrListEnable=1 # Enable Runtime PM Feature. # Enabling this feature will put target wow and shutdown pcie link # when inactivity is detected in WLAN Driver. @@ -643,7 +639,7 @@ gEnableBusAutoSuspend=0 # 0 - disable # 1 - enable -gRuntimePM=1 +gRuntimePM=0 # When gRuntimePM is disabled gRuntimeAutoTime won't take effect. # The Time is in msec. # 100 is min, 10000 is max, 500 is default. @@ -654,32 +650,26 @@ gRuntimePMDelay=500 # builds only since it will be ignored in performance/release builds. gEnableFWHashCheck=1 -# Enable FW to filter out broadcast packets and wakeup host during runtime PM. -# As APPS is awake during runtime PM, if any application needs the broadcast -# packets OEM's can enable this flag. -# FW will filters the broadcast packets and wakeup host to deliver them during -# runtime suspend. -# This flag will take affect when Runtime PM is enabled -gRuntimePmEnableBcastPattern=0 +# Tx Chain Mask for CCK +gCckChainMaskEnable=1 -# intervals length (in ms) during WLAN P2P (single vdev) + BT Paging -# min 20ms, max 200ms -gBTIntervalPageP2P=30 -gWLIntervalPageP2P=30 +# Tx Chain Mask for 1SS +gTxChainMask1ss=0 -# intervals length (in ms) during WLAN STA (single vdev) + BT Paging -# min 20ms, max 200ms -gBTIntervalPageSTA=30 -gWLIntervalPageSTA=30 +# TPC power +gSelfGenFrmPwr=3 -# intervals length (in ms) during WLAN SAP (single vdev) + BT Paging -# min 20ms, max 200ms -gBTIntervalPageSAP=30 -gWLIntervalPageSAP=30 +gAllowDFSChannelRoam=1 -arp_ac_category=0 +# Enable or Disable Extended Scan (GScan) +# 1=Enable (default), 0=Disable +gExtScanEnable=1 + + +gEnableModulatedDTIM=2 +gMaxLIModulatedDTIM=6 +gSoftApMaxPeers=16 END # Note: Configuration parser would not read anything past the END marker - diff --git a/wifi/grippower.info b/wifi/grippower.info deleted file mode 100644 index ac2182d..0000000 --- a/wifi/grippower.info +++ /dev/null @@ -1 +0,0 @@ -55:55 \ No newline at end of file