├── odm.prop ├── sepolicy └── vendor │ ├── device.te │ ├── init_shell.te │ ├── property.te │ ├── vendor_init.te │ ├── hal_light_default.te │ ├── app.te │ ├── hal_power_default.te │ ├── init-qcom-sensors-sh.te │ ├── hal_camera_default.te │ ├── hwservice_contexts │ ├── tee.te │ ├── file.te │ ├── property_contexts │ ├── hal_thermal_default.te │ ├── init-thermal-symlinks.sh.te │ ├── hal_fingerprint_default.te │ ├── batterysecret.te │ ├── genfs_contexts │ └── file_contexts ├── setup-makefiles.py ├── amplifier ├── .clang-format └── Android.bp ├── gps ├── Android.bp ├── pla │ ├── Android.bp │ └── android │ │ └── loc_pla.h ├── android │ ├── 2.1 │ │ ├── android.hardware.gnss@2.1-service-qti.rc │ │ ├── android.hardware.gnss@2.1-service-qti.xml │ │ ├── GnssDebug.h │ │ ├── GnssNi.h │ │ ├── AGnss.h │ │ ├── service.cpp │ │ ├── GnssNi.cpp │ │ ├── Android.bp │ │ ├── GnssBatching.h │ │ ├── AGnssRil.h │ │ ├── GnssConfiguration.h │ │ ├── location_api │ │ │ ├── GeofenceAPIClient.h │ │ │ ├── LocationUtil.h │ │ │ └── BatchingAPIClient.h │ │ ├── GnssGeofencing.h │ │ ├── GnssMeasurement.h │ │ ├── GnssAntennaInfo.h │ │ └── GnssVisibilityControl.h │ └── utils │ │ ├── Android.bp │ │ └── battery_listener.h ├── etc │ ├── Android.bp │ └── flp.conf ├── geofence │ └── Android.bp ├── batching │ └── Android.bp ├── location │ └── Android.bp ├── gnss │ ├── Android.bp │ └── NativeAgpsHandler.h ├── utils │ ├── Android.bp │ ├── LocLoggerBase.h │ ├── MsgTask.h │ ├── loc_timer.h │ ├── LocTimer.h │ ├── LogBuffer.h │ ├── loc_target.h │ ├── LocSharedLock.h │ ├── LocThread.h │ ├── loc_nmea.h │ └── LocThread.cpp ├── core │ ├── Android.bp │ ├── data-items │ │ ├── DataItemsFactoryProxy.h │ │ ├── IDataItemCore.h │ │ ├── DataItemId.h │ │ └── DataItemsFactoryProxy.cpp │ ├── LocContext.h │ ├── loc_core_log.h │ ├── LBSProxyBase.h │ ├── observer │ │ ├── IDataItemObserver.h │ │ ├── IFrameworkActionReq.h │ │ └── IOsObserver.h │ ├── LocAdapterProxyBase.h │ └── LocContext.cpp └── CleanSpec.mk ├── wifi ├── p2p_supplicant_overlay.conf └── wpa_supplicant_overlay.conf ├── README.md ├── overlay ├── WifiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── SM6250Frameworks │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ ├── values │ │ └── dimens.xml │ │ └── xml │ │ └── power_profile.xml ├── SM6250SystemUI │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── dimens.xml ├── TelephonyResCommon │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml └── CarrierConfigResCommon │ ├── Android.bp │ └── AndroidManifest.xml ├── rootdir ├── bin │ ├── init.sensors_fixup.sh │ ├── init.qti.chg_policy.sh │ ├── init.qcom.sh │ └── init.qcom.early_boot.sh ├── Android.bp └── etc │ └── init.recovery.qcom.rc ├── overlay-lineage ├── SM6250Aperture │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── SM6250LineageSDK │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml └── SM6250LineageDialer │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ └── values │ └── config.xml ├── lineage.dependencies ├── libinit ├── Android.bp ├── include │ ├── libinit_utils.h │ ├── libinit_dalvik_heap.h │ └── libinit_variant.h ├── libinit_variant.cpp ├── libinit_dalvik_heap.cpp └── libinit_utils.cpp ├── Android.bp ├── system.prop ├── permissions └── privapp-permissions-hotword.xml ├── releasetools.py ├── config.fs └── extract-files.py /odm.prop: -------------------------------------------------------------------------------- 1 | # Fwk detect 2 | ro.vendor.qti.va_odm.support=1 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/device.te: -------------------------------------------------------------------------------- 1 | type fingerprint_device, dev_type; 2 | -------------------------------------------------------------------------------- /setup-makefiles.py: -------------------------------------------------------------------------------- 1 | #!./extract-files.py --regenerate_makefiles 2 | -------------------------------------------------------------------------------- /amplifier/.clang-format: -------------------------------------------------------------------------------- 1 | ../../../../build/soong/scripts/system-clang-format -------------------------------------------------------------------------------- /sepolicy/vendor/init_shell.te: -------------------------------------------------------------------------------- 1 | allow vendor_qti_init_shell proc_page_cluster:file w_file_perms; 2 | -------------------------------------------------------------------------------- /gps/Android.bp: -------------------------------------------------------------------------------- 1 | GNSS_CFLAGS = [ 2 | "-Werror", 3 | "-Wno-undefined-bool-conversion", 4 | ] 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/property.te: -------------------------------------------------------------------------------- 1 | vendor_internal_prop(vendor_thermal_prop) 2 | 3 | vendor_restricted_prop(vendor_fingerprint_prop) 4 | -------------------------------------------------------------------------------- /sepolicy/vendor/vendor_init.te: -------------------------------------------------------------------------------- 1 | allow vendor_init proc_dirty:file w_file_perms; 2 | 3 | set_prop(vendor_init, vendor_camera_remapid_prop) 4 | -------------------------------------------------------------------------------- /wifi/p2p_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | p2p_no_group_iface=1 3 | persistent_reconnect=1 4 | bss_max_count=400 5 | p2p_go_intent=14 6 | -------------------------------------------------------------------------------- /gps/pla/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_headers { 3 | 4 | name: "libloc_pla_headers", 5 | export_include_dirs: ["android"], 6 | vendor: true, 7 | } 8 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_light_default.te: -------------------------------------------------------------------------------- 1 | allow hal_light_default { 2 | sysfs_leds 3 | }:file rw_file_perms; 4 | 5 | r_dir_file(hal_light_default, sysfs_leds) 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/app.te: -------------------------------------------------------------------------------- 1 | get_prop({ appdomain -isolated_app_all }, vendor_fingerprint_prop) 2 | get_prop({ appdomain -isolated_app_all }, vendor_tee_listener_prop) 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Common device tree for Xiaomi SM6250 devices 2 | 3 | ``` 4 | # 5 | # SPDX-FileCopyrightText: The LineageOS Project 6 | # SPDX-License-Identifier: Apache-2.0 7 | # 8 | ``` 9 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_power_default.te: -------------------------------------------------------------------------------- 1 | # Allow writing to files in /sys/touchpanel 2 | allow hal_power_default sysfs_touchpanel:dir search; 3 | allow hal_power_default sysfs_touchpanel:file rw_file_perms; 4 | -------------------------------------------------------------------------------- /sepolicy/vendor/init-qcom-sensors-sh.te: -------------------------------------------------------------------------------- 1 | allow vendor_init-qcom-sensors-sh vendor_persist_sensors_file:dir rw_dir_perms; 2 | allow vendor_init-qcom-sensors-sh vendor_persist_sensors_file:file create_file_perms; 3 | -------------------------------------------------------------------------------- /gps/android/2.1/android.hardware.gnss@2.1-service-qti.rc: -------------------------------------------------------------------------------- 1 | service gnss_service /vendor/bin/hw/android.hardware.gnss@2.1-service-qti 2 | class hal 3 | user gps 4 | group system gps radio vendor_qti_diag 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_camera_default.te: -------------------------------------------------------------------------------- 1 | allow hal_camera_default mnt_vendor_file:dir search; 2 | 3 | # Allow hal_camera_default to read to mnt/vendor/persist/camera 4 | r_dir_file(hal_camera_default, camera_persist_file) 5 | -------------------------------------------------------------------------------- /overlay/WifiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "WifiOverlay", 8 | vendor: true 9 | } 10 | -------------------------------------------------------------------------------- /rootdir/bin/init.sensors_fixup.sh: -------------------------------------------------------------------------------- 1 | #!/vendor/bin/sh 2 | # 3 | # SPDX-FileCopyrightText: The LineageOS Project 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | sed -i '/sensor_temperature/d' /mnt/vendor/persist/sensors/sensors_list.txt 8 | -------------------------------------------------------------------------------- /overlay/SM6250Frameworks/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "SM6250Frameworks", 8 | vendor: true, 9 | } 10 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "SM6250SystemUI", 8 | vendor: true, 9 | } 10 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250Aperture/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "SM6250Aperture", 8 | product_specific: true, 9 | } 10 | -------------------------------------------------------------------------------- /overlay/TelephonyResCommon/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "TelephonyResCommon", 8 | product_specific: true, 9 | } 10 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250LineageSDK/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "SM6250LineageSDK", 8 | product_specific: true, 9 | } 10 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250LineageDialer/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "SM6250LineageDialer", 8 | product_specific: true, 9 | } 10 | -------------------------------------------------------------------------------- /wifi/wpa_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | p2p_disabled=1 3 | tdls_external_control=1 4 | wowlan_triggers=magic_pkt 5 | bss_max_count=400 6 | interworking=1 7 | config_methods=virtual_display virtual_push_button keypad 8 | driver_param="use_p2p_group_interface=1 no_rrm=1" 9 | -------------------------------------------------------------------------------- /sepolicy/vendor/hwservice_contexts: -------------------------------------------------------------------------------- 1 | vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemon u:object_r:hal_fingerprint_hwservice:s0 2 | vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemonExt u:object_r:hal_fingerprint_hwservice:s0 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/tee.te: -------------------------------------------------------------------------------- 1 | typeattribute tee data_between_core_and_vendor_violators; 2 | 3 | allow tee fingerprint_data_file:dir create_dir_perms; 4 | allow tee { 5 | fingerprint_data_file 6 | mnt_vendor_file 7 | }:file create_file_perms; 8 | 9 | allow tee mnt_vendor_file:dir rw_dir_perms; 10 | -------------------------------------------------------------------------------- /overlay/CarrierConfigResCommon/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "CarrierConfigResCommon", 8 | aaptflags: ["--keep-raw-values"], 9 | product_specific: true, 10 | } 11 | -------------------------------------------------------------------------------- /sepolicy/vendor/file.te: -------------------------------------------------------------------------------- 1 | type camera_persist_file, file_type, vendor_persist_type; 2 | 3 | type fingerprint_data_file, data_file_type, core_data_file_type, file_type; 4 | 5 | type persist_subsys_file, vendor_persist_type, file_type; 6 | 7 | type thermal_link_device, dev_type; 8 | 9 | type sysfs_touchpanel, fs_type, sysfs_type; 10 | -------------------------------------------------------------------------------- /lineage.dependencies: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "repository": "android_hardware_sony_timekeep", 4 | "target_path": "hardware/sony/timekeep" 5 | }, 6 | { 7 | "repository": "android_hardware_xiaomi", 8 | "target_path": "hardware/xiaomi" 9 | }, 10 | { 11 | "repository": "android_kernel_xiaomi_sm6250", 12 | "target_path": "kernel/xiaomi/sm6250" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /sepolicy/vendor/property_contexts: -------------------------------------------------------------------------------- 1 | # Camera 2 | vendor.camera. u:object_r:vendor_camera_prop:s0 3 | 4 | # Fingerprint 5 | persist.vendor.sys.fp. u:object_r:vendor_fingerprint_prop:s0 6 | vendor.sys.fp u:object_r:vendor_fingerprint_prop:s0 7 | 8 | # Thermal 9 | vendor.thermal. u:object_r:vendor_thermal_prop:s0 10 | -------------------------------------------------------------------------------- /libinit/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | cc_library_static { 7 | name: "libinit_xiaomi_atoll", 8 | srcs: [ 9 | "libinit_dalvik_heap.cpp", 10 | "libinit_variant.cpp", 11 | "libinit_utils.cpp", 12 | ], 13 | whole_static_libs: ["libbase"], 14 | export_include_dirs: ["include"], 15 | recovery_available: true, 16 | } 17 | -------------------------------------------------------------------------------- /overlay/SM6250Frameworks/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /gps/etc/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | prebuilt_etc { 3 | 4 | name: "gps.conf", 5 | vendor: true, 6 | src: "gps.conf", 7 | } 8 | 9 | prebuilt_etc { 10 | 11 | name: "flp.conf", 12 | vendor: true, 13 | src: "flp.conf", 14 | } 15 | 16 | prebuilt_etc { 17 | 18 | name: "gnss_antenna_info.conf", 19 | vendor: true, 20 | src: "gnss_antenna_info.conf", 21 | } 22 | 23 | prebuilt_etc { 24 | 25 | name: "izat.conf", 26 | vendor: true, 27 | src: "izat.conf", 28 | } 29 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/TelephonyResCommon/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | soong_namespace { 7 | imports: [ 8 | "bootable/deprecated-ota", 9 | "hardware/xiaomi", 10 | ], 11 | } 12 | 13 | install_symlink { 14 | name: "firmware_WCNSS_qcom_cfg.ini_symlink", 15 | vendor: true, 16 | installed_location: "firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini", 17 | symlink_target: "/vendor/etc/wifi/WCNSS_qcom_cfg.ini", 18 | } 19 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250LineageSDK/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250LineageDialer/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250Aperture/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/CarrierConfigResCommon/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /libinit/include/libinit_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #ifndef LIBINIT_UTILS_H 7 | #define LIBINIT_UTILS_H 8 | 9 | #include 10 | 11 | void property_override(std::string prop, std::string value, bool add = true); 12 | 13 | void set_ro_build_prop(const std::string &prop, const std::string &value, bool product = false); 14 | 15 | std::string fingerprint_to_description(std::string fingerprint); 16 | 17 | #endif // LIBINIT_UTILS_H 18 | -------------------------------------------------------------------------------- /overlay/WifiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_thermal_default.te: -------------------------------------------------------------------------------- 1 | allow hal_thermal_default sysfs_thermal:dir r_dir_perms; 2 | allow hal_thermal_default sysfs_thermal:file rw_file_perms; 3 | allow hal_thermal_default sysfs_thermal:lnk_file r_file_perms; 4 | allow hal_thermal_default thermal_link_device:dir r_dir_perms; 5 | allow hal_thermal_default proc_stat:file r_file_perms; 6 | 7 | allow hal_thermal_default self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; 8 | 9 | hal_client_domain(hal_thermal_default, hal_power) 10 | 11 | get_prop(hal_thermal_default, vendor_thermal_prop) 12 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250LineageDialer/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | true 10 | 12 | 4 13 | 14 | 15 | -------------------------------------------------------------------------------- /libinit/include/libinit_dalvik_heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #ifndef LIBINIT_DALVIK_HEAP_H 7 | #define LIBINIT_DALVIK_HEAP_H 8 | 9 | #include 10 | 11 | typedef struct dalvik_heap_info { 12 | std::string heapstartsize; 13 | std::string heapgrowthlimit; 14 | std::string heapsize; 15 | std::string heapminfree; 16 | std::string heapmaxfree; 17 | std::string heaptargetutilization; 18 | } dalvik_heap_info_t; 19 | 20 | void set_dalvik_heap(void); 21 | 22 | #endif // LIBINIT_DALVIK_HEAP_H 23 | -------------------------------------------------------------------------------- /gps/geofence/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | 3 | cc_library_shared { 4 | 5 | name: "libgeofencing", 6 | vendor: true, 7 | 8 | 9 | 10 | srcs: [ 11 | "GeofenceAdapter.cpp", 12 | "location_geofence.cpp", 13 | ], 14 | 15 | shared_libs: [ 16 | "libutils", 17 | "libcutils", 18 | "libgps.utils", 19 | "liblog", 20 | "libloc_core", 21 | ], 22 | 23 | header_libs: [ 24 | "libgps.utils_headers", 25 | "libloc_core_headers", 26 | "libloc_pla_headers", 27 | "liblocation_api_headers", 28 | ], 29 | 30 | cflags: GNSS_CFLAGS, 31 | } 32 | -------------------------------------------------------------------------------- /gps/batching/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "libbatching", 5 | vendor: true, 6 | 7 | 8 | 9 | shared_libs: [ 10 | "libutils", 11 | "libcutils", 12 | "liblog", 13 | "libloc_core", 14 | "libgps.utils", 15 | "libdl", 16 | ], 17 | 18 | srcs: [ 19 | "location_batching.cpp", 20 | "BatchingAdapter.cpp", 21 | ], 22 | 23 | header_libs: [ 24 | "libgps.utils_headers", 25 | "libloc_core_headers", 26 | "libloc_pla_headers", 27 | "liblocation_api_headers", 28 | ], 29 | 30 | cflags: GNSS_CFLAGS, 31 | } 32 | -------------------------------------------------------------------------------- /libinit/include/libinit_variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #ifndef LIBINIT_VARIANT_H 7 | #define LIBINIT_VARIANT_H 8 | 9 | #include 10 | #include 11 | 12 | typedef struct variant_info { 13 | std::string hwc_value; 14 | 15 | std::string brand; 16 | std::string device; 17 | std::string model; 18 | std::string build_fingerprint; 19 | } variant_info_t; 20 | 21 | void search_variant(const std::vector variants); 22 | 23 | void set_variant_props(const variant_info_t variant); 24 | 25 | #endif // LIBINIT_VARIANT_H 26 | -------------------------------------------------------------------------------- /sepolicy/vendor/init-thermal-symlinks.sh.te: -------------------------------------------------------------------------------- 1 | type init-thermal-symlinks-sh, domain; 2 | type init-thermal-symlinks-sh_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(init-thermal-symlinks-sh) 5 | 6 | allow init-thermal-symlinks-sh vendor_toolbox_exec:file rx_file_perms; 7 | allow init-thermal-symlinks-sh thermal_link_device:dir rw_dir_perms; 8 | allow init-thermal-symlinks-sh thermal_link_device:lnk_file create_file_perms; 9 | allow init-thermal-symlinks-sh sysfs_thermal:dir r_dir_perms; 10 | allow init-thermal-symlinks-sh sysfs_thermal:file r_file_perms; 11 | allow init-thermal-symlinks-sh sysfs_thermal:lnk_file r_file_perms; 12 | set_prop(init-thermal-symlinks-sh, vendor_thermal_prop) 13 | -------------------------------------------------------------------------------- /gps/location/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "liblocation_api", 5 | vendor: true, 6 | 7 | 8 | 9 | shared_libs: [ 10 | "libutils", 11 | "libcutils", 12 | "libgps.utils", 13 | "libdl", 14 | "liblog", 15 | ], 16 | 17 | srcs: [ 18 | "LocationAPI.cpp", 19 | "LocationAPIClientBase.cpp", 20 | ], 21 | 22 | cflags: ["-fno-short-enums"] + GNSS_CFLAGS, 23 | 24 | header_libs: [ 25 | "libloc_pla_headers", 26 | "libgps.utils_headers", 27 | ], 28 | 29 | } 30 | 31 | cc_library_headers { 32 | 33 | name: "liblocation_api_headers", 34 | export_include_dirs: ["."], 35 | vendor: true, 36 | } 37 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # Audio 2 | audio.offload.min.duration.secs=30 3 | 4 | # CNE 5 | persist.vendor.cne.feature=1 6 | 7 | # Display 8 | debug.sf.enable_hwc_vds=1 9 | 10 | # DPM 11 | persist.vendor.dpm.feature=11 12 | 13 | # FUSE 14 | persist.sys.fuse.passthrough.enable=true 15 | 16 | # Fwk detect 17 | ro.vendor.qti.va_aosp.support=1 18 | 19 | # IMS 20 | persist.dbg.volte_avail_ovr=1 21 | persist.dbg.vt_avail_ovr=1 22 | persist.dbg.wfc_avail_ovr=1 23 | 24 | # Media 25 | media.stagefright.thumbnail.prefer_hw_codecs=true 26 | ro.media.recorder-max-base-layer-fps=60 27 | persist.mm.enable.prefetch=true 28 | vendor.mm.enable.qcom_parser=16777199 29 | 30 | # WFD 31 | persist.debug.wfd.enable=1 32 | vendor.sys.video.disable.ubwc=1 33 | -------------------------------------------------------------------------------- /gps/gnss/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | 3 | cc_library_shared { 4 | 5 | name: "libgnss", 6 | vendor: true, 7 | 8 | 9 | 10 | shared_libs: [ 11 | "libutils", 12 | "libcutils", 13 | "libdl", 14 | "liblog", 15 | "libloc_core", 16 | "libgps.utils", 17 | ], 18 | 19 | srcs: [ 20 | "location_gnss.cpp", 21 | "GnssAdapter.cpp", 22 | "Agps.cpp", 23 | "XtraSystemStatusObserver.cpp", 24 | "NativeAgpsHandler.cpp", 25 | ], 26 | 27 | cflags: ["-fno-short-enums"] + GNSS_CFLAGS, 28 | header_libs: [ 29 | "libgps.utils_headers", 30 | "libloc_core_headers", 31 | "libloc_pla_headers", 32 | "liblocation_api_headers", 33 | ], 34 | 35 | } 36 | -------------------------------------------------------------------------------- /permissions/privapp-permissions-hotword.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 1080px 10 | 760px 11 | 12 | 13 | 760px 14 | 15 | 16 | 16dp 17 | 18 | 19 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_fingerprint_default.te: -------------------------------------------------------------------------------- 1 | typeattribute hal_fingerprint_default data_between_core_and_vendor_violators; 2 | 3 | allow hal_fingerprint_default fingerprint_data_file:dir rw_dir_perms; 4 | allow hal_fingerprint_default fingerprint_data_file:file create_file_perms; 5 | 6 | allow hal_fingerprint_default { 7 | fingerprint_device 8 | input_device 9 | tee_device 10 | uhid_device 11 | }: chr_file rw_file_perms; 12 | 13 | allow hal_fingerprint_default self:netlink_socket create_socket_perms_no_ioctl; 14 | 15 | allow hal_fingerprint_default input_device:dir r_dir_perms; 16 | 17 | allow hal_fingerprint_default { 18 | vendor_sysfs_fingerprint 19 | vendor_sysfs_fps_attr 20 | }: file rw_file_perms; 21 | 22 | r_dir_file(hal_fingerprint_default, firmware_file) 23 | 24 | set_prop(hal_fingerprint_default, vendor_fingerprint_prop) 25 | -------------------------------------------------------------------------------- /gps/android/utils/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_static { 2 | 3 | name: "liblocbatterylistener", 4 | vendor: true, 5 | 6 | 7 | 8 | cflags: GNSS_CFLAGS + ["-DBATTERY_LISTENER_ENABLED"], 9 | local_include_dirs: ["."], 10 | 11 | srcs: ["battery_listener.cpp"], 12 | 13 | shared_libs: [ 14 | "liblog", 15 | "libhidlbase", 16 | "libcutils", 17 | "libutils", 18 | "android.hardware.health@1.0", 19 | "android.hardware.health@2.0", 20 | "android.hardware.health@2.1", 21 | "android.hardware.power@1.2", 22 | "libbase", 23 | ], 24 | 25 | static_libs: ["libhealthhalutils"], 26 | 27 | header_libs: [ 28 | "libgps.utils_headers", 29 | "libloc_pla_headers", 30 | ], 31 | } 32 | 33 | cc_library_headers { 34 | 35 | name: "liblocbatterylistener_headers", 36 | vendor: true, 37 | export_include_dirs: ["."], 38 | } 39 | -------------------------------------------------------------------------------- /overlay/SM6250Frameworks/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 10 | 93px 11 | 12 | 14 | 93px 15 | 16 | 17 | 24dp 18 | 19 | 20 | 102px 21 | 22 | 23 | -------------------------------------------------------------------------------- /amplifier/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | cc_library_shared { 7 | name: "audio_amplifier.tas2562", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | owner: "qti", 11 | 12 | srcs: [ 13 | "tas2562.c", 14 | ], 15 | 16 | include_dirs: [ 17 | "external/tinyalsa/include", 18 | "external/tinycompress/include", 19 | "hardware/qcom-caf/sm8150/audio/hal", 20 | "hardware/qcom-caf/sm8150/audio/hal/audio_extn", 21 | "hardware/qcom-caf/sm8150/audio/hal/msm8974", 22 | "system/media/audio_route/include", 23 | "system/media/audio_utils/include", 24 | ], 25 | 26 | header_libs: [ 27 | "libhardware_headers", 28 | "qti_kernel_headers", 29 | ], 30 | 31 | shared_libs: [ 32 | "libcutils", 33 | "libdl", 34 | "libhardware", 35 | "liblog", 36 | "libtinyalsa", 37 | ], 38 | } 39 | -------------------------------------------------------------------------------- /releasetools.py: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-FileCopyrightText: The LineageOS Project 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | import common 7 | 8 | def FullOTA_InstallEnd(info): 9 | OTA_InstallEnd(info) 10 | return 11 | 12 | def IncrementalOTA_InstallEnd(info): 13 | OTA_InstallEnd(info) 14 | return 15 | 16 | def AddImage(info, basename, dest): 17 | path = "IMAGES/" + basename 18 | if path not in info.input_zip.namelist(): 19 | return 20 | 21 | data = info.input_zip.read(path) 22 | common.ZipWriteStr(info.output_zip, basename, data) 23 | info.script.Print("Patching {} image unconditionally...".format(dest.split('/')[-1])) 24 | info.script.AppendExtra('package_extract_file("%s", "%s");' % (basename, dest)) 25 | 26 | def OTA_InstallEnd(info): 27 | AddImage(info, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo") 28 | AddImage(info, "vbmeta.img", "/dev/block/bootdevice/by-name/vbmeta") 29 | AddImage(info, "vbmeta_system.img", "/dev/block/bootdevice/by-name/vbmeta_system") 30 | return 31 | -------------------------------------------------------------------------------- /gps/utils/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "libgps.utils", 5 | vendor: true, 6 | 7 | 8 | 9 | //# Libs 10 | shared_libs: [ 11 | "libdl", 12 | "libutils", 13 | "libcutils", 14 | "liblog", 15 | "libprocessgroup", 16 | ], 17 | 18 | srcs: [ 19 | "loc_log.cpp", 20 | "loc_cfg.cpp", 21 | "msg_q.c", 22 | "linked_list.c", 23 | "loc_target.cpp", 24 | "LocHeap.cpp", 25 | "LocTimer.cpp", 26 | "LocThread.cpp", 27 | "MsgTask.cpp", 28 | "loc_misc_utils.cpp", 29 | "loc_nmea.cpp", 30 | "LocIpc.cpp", 31 | "LogBuffer.cpp", 32 | ], 33 | 34 | cflags: [ 35 | "-fno-short-enums", 36 | "-D_ANDROID_", 37 | ] + GNSS_CFLAGS, 38 | 39 | //# Includes 40 | ldflags: ["-Wl,--export-dynamic"], 41 | 42 | header_libs: [ 43 | "libutils_headers", 44 | "libloc_pla_headers", 45 | "liblocation_api_headers", 46 | ], 47 | } 48 | 49 | cc_library_headers { 50 | 51 | name: "libgps.utils_headers", 52 | export_include_dirs: ["."], 53 | vendor: true, 54 | } 55 | -------------------------------------------------------------------------------- /gps/core/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "libloc_core", 5 | vendor: true, 6 | 7 | 8 | 9 | shared_libs: [ 10 | "liblog", 11 | "libutils", 12 | "libcutils", 13 | "libgps.utils", 14 | "libdl", 15 | "liblog", 16 | ], 17 | 18 | srcs: [ 19 | "LocApiBase.cpp", 20 | "LocAdapterBase.cpp", 21 | "ContextBase.cpp", 22 | "LocContext.cpp", 23 | "loc_core_log.cpp", 24 | "data-items/DataItemsFactoryProxy.cpp", 25 | "SystemStatusOsObserver.cpp", 26 | "SystemStatus.cpp", 27 | ], 28 | 29 | cflags: [ 30 | "-fno-short-enums", 31 | "-D_ANDROID_", 32 | ] + GNSS_CFLAGS, 33 | 34 | local_include_dirs: [ 35 | "data-items", 36 | "observer", 37 | ], 38 | 39 | header_libs: [ 40 | "libutils_headers", 41 | "libgps.utils_headers", 42 | "libloc_pla_headers", 43 | "liblocation_api_headers", 44 | ], 45 | 46 | } 47 | 48 | cc_library_headers { 49 | 50 | name: "libloc_core_headers", 51 | vendor: true, 52 | export_include_dirs: ["."] + [ 53 | "data-items", 54 | "observer", 55 | ], 56 | } 57 | -------------------------------------------------------------------------------- /libinit/libinit_variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using android::base::GetProperty; 12 | 13 | #define HWC_PROP "ro.boot.hwc" 14 | #define HWNAME_PROP "ro.boot.hwname" 15 | 16 | void search_variant(const std::vector variants) { 17 | std::string hwc_value = GetProperty(HWC_PROP, ""); 18 | std::string hwname_value = GetProperty(HWNAME_PROP, ""); 19 | 20 | for (const auto& variant : variants) { 21 | if ((variant.hwc_value == "" || variant.hwc_value == hwc_value) && (variant.device == hwname_value)) { 22 | set_variant_props(variant); 23 | break; 24 | } 25 | } 26 | } 27 | 28 | void set_variant_props(const variant_info_t variant) { 29 | set_ro_build_prop("brand", variant.brand, true); 30 | set_ro_build_prop("device", variant.device, true); 31 | set_ro_build_prop("model", variant.model, true); 32 | 33 | set_ro_build_prop("fingerprint", variant.build_fingerprint); 34 | property_override("ro.bootimage.build.fingerprint", variant.build_fingerprint); 35 | 36 | property_override("ro.build.description", fingerprint_to_description(variant.build_fingerprint)); 37 | } 38 | -------------------------------------------------------------------------------- /sepolicy/vendor/batterysecret.te: -------------------------------------------------------------------------------- 1 | type batterysecret, domain; 2 | type batterysecret_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(batterysecret) 5 | 6 | r_dir_file(batterysecret, cgroup) 7 | r_dir_file(batterysecret, mnt_vendor_file) 8 | r_dir_file(batterysecret, vendor_sysfs_battery_supply) 9 | r_dir_file(batterysecret, sysfs_batteryinfo) 10 | r_dir_file(batterysecret, sysfs_type) 11 | r_dir_file(batterysecret, vendor_sysfs_usb_supply) 12 | r_dir_file(batterysecret, vendor_sysfs_usbpd_device) 13 | 14 | allow batterysecret { 15 | mnt_vendor_file 16 | persist_subsys_file 17 | rootfs 18 | }:dir rw_dir_perms; 19 | 20 | allow batterysecret { 21 | persist_subsys_file 22 | vendor_sysfs_battery_supply 23 | sysfs_usb 24 | vendor_sysfs_usb_supply 25 | vendor_sysfs_usbpd_device 26 | }:file w_file_perms; 27 | 28 | allow batterysecret kmsg_device:chr_file rw_file_perms; 29 | 30 | allow batterysecret self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; 31 | 32 | allow batterysecret self:global_capability_class_set { 33 | sys_tty_config 34 | sys_boot 35 | }; 36 | 37 | allow batterysecret self:capability { 38 | chown 39 | fsetid 40 | }; 41 | 42 | allow batterysecret { 43 | system_suspend_hwservice 44 | hidl_manager_hwservice 45 | }:hwservice_manager find; 46 | 47 | binder_call(batterysecret, system_suspend_server) 48 | 49 | wakelock_use(batterysecret) 50 | -------------------------------------------------------------------------------- /rootdir/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | // Init scripts 7 | sh_binary { 8 | name: "init.qcom.early_boot.sh", 9 | src: "bin/init.qcom.early_boot.sh", 10 | vendor: true, 11 | } 12 | 13 | sh_binary { 14 | name: "init.qcom.post_boot-atoll.sh", 15 | src: "bin/init.qcom.post_boot-atoll.sh", 16 | vendor: true, 17 | } 18 | 19 | sh_binary { 20 | name: "init.qcom.sh", 21 | src: "bin/init.qcom.sh", 22 | vendor: true, 23 | } 24 | 25 | sh_binary { 26 | name: "init.qti.chg_policy.sh", 27 | src: "bin/init.qti.chg_policy.sh", 28 | vendor: true, 29 | } 30 | 31 | sh_binary { 32 | name: "init.sensors_fixup.sh", 33 | src: "bin/init.sensors_fixup.sh", 34 | vendor: true, 35 | } 36 | 37 | // fstab 38 | prebuilt_etc { 39 | name: "fstab.qcom", 40 | src: "etc/fstab.qcom", 41 | vendor: true, 42 | } 43 | 44 | // Init configuration files 45 | prebuilt_etc { 46 | name: "init.qcom.rc", 47 | src: "etc/init.qcom.rc", 48 | sub_dir: "init/hw", 49 | vendor: true, 50 | } 51 | 52 | prebuilt_etc { 53 | name: "init.target.rc", 54 | src: "etc/init.target.rc", 55 | sub_dir: "init/hw", 56 | vendor: true, 57 | } 58 | 59 | prebuilt_etc { 60 | name: "ueventd.qcom.rc", 61 | filename: "ueventd.rc", 62 | src: "etc/ueventd.qcom.rc", 63 | vendor: true, 64 | } 65 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250Aperture/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | true 9 | 10 | 11 | 12 | 20 13 | 100 14 | 101 15 | 16 | 17 | 40 | 41 | 0 sd|hd|fhd 60 42 | 43 | 44 | -------------------------------------------------------------------------------- /overlay/TelephonyResCommon/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 10 | 1 11 | 12 | 13 | true 14 | 15 | 16 | true 17 | 18 | 21 | true 22 | 23 | 24 | com.qualcomm.qti.uimGbaApp 25 | 26 | 27 | org.codeaurora.ims 28 | 29 | 30 | org.codeaurora.ims 31 | 32 | 33 | com.google.android.gms 34 | 35 | 36 | -------------------------------------------------------------------------------- /config.fs: -------------------------------------------------------------------------------- 1 | [AID_VENDOR_QTI_DIAG] 2 | value:2901 3 | 4 | [AID_VENDOR_QDSS] 5 | value:2902 6 | 7 | [AID_VENDOR_RFS] 8 | value:2903 9 | 10 | [AID_VENDOR_RFS_SHARED] 11 | value:2904 12 | 13 | [AID_VENDOR_ADPL_ODL] 14 | value:2905 15 | 16 | [AID_VENDOR_QRTR] 17 | value:2906 18 | 19 | [AID_VENDOR_THERMAL] 20 | value:2907 21 | 22 | [vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti] 23 | mode: 0755 24 | user: AID_BLUETOOTH 25 | group: AID_BLUETOOTH 26 | caps: BLOCK_SUSPEND NET_ADMIN 27 | 28 | [vendor/bin/pm-service] 29 | mode: 0755 30 | user: AID_SYSTEM 31 | group: AID_SYSTEM 32 | caps: NET_BIND_SERVICE SYS_BOOT 33 | 34 | [vendor/bin/pd-mapper] 35 | mode: 0755 36 | user: AID_SYSTEM 37 | group: AID_SYSTEM 38 | caps: NET_BIND_SERVICE 39 | 40 | [vendor/bin/imsdatadaemon] 41 | mode: 0755 42 | user: AID_RADIO 43 | group: AID_RADIO 44 | caps: NET_BIND_SERVICE 45 | 46 | [vendor/bin/ims_rtp_daemon] 47 | mode: 0755 48 | user: AID_RADIO 49 | group: AID_RADIO 50 | caps: NET_BIND_SERVICE 51 | 52 | [vendor/bin/imsrcsd] 53 | mode: 0755 54 | user: AID_RADIO 55 | group: AID_RADIO 56 | caps: NET_BIND_SERVICE BLOCK_SUSPEND WAKE_ALARM 57 | 58 | [vendor/bin/cnd] 59 | mode: 0755 60 | user: AID_SYSTEM 61 | group: AID_SYSTEM 62 | caps: NET_BIND_SERVICE BLOCK_SUSPEND NET_ADMIN 63 | 64 | [vendor/bin/slim_daemon] 65 | mode: 0755 66 | user: AID_GPS 67 | group: AID_GPS 68 | caps: NET_BIND_SERVICE 69 | 70 | [vendor/bin/loc_launcher] 71 | mode: 0755 72 | user: AID_GPS 73 | group: AID_GPS 74 | caps: SETUID SETGID 75 | 76 | [vendor/bin/xtwifi-client] 77 | mode: 0755 78 | user: AID_GPS 79 | group: AID_GPS 80 | caps: NET_BIND_SERVICE BLOCK_SUSPEND WAKE_ALARM 81 | 82 | [vendor/bin/sensors.qti] 83 | mode: 0755 84 | user: AID_SYSTEM 85 | group: AID_SYSTEM 86 | caps: NET_BIND_SERVICE 87 | 88 | [vendor/firmware_mnt/image/*] 89 | mode: 0771 90 | user: AID_SYSTEM 91 | group: AID_SYSTEM 92 | caps: 0 93 | -------------------------------------------------------------------------------- /gps/utils/LocLoggerBase.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef LOC_LOGGER_BASE_H 30 | #define LOC_LOGGER_BASE_H 31 | 32 | namespace loc_util { 33 | class LocLoggerBase { 34 | public: 35 | virtual void log() {} 36 | }; 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /gps/android/utils/battery_listener.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | typedef void (* battery_status_change_fn_t)(bool); 30 | void loc_extn_battery_properties_listener_init(battery_status_change_fn_t fn); 31 | void loc_extn_battery_properties_listener_deinit(); 32 | bool loc_extn_battery_properties_is_charging(); 33 | -------------------------------------------------------------------------------- /gps/android/2.1/android.hardware.gnss@2.1-service-qti.xml: -------------------------------------------------------------------------------- 1 | 28 | 29 | 30 | android.hardware.gnss 31 | hwbinder 32 | @1.1::IGnss/default 33 | @2.1::IGnss/default 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H 22 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H 23 | 24 | 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_1 { 32 | namespace implementation { 33 | 34 | using ::android::hardware::gnss::V2_0::IGnssDebug; 35 | using ::android::hardware::Return; 36 | using ::android::hardware::Void; 37 | using ::android::hardware::hidl_vec; 38 | using ::android::hardware::hidl_string; 39 | using ::android::sp; 40 | 41 | /* Interface for GNSS Debug support. */ 42 | struct Gnss; 43 | struct GnssDebug : public IGnssDebug { 44 | GnssDebug(Gnss* gnss); 45 | ~GnssDebug() {}; 46 | 47 | // Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow 48 | Return getDebugData(getDebugData_cb _hidl_cb) override; 49 | // Methods from ::android::hardware::gnss::V2_0::IGnssDebug follow. 50 | Return getDebugData_2_0(getDebugData_2_0_cb _hidl_cb) override; 51 | 52 | private: 53 | Gnss* mGnss = nullptr; 54 | }; 55 | 56 | } // namespace implementation 57 | } // namespace V2_1 58 | } // namespace gnss 59 | } // namespace hardware 60 | } // namespace android 61 | 62 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H 63 | -------------------------------------------------------------------------------- /gps/etc/flp.conf: -------------------------------------------------------------------------------- 1 | ################################### 2 | ##### FLP settings ##### 3 | ################################### 4 | 5 | ################################### 6 | # FLP BATCH SIZE 7 | ################################### 8 | # The number of batched locations 9 | # requested to modem. The desired number 10 | # defined below may not be satisfied, as 11 | # the modem can only return the number 12 | # of batched locations that can be allocated, 13 | # which is limited by memory. The default 14 | # batch size defined as 20 as below. 15 | BATCH_SIZE=20 16 | 17 | ################################### 18 | # FLP OUTDOOR TRIP BATCH SIZE 19 | ################################### 20 | # The number of batched locations 21 | # requested to modem for outdoor 22 | # trip batching. The desired number 23 | # defined below may not be satisfied, as 24 | # the modem can only return the number 25 | # of batched locations that can be allocated, 26 | # which is limited by memory. The default 27 | # trip batch size defined as 600 as below. 28 | OUTDOOR_TRIP_BATCH_SIZE=600 29 | 30 | ################################### 31 | # FLP BATCHING SESSION TIMEOUT 32 | ################################### 33 | # Duration with which batch session timeout 34 | # happens in milliseconds. If not specified 35 | # or set to zero, batching session timeout 36 | # defaults to 20 seconds by the modem. 37 | # BATCH_SESSION_TIMEOUT=20000 38 | 39 | ################################### 40 | # FLP BATCHING ACCURACY 41 | ################################### 42 | # Set to one of the defined values below 43 | # to define the accuracy of batching. 44 | # If not specified, accuracy defaults 45 | # to LOW. 46 | # FLP BATCHING ACCURACY values: 47 | # Low accuracy = 0 48 | # Medium accuracy = 1 49 | # High accuracy = 2 50 | ACCURACY=1 51 | 52 | #################################### 53 | # By default if network fixes are not sensor assisted 54 | # these fixes must be dropped. This parameter adds an exception 55 | # for targets where there is no PDR and we still want to 56 | # report out network fixes 57 | # 0: MUST NOT ALLOW NETWORK FIXES 58 | # 1: ALLOW NETWORK FIXES 59 | #################################### 60 | ALLOW_NETWORK_FIXES = 0 61 | -------------------------------------------------------------------------------- /rootdir/etc/init.recovery.qcom.rc: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # * Redistributions of source code must retain the above copyright 6 | # notice, this list of conditions and the following disclaimer. 7 | # * Redistributions in binary form must reproduce the above copyright 8 | # notice, this list of conditions and the following disclaimer in the 9 | # documentation and/or other materials provided with the distribution. 10 | # * Neither the name of The Linux Foundation nor 11 | # the names of its contributors may be used to endorse or promote 12 | # products derived from this software without specific prior written 13 | # permission. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # 27 | 28 | on init 29 | write /sys/class/backlight/panel0-backlight/brightness 200 30 | setprop sys.usb.configfs 1 31 | 32 | on property:ro.boot.usbcontroller=* 33 | setprop sys.usb.controller ${ro.boot.usbcontroller} 34 | write /sys/class/udc/${ro.boot.usbcontroller}/device/../mode peripheral 35 | 36 | on fs 37 | wait /dev/block/platform/soc/${ro.boot.bootdevice} 38 | symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice 39 | -------------------------------------------------------------------------------- /libinit/libinit_dalvik_heap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #define HEAPSTARTSIZE_PROP "dalvik.vm.heapstartsize" 12 | #define HEAPGROWTHLIMIT_PROP "dalvik.vm.heapgrowthlimit" 13 | #define HEAPSIZE_PROP "dalvik.vm.heapsize" 14 | #define HEAPMINFREE_PROP "dalvik.vm.heapminfree" 15 | #define HEAPMAXFREE_PROP "dalvik.vm.heapmaxfree" 16 | #define HEAPTARGETUTILIZATION_PROP "dalvik.vm.heaptargetutilization" 17 | 18 | #define GB(b) (b * 1024ull * 1024 * 1024) 19 | 20 | static const dalvik_heap_info_t dalvik_heap_info_6144 = { 21 | .heapstartsize = "16m", 22 | .heapgrowthlimit = "256m", 23 | .heapsize = "512m", 24 | .heapminfree = "8m", 25 | .heapmaxfree = "32m", 26 | .heaptargetutilization = "0.5", 27 | }; 28 | 29 | static const dalvik_heap_info_t dalvik_heap_info_4096 = { 30 | .heapstartsize = "8m", 31 | .heapgrowthlimit = "256m", 32 | .heapsize = "512m", 33 | .heapminfree = "8m", 34 | .heapmaxfree = "16m", 35 | .heaptargetutilization = "0.6", 36 | }; 37 | 38 | static const dalvik_heap_info_t dalvik_heap_info_2048 = { 39 | .heapstartsize = "8m", 40 | .heapgrowthlimit = "192m", 41 | .heapsize = "512m", 42 | .heapminfree = "512k", 43 | .heapmaxfree = "8m", 44 | .heaptargetutilization = "0.75", 45 | }; 46 | 47 | void set_dalvik_heap() { 48 | struct sysinfo sys; 49 | const dalvik_heap_info_t *dhi; 50 | 51 | sysinfo(&sys); 52 | 53 | if (sys.totalram > GB(5)) 54 | dhi = &dalvik_heap_info_6144; 55 | else if (sys.totalram > GB(3)) 56 | dhi = &dalvik_heap_info_4096; 57 | else 58 | dhi = &dalvik_heap_info_2048; 59 | 60 | property_override(HEAPSTARTSIZE_PROP, dhi->heapstartsize); 61 | property_override(HEAPGROWTHLIMIT_PROP, dhi->heapgrowthlimit); 62 | property_override(HEAPSIZE_PROP, dhi->heapsize); 63 | property_override(HEAPTARGETUTILIZATION_PROP, dhi->heaptargetutilization); 64 | property_override(HEAPMINFREE_PROP, dhi->heapminfree); 65 | property_override(HEAPMAXFREE_PROP, dhi->heapmaxfree); 66 | } 67 | -------------------------------------------------------------------------------- /gps/utils/MsgTask.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2013, 2015, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef __MSG_TASK__ 30 | #define __MSG_TASK__ 31 | 32 | #include 33 | #include 34 | 35 | namespace loc_util { 36 | 37 | struct LocMsg { 38 | inline LocMsg() {} 39 | inline virtual ~LocMsg() {} 40 | virtual void proc() const = 0; 41 | inline virtual void log() const {} 42 | }; 43 | 44 | class MsgTask { 45 | const void* mQ; 46 | LocThread mThread; 47 | public: 48 | ~MsgTask() = default; 49 | MsgTask(const char* threadName = NULL); 50 | void sendMsg(const LocMsg* msg) const; 51 | void sendMsg(const std::function runnable) const; 52 | }; 53 | 54 | } // 55 | 56 | #endif //__MSG_TASK__ 57 | -------------------------------------------------------------------------------- /gps/core/data-items/DataItemsFactoryProxy.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __DATAITEMFACTORYBASE__ 31 | #define __DATAITEMFACTORYBASE__ 32 | 33 | #include 34 | #include 35 | 36 | namespace loc_core 37 | { 38 | 39 | #define DATA_ITEMS_LIB_NAME "libdataitems.so" 40 | #define DATA_ITEMS_GET_CONCRETE_DI "getConcreteDataItem" 41 | 42 | typedef IDataItemCore * (get_concrete_data_item_fn)(DataItemId); 43 | 44 | class DataItemsFactoryProxy { 45 | public: 46 | static IDataItemCore* createNewDataItem(DataItemId id); 47 | static void closeDataItemLibraryHandle(); 48 | static void *dataItemLibHandle; 49 | static get_concrete_data_item_fn *getConcreteDIFunc; 50 | }; 51 | 52 | } // namespace loc_core 53 | 54 | #endif //__DATAITEMFACTORYBASE__ 55 | 56 | -------------------------------------------------------------------------------- /gps/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libloc_api*) 51 | -------------------------------------------------------------------------------- /gps/core/LocContext.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2014, 2017-2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef __LOC_CONTEXT__ 30 | #define __LOC_CONTEXT__ 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace loc_core { 38 | 39 | class LocContext : public ContextBase { 40 | static const MsgTask* mMsgTask; 41 | static ContextBase* mContext; 42 | static const MsgTask* getMsgTask(const char* name); 43 | static pthread_mutex_t mGetLocContextMutex; 44 | 45 | protected: 46 | LocContext(const MsgTask* msgTask); 47 | inline virtual ~LocContext() {} 48 | 49 | public: 50 | static const char* mLBSLibName; 51 | static const char* mLocationHalName; 52 | 53 | static ContextBase* getLocContext(const char* name); 54 | 55 | static void injectFeatureConfig(ContextBase *context); 56 | }; 57 | 58 | } 59 | 60 | #endif //__LOC_CONTEXT__ 61 | -------------------------------------------------------------------------------- /rootdir/bin/init.qti.chg_policy.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | 3 | # 4 | # Copyright (c) 2019-2021 Qualcomm Technologies, Inc. 5 | # All Rights Reserved. 6 | # Confidential and Proprietary - Qualcomm Technologies, Inc. 7 | # 8 | # Copyright (c) 2019 The Linux Foundation. All rights reserved. 9 | # 10 | 11 | export PATH=/vendor/bin 12 | 13 | soc_id=`getprop ro.vendor.qti.soc_id` 14 | if [ "$soc_id" -eq 415 ] || [ "$soc_id" -eq 439 ] || [ "$soc_id" -eq 450 ] || [ "$soc_id" -eq 475 ] || [ "$soc_id" -eq 497 ] || [ "$soc_id" -eq 498 ] || [ "$soc_id" -eq 499 ] || [ "$soc_id" -eq 515 ]; then 15 | setprop persist.vendor.hvdcp_opti.start 2 16 | exit 0 17 | fi 18 | 19 | if [ "$soc_id" -eq 441 ] || [ "$soc_id" -eq 471 ]; then 20 | #Scuba does not support usb-pd or charge pumps 21 | find /sys/class/power_supply/battery/ -type f -maxdepth 1 | xargs chown system.system 22 | find /sys/class/power_supply/bms/ -type f -maxdepth 1 | xargs chown system.system 23 | find /sys/class/power_supply/main/ -type f -maxdepth 1 | xargs chown system.system 24 | find /sys/class/power_supply/usb/ -type f -maxdepth 1 | xargs chown system.system 25 | else 26 | find /sys/class/power_supply/battery/ -type f -maxdepth 1 | xargs chown system.system 27 | find /sys/class/power_supply/bms/ -type f -maxdepth 1 | xargs chown system.system 28 | find /sys/class/power_supply/main/ -type f -maxdepth 1 | xargs chown system.system 29 | find /sys/class/power_supply/usb/ -type f -maxdepth 1 | xargs chown system.system 30 | find /sys/class/power_supply/charge_pump_master/ -type f -maxdepth 1 | xargs chown system.system 31 | find /sys/class/power_supply/pc_port/ -type f -maxdepth 1 | xargs chown system.system 32 | find /sys/class/power_supply/dc/ -type f -maxdepth 1 | xargs chown system.system 33 | find /sys/class/power_supply/parallel/ -type f -maxdepth 1 | xargs chown system.system 34 | find /sys/class/usbpd/usbpd0/ -type f -maxdepth 1 | xargs chown system.system 35 | find /sys/class/qc-vdm/ -type f -maxdepth 1 | xargs chown system.system 36 | find /sys/class/charge_pump/ -type f -maxdepth 1 | xargs chown system.system 37 | find /sys/class/qcom-battery/ -type f -maxdepth 1 | xargs chown system.system 38 | 39 | for i in 0 1 2 3 4 5 6 7 8 9 40 | do 41 | devname=`cat /sys/bus/iio/devices/iio:device$i/name` 42 | if [[ "$devname" == *smb* ]] || [[ "$devname" == *qg* ]] || [[ "$devname" == *div2_cp* ]] || [[ "$devname" == *div2-cp* ]]; then 43 | find /sys/bus/iio/devices/iio:device$i/ -type f -maxdepth 1 | xargs chown system.system 44 | fi 45 | done 46 | fi 47 | 48 | setprop persist.vendor.hvdcp_opti.start 1 49 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssNi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H 22 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H 23 | 24 | #include 25 | #include 26 | 27 | namespace android { 28 | namespace hardware { 29 | namespace gnss { 30 | namespace V2_1 { 31 | namespace implementation { 32 | 33 | using ::android::hardware::gnss::V1_0::IGnssNi; 34 | using ::android::hardware::gnss::V1_0::IGnssNiCallback; 35 | using ::android::hardware::Return; 36 | using ::android::hardware::Void; 37 | using ::android::hardware::hidl_vec; 38 | using ::android::hardware::hidl_string; 39 | using ::android::sp; 40 | 41 | struct Gnss; 42 | struct GnssNi : public IGnssNi { 43 | GnssNi(Gnss* gnss); 44 | ~GnssNi() = default; 45 | 46 | /* 47 | * Methods from ::android::hardware::gnss::V1_0::IGnssNi follow. 48 | * These declarations were generated from IGnssNi.hal. 49 | */ 50 | Return setCallback(const sp& callback) override; 51 | Return respond(int32_t notifId, 52 | IGnssNiCallback::GnssUserResponseType userResponse) override; 53 | 54 | private: 55 | struct GnssNiDeathRecipient : hidl_death_recipient { 56 | GnssNiDeathRecipient(sp gnssNi) : mGnssNi(gnssNi) { 57 | } 58 | ~GnssNiDeathRecipient() = default; 59 | virtual void serviceDied(uint64_t cookie, const wp& who) override; 60 | sp mGnssNi; 61 | }; 62 | 63 | private: 64 | sp mGnssNiDeathRecipient = nullptr; 65 | sp mGnssNiCbIface = nullptr; 66 | Gnss* mGnss = nullptr; 67 | }; 68 | 69 | } // namespace implementation 70 | } // namespace V2_1 71 | } // namespace gnss 72 | } // namespace hardware 73 | } // namespace android 74 | 75 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H 76 | -------------------------------------------------------------------------------- /libinit/libinit_utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | void property_override(std::string prop, std::string value, bool add) { 13 | auto pi = (prop_info *) __system_property_find(prop.c_str()); 14 | if (pi != nullptr) { 15 | __system_property_update(pi, value.c_str(), value.length()); 16 | } else if (add) { 17 | __system_property_add(prop.c_str(), prop.length(), value.c_str(), value.length()); 18 | } 19 | } 20 | 21 | std::vector ro_props_default_source_order = { 22 | "odm.", 23 | "odm_dlkm.", 24 | "product.", 25 | "system.", 26 | "system_ext.", 27 | "vendor.", 28 | "vendor_dlkm.", 29 | "", 30 | }; 31 | 32 | void set_ro_build_prop(const std::string &prop, const std::string &value, bool product) { 33 | std::string prop_name; 34 | 35 | for (const auto &source : ro_props_default_source_order) { 36 | if (product) 37 | prop_name = "ro.product." + source + prop; 38 | else 39 | prop_name = "ro." + source + "build." + prop; 40 | 41 | property_override(prop_name, value, true); 42 | } 43 | } 44 | 45 | #define FIND_AND_REMOVE(s, delimiter, variable_name) \ 46 | std::string variable_name = s.substr(0, s.find(delimiter)); \ 47 | s.erase(0, s.find(delimiter) + delimiter.length()); 48 | 49 | #define APPEND_STRING(s, to_append) \ 50 | s.append(" "); \ 51 | s.append(to_append); 52 | 53 | std::string fingerprint_to_description(std::string fingerprint) { 54 | std::string delimiter = "/"; 55 | std::string delimiter2 = ":"; 56 | std::string build_fingerprint_copy = fingerprint; 57 | 58 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, brand) 59 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, product) 60 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter2, device) 61 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, platform_version) 62 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, build_id) 63 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter2, build_number) 64 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, build_variant) 65 | std::string build_version_tags = build_fingerprint_copy; 66 | 67 | std::string description = product + "-" + build_variant; 68 | APPEND_STRING(description, platform_version) 69 | APPEND_STRING(description, build_id) 70 | APPEND_STRING(description, build_number) 71 | APPEND_STRING(description, build_version_tags) 72 | 73 | return description; 74 | } 75 | -------------------------------------------------------------------------------- /gps/android/2.1/AGnss.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H 22 | #define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_1 { 32 | namespace implementation { 33 | 34 | using ::android::hardware::Return; 35 | using ::android::hardware::Void; 36 | using ::android::hardware::hidl_vec; 37 | using ::android::hardware::hidl_string; 38 | using ::android::sp; 39 | using ::android::hardware::gnss::V2_0::IAGnssCallback; 40 | 41 | struct Gnss; 42 | struct AGnss : public V2_0::IAGnss { 43 | 44 | AGnss(Gnss* gnss); 45 | ~AGnss(); 46 | /* 47 | * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow. 48 | * These declarations were generated from IAGnss.hal. 49 | */ 50 | Return setCallback(const sp& callback) override; 51 | 52 | Return dataConnClosed() override; 53 | 54 | Return dataConnFailed() override; 55 | 56 | Return dataConnOpen(uint64_t networkHandle, const hidl_string& apn, 57 | V2_0::IAGnss::ApnIpType apnIpType) override; 58 | 59 | Return setServer(V2_0::IAGnssCallback::AGnssType type, 60 | const hidl_string& hostname, int32_t port) override; 61 | 62 | void statusCb(AGpsExtType type, LocAGpsStatusValue status); 63 | 64 | /* Data call setup callback passed down to GNSS HAL implementation */ 65 | static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status); 66 | 67 | private: 68 | Gnss* mGnss = nullptr; 69 | sp mAGnssCbIface = nullptr; 70 | 71 | AGpsExtType mType; 72 | }; 73 | 74 | } // namespace implementation 75 | } // namespace V2_1 76 | } // namespace gnss 77 | } // namespace hardware 78 | } // namespace android 79 | 80 | #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H 81 | -------------------------------------------------------------------------------- /gps/android/2.1/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2_0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2_0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #define LOG_TAG "android.hardware.gnss@2.1-service-qti" 22 | 23 | #include 24 | #include 25 | #include "loc_cfg.h" 26 | #include "loc_misc_utils.h" 27 | 28 | extern "C" { 29 | #include "vndfwk-detect.h" 30 | } 31 | 32 | #ifdef ARCH_ARM_32 33 | #define DEFAULT_HW_BINDER_MEM_SIZE 65536 34 | #endif 35 | 36 | using android::hardware::gnss::V2_1::IGnss; 37 | 38 | using android::hardware::configureRpcThreadpool; 39 | using android::hardware::registerPassthroughServiceImplementation; 40 | using android::hardware::joinRpcThreadpool; 41 | 42 | using android::status_t; 43 | using android::OK; 44 | 45 | typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []); 46 | 47 | int main() { 48 | 49 | ALOGI("%s", __FUNCTION__); 50 | 51 | int vendorInfo = getVendorEnhancedInfo(); 52 | bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo ); 53 | setVendorEnhanced(vendorEnhanced); 54 | 55 | #ifdef ARCH_ARM_32 56 | android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE)); 57 | #endif 58 | configureRpcThreadpool(1, true); 59 | status_t status; 60 | 61 | status = registerPassthroughServiceImplementation(); 62 | if (status == OK) { 63 | #ifdef LOC_HIDL_VERSION 64 | #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so" 65 | 66 | void* libHandle = NULL; 67 | vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*) 68 | dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main"); 69 | if (NULL != vendorEnhancedMainMethod) { 70 | (*vendorEnhancedMainMethod)(0, NULL); 71 | } 72 | #else 73 | ALOGI("LOC_HIDL_VERSION not defined."); 74 | #endif 75 | joinRpcThreadpool(); 76 | } else { 77 | ALOGE("Error while registering IGnss 2.1 service: %d", status); 78 | } 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /gps/core/loc_core_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2013, 2016-2017 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_CORE_LOG_H 31 | #define LOC_CORE_LOG_H 32 | 33 | #include 34 | #include 35 | 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif 40 | 41 | const char* loc_get_gps_status_name(LocGpsStatusValue gps_status); 42 | const char* loc_get_position_mode_name(LocGpsPositionMode mode); 43 | const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur); 44 | const char* loc_get_aiding_data_mask_names(LocGpsAidingData data); 45 | const char* loc_get_agps_type_name(LocAGpsType type); 46 | const char* loc_get_ni_type_name(LocGpsNiType type); 47 | const char* loc_get_ni_response_name(LocGpsUserResponseType response); 48 | const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding); 49 | const char* loc_get_agps_bear_name(AGpsBearerType bear); 50 | const char* loc_get_server_type_name(LocServerType type); 51 | const char* loc_get_position_sess_status_name(enum loc_sess_status status); 52 | const char* loc_get_agps_status_name(LocAGpsStatusValue status); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* LOC_CORE_LOG_H */ 59 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssNi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #define LOG_TAG "LocSvc_GnssNiInterface" 22 | 23 | #include 24 | #include "Gnss.h" 25 | #include "GnssNi.h" 26 | 27 | namespace android { 28 | namespace hardware { 29 | namespace gnss { 30 | namespace V2_1 { 31 | namespace implementation { 32 | 33 | void GnssNi::GnssNiDeathRecipient::serviceDied(uint64_t cookie, const wp& who) { 34 | LOC_LOGE("%s] service died. cookie: %llu, who: %p", 35 | __FUNCTION__, static_cast(cookie), &who); 36 | // we do nothing here 37 | // Gnss::GnssDeathRecipient will stop the session 38 | } 39 | 40 | GnssNi::GnssNi(Gnss* gnss) : mGnss(gnss) { 41 | mGnssNiDeathRecipient = new GnssNiDeathRecipient(this); 42 | } 43 | 44 | // Methods from ::android::hardware::gnss::V1_0::IGnssNi follow. 45 | Return GnssNi::setCallback(const sp& callback) { 46 | if (mGnss == nullptr) { 47 | LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__); 48 | return Void(); 49 | } 50 | 51 | mGnss->setGnssNiCb(callback); 52 | 53 | if (mGnssNiCbIface != nullptr) { 54 | mGnssNiCbIface->unlinkToDeath(mGnssNiDeathRecipient); 55 | } 56 | mGnssNiCbIface = callback; 57 | if (mGnssNiCbIface != nullptr) { 58 | mGnssNiCbIface->linkToDeath(mGnssNiDeathRecipient, 0 /*cookie*/); 59 | } 60 | 61 | return Void(); 62 | } 63 | 64 | Return GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse) { 65 | if (mGnss == nullptr) { 66 | LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__); 67 | return Void(); 68 | } 69 | 70 | GnssAPIClient* api = mGnss->getApi(); 71 | if (api == nullptr) { 72 | LOC_LOGE("%s]: api is nullptr", __FUNCTION__); 73 | return Void(); 74 | } 75 | 76 | api->gnssNiRespond(notifId, userResponse); 77 | 78 | return Void(); 79 | } 80 | 81 | } // namespace implementation 82 | } // namespace V2_1 83 | } // namespace gnss 84 | } // namespace hardware 85 | } // namespace android 86 | -------------------------------------------------------------------------------- /gps/gnss/NativeAgpsHandler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef NATIVEAGPSHANDLER_H 30 | #define NATIVEAGPSHANDLER_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | using namespace std; 40 | using loc_core::IOsObserver; 41 | using loc_core::IDataItemObserver; 42 | using loc_core::IDataItemCore; 43 | 44 | class GnssAdapter; 45 | 46 | class NativeAgpsHandler : public IDataItemObserver { 47 | public: 48 | NativeAgpsHandler(IOsObserver* sysStatObs, GnssAdapter& adapter); 49 | ~NativeAgpsHandler(); 50 | AgpsCbInfo getAgpsCbInfo(); 51 | // IDataItemObserver overrides 52 | virtual void notify(const list& dlist); 53 | inline virtual void getName(string& name); 54 | private: 55 | static NativeAgpsHandler* sLocalHandle; 56 | static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 statusInfo); 57 | void processATLRequestRelease(AGnssExtStatusIpV4 statusInfo); 58 | IOsObserver* mSystemStatusObsrvr; 59 | bool mConnected; 60 | string mApn; 61 | GnssAdapter& mAdapter; 62 | }; 63 | 64 | #endif // NATIVEAGPSHANDLER_H 65 | -------------------------------------------------------------------------------- /gps/core/LBSProxyBase.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef IZAT_PROXY_BASE_H 30 | #define IZAT_PROXY_BASE_H 31 | #include 32 | 33 | namespace loc_core { 34 | 35 | class LocApiBase; 36 | class LocAdapterBase; 37 | class ContextBase; 38 | 39 | class LBSProxyBase { 40 | friend class ContextBase; 41 | inline virtual LocApiBase* 42 | getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask, 43 | ContextBase* context) const { 44 | 45 | (void)exMask; 46 | (void)context; 47 | return NULL; 48 | } 49 | protected: 50 | inline LBSProxyBase() {} 51 | public: 52 | inline virtual ~LBSProxyBase() {} 53 | inline virtual bool hasAgpsExtendedCapabilities() const { return false; } 54 | inline virtual void modemPowerVote(bool power) const { 55 | 56 | (void)power; 57 | } 58 | virtual void injectFeatureConfig(ContextBase* context) const { 59 | 60 | (void)context; 61 | } 62 | inline virtual bool hasNativeXtraClient() const { return false; } 63 | inline virtual IzatDevId_t getIzatDevId() const { return 0; } 64 | }; 65 | 66 | typedef LBSProxyBase* (getLBSProxy_t)(); 67 | 68 | } // namespace loc_core 69 | 70 | #endif // IZAT_PROXY_BASE_H 71 | -------------------------------------------------------------------------------- /rootdir/bin/init.qcom.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | 3 | # Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of The Linux Foundation nor 13 | # the names of its contributors may be used to endorse or promote 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | # 31 | # Make modem config folder and copy firmware config to that folder for RIL 32 | # 33 | if [ -f /data/vendor/modem_config/ver_info.txt ]; then 34 | prev_version_info=`cat /data/vendor/modem_config/ver_info.txt` 35 | else 36 | prev_version_info="" 37 | fi 38 | 39 | cur_version_info=`cat /vendor/firmware_mnt/verinfo/ver_info.txt` 40 | if [ ! -f /vendor/firmware_mnt/verinfo/ver_info.txt -o "$prev_version_info" != "$cur_version_info" ]; then 41 | # add W for group recursively before delete 42 | chmod g+w -R /data/vendor/modem_config/* 43 | rm -rf /data/vendor/modem_config/* 44 | # preserve the read only mode for all subdir and files 45 | cp --preserve=m -dr /vendor/firmware_mnt/image/modem_pr/mcfg/configs/* /data/vendor/modem_config 46 | cp --preserve=m -d /vendor/firmware_mnt/verinfo/ver_info.txt /data/vendor/modem_config/ 47 | cp --preserve=m -d /vendor/firmware_mnt/image/modem_pr/mbn_ota.txt /data/vendor/modem_config/ 48 | # the group must be root, otherwise this script could not add "W" for group recursively 49 | chown -hR radio.root /data/vendor/modem_config/* 50 | fi 51 | chmod g-w /data/vendor/modem_config 52 | setprop ro.vendor.ril.mbn_copy_completed 1 53 | -------------------------------------------------------------------------------- /gps/core/observer/IDataItemObserver.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __IDATAITEMOBSERVER_H__ 31 | #define __IDATAITEMOBSERVER_H__ 32 | 33 | #include 34 | #include 35 | 36 | using namespace std; 37 | 38 | namespace loc_core 39 | { 40 | class IDataItemCore; 41 | 42 | /** 43 | * @brief IDataItemObserver interface 44 | * @details IDataItemObserver interface; 45 | * In OS dependent code this type serves as a handle to an OS independent instance of this interface. 46 | */ 47 | class IDataItemObserver { 48 | 49 | public: 50 | 51 | /** 52 | * @brief Gets name of Data Item Observer 53 | * @details Gets name of Data Item Observer 54 | * 55 | * @param name reference to name of Data Item Observer 56 | */ 57 | virtual void getName (string & name) = 0; 58 | 59 | /** 60 | * @brief Notify updated values of Data Items 61 | * @details Notifys updated values of Data items 62 | * 63 | * @param dlist List of updated data items 64 | */ 65 | virtual void notify (const std :: list & dlist) = 0; 66 | 67 | /** 68 | * @brief Destructor 69 | * @details Destructor 70 | */ 71 | virtual ~IDataItemObserver () {} 72 | }; 73 | 74 | } // namespace loc_core 75 | 76 | #endif // #ifndef __IDATAITEMOBSERVER_H__ 77 | -------------------------------------------------------------------------------- /gps/android/2.1/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_shared { 2 | name: "android.hardware.gnss@2.1-impl-qti", 3 | vendor: true, 4 | relative_install_path: "hw", 5 | srcs: [ 6 | "AGnss.cpp", 7 | "Gnss.cpp", 8 | "AGnssRil.cpp", 9 | "GnssMeasurement.cpp", 10 | "GnssConfiguration.cpp", 11 | "GnssBatching.cpp", 12 | "GnssGeofencing.cpp", 13 | "GnssNi.cpp", 14 | "GnssDebug.cpp", 15 | "GnssAntennaInfo.cpp", 16 | "MeasurementCorrections.cpp", 17 | "GnssVisibilityControl.cpp", 18 | ] + [ 19 | "location_api/GnssAPIClient.cpp", 20 | "location_api/MeasurementAPIClient.cpp", 21 | "location_api/GeofenceAPIClient.cpp", 22 | "location_api/BatchingAPIClient.cpp", 23 | "location_api/LocationUtil.cpp", 24 | ], 25 | 26 | local_include_dirs: ["location_api"], 27 | 28 | header_libs: [ 29 | "libgps.utils_headers", 30 | "libloc_core_headers", 31 | "libloc_pla_headers", 32 | "liblocation_api_headers", 33 | "liblocbatterylistener_headers", 34 | ], 35 | 36 | shared_libs: [ 37 | "liblog", 38 | "libhidlbase", 39 | "libcutils", 40 | "libutils", 41 | "android.hardware.gnss@1.0", 42 | "android.hardware.gnss@1.1", 43 | "android.hardware.gnss@2.0", 44 | "android.hardware.gnss@2.1", 45 | "android.hardware.gnss.measurement_corrections@1.0", 46 | "android.hardware.gnss.measurement_corrections@1.1", 47 | "android.hardware.gnss.visibility_control@1.0", 48 | "android.hardware.health@1.0", 49 | "android.hardware.health@2.0", 50 | "android.hardware.health@2.1", 51 | "android.hardware.power@1.2", 52 | "libbase", 53 | ] + [ 54 | "libloc_core", 55 | "libgps.utils", 56 | "libdl", 57 | "liblocation_api", 58 | ], 59 | 60 | cflags: GNSS_CFLAGS, 61 | static_libs: ["liblocbatterylistener"] + ["libhealthhalutils"], 62 | } 63 | 64 | cc_binary { 65 | name: "android.hardware.gnss@2.1-service-qti", 66 | vintf_fragments: ["android.hardware.gnss@2.1-service-qti.xml"], 67 | vendor: true, 68 | relative_install_path: "hw", 69 | init_rc: ["android.hardware.gnss@2.1-service-qti.rc"], 70 | srcs: ["service.cpp"], 71 | 72 | header_libs: [ 73 | "libgps.utils_headers", 74 | "libloc_core_headers", 75 | "libloc_pla_headers", 76 | "liblocation_api_headers", 77 | ], 78 | 79 | shared_libs: [ 80 | "liblog", 81 | "libcutils", 82 | "libdl", 83 | "libbase", 84 | "libutils", 85 | "libgps.utils", 86 | "libqti_vndfwk_detect", 87 | ] + [ 88 | "libhidlbase", 89 | "android.hardware.gnss@1.0", 90 | "android.hardware.gnss@1.1", 91 | "android.hardware.gnss@2.0", 92 | "android.hardware.gnss@2.1", 93 | ], 94 | 95 | cflags: GNSS_CFLAGS + ["-DLOC_HIDL_VERSION=\"4.0\""], 96 | } 97 | -------------------------------------------------------------------------------- /gps/core/data-items/IDataItemCore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __IDATAITEMCORE_H__ 31 | #define __IDATAITEMCORE_H__ 32 | 33 | #include 34 | #include 35 | 36 | namespace loc_core { 37 | 38 | using namespace std; 39 | 40 | /** 41 | * @brief IDataItemCore interface. 42 | * @details IDataItemCore interface. 43 | * 44 | */ 45 | class IDataItemCore { 46 | public: 47 | /** 48 | * @brief Gets Data item id. 49 | * @details Gets Data item id. 50 | * @return Data item id. 51 | */ 52 | virtual DataItemId getId () = 0; 53 | 54 | /** 55 | * @brief Stringify. 56 | * @details Stringify. 57 | * 58 | * @param valueStr Reference to string. 59 | */ 60 | virtual void stringify (string & valueStr) = 0; 61 | 62 | /** 63 | * @brief copy. 64 | * @details copy. 65 | * 66 | * @param src Where to copy from. 67 | * @param dataItemCopied Boolean flag indicated whether or not copied. 68 | * 69 | * @return Zero for success or non zero for failure. 70 | */ 71 | virtual int32_t copy (IDataItemCore * src, bool *dataItemCopied = nullptr) = 0; 72 | 73 | /** 74 | * @brief Destructor. 75 | * @details Destructor. 76 | */ 77 | virtual ~IDataItemCore () {} 78 | }; 79 | 80 | } // namespace loc_core 81 | 82 | #endif // __IDATAITEMCORE_H__ 83 | -------------------------------------------------------------------------------- /rootdir/bin/init.qcom.early_boot.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | 3 | # Copyright (c) 2012-2013,2016,2018-2020 The Linux Foundation. All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of The Linux Foundation nor 13 | # the names of its contributors may be used to endorse or promote 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | export PATH=/vendor/bin 31 | 32 | echo "detect" > /sys/class/drm/card0-DSI-1/status 33 | #For drm based display driver 34 | vbfile=/sys/module/drm/parameters/vblankoffdelay 35 | if [ -w $vbfile ]; then 36 | echo -1 > $vbfile 37 | else 38 | log -t DRM_BOOT -p w "file: '$vbfile' or perms doesn't exist" 39 | fi 40 | 41 | function set_perms() { 42 | #Usage set_perms 43 | chown -h $2 $1 44 | chmod $3 $1 45 | } 46 | 47 | set_perms /sys/devices/virtual/hdcp/msm_hdcp/min_level_change system.graphics 0660 48 | # allow system_graphics group to access pmic secure_mode node 49 | set_perms /sys/class/lcd_bias/secure_mode system.graphics 0660 50 | set_perms /sys/class/leds/wled/secure_mode system.graphics 0660 51 | 52 | boot_reason=`cat /proc/sys/kernel/boot_reason` 53 | reboot_reason=`getprop ro.boot.alarmboot` 54 | if [ "$boot_reason" = "3" ] || [ "$reboot_reason" = "true" ]; then 55 | setprop ro.vendor.alarm_boot true 56 | else 57 | setprop ro.vendor.alarm_boot false 58 | fi 59 | 60 | # copy GPU frequencies to vendor property 61 | if [ -f /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies ]; then 62 | gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies` 2> /dev/null 63 | setprop vendor.gpu.available_frequencies "$gpu_freq" 64 | fi 65 | -------------------------------------------------------------------------------- /gps/core/data-items/DataItemId.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __DATAITEMID_H__ 31 | #define __DATAITEMID_H__ 32 | 33 | /** 34 | * Enumeration of Data Item types 35 | * When add/remove/update changes are made to Data Items, this file needs to be updated 36 | * accordingly 37 | */ 38 | typedef enum e_DataItemId { 39 | INVALID_DATA_ITEM_ID = -1, 40 | // 0 - 4 41 | AIRPLANEMODE_DATA_ITEM_ID, 42 | ENH_DATA_ITEM_ID, 43 | GPSSTATE_DATA_ITEM_ID, 44 | NLPSTATUS_DATA_ITEM_ID, 45 | WIFIHARDWARESTATE_DATA_ITEM_ID, 46 | // 5 - 9 47 | NETWORKINFO_DATA_ITEM_ID, 48 | RILVERSION_DATA_ITEM_ID, 49 | RILSERVICEINFO_DATA_ITEM_ID, 50 | RILCELLINFO_DATA_ITEM_ID, 51 | SERVICESTATUS_DATA_ITEM_ID, 52 | // 10 - 14 53 | MODEL_DATA_ITEM_ID, 54 | MANUFACTURER_DATA_ITEM_ID, 55 | VOICECALL_DATA_ITEM, 56 | ASSISTED_GPS_DATA_ITEM_ID, 57 | SCREEN_STATE_DATA_ITEM_ID, 58 | // 15 - 19 59 | POWER_CONNECTED_STATE_DATA_ITEM_ID, 60 | TIMEZONE_CHANGE_DATA_ITEM_ID, 61 | TIME_CHANGE_DATA_ITEM_ID, 62 | WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID, 63 | SHUTDOWN_STATE_DATA_ITEM_ID, 64 | // 20 - 24 65 | TAC_DATA_ITEM_ID, 66 | MCCMNC_DATA_ITEM_ID, 67 | BTLE_SCAN_DATA_ITEM_ID, 68 | BT_SCAN_DATA_ITEM_ID, 69 | OEM_GTP_UPLOAD_TRIGGER_READY_ITEM_ID, 70 | 71 | MAX_DATA_ITEM_ID, 72 | 73 | // 26 - 74 | BATTERY_LEVEL_DATA_ITEM_ID, 75 | 76 | MAX_DATA_ITEM_ID_1_1, 77 | } DataItemId; 78 | 79 | #endif // #ifndef __DATAITEMID_H__ 80 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssBatching.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H 22 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H 23 | 24 | #include 25 | #include 26 | 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_1 { 32 | namespace implementation { 33 | 34 | using ::android::hardware::gnss::V2_0::IGnssBatching; 35 | using ::android::hardware::gnss::V2_0::IGnssBatchingCallback; 36 | using ::android::hidl::base::V1_0::IBase; 37 | using ::android::hardware::hidl_array; 38 | using ::android::hardware::hidl_memory; 39 | using ::android::hardware::hidl_string; 40 | using ::android::hardware::hidl_vec; 41 | using ::android::hardware::Return; 42 | using ::android::hardware::Void; 43 | using ::android::sp; 44 | 45 | class BatchingAPIClient; 46 | struct GnssBatching : public IGnssBatching { 47 | GnssBatching(); 48 | ~GnssBatching(); 49 | 50 | // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow. 51 | Return init(const sp& callback) override; 52 | Return getBatchSize() override; 53 | Return start(const IGnssBatching::Options& options ) override; 54 | Return flush() override; 55 | Return stop() override; 56 | Return cleanup() override; 57 | 58 | // Methods from ::android::hardware::gnss::V2_0::IGnssBatching follow. 59 | Return init_2_0(const sp& callback) override; 60 | 61 | private: 62 | struct GnssBatchingDeathRecipient : hidl_death_recipient { 63 | GnssBatchingDeathRecipient(sp gnssBatching) : 64 | mGnssBatching(gnssBatching) { 65 | } 66 | ~GnssBatchingDeathRecipient() = default; 67 | virtual void serviceDied(uint64_t cookie, const wp& who) override; 68 | sp mGnssBatching; 69 | }; 70 | 71 | private: 72 | sp mGnssBatchingDeathRecipient = nullptr; 73 | sp mGnssBatchingCbIface = nullptr; 74 | BatchingAPIClient* mApi = nullptr; 75 | sp mGnssBatchingCbIface_2_0 = nullptr; 76 | }; 77 | 78 | } // namespace implementation 79 | } // namespace V2_1 80 | } // namespace gnss 81 | } // namespace hardware 82 | } // namespace android 83 | 84 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H 85 | -------------------------------------------------------------------------------- /gps/android/2.1/AGnssRil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_ 22 | #define ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_1 { 32 | namespace implementation { 33 | 34 | using ::android::hardware::Return; 35 | using ::android::hardware::Void; 36 | using ::android::hardware::hidl_vec; 37 | using ::android::hardware::hidl_string; 38 | using ::android::sp; 39 | 40 | struct Gnss; 41 | /* 42 | * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface Layer interface 43 | * allows the GNSS chipset to request radio interface layer information from Android platform. 44 | * Examples of such information are reference location, unique subscriber ID, phone number string 45 | * and network availability changes. Also contains wrapper methods to allow methods from 46 | * IAGnssiRilCallback interface to be passed into the conventional implementation of the GNSS HAL. 47 | */ 48 | struct AGnssRil : public V2_0::IAGnssRil { 49 | AGnssRil(Gnss* gnss); 50 | ~AGnssRil(); 51 | 52 | /* 53 | * Methods from ::android::hardware::gnss::V1_0::IAGnssRil follow. 54 | * These declarations were generated from IAGnssRil.hal. 55 | */ 56 | Return setCallback(const sp& /*callback*/) override { 57 | return Void(); 58 | } 59 | Return setRefLocation(const V1_0::IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override { 60 | return Void(); 61 | } 62 | Return setSetId(V1_0::IAGnssRil::SetIDType /*type*/, const hidl_string& /*setid*/) override { 63 | return false; 64 | } 65 | Return updateNetworkAvailability(bool /*available*/, 66 | const hidl_string& /*apn*/) override { 67 | return false; 68 | } 69 | Return updateNetworkState(bool connected, V1_0::IAGnssRil::NetworkType type, bool roaming) override; 70 | 71 | // Methods from ::android::hardware::gnss::V2_0::IAGnssRil follow 72 | Return updateNetworkState_2_0(const V2_0::IAGnssRil::NetworkAttributes& attributes) override; 73 | 74 | private: 75 | Gnss* mGnss = nullptr; 76 | }; 77 | 78 | } // namespace implementation 79 | } // namespace V2_1 80 | } // namespace gnss 81 | } // namespace hardware 82 | } // namespace android 83 | 84 | #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_ 85 | -------------------------------------------------------------------------------- /gps/core/data-items/DataItemsFactoryProxy.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #define LOG_TAG "DataItemsFactoryProxy" 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include "loc_misc_utils.h" 38 | 39 | namespace loc_core 40 | { 41 | void* DataItemsFactoryProxy::dataItemLibHandle = NULL; 42 | get_concrete_data_item_fn* DataItemsFactoryProxy::getConcreteDIFunc = NULL; 43 | 44 | IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id) 45 | { 46 | IDataItemCore *mydi = nullptr; 47 | 48 | if (NULL != getConcreteDIFunc) { 49 | mydi = (*getConcreteDIFunc)(id); 50 | } 51 | else { 52 | getConcreteDIFunc = (get_concrete_data_item_fn * ) 53 | dlGetSymFromLib(dataItemLibHandle, DATA_ITEMS_LIB_NAME, DATA_ITEMS_GET_CONCRETE_DI); 54 | 55 | if (NULL != getConcreteDIFunc) { 56 | LOC_LOGd("Loaded function %s : %p", DATA_ITEMS_GET_CONCRETE_DI, getConcreteDIFunc); 57 | mydi = (*getConcreteDIFunc)(id); 58 | } 59 | else { 60 | // dlysm failed. 61 | const char * err = dlerror(); 62 | if (NULL == err) 63 | { 64 | err = "Unknown"; 65 | } 66 | LOC_LOGe("failed to find symbol %s; error=%s", DATA_ITEMS_GET_CONCRETE_DI, err); 67 | } 68 | } 69 | return mydi; 70 | } 71 | 72 | void DataItemsFactoryProxy::closeDataItemLibraryHandle() 73 | { 74 | if (NULL != dataItemLibHandle) { 75 | dlclose(dataItemLibHandle); 76 | dataItemLibHandle = NULL; 77 | } 78 | } 79 | 80 | } // namespace loc_core 81 | 82 | 83 | -------------------------------------------------------------------------------- /gps/utils/loc_timer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013,2015 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __LOC_DELAY_H__ 31 | #define __LOC_DELAY_H__ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif /* __cplusplus */ 36 | #include 37 | #include 38 | #include 39 | /* 40 | user_data: client context pointer, passthrough. Originally received 41 | from calling client when loc_timer_start() is called. 42 | result: 0 if timer successfully timed out; else timer failed. 43 | */ 44 | typedef void (*loc_timer_callback)(void *user_data, int32_t result); 45 | 46 | 47 | /* 48 | delay_msec: timeout value for the timer. 49 | cb_func: callback function pointer, implemented by client. 50 | Can not be NULL. 51 | user_data: client context pointer, passthrough. Will be 52 | returned when loc_timer_callback() is called. 53 | wakeOnExpire: true if to wake up CPU (if sleeping) upon timer 54 | expiration and notify the client. 55 | false if to wait until next time CPU wakes up (if 56 | sleeping) and then notify the client. 57 | Returns the handle, which can be used to stop the timer 58 | NULL, if timer start fails (e.g. if cb_func is NULL). 59 | */ 60 | void* loc_timer_start(uint64_t delay_msec, 61 | loc_timer_callback cb_func, 62 | void *user_data, 63 | bool wake_on_expire=false); 64 | 65 | /* 66 | handle becomes invalid upon the return of the callback 67 | */ 68 | void loc_timer_stop(void*& handle); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif /* __cplusplus */ 73 | 74 | #endif //__LOC_DELAY_H__ 75 | -------------------------------------------------------------------------------- /gps/core/LocAdapterProxyBase.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 2016-2017 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_ADAPTER_PROXY_BASE_H 31 | #define LOC_ADAPTER_PROXY_BASE_H 32 | 33 | #include 34 | #include 35 | 36 | namespace loc_core { 37 | 38 | class LocAdapterProxyBase { 39 | private: 40 | LocAdapterBase *mLocAdapterBase; 41 | protected: 42 | inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, 43 | ContextBase* context, bool isMaster = false): 44 | mLocAdapterBase(new LocAdapterBase(mask, context, isMaster, this)) { 45 | } 46 | inline virtual ~LocAdapterProxyBase() { 47 | delete mLocAdapterBase; 48 | } 49 | inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event, 50 | loc_registration_mask_status isEnabled) { 51 | mLocAdapterBase->updateEvtMask(event,isEnabled); 52 | } 53 | 54 | inline uint32_t generateSessionId() { 55 | return mLocAdapterBase->generateSessionId(); 56 | } 57 | public: 58 | inline ContextBase* getContext() const { 59 | return mLocAdapterBase->getContext(); 60 | } 61 | 62 | inline virtual void handleEngineUpEvent() {}; 63 | inline virtual void handleEngineDownEvent() {}; 64 | inline virtual void reportPositionEvent(UlpLocation &location, 65 | GpsLocationExtended &locationExtended, 66 | enum loc_sess_status status, 67 | LocPosTechMask loc_technology_mask) { 68 | (void)location; 69 | (void)locationExtended; 70 | (void)status; 71 | (void)loc_technology_mask; 72 | } 73 | }; 74 | 75 | } // namespace loc_core 76 | 77 | #endif //LOC_ADAPTER_PROXY_BASE_H 78 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | 6 | /* Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2_0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2_0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | 22 | #ifndef ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H 23 | #define ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H 24 | 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_1 { 32 | namespace implementation { 33 | 34 | using ::android::hardware::Return; 35 | using ::android::hardware::Void; 36 | using ::android::hardware::hidl_vec; 37 | using ::android::hardware::hidl_string; 38 | using ::android::hardware::gnss::V2_0::GnssConstellationType; 39 | using ::android::sp; 40 | 41 | /* 42 | * Interface for passing GNSS configuration info from platform to HAL. 43 | */ 44 | struct Gnss; 45 | struct GnssConfiguration : public V2_1::IGnssConfiguration { 46 | GnssConfiguration(Gnss* gnss); 47 | ~GnssConfiguration() = default; 48 | 49 | 50 | /* 51 | * Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow. 52 | * These declarations were generated from IGnssConfiguration.hal. 53 | */ 54 | Return setSuplVersion(uint32_t version) override; 55 | Return setSuplMode(uint8_t mode) override; 56 | Return setSuplEs(bool enabled) override; 57 | Return setLppProfile(uint8_t lppProfileMask) override; 58 | Return setGlonassPositioningProtocol(uint8_t protocol) override; 59 | Return setEmergencySuplPdn(bool enable) override; 60 | Return setGpsLock(uint8_t lock) override; 61 | 62 | // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow. 63 | Return setBlacklist( 64 | const hidl_vec& blacklist) override; 65 | 66 | // Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow. 67 | Return setEsExtensionSec(uint32_t emergencyExtensionSeconds) override; 68 | // Methods from ::android::hardware::gnss::V2_1::IGnssConfiguration follow. 69 | Return setBlacklist_2_1( 70 | const hidl_vec& blacklist) override; 71 | 72 | private: 73 | Gnss* mGnss = nullptr; 74 | bool setBlacklistedSource( 75 | GnssSvIdSource& copyToSource, 76 | const GnssConfiguration::BlacklistedSource& copyFromSource); 77 | bool setBlacklistedSource( 78 | GnssSvIdSource& copyToSource, const GnssConstellationType& constellation, 79 | const int16_t svid); 80 | }; 81 | 82 | } // namespace implementation 83 | } // namespace V2_1 84 | } // namespace gnss 85 | } // namespace hardware 86 | } // namespace android 87 | 88 | #endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H 89 | -------------------------------------------------------------------------------- /gps/utils/LocTimer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __LOC_TIMER_CPP_H__ 31 | #define __LOC_TIMER_CPP_H__ 32 | 33 | #include 34 | #include 35 | 36 | namespace loc_util { 37 | 38 | // opaque class to provide service implementation. 39 | class LocTimerDelegate; 40 | class LocSharedLock; 41 | 42 | // LocTimer client must extend this class and implementthe callback. 43 | // start() / stop() methods are to arm / disarm timer. 44 | class LocTimer 45 | { 46 | LocTimerDelegate* mTimer; 47 | LocSharedLock* mLock; 48 | // don't really want mLock to be manipulated by clients, yet LocTimer 49 | // has to have a reference to the lock so that the delete of LocTimer 50 | // and LocTimerDelegate can work together on their share resources. 51 | friend class LocTimerDelegate; 52 | 53 | public: 54 | LocTimer(); 55 | virtual ~LocTimer(); 56 | 57 | // timeOutInMs: timeout delay in ms 58 | // wakeOnExpire: true if to wake up CPU (if sleeping) upon timer 59 | // expiration and notify the client. 60 | // false if to wait until next time CPU wakes up (if 61 | // sleeping) and then notify the client. 62 | // return: true on success; 63 | // false on failure, e.g. timer is already running. 64 | bool start(uint32_t timeOutInMs, bool wakeOnExpire); 65 | 66 | // return: true on success; 67 | // false on failure, e.g. timer is not running. 68 | bool stop(); 69 | 70 | // LocTimer client Should implement this method. 71 | // This method is used for timeout calling back to client. This method 72 | // should be short enough (eg: send a message to your own thread). 73 | virtual void timeOutCallback() = 0; 74 | }; 75 | 76 | } // namespace loc_util 77 | 78 | #endif //__LOC_DELAY_H__ 79 | -------------------------------------------------------------------------------- /gps/utils/LogBuffer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOG_BUFFER_H 31 | #define LOG_BUFFER_H 32 | 33 | #include "SkipList.h" 34 | #include "log_util.h" 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | //default error level time depth threshold, 48 | #define TIME_DEPTH_THRESHOLD_MINIMAL_IN_SEC 60 49 | //default maximum log buffer size 50 | #define MAXIMUM_NUM_IN_LIST 50 51 | //file path of dumped log buffer 52 | #define LOG_BUFFER_FILE_PATH "/data/vendor/location/" 53 | 54 | namespace loc_util { 55 | 56 | class ConfigsInLevel{ 57 | public: 58 | uint32_t mTimeDepthThres; 59 | uint32_t mMaxNumThres; 60 | int mCurrentSize; 61 | 62 | ConfigsInLevel(uint32_t time, int num, int size): 63 | mTimeDepthThres(time), mMaxNumThres(num), mCurrentSize(size) {} 64 | }; 65 | 66 | class LogBuffer { 67 | private: 68 | static LogBuffer* mInstance; 69 | static struct sigaction mOriSigAction[NSIG]; 70 | static struct sigaction mNewSigAction; 71 | static mutex sLock; 72 | 73 | SkipList> mLogList; 74 | vector mConfigVec; 75 | mutex mLock; 76 | 77 | const vector mLevelMap {"E", "W", "I", "D", "V"}; 78 | 79 | public: 80 | static LogBuffer* getInstance(); 81 | void append(string& data, int level, uint64_t timestamp); 82 | void dump(std::function log, int level = -1); 83 | void dumpToAdbLogcat(); 84 | void dumpToLogFile(string filePath); 85 | void flush(); 86 | private: 87 | LogBuffer(); 88 | void registerSignalHandler(); 89 | static void signalHandler(const int code, siginfo_t *const si, void *const sc); 90 | 91 | }; 92 | 93 | } 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /gps/utils/loc_target.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef LOC_TARGET_H 30 | #define LOC_TARGET_H 31 | #define TARGET_SET(gnss,ssc) ( (gnss<<1)|ssc ) 32 | #define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC) 33 | #define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC) 34 | #define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC) 35 | #define TARGET_NO_GNSS TARGET_SET(GNSS_NONE, NO_SSC) 36 | #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) 37 | #define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) 38 | #define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) 39 | #define getTargetGnssType(target) (target>>1) 40 | 41 | #ifdef __cplusplus 42 | extern "C" 43 | { 44 | #endif 45 | 46 | unsigned int loc_get_target(void); 47 | 48 | /*The character array passed to this function should have length 49 | of atleast PROPERTY_VALUE_MAX*/ 50 | void loc_get_target_baseband(char *baseband, int array_length); 51 | /*The character array passed to this function should have length 52 | of atleast PROPERTY_VALUE_MAX*/ 53 | void loc_get_platform_name(char *platform_name, int array_length); 54 | /*The character array passed to this function should have length 55 | of atleast PROPERTY_VALUE_MAX*/ 56 | void loc_get_auto_platform_name(char *platform_name, int array_length); 57 | int loc_identify_low_ram_target(); 58 | /*The character array passed to this function should have length 59 | of atleast PROPERTY_VALUE_MAX*/ 60 | void loc_get_device_soc_id(char *soc_id_value, int array_length); 61 | 62 | /* Please remember to update 'target_name' in loc_log.cpp, 63 | if do any changes to this enum. */ 64 | typedef enum { 65 | GNSS_NONE = 0, 66 | GNSS_MSM, 67 | GNSS_GSS, 68 | GNSS_MDM, 69 | GNSS_AUTO, 70 | GNSS_UNKNOWN 71 | }GNSS_TARGET; 72 | 73 | typedef enum { 74 | NO_SSC = 0, 75 | HAS_SSC 76 | }SSC_TYPE; 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /*LOC_TARGET_H*/ 83 | -------------------------------------------------------------------------------- /gps/android/2.1/location_api/GeofenceAPIClient.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef GEOFENCE_API_CLINET_H 31 | #define GEOFENCE_API_CLINET_H 32 | 33 | 34 | #include 35 | #include 36 | 37 | namespace android { 38 | namespace hardware { 39 | namespace gnss { 40 | namespace V2_1 { 41 | namespace implementation { 42 | 43 | using ::android::sp; 44 | 45 | class GeofenceAPIClient : public LocationAPIClientBase 46 | { 47 | public: 48 | GeofenceAPIClient(const sp& callback); 49 | 50 | void geofenceAdd(uint32_t geofence_id, double latitude, double longitude, 51 | double radius_meters, int32_t last_transition, int32_t monitor_transitions, 52 | uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms); 53 | void geofencePause(uint32_t geofence_id); 54 | void geofenceResume(uint32_t geofence_id, int32_t monitor_transitions); 55 | void geofenceRemove(uint32_t geofence_id); 56 | void geofenceRemoveAll(); 57 | 58 | // callbacks 59 | void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification) final; 60 | void onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification) final; 61 | void onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final; 62 | void onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final; 63 | void onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final; 64 | void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final; 65 | 66 | private: 67 | virtual ~GeofenceAPIClient() = default; 68 | 69 | sp mGnssGeofencingCbIface; 70 | }; 71 | 72 | } // namespace implementation 73 | } // namespace V2_1 74 | } // namespace gnss 75 | } // namespace hardware 76 | } // namespace android 77 | #endif // GEOFENCE_API_CLINET_H 78 | -------------------------------------------------------------------------------- /gps/core/LocContext.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2014, 2016-2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #define LOG_NDEBUG 0 30 | #define LOG_TAG "LocSvc_Ctx" 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | namespace loc_core { 40 | 41 | const MsgTask* LocContext::mMsgTask = NULL; 42 | ContextBase* LocContext::mContext = NULL; 43 | // the name must be shorter than 15 chars 44 | const char* LocContext::mLocationHalName = "Loc_hal_worker"; 45 | #ifndef USE_GLIB 46 | const char* LocContext::mLBSLibName = "liblbs_core.so"; 47 | #else 48 | const char* LocContext::mLBSLibName = "liblbs_core.so.1"; 49 | #endif 50 | 51 | pthread_mutex_t LocContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER; 52 | 53 | const MsgTask* LocContext::getMsgTask(const char* name) 54 | { 55 | if (NULL == mMsgTask) { 56 | mMsgTask = new MsgTask(name); 57 | } 58 | return mMsgTask; 59 | } 60 | 61 | ContextBase* LocContext::getLocContext(const char* name) 62 | { 63 | pthread_mutex_lock(&LocContext::mGetLocContextMutex); 64 | LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__); 65 | if (NULL == mContext) { 66 | LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__); 67 | const MsgTask* msgTask = getMsgTask(name); 68 | mContext = new LocContext(msgTask); 69 | } 70 | pthread_mutex_unlock(&LocContext::mGetLocContextMutex); 71 | 72 | return mContext; 73 | } 74 | 75 | void LocContext :: injectFeatureConfig(ContextBase *curContext) 76 | { 77 | LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config", 78 | __func__, __LINE__, ((LocContext *)curContext)->mLBSProxy); 79 | ((LocContext *)curContext)->mLBSProxy->injectFeatureConfig(curContext); 80 | } 81 | 82 | LocContext::LocContext(const MsgTask* msgTask) : 83 | ContextBase(msgTask, 0, mLBSLibName) 84 | { 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /gps/android/2.1/location_api/LocationUtil.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOCATION_UTIL_H 31 | #define LOCATION_UTIL_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | namespace android { 39 | namespace hardware { 40 | namespace gnss { 41 | namespace V2_1 { 42 | namespace implementation { 43 | 44 | using MeasurementCorrectionsV1_0 = 45 | ::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections; 46 | using ::android::hardware::gnss::measurement_corrections::V1_0::SingleSatCorrection; 47 | 48 | void convertGnssLocation(Location& in, V1_0::GnssLocation& out); 49 | void convertGnssLocation(Location& in, V2_0::GnssLocation& out); 50 | void convertGnssLocation(const V1_0::GnssLocation& in, Location& out); 51 | void convertGnssLocation(const V2_0::GnssLocation& in, Location& out); 52 | void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out); 53 | void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out); 54 | void convertGnssSvid(GnssSv& in, int16_t& out); 55 | void convertGnssSvid(GnssMeasurementsData& in, int16_t& out); 56 | void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); 57 | void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); 58 | void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); 59 | void convertSingleSatCorrections(const SingleSatCorrection& in, GnssSingleSatCorrection& out); 60 | void convertMeasurementCorrections(const MeasurementCorrectionsV1_0& in, 61 | GnssMeasurementCorrections& out); 62 | 63 | } // namespace implementation 64 | } // namespace V2_1 65 | } // namespace gnss 66 | } // namespace hardware 67 | } // namespace android 68 | #endif // LOCATION_UTIL_H 69 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssGeofencing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H 22 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H 23 | 24 | #include 25 | #include 26 | 27 | namespace android { 28 | namespace hardware { 29 | namespace gnss { 30 | namespace V2_1 { 31 | namespace implementation { 32 | 33 | using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback; 34 | using ::android::hardware::gnss::V1_0::IGnssGeofencing; 35 | using ::android::hardware::Return; 36 | using ::android::hardware::Void; 37 | using ::android::hardware::hidl_vec; 38 | using ::android::hardware::hidl_string; 39 | using ::android::sp; 40 | 41 | class GeofenceAPIClient; 42 | struct GnssGeofencing : public IGnssGeofencing { 43 | GnssGeofencing(); 44 | ~GnssGeofencing(); 45 | 46 | /* 47 | * Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow. 48 | * These declarations were generated from IGnssGeofencing.hal. 49 | */ 50 | Return setCallback(const sp& callback) override; 51 | Return addGeofence(int32_t geofenceId, 52 | double latitudeDegrees, 53 | double longitudeDegrees, 54 | double radiusMeters, 55 | IGnssGeofenceCallback::GeofenceTransition lastTransition, 56 | int32_t monitorTransitions, 57 | uint32_t notificationResponsivenessMs, 58 | uint32_t unknownTimerMs) override; 59 | 60 | Return pauseGeofence(int32_t geofenceId) override; 61 | Return resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) override; 62 | Return removeGeofence(int32_t geofenceId) override; 63 | 64 | private: 65 | // This method is not part of the IGnss base class. 66 | // It is called by GnssGeofencingDeathRecipient to remove all geofences added so far. 67 | Return removeAllGeofences(); 68 | 69 | private: 70 | struct GnssGeofencingDeathRecipient : hidl_death_recipient { 71 | GnssGeofencingDeathRecipient(sp gnssGeofencing) : 72 | mGnssGeofencing(gnssGeofencing) { 73 | } 74 | ~GnssGeofencingDeathRecipient() = default; 75 | virtual void serviceDied(uint64_t cookie, const wp& who) override; 76 | sp mGnssGeofencing; 77 | }; 78 | 79 | private: 80 | sp mGnssGeofencingDeathRecipient = nullptr; 81 | sp mGnssGeofencingCbIface = nullptr; 82 | GeofenceAPIClient* mApi = nullptr; 83 | }; 84 | 85 | } // namespace implementation 86 | } // namespace V2_1 87 | } // namespace gnss 88 | } // namespace hardware 89 | } // namespace android 90 | 91 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H 92 | -------------------------------------------------------------------------------- /overlay/WifiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | 19 | 20 | true 21 | 22 | 24 | 524288,1048576,5505024,262144,524288,5505024 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | true 33 | 34 | 35 | true 36 | 37 | 38 | true 39 | 40 | 41 | true 42 | 43 | 44 | true 45 | 46 | 47 | true 48 | 49 | 50 | 3000 51 | 52 | 53 | false 54 | 55 | 56 | true 57 | 58 | 59 | true 60 | 61 | 62 | 32 63 | 64 | 65 | false 66 | 67 | 68 | true 69 | 70 | 71 | true 72 | 73 | 74 | -------------------------------------------------------------------------------- /gps/android/2.1/location_api/BatchingAPIClient.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef BATCHING_API_CLINET_H 31 | #define BATCHING_API_CLINET_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | namespace android { 41 | namespace hardware { 42 | namespace gnss { 43 | namespace V2_1 { 44 | namespace implementation { 45 | 46 | 47 | enum BATCHING_STATE { STARTED, STOPPING, STOPPED }; 48 | 49 | class BatchingAPIClient : public LocationAPIClientBase 50 | { 51 | public: 52 | BatchingAPIClient(const sp& callback); 53 | BatchingAPIClient(const sp& callback); 54 | void gnssUpdateCallbacks(const sp& callback); 55 | void gnssUpdateCallbacks_2_0(const sp& callback); 56 | int getBatchSize(); 57 | int startSession(const V1_0::IGnssBatching::Options& options); 58 | int updateSessionOptions(const V1_0::IGnssBatching::Options& options); 59 | int stopSession(); 60 | void getBatchedLocation(int last_n_locations); 61 | void flushBatchedLocations(); 62 | 63 | inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; } 64 | 65 | // callbacks 66 | void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final; 67 | void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final; 68 | 69 | private: 70 | ~BatchingAPIClient(); 71 | 72 | void setCallbacks(); 73 | std::mutex mMutex; 74 | sp mGnssBatchingCbIface; 75 | uint32_t mDefaultId; 76 | LocationCapabilitiesMask mLocationCapabilitiesMask; 77 | sp mGnssBatchingCbIface_2_0; 78 | volatile BATCHING_STATE mState = STOPPED; 79 | 80 | std::vector mBatchedLocationInCache; 81 | }; 82 | 83 | } // namespace implementation 84 | } // namespace V2_1 85 | } // namespace gnss 86 | } // namespace hardware 87 | } // namespace android 88 | #endif // BATCHING_API_CLINET_H 89 | -------------------------------------------------------------------------------- /overlay/SM6250Frameworks/res/xml/power_profile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5020 4 | 5 | 6 6 | 2 7 | 8 | 4.65 9 | 0.52 10 | 1 11 | 12.10 12 | 16.43 13 | 14 | 300000 15 | 576000 16 | 768000 17 | 1017600 18 | 1248000 19 | 1324800 20 | 1516800 21 | 1612800 22 | 1708800 23 | 1804800 24 | 25 | 26 | 652800 27 | 825600 28 | 979200 29 | 1113600 30 | 1267200 31 | 1555200 32 | 1708800 33 | 1843200 34 | 1900800 35 | 1996800 36 | 2112000 37 | 2208000 38 | 39 | 40 | 4.2 41 | 8.28 42 | 11.99 43 | 15.06 44 | 23.81 45 | 27.99 46 | 38.22 47 | 51.99 48 | 62.37 49 | 71.82 50 | 51 | 52 | 11.06 53 | 23.81 54 | 35.09 55 | 44.08 56 | 73.08 57 | 87.18 58 | 134.31 59 | 192.47 60 | 216.45 61 | 257.83 62 | 289.78 63 | 337.24 64 | 65 | 82.45 66 | 242.93 67 | 245.859 68 | 500 69 | 83.29 70 | 37.41 71 | 2 72 | 220 73 | 150 74 | 3700 75 | 1 76 | 1 77 | 100 78 | 79 | 90 80 | 100 81 | 110 82 | 120 83 | 130 84 | 85 | 3700 86 | 87 | 100 88 | 110 89 | 90 | 3700 91 | 1 92 | 50 93 | 50 94 | 3300 95 | 100 96 | 50 97 | 98 | 7 99 | 5 100 | 101 | 102 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssMeasurement.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 | * Not a Contribution 4 | */ 5 | /* 6 | * Copyright (C) 2016 The Android Open Source Project 7 | * 8 | * Licensed under the Apache License, Version 2_0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2_0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H 22 | #define ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_1 { 32 | namespace implementation { 33 | 34 | using ::android::hardware::Return; 35 | using ::android::hardware::Void; 36 | using ::android::hardware::hidl_vec; 37 | using ::android::hardware::hidl_string; 38 | using ::android::sp; 39 | 40 | class MeasurementAPIClient; 41 | struct GnssMeasurement : public V2_1::IGnssMeasurement { 42 | GnssMeasurement(); 43 | ~GnssMeasurement(); 44 | 45 | /* 46 | * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. 47 | * These declarations were generated from IGnssMeasurement.hal. 48 | */ 49 | Return setCallback( 50 | const sp& callback) override; 51 | Return close() override; 52 | 53 | // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow. 54 | Return setCallback_1_1( 55 | const sp& callback, 56 | bool enableFullTracking) override; 57 | 58 | // Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow. 59 | Return setCallback_2_0( 60 | const sp& callback, 61 | bool enableFullTracking) override; 62 | // Methods from ::android::hardware::gnss::V2_1::IGnssMeasurement follow. 63 | Return setCallback_2_1( 64 | const sp<::android::hardware::gnss::V2_1::IGnssMeasurementCallback>& callback, 65 | bool enableFullTracking) override; 66 | 67 | private: 68 | struct GnssMeasurementDeathRecipient : hidl_death_recipient { 69 | GnssMeasurementDeathRecipient(sp gnssMeasurement) : 70 | mGnssMeasurement(gnssMeasurement) { 71 | } 72 | ~GnssMeasurementDeathRecipient() = default; 73 | virtual void serviceDied(uint64_t cookie, const wp& who) override; 74 | sp mGnssMeasurement; 75 | }; 76 | 77 | private: 78 | sp mGnssMeasurementDeathRecipient = nullptr; 79 | sp mGnssMeasurementCbIface = nullptr; 80 | sp mGnssMeasurementCbIface_1_1 = nullptr; 81 | sp mGnssMeasurementCbIface_2_0 = nullptr; 82 | sp mGnssMeasurementCbIface_2_1 = nullptr; 83 | MeasurementAPIClient* mApi; 84 | void clearInterfaces(); 85 | }; 86 | 87 | } // namespace implementation 88 | } // namespace V2_1 89 | } // namespace gnss 90 | } // namespace hardware 91 | } // namespace android 92 | 93 | #endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H 94 | -------------------------------------------------------------------------------- /gps/utils/LocSharedLock.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef __LOC_SHARED_LOCK__ 30 | #define __LOC_SHARED_LOCK__ 31 | 32 | #include 33 | #ifndef FEATURE_EXTERNAL_AP 34 | #include 35 | #endif /* FEATURE_EXTERNAL_AP */ 36 | #include 37 | 38 | #ifdef FEATURE_EXTERNAL_AP 39 | #include 40 | 41 | inline int32_t android_atomic_inc(volatile int32_t *addr) 42 | { 43 | volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; 44 | return std::atomic_fetch_add_explicit(a, 1, std::memory_order_release); 45 | } 46 | 47 | inline int32_t android_atomic_dec(volatile int32_t *addr) 48 | { 49 | volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; 50 | return std::atomic_fetch_sub_explicit(a, 1, std::memory_order_release); 51 | } 52 | #endif /* FEATURE_EXTERNAL_AP */ 53 | 54 | namespace loc_util { 55 | 56 | // This is a utility created for use cases such that there are more than 57 | // one client who need to share the same lock, but it is not predictable 58 | // which of these clients is to last to go away. This shared lock deletes 59 | // itself when the last client calls its drop() method. To add a cient, 60 | // this share lock's share() method has to be called, so that the obj 61 | // can maintain an accurate client count. 62 | class LocSharedLock { 63 | volatile int32_t mRef; 64 | pthread_mutex_t mMutex; 65 | inline ~LocSharedLock() { pthread_mutex_destroy(&mMutex); } 66 | public: 67 | // first client to create this LockSharedLock 68 | inline LocSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); } 69 | // following client(s) are to *share()* this lock created by the first client 70 | inline LocSharedLock* share() { android_atomic_inc(&mRef); return this; } 71 | // whe a client no longer needs this shared lock, drop() shall be called. 72 | inline void drop() { if (1 == android_atomic_dec(&mRef)) delete this; } 73 | // locking the lock to enter critical section 74 | inline void lock() { pthread_mutex_lock(&mMutex); } 75 | // unlocking the lock to leave the critical section 76 | inline void unlock() { pthread_mutex_unlock(&mMutex); } 77 | }; 78 | 79 | } //namespace loc_util 80 | 81 | #endif //__LOC_SHARED_LOCK__ 82 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssAntennaInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | 31 | #ifndef ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H 32 | #define ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H 33 | 34 | #include 35 | #include 36 | 37 | namespace android { 38 | namespace hardware { 39 | namespace gnss { 40 | namespace V2_1 { 41 | namespace implementation { 42 | 43 | using ::android::hardware::gnss::V2_1::IGnssAntennaInfo; 44 | using ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback; 45 | using ::android::hardware::Return; 46 | using ::android::hardware::Void; 47 | using ::android::hardware::hidl_vec; 48 | using ::android::hardware::hidl_string; 49 | using ::android::sp; 50 | 51 | struct Gnss; 52 | struct GnssAntennaInfo : public IGnssAntennaInfo { 53 | GnssAntennaInfo(Gnss* gnss); 54 | ~GnssAntennaInfo(); 55 | 56 | /* 57 | * Methods from ::android::hardware::gnss::V1_1::IGnssAntennaInfo follow. 58 | * These declarations were generated from IGnssAntennaInfo.hal. 59 | */ 60 | Return 61 | setCallback(const sp& callback) override; 62 | Return close(void) override; 63 | 64 | void gnssAntennaInfoCb(std::vector gnssAntennaInformations); 65 | 66 | static void aiGnssAntennaInfoCb(std::vector gnssAntennaInformations); 67 | 68 | private: 69 | struct GnssAntennaInfoDeathRecipient : hidl_death_recipient { 70 | GnssAntennaInfoDeathRecipient(sp gnssAntennaInfo) : 71 | mGnssAntennaInfo(gnssAntennaInfo) { 72 | } 73 | ~GnssAntennaInfoDeathRecipient() = default; 74 | virtual void serviceDied(uint64_t cookie, const wp& who) override; 75 | sp mGnssAntennaInfo; 76 | }; 77 | 78 | private: 79 | sp mGnssAntennaInfoDeathRecipient = nullptr; 80 | sp mGnssAntennaInfoCbIface = nullptr; 81 | Gnss* mGnss = nullptr; 82 | }; 83 | 84 | } // namespace implementation 85 | } // namespace V2_1 86 | } // namespace gnss 87 | } // namespace hardware 88 | } // namespace android 89 | 90 | #endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H 91 | -------------------------------------------------------------------------------- /gps/pla/android/loc_pla.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef __LOC_PLA__ 30 | #define __LOC_PLA__ 31 | 32 | #ifdef __cplusplus 33 | #include 34 | #define uptimeMillis() android::uptimeMillis() 35 | #define elapsedRealtime() android::elapsedRealtime() 36 | #endif 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #define UID_GPS (AID_GPS) 49 | #define GID_GPS (AID_GPS) 50 | #define UID_LOCCLIENT (4021) 51 | #define GID_LOCCLIENT (4021) 52 | 53 | #define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf" 54 | #define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf" 55 | #define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf" 56 | #define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf" 57 | #define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf" 58 | #define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf" 59 | #define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf" 60 | #define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf" 61 | #define LOC_PATH_ANT_CORR_STR "/vendor/etc/gnss_antenna_info.conf" 62 | #define LOC_PATH_SLIM_CONF_STR "/vendor/etc/slim.conf" 63 | #define LOC_PATH_VPE_CONF_STR "/vendor/etc/vpeglue.conf" 64 | 65 | /*! 66 | * @brief Function for memory block copy 67 | * 68 | * @param[out] p_Dest Destination buffer. 69 | * @param[in] q_DestSize Destination buffer size. 70 | * @param[in] p_Src Source buffer. 71 | * @param[in] q_SrcSize Source buffer size. 72 | * 73 | * @return Number of bytes copied. 74 | */ 75 | static inline size_t memscpy (void *p_Dest, size_t q_DestSize, const void *p_Src, size_t q_SrcSize) 76 | { 77 | size_t res = (q_DestSize < q_SrcSize) ? q_DestSize : q_SrcSize; 78 | if (p_Dest && p_Src && q_DestSize > 0 && q_SrcSize > 0) { 79 | memcpy(p_Dest, p_Src, res); 80 | } else { 81 | res = 0; 82 | } 83 | return res; 84 | } 85 | 86 | /*API for boot kpi marker prints */ 87 | inline int loc_boot_kpi_marker(const char * pFmt __unused, ...) 88 | { 89 | return -1; 90 | } 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif /*__cplusplus */ 95 | 96 | #endif /* __LOC_PLA__ */ 97 | -------------------------------------------------------------------------------- /gps/android/2.1/GnssVisibilityControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H 31 | #define ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include "Gnss.h" 40 | 41 | namespace android { 42 | namespace hardware { 43 | namespace gnss { 44 | namespace visibility_control { 45 | namespace V1_0 { 46 | namespace implementation { 47 | 48 | using ::android::hardware::hidl_array; 49 | using ::android::hardware::hidl_memory; 50 | using ::android::hardware::hidl_string; 51 | using ::android::hardware::hidl_vec; 52 | using ::android::hardware::Return; 53 | using ::android::hardware::Void; 54 | using ::android::sp; 55 | using ::android::hardware::gnss::V2_1::implementation::Gnss; 56 | 57 | struct GnssVisibilityControl : public IGnssVisibilityControl { 58 | GnssVisibilityControl(Gnss* gnss); 59 | ~GnssVisibilityControl(); 60 | 61 | // Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow. 62 | Return enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) override; 63 | /** 64 | * Registers the callback for HAL implementation to use. 65 | * 66 | * @param callback Handle to IGnssVisibilityControlCallback interface. 67 | */ 68 | Return setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) override; 69 | 70 | void statusCb(GnssNfwNotification notification); 71 | bool isE911Session(); 72 | 73 | /* Data call setup callback passed down to GNSS HAL implementation */ 74 | static void nfwStatusCb(GnssNfwNotification notification); 75 | static bool isInEmergencySession(); 76 | 77 | private: 78 | Gnss* mGnss = nullptr; 79 | sp mGnssVisibilityControlCbIface = nullptr; 80 | }; 81 | 82 | 83 | } // namespace implementation 84 | } // namespace V1_0 85 | } // namespace visibility_control 86 | } // namespace gnss 87 | } // namespace hardware 88 | } // namespace android 89 | 90 | #endif // ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H 91 | -------------------------------------------------------------------------------- /overlay-lineage/SM6250LineageSDK/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 20 | 64 21 | 22 | 34 | 64 35 | 36 | 68 | 232 69 | 70 | 71 | true 72 | 73 | 74 | 75 | restart 76 | restart_recovery 77 | restart_bootloader 78 | restart_fastboot 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /gps/utils/LocThread.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef __LOC_THREAD__ 30 | #define __LOC_THREAD__ 31 | 32 | #include 33 | #include 34 | 35 | using std::shared_ptr; 36 | 37 | namespace loc_util { 38 | 39 | // abstract class to be implemented by client to provide a runnable class 40 | // which gets scheduled by LocThread 41 | class LocRunnable { 42 | public: 43 | inline LocRunnable() = default; 44 | inline virtual ~LocRunnable() = default; 45 | 46 | // The method to be implemented by thread clients 47 | // and be scheduled by LocThread 48 | // This method will be repeated called until it returns false; or 49 | // until thread is stopped. 50 | virtual bool run() = 0; 51 | 52 | // The method to be run before thread loop (conditionally repeatedly) 53 | // calls run() 54 | inline virtual void prerun() {} 55 | 56 | // The method to be run after thread loop (conditionally repeatedly) 57 | // calls run() 58 | inline virtual void postrun() {} 59 | 60 | // The method to wake up the potential blocking thread 61 | // no op if not applicable 62 | inline virtual void interrupt() = 0; 63 | }; 64 | 65 | // opaque class to provide service implementation. 66 | class LocThreadDelegate; 67 | 68 | // A utility class to create a thread and run LocRunnable 69 | // caller passes in. 70 | class LocThread { 71 | LocThreadDelegate* mThread; 72 | public: 73 | inline LocThread() : mThread(NULL) {} 74 | inline virtual ~LocThread() { stop(); } 75 | 76 | // client starts thread with a runnable, which implements 77 | // the logics to fun in the created thread context. 78 | // The thread is always detached. 79 | // runnable is an obj managed by client. Client creates and 80 | // frees it (but must be after stop() is called, or 81 | // this LocThread obj is deleted). 82 | // The obj will be deleted by LocThread if start() 83 | // returns true. Else it is client's responsibility 84 | // to delete the object 85 | // Returns 0 if success; false if failure. 86 | bool start(const char* threadName, shared_ptr runnable); 87 | 88 | void stop(); 89 | 90 | // thread status check 91 | inline bool isRunning() { return NULL != mThread; } 92 | }; 93 | 94 | } // loc_util 95 | #endif //__LOC_THREAD__ 96 | -------------------------------------------------------------------------------- /sepolicy/vendor/genfs_contexts: -------------------------------------------------------------------------------- 1 | # Display 2 | genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/idle_state u:object_r:vendor_sysfs_graphics:s0 3 | 4 | # Health 5 | genfscon sysfs /class/power_supply/battery/capacity u:object_r:vendor_sysfs_battery_supply:s0 6 | genfscon sysfs /devices/platform/soc/soc:maxim_ds28e16/power_supply/batt_verify u:object_r:vendor_sysfs_battery_supply:s0 7 | 8 | # LED 9 | genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-05/c440000.qcom,spmi:qcom,pm6150l@5:qcom,leds@d000/leds/white u:object_r:sysfs_leds:s0 10 | 11 | # Touchpanel 12 | genfscon sysfs /touchpanel u:object_r:sysfs_touchpanel:s0 13 | 14 | # Wakeup source stats 15 | genfscon sysfs /devices/platform/soc/a8c000.i2c/i2c-2/2-0034/a8c000.i2c:qcom,smb1396@34:qcom,div2_cp/wakeup u:object_r:sysfs_wakeup:s0 16 | genfscon sysfs /devices/platform/soc/18800000.qcom,icnss/wakeup u:object_r:sysfs_wakeup:s0 17 | genfscon sysfs /devices/platform/soc/880000.i2c/i2c-0/0-0028/wakeup u:object_r:sysfs_wakeup:s0 18 | genfscon sysfs /devices/platform/soc/88e0000.qcom,msm-eud/wakeup u:object_r:sysfs_wakeup:s0 19 | genfscon sysfs /devices/platform/soc/890000.i2c/i2c-1/1-005a/wakeup u:object_r:sysfs_wakeup:s0 20 | genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm6150@0:qcom,pm6150_rtc/rtc/rtc0/wakeup u:object_r:sysfs_wakeup:s0 21 | genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm6150@0:qcom,pm6150_rtc/wakeup u:object_r:sysfs_wakeup:s0 22 | genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm6150@0:qcom,usb-pdphy@1700/usbpd/usbpd0/otg_default/wakeup u:object_r:sysfs_wakeup:s0 23 | genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm6150@0:qcom,usb-pdphy@1700/usbpd/usbpd0/wakeup u:object_r:sysfs_wakeup:s0 24 | genfscon sysfs /devices/platform/soc/soc:maxim_ds28e16/power_supply/batt_verify/wakeup u:object_r:sysfs_wakeup:s0 25 | genfscon sysfs /devices/virtual/input/input0/wakeup u:object_r:sysfs_wakeup:s0 26 | genfscon sysfs /devices/virtual/input/input1/wakeup u:object_r:sysfs_wakeup:s0 27 | genfscon sysfs /devices/virtual/input/input2/wakeup u:object_r:sysfs_wakeup:s0 28 | genfscon sysfs /devices/virtual/input/input3/wakeup u:object_r:sysfs_wakeup:s0 29 | genfscon sysfs /devices/virtual/input/input4/wakeup u:object_r:sysfs_wakeup:s0 30 | genfscon sysfs /devices/virtual/input/input5/wakeup u:object_r:sysfs_wakeup:s0 31 | genfscon sysfs /devices/virtual/input/input6/wakeup u:object_r:sysfs_wakeup:s0 32 | -------------------------------------------------------------------------------- /gps/utils/loc_nmea.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2013, 2015-2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_ENG_NMEA_H 31 | #define LOC_ENG_NMEA_H 32 | 33 | #include 34 | #include 35 | #include 36 | #define NMEA_SENTENCE_MAX_LENGTH 200 37 | 38 | /** gnss datum type */ 39 | #define LOC_GNSS_DATUM_WGS84 0 40 | #define LOC_GNSS_DATUM_PZ90 1 41 | 42 | /* len of semi major axis of ref ellips*/ 43 | #define MAJA (6378137.0) 44 | /* flattening coef of ref ellipsoid*/ 45 | #define FLAT (1.0/298.2572235630) 46 | /* 1st eccentricity squared*/ 47 | #define ESQR (FLAT*(2.0 - FLAT)) 48 | /*1 minus eccentricity squared*/ 49 | #define OMES (1.0 - ESQR) 50 | #define MILARCSEC2RAD (4.848136811095361e-09) 51 | /*semi major axis */ 52 | #define C_PZ90A (6378136.0) 53 | /*semi minor axis */ 54 | #define C_PZ90B (6356751.3618) 55 | /* Transformation from WGS84 to PZ90 56 | * Cx,Cy,Cz,Rs,Rx,Ry,Rz,C_SYS_A,C_SYS_B*/ 57 | const double DatumConstFromWGS84[9] = 58 | {+0.003, +0.001, 0.000, (1.0+(0.000*1E-6)), (-0.019*MILARCSEC2RAD), 59 | (+0.042*MILARCSEC2RAD), (-0.002*MILARCSEC2RAD), C_PZ90A, C_PZ90B}; 60 | 61 | /** Represents a LTP*/ 62 | typedef struct { 63 | double lat; 64 | double lon; 65 | double alt; 66 | } LocLla; 67 | 68 | /** Represents a ECEF*/ 69 | typedef struct { 70 | double X; 71 | double Y; 72 | double Z; 73 | } LocEcef; 74 | 75 | void loc_nmea_generate_sv(const GnssSvNotification &svNotify, 76 | std::vector &nmeaArraystr); 77 | 78 | void loc_nmea_generate_pos(const UlpLocation &location, 79 | const GpsLocationExtended &locationExtended, 80 | const LocationSystemInfo &systemInfo, 81 | unsigned char generate_nmea, 82 | bool custom_gga_fix_quality, 83 | std::vector &nmeaArraystr, 84 | int& indexOfGGA, 85 | bool isTagBlockGroupingEnabled); 86 | 87 | #define DEBUG_NMEA_MINSIZE 6 88 | #define DEBUG_NMEA_MAXSIZE 4096 89 | inline bool loc_nmea_is_debug(const char* nmea, int length) { 90 | return ((nullptr != nmea) && 91 | (length >= DEBUG_NMEA_MINSIZE) && (length <= DEBUG_NMEA_MAXSIZE) && 92 | (nmea[0] == '$') && (nmea[1] == 'P') && (nmea[2] == 'Q') && (nmea[3] == 'W')); 93 | } 94 | 95 | #endif // LOC_ENG_NMEA_H 96 | -------------------------------------------------------------------------------- /gps/core/observer/IFrameworkActionReq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __IFRAMEWORKACTIONREQ_H__ 31 | #define __IFRAMEWORKACTIONREQ_H__ 32 | 33 | #include 34 | #include 35 | 36 | using namespace std; 37 | 38 | namespace loc_core 39 | { 40 | 41 | /** 42 | * @brief IFrameworkActionReq interface 43 | * @details IFrameworkActionReq interface; 44 | * Defines an interface for operations such as turnOn, turnOff a 45 | * framework module described by the data item. Framework module 46 | * could be bluetooth, wifi etc. 47 | * Must be implemented by OS dependent code. 48 | * 49 | */ 50 | class IFrameworkActionReq { 51 | 52 | public: 53 | /** 54 | * @brief Turn on the framework module described by the data item. 55 | * @details Turn on the framework module described by the data item; 56 | * An IFrameworkActionReq implementer invokes this method to 57 | * turn on the framework module described by the data item. 58 | * Framework module could be bluetooth, wifi etc. 59 | * 60 | * @param dit DataItemId 61 | * @param timeout Timeout after which to turn off the framework module. 62 | */ 63 | virtual void turnOn (DataItemId dit, int timeOut = 0) = 0; 64 | 65 | /** 66 | * @brief Turn off the framework module described by the data item. 67 | * @details Turn off the framework module described by the data item; 68 | * An IFrameworkActionReq implementer invokes this method to 69 | * turn off the framework module described by the data item. 70 | * Framework module could be bluetooth, wifi etc. 71 | * 72 | * @param dit DataItemId 73 | */ 74 | virtual void turnOff (DataItemId dit) = 0; 75 | 76 | #ifdef USE_GLIB 77 | /** 78 | * @brief Setup WWAN backhaul 79 | * @details Setup WWAN backhaul 80 | * 81 | * @param None 82 | */ 83 | virtual bool connectBackhaul(const string& clientName) = 0; 84 | 85 | /** 86 | * @brief Disconnects the WWANbackhaul 87 | * @details Disconnects the WWANbackhaul, only if it was setup by us 88 | * 89 | * @param None 90 | */ 91 | virtual bool disconnectBackhaul(const string& clientName) = 0; 92 | #endif 93 | 94 | /** 95 | * @brief Destructor 96 | * @details Destructor 97 | */ 98 | virtual ~IFrameworkActionReq () {} 99 | }; 100 | 101 | } // namespace loc_core 102 | 103 | #endif // #ifndef __IFRAMEWORKACTIONREQ_H__ 104 | 105 | -------------------------------------------------------------------------------- /gps/utils/LocThread.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | using std::weak_ptr; 37 | using std::shared_ptr; 38 | using std::thread; 39 | using std::string; 40 | 41 | namespace loc_util { 42 | 43 | class LocThreadDelegate { 44 | static const char defaultThreadName[]; 45 | weak_ptr mRunnable; 46 | thread mThread; 47 | LocThreadDelegate(const string tName, shared_ptr r); 48 | public: 49 | ~LocThreadDelegate() { 50 | shared_ptr runnable = mRunnable.lock(); 51 | if (nullptr != runnable) { 52 | runnable->interrupt(); 53 | } 54 | } 55 | inline static LocThreadDelegate* create(const char* tName, shared_ptr runnable); 56 | }; 57 | 58 | const char LocThreadDelegate::defaultThreadName[] = "LocThread"; 59 | 60 | LocThreadDelegate* LocThreadDelegate::create(const char* tName, shared_ptr runnable) { 61 | LocThreadDelegate* threadDelegate = nullptr; 62 | 63 | if (nullptr != runnable) { 64 | if (!tName) { 65 | tName = defaultThreadName; 66 | } 67 | 68 | char lname[16]; 69 | auto nameSize = strlen(tName) + 1; 70 | int len = std::min(sizeof(lname), nameSize) - 1; 71 | memcpy(lname, tName, len); 72 | lname[len] = 0; 73 | 74 | threadDelegate = new LocThreadDelegate(lname, runnable); 75 | } 76 | 77 | return threadDelegate; 78 | } 79 | 80 | LocThreadDelegate::LocThreadDelegate(const string tName, shared_ptr runnable) : 81 | mRunnable(runnable), 82 | mThread([tName, runnable] { 83 | prctl(PR_SET_NAME, tName.c_str(), 0, 0, 0); 84 | runnable->prerun(); 85 | while (runnable->run()); 86 | runnable->postrun(); 87 | }) { 88 | 89 | mThread.detach(); 90 | } 91 | 92 | 93 | 94 | bool LocThread::start(const char* tName, shared_ptr runnable) { 95 | bool success = false; 96 | if (!mThread) { 97 | mThread = LocThreadDelegate::create(tName, runnable); 98 | // true only if thread is created successfully 99 | success = (NULL != mThread); 100 | } 101 | return success; 102 | } 103 | 104 | void LocThread::stop() { 105 | if (nullptr != mThread) { 106 | delete mThread; 107 | mThread = nullptr; 108 | } 109 | } 110 | 111 | } // loc_util 112 | -------------------------------------------------------------------------------- /gps/core/observer/IOsObserver.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __IOSOBSERVER_H__ 31 | #define __IOSOBSERVER_H__ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | using namespace std; 40 | 41 | namespace loc_core 42 | { 43 | 44 | /** 45 | * @brief IOsObserver interface 46 | * @details IOsObserver interface; 47 | * In OS dependent code this type serves as a handle to 48 | * an OS independent instance of this interface. 49 | */ 50 | class IOsObserver : 51 | public IDataItemObserver, 52 | public IDataItemSubscription, 53 | public IFrameworkActionReq { 54 | 55 | public: 56 | 57 | // To set the subscription object 58 | virtual void setSubscriptionObj(IDataItemSubscription *subscriptionObj) = 0; 59 | 60 | // To set the framework action request object 61 | virtual void setFrameworkActionReqObj(IFrameworkActionReq *frameworkActionReqObj) = 0; 62 | 63 | // IDataItemObserver Overrides 64 | inline virtual void getName (string & /*name*/) {} 65 | inline virtual void notify (const std::list & /*dlist*/) {} 66 | 67 | // IDataItemSubscription Overrides 68 | inline virtual void subscribe 69 | ( 70 | const std :: list & /*l*/, 71 | IDataItemObserver * /*client*/ 72 | ){} 73 | inline virtual void updateSubscription 74 | ( 75 | const std :: list & /*l*/, 76 | IDataItemObserver * /*client*/ 77 | ){} 78 | inline virtual void requestData 79 | ( 80 | const std :: list & /*l*/, 81 | IDataItemObserver * /*client*/ 82 | ){} 83 | inline virtual void unsubscribe 84 | ( 85 | const std :: list & /*l*/, 86 | IDataItemObserver * /*client*/ 87 | ){} 88 | inline virtual void unsubscribeAll (IDataItemObserver * /*client*/){} 89 | 90 | // IFrameworkActionReq Overrides 91 | inline virtual void turnOn (DataItemId /*dit*/, int /*timeOut*/){} 92 | inline virtual void turnOff (DataItemId /*dit*/) {} 93 | #ifdef USE_GLIB 94 | inline virtual bool connectBackhaul(const string& clientName) { return false; } 95 | inline virtual bool disconnectBackhaul(const string& clientName) { return false; } 96 | #endif 97 | 98 | /** 99 | * @brief Destructor 100 | * @details Destructor 101 | */ 102 | virtual ~IOsObserver () {} 103 | }; 104 | 105 | } // namespace loc_core 106 | 107 | #endif // #ifndef __IOSOBSERVER_H__ 108 | -------------------------------------------------------------------------------- /extract-files.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3 2 | # 3 | # SPDX-FileCopyrightText: 2024-2025 The LineageOS Project 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | from extract_utils.fixups_blob import ( 8 | blob_fixup, 9 | blob_fixups_user_type, 10 | ) 11 | from extract_utils.fixups_lib import ( 12 | lib_fixups, 13 | lib_fixups_user_type, 14 | ) 15 | from extract_utils.main import ( 16 | ExtractUtils, 17 | ExtractUtilsModule, 18 | ) 19 | 20 | namespace_imports = [ 21 | 'device/xiaomi/sm6250-common', 22 | 'hardware/qcom-caf/sm8150', 23 | 'hardware/qcom-caf/wlan', 24 | 'hardware/xiaomi', 25 | 'vendor/qcom/opensource/commonsys-intf/display', 26 | 'vendor/qcom/opensource/commonsys/display', 27 | 'vendor/qcom/opensource/dataservices', 28 | 'vendor/qcom/opensource/display', 29 | ] 30 | 31 | 32 | def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs): 33 | return f'{lib}_{partition}' if partition == 'vendor' else None 34 | 35 | 36 | lib_fixups: lib_fixups_user_type = { 37 | **lib_fixups, 38 | ( 39 | 'com.qualcomm.qti.dpm.api@1.0', 40 | 'libmmosal', 41 | 'vendor.qti.hardware.fm@1.0', 42 | 'vendor.qti.hardware.wifidisplaysession@1.0', 43 | 'vendor.qti.imsrtpservice@3.0', 44 | ): lib_fixup_vendor_suffix, 45 | } 46 | 47 | blob_fixups: blob_fixups_user_type = { 48 | 'vendor/etc/camera/camxoverridesettings.txt': blob_fixup() 49 | .regex_replace('0x10082', '0') 50 | .regex_replace('0x1F', '0x0'), 51 | 'vendor/etc/init/android.hardware.keymaster@4.0-service-qti.rc': blob_fixup() 52 | .regex_replace('@4.0', '@4.1'), 53 | 'vendor/lib64/camera/components/com.qti.node.watermark.so': blob_fixup() 54 | .add_needed('libpiex_shim.so'), 55 | 'vendor/lib64/hw/fingerprint.fpc.default.so': blob_fixup() 56 | .sig_replace('30 00 00 90 11 3A 42 F9', '30 00 00 90 1F 20 03 D5'), 57 | ('vendor/lib64/libalAILDC.so', 'vendor/lib64/libalLDC.so', 'vendor/lib64/libalhLDC.so'): blob_fixup() 58 | .clear_symbol_version('AHardwareBuffer_allocate') 59 | .clear_symbol_version('AHardwareBuffer_describe') 60 | .clear_symbol_version('AHardwareBuffer_lock') 61 | .clear_symbol_version('AHardwareBuffer_release') 62 | .clear_symbol_version('AHardwareBuffer_unlock'), 63 | ('vendor/lib64/libhvx_interface.so', 'vendor/lib64/libmialgo_rfs.so', 'vendor/lib64/libVDSuperPhotoAPI.so', 'vendor/lib64/libsnpe_dsp_domains_v2.so'): blob_fixup() 64 | .clear_symbol_version('remote_handle_close') 65 | .clear_symbol_version('remote_handle_invoke') 66 | .clear_symbol_version('remote_handle_open') 67 | .clear_symbol_version('remote_handle64_close') 68 | .clear_symbol_version('remote_handle64_invoke') 69 | .clear_symbol_version('remote_handle64_open') 70 | .clear_symbol_version('remote_register_dma_handle') 71 | .clear_symbol_version('remote_register_buf_attr') 72 | .clear_symbol_version('remote_register_buf'), 73 | 'vendor/lib64/libgoodixhwfingerprint.so': blob_fixup() 74 | .replace_needed('libvendor.goodix.hardware.biometrics.fingerprint@2.1.so', 'vendor.goodix.hardware.biometrics.fingerprint@2.1.so'), 75 | 'vendor/lib64/libwvhidl.so': blob_fixup() 76 | .add_needed('libcrypto_shim.so'), 77 | 'system_ext/etc/init/wfdservice.rc': blob_fixup() 78 | .regex_replace(r'(start|stop) wfdservice\b', r'\1 wfdservice64'), 79 | 'system_ext/lib64/libwfdmmsrc_system.so': blob_fixup() 80 | .add_needed('libgui_shim.so'), 81 | 'system_ext/lib64/libwfdnative.so': blob_fixup() 82 | .remove_needed('android.hidl.base@1.0.so') 83 | .add_needed('libbinder_shim.so') 84 | .add_needed('libinput_shim.so'), 85 | 'system_ext/lib64/libwfdservice.so': blob_fixup() 86 | .replace_needed('android.media.audio.common.types-V2-cpp.so', 'android.media.audio.common.types-V4-cpp.so'), 87 | } # fmt: skip 88 | 89 | module = ExtractUtilsModule( 90 | 'sm6250-common', 91 | 'xiaomi', 92 | blob_fixups=blob_fixups, 93 | lib_fixups=lib_fixups, 94 | namespace_imports=namespace_imports, 95 | ) 96 | 97 | if __name__ == '__main__': 98 | utils = ExtractUtils.device(module) 99 | utils.run() 100 | -------------------------------------------------------------------------------- /sepolicy/vendor/file_contexts: -------------------------------------------------------------------------------- 1 | # Camera 2 | /mnt/vendor/persist/camera(/.*)? u:object_r:camera_persist_file:s0 3 | 4 | # Charger 5 | /vendor/bin/batterysecret u:object_r:batterysecret_exec:s0 6 | 7 | # Fingerprint 8 | /vendor/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0 9 | 10 | # Fingerprint - devices 11 | /dev/goodix_fp u:object_r:fingerprint_device:s0 12 | 13 | # Fingerprint - data 14 | /data/vendor/goodix(/.*)? u:object_r:fingerprint_vendor_data_file:s0 15 | /data/vendor/fpc(/.*)? u:object_r:fingerprint_vendor_data_file:s0 16 | 17 | # IR 18 | /dev/spidev0.1 u:object_r:lirc_device:s0 19 | 20 | # Persist subsystem 21 | /mnt/vendor/persist/subsys(/.*)? u:object_r:persist_subsys_file:s0 22 | 23 | # Power 24 | /vendor/bin/init\.qcom\.post_boot-atoll\.sh u:object_r:vendor_qti_init_shell_exec:s0 25 | 26 | # Public libraries 27 | /vendor/lib64/lib_denoiser3\.so u:object_r:same_process_hal_file:s0 28 | /vendor/lib64/libalhLDC\.so u:object_r:same_process_hal_file:s0 29 | /vendor/lib64/libarcsoft_beautyshot\.so u:object_r:same_process_hal_file:s0 30 | /vendor/lib64/libarcsoft_bodyslim\.so u:object_r:same_process_hal_file:s0 31 | /vendor/lib64/libarcsoft_dualcam_refocus\.so u:object_r:same_process_hal_file:s0 32 | /vendor/lib64/libarcsoft_dualcam_refocus_front\.so u:object_r:same_process_hal_file:s0 33 | /vendor/lib64/libarcsoft_dualcam_refocus_rear_t\.so u:object_r:same_process_hal_file:s0 34 | /vendor/lib64/libarcsoft_dualcam_refocus_rear_w\.so u:object_r:same_process_hal_file:s0 35 | /vendor/lib64/libarcsoft_portrait_lighting\.so u:object_r:same_process_hal_file:s0 36 | /vendor/lib64/libarcsoft_portrait_lighting_c\.so u:object_r:same_process_hal_file:s0 37 | /vendor/lib64/libc\+\+_shared\.so u:object_r:same_process_hal_file:s0 38 | /vendor/lib64/libhvx_interface\.so u:object_r:same_process_hal_file:s0 39 | /vendor/lib64/libmiStereoFactoryRemapLib\.so u:object_r:same_process_hal_file:s0 40 | /vendor/lib64/libmialgo_basic\.so u:object_r:same_process_hal_file:s0 41 | /vendor/lib64/libmialgo_utils\.so u:object_r:same_process_hal_file:s0 42 | /vendor/lib64/libmialgoengine\.so u:object_r:same_process_hal_file:s0 43 | /vendor/lib64/libmibokeh_712\.so u:object_r:same_process_hal_file:s0 44 | /vendor/lib64/libmpbase\.so u:object_r:same_process_hal_file:s0 45 | /vendor/lib64/libsdk_sr\.so u:object_r:same_process_hal_file:s0 46 | /vendor/lib64/libst_sr_models\.so u:object_r:same_process_hal_file:s0 47 | /vendor/lib64/libxmi_high_dynamic_range\.so u:object_r:same_process_hal_file:s0 48 | /vendor/lib64/libxml2_vendor\.so u:object_r:same_process_hal_file:s0 49 | 50 | # Sensors 51 | /vendor/bin/hw/android\.hardware\.sensors-service\.xiaomi-multihal u:object_r:hal_sensors_default_exec:s0 52 | /vendor/bin/init\.sensors_fixup\.sh u:object_r:vendor_init-qcom-sensors-sh_exec:s0 53 | 54 | # Thermal 55 | /vendor/bin/hw/android\.hardware\.thermal-service\.pixel u:object_r:hal_thermal_default_exec:s0 56 | /vendor/bin/thermal_symlinks u:object_r:init-thermal-symlinks-sh_exec:s0 57 | /dev/thermal(/.*)? u:object_r:thermal_link_device:s0 58 | --------------------------------------------------------------------------------