├── Android.bp ├── Android.mk ├── BoardConfigCommon.mk ├── README.md ├── RemovePackages └── Android.mk ├── atoll.mk ├── audio ├── audio_effects.xml ├── audio_io_policy.conf ├── audio_platform_info_intcodec.xml ├── audio_policy_configuration.xml ├── mixer_paths_wcd937x.xml ├── sound_trigger_mixer_paths.xml └── sound_trigger_platform_info.xml ├── compatibility_matrix.xml ├── config.fs ├── configs ├── excluded-input-devices.xml ├── powerhint.json └── thermal_info_config.json ├── device_framework_matrix.xml ├── evolution.dependencies ├── extract-files.sh ├── fastcharge ├── Android.bp ├── FastCharge.cpp ├── FastCharge.h ├── RestrictedCurrent.cpp ├── RestrictedCurrent.h ├── service.cpp ├── vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250.rc └── vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250.xml ├── generate_sha1_from_commit.sh ├── gps ├── Android.bp ├── Android.mk ├── CleanSpec.mk ├── android │ ├── 2.1 │ │ ├── AGnss.cpp │ │ ├── AGnss.h │ │ ├── AGnssRil.cpp │ │ ├── AGnssRil.h │ │ ├── Android.mk │ │ ├── Gnss.cpp │ │ ├── Gnss.h │ │ ├── GnssAntennaInfo.cpp │ │ ├── GnssAntennaInfo.h │ │ ├── GnssBatching.cpp │ │ ├── GnssBatching.h │ │ ├── GnssConfiguration.cpp │ │ ├── GnssConfiguration.h │ │ ├── GnssDebug.cpp │ │ ├── GnssDebug.h │ │ ├── GnssGeofencing.cpp │ │ ├── GnssGeofencing.h │ │ ├── GnssMeasurement.cpp │ │ ├── GnssMeasurement.h │ │ ├── GnssNi.cpp │ │ ├── GnssNi.h │ │ ├── GnssVisibilityControl.cpp │ │ ├── GnssVisibilityControl.h │ │ ├── MeasurementCorrections.cpp │ │ ├── MeasurementCorrections.h │ │ ├── android.hardware.gnss@2.1-service-qti.rc │ │ ├── android.hardware.gnss@2.1-service-qti.xml │ │ ├── location_api │ │ │ ├── BatchingAPIClient.cpp │ │ │ ├── BatchingAPIClient.h │ │ │ ├── GeofenceAPIClient.cpp │ │ │ ├── GeofenceAPIClient.h │ │ │ ├── GnssAPIClient.cpp │ │ │ ├── GnssAPIClient.h │ │ │ ├── LocationUtil.cpp │ │ │ ├── LocationUtil.h │ │ │ ├── MeasurementAPIClient.cpp │ │ │ └── MeasurementAPIClient.h │ │ └── service.cpp │ ├── Android.mk │ └── utils │ │ ├── Android.bp │ │ ├── battery_listener.cpp │ │ └── battery_listener.h ├── batching │ ├── Android.bp │ ├── BatchingAdapter.cpp │ ├── BatchingAdapter.h │ └── location_batching.cpp ├── core │ ├── Android.bp │ ├── ContextBase.cpp │ ├── ContextBase.h │ ├── EngineHubProxyBase.h │ ├── LBSProxyBase.h │ ├── LocAdapterBase.cpp │ ├── LocAdapterBase.h │ ├── LocAdapterProxyBase.h │ ├── LocApiBase.cpp │ ├── LocApiBase.h │ ├── LocContext.cpp │ ├── LocContext.h │ ├── SystemStatus.cpp │ ├── SystemStatus.h │ ├── SystemStatusOsObserver.cpp │ ├── SystemStatusOsObserver.h │ ├── data-items │ │ ├── DataItemConcreteTypesBase.h │ │ ├── DataItemId.h │ │ ├── DataItemsFactoryProxy.cpp │ │ ├── DataItemsFactoryProxy.h │ │ └── IDataItemCore.h │ ├── loc_core_log.cpp │ ├── loc_core_log.h │ └── observer │ │ ├── IDataItemObserver.h │ │ ├── IDataItemSubscription.h │ │ ├── IFrameworkActionReq.h │ │ └── IOsObserver.h ├── etc │ ├── Android.bp │ ├── flp.conf │ ├── gnss_antenna_info.conf │ ├── gps.conf │ └── izat.conf ├── geofence │ ├── Android.bp │ ├── GeofenceAdapter.cpp │ ├── GeofenceAdapter.h │ └── location_geofence.cpp ├── gnss │ ├── Agps.cpp │ ├── Agps.h │ ├── Android.bp │ ├── GnssAdapter.cpp │ ├── GnssAdapter.h │ ├── NativeAgpsHandler.cpp │ ├── NativeAgpsHandler.h │ ├── XtraSystemStatusObserver.cpp │ ├── XtraSystemStatusObserver.h │ └── location_gnss.cpp ├── location │ ├── Android.bp │ ├── ILocationAPI.h │ ├── LocationAPI.cpp │ ├── LocationAPI.h │ ├── LocationAPIClientBase.cpp │ ├── LocationAPIClientBase.h │ ├── LocationDataTypes.h │ └── location_interface.h ├── pla │ ├── Android.bp │ ├── android │ │ └── loc_pla.h │ └── oe │ │ └── loc_pla.h └── utils │ ├── Android.bp │ ├── LocHeap.cpp │ ├── LocHeap.h │ ├── LocIpc.cpp │ ├── LocIpc.h │ ├── LocLoggerBase.h │ ├── LocSharedLock.h │ ├── LocThread.cpp │ ├── LocThread.h │ ├── LocTimer.cpp │ ├── LocTimer.h │ ├── LocUnorderedSetMap.h │ ├── LogBuffer.cpp │ ├── LogBuffer.h │ ├── MsgTask.cpp │ ├── MsgTask.h │ ├── SkipList.h │ ├── gps_extended.h │ ├── gps_extended_c.h │ ├── linked_list.c │ ├── linked_list.h │ ├── loc_cfg.cpp │ ├── loc_cfg.h │ ├── loc_gps.h │ ├── loc_log.cpp │ ├── loc_log.h │ ├── loc_misc_utils.cpp │ ├── loc_misc_utils.h │ ├── loc_nmea.cpp │ ├── loc_nmea.h │ ├── loc_target.cpp │ ├── loc_target.h │ ├── loc_timer.h │ ├── log_util.h │ ├── msg_q.c │ └── msg_q.h ├── idc ├── uinput-fpc.idc └── uinput-goodix.idc ├── keylayout ├── gpio-keys.kl ├── uinput-fpc.kl └── uinput-goodix.kl ├── libinit ├── Android.bp ├── include │ ├── libinit_dalvik_heap.h │ ├── libinit_utils.h │ └── libinit_variant.h ├── init_xiaomi_atoll.cpp ├── libinit_dalvik_heap.cpp ├── libinit_utils.cpp └── libinit_variant.cpp ├── libqti-perfd-client ├── Android.bp └── client.c ├── manifest.xml ├── media ├── media_codecs_performance.xml ├── media_codecs_vendor.xml ├── media_codecs_vendor_audio.xml └── media_profiles.xml ├── odm.prop ├── overlay ├── CarrierConfigResCommon │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── xml │ │ └── vendor.xml ├── SM6250Aperture │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── SM6250Frameworks │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ ├── values │ │ ├── config.xml │ │ ├── dimens.xml │ │ └── evolution_config.xml │ │ └── xml │ │ └── power_profile.xml ├── SM6250Settings │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ ├── bools.xml │ │ ├── config.xml │ │ └── evolution_strings.xml ├── SM6250SystemUI │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ ├── values-land │ │ ├── config.xml │ │ └── dimens.xml │ │ └── values │ │ ├── config.xml │ │ ├── dimens.xml │ │ └── evolution_config.xml ├── TelephonyResCommon │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml └── WifiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ └── values │ └── config.xml ├── permissions └── privapp-permissions-hotword.xml ├── proprietary-files.txt ├── releasetools.py ├── rootdir ├── Android.bp ├── bin │ ├── init.qcom.early_boot.sh │ ├── init.qcom.sh │ ├── init.qti.chg_policy.sh │ └── init.sensors_fixup.sh └── etc │ ├── fstab.qcom │ ├── init.qcom.power.rc │ ├── init.qcom.rc │ ├── init.recovery.qcom.rc │ ├── init.target.rc │ └── ueventd.qcom.rc ├── sepolicy └── vendor │ ├── app.te │ ├── audioserver.te │ ├── batterysecret.te │ ├── device.te │ ├── file.te │ ├── file_contexts │ ├── genfs_contexts │ ├── hal_camera_default.te │ ├── hal_fingerprint_default.te │ ├── hal_ir_default.te │ ├── hal_light_default.te │ ├── hal_lineage_fastcharge_default.te │ ├── hal_lineage_health_default.te │ ├── hal_power_default.te │ ├── hal_thermal_default.te │ ├── hwservice_contexts │ ├── init-qcom-sensors-sh.te │ ├── init-thermal-symlinks.sh.te │ ├── property.te │ ├── property_contexts │ ├── seapp_contexts │ ├── service_contexts │ ├── tee.te │ ├── timekeep.te │ ├── timekeep_app.te │ └── vendor_init.te ├── setup-makefiles.sh ├── system.prop ├── vendor.prop └── wifi ├── WCNSS_qcom_cfg.ini ├── p2p_supplicant_overlay.conf └── wpa_supplicant_overlay.conf /Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | soong_namespace { 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Common device tree for Xiaomi SM6250 devices 2 | 3 | ``` 4 | # 5 | # Copyright (C) 2021 The LineageOS Project 6 | # 7 | # SPDX-License-Identifier: Apache-2.0 8 | # 9 | ``` 10 | -------------------------------------------------------------------------------- /RemovePackages/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := RemovePackages 5 | LOCAL_MODULE_CLASS := APPS 6 | LOCAL_MODULE_TAGS := optional 7 | LOCAL_OVERRIDES_PACKAGES := DevicePolicyPrebuilt NgaResources PlayAutoInstallConfig SoundAmplifierPrebuilt SwitchAccessPrebuilt Tycho VoiceAccessPrebuilt VZWAPNLib arcore talkback AdaptiveVPNPrebuilt AmbientStreaming AppDirectedSMSService BetterBugStub CarrierLocation CarrierMetrics CarrierWifi CbrsNetworkMonitor ConfigUpdater ConnMO DCMO DMService FilesPrebuilt HealthIntelligenceStubPrebuilt KidsSupervisionStub MaestroPrebuilt MyVerizonServices OdadPrebuilt OemDmTrigger PartnerSetupPrebuilt PixelSupportPrebuilt ScribePrebuilt Showcase TetheringEntitlement VzwOmaTrigger WeatherPixelPrebuilt WfcActivation DocumentsUIGoogle CarrierSetup ConnectivityThermalPowerManager GoogleFeedback PixelDisplayService RilConfigService grilservice Papers 8 | LOCAL_UNINSTALLABLE_MODULE := true 9 | LOCAL_CERTIFICATE := PRESIGNED 10 | LOCAL_SRC_FILES := /dev/null 11 | include $(BUILD_PREBUILT) 12 | -------------------------------------------------------------------------------- /compatibility_matrix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.frameworks.schedulerservice 4 | 1.0 5 | 6 | ISchedulingPolicyService 7 | default 8 | 9 | 10 | 11 | android.frameworks.sensorservice 12 | 1.0 13 | 14 | ISensorManager 15 | default 16 | 17 | 18 | 19 | android.hidl.allocator 20 | 1.0 21 | 22 | IAllocator 23 | ashmem 24 | 25 | 26 | 27 | android.hidl.manager 28 | 1.0 29 | 30 | IServiceManager 31 | default 32 | 33 | 34 | 35 | android.hidl.memory 36 | 1.0 37 | 38 | IMapper 39 | ashmem 40 | 41 | 42 | 43 | android.hidl.token 44 | 1.0 45 | 46 | ITokenManager 47 | default 48 | 49 | 50 | 51 | android.system.wifi.keystore 52 | 1.0 53 | 54 | IKeystore 55 | default 56 | 57 | 58 | 59 | vendor.qti.hardware.qccsyshal 60 | 1.0 61 | 62 | IQccsyshal 63 | qccsyshal 64 | 65 | 66 | 67 | vendor.qti.hardware.sigma_miracast 68 | 1.0 69 | 70 | Isigma_miracast 71 | sigmahal 72 | 73 | 74 | 75 | vendor.qti.hardware.wifi.keystore 76 | 1.0 77 | 78 | IKeystoreExt 79 | default 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /configs/excluded-input-devices.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /device_framework_matrix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.fingerprints.extension 4 | 1.0 5 | 6 | IFingerprintEngineering 7 | default 8 | 9 | 10 | IFingerprintNavigation 11 | default 12 | 13 | 14 | IFingerprintSensorTest 15 | default 16 | 17 | 18 | 19 | vendor.goodix.hardware.biometrics.fingerprint 20 | 2.0-1 21 | 22 | IGoodixFingerprintDaemon 23 | default 24 | 25 | 26 | IGoodixFingerprintDaemonExt 27 | default 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /evolution.dependencies: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "repository" : "kernel_xiaomi_sm6250", 4 | "target_path" : "kernel/xiaomi/sm6250" 5 | }, 6 | { 7 | "repository" : "vendor_xiaomi_sm6250-common", 8 | "target_path" : "vendor/xiaomi/sm6250-common" 9 | }, 10 | { 11 | "remote" : "gitlab", 12 | "branch" : "fourteen", 13 | "repository" : "SonalSingh18/android_vendor_xiaomi_miuicamera", 14 | "target_path" : "vendor/xiaomi/miuicamera" 15 | }, 16 | { 17 | "remote" : "github", 18 | "branch" : "lineage-21", 19 | "repository" : "LineageOS/android_hardware_sony_timekeep", 20 | "target_path" : "hardware/sony/timekeep" 21 | }, 22 | { 23 | "remote" : "github", 24 | "branch" : "v4a", 25 | "repository" : "TogoFire/packages_apps_ViPER4AndroidFX", 26 | "target_path" : "packages/apps/ViPER4AndroidFX" 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /extract-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2016 The CyanogenMod Project 4 | # Copyright (C) 2017-2020, 2022 The LineageOS Project 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | # 8 | 9 | set -e 10 | 11 | # Load extract_utils and do some sanity checks 12 | MY_DIR="${BASH_SOURCE%/*}" 13 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi 14 | 15 | ANDROID_ROOT="${MY_DIR}/../../.." 16 | 17 | HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" 18 | if [ ! -f "${HELPER}" ]; then 19 | echo "Unable to find helper script at ${HELPER}" 20 | exit 1 21 | fi 22 | source "${HELPER}" 23 | 24 | # Default to sanitizing the vendor folder before extraction 25 | CLEAN_VENDOR=true 26 | 27 | ONLY_COMMON= 28 | ONLY_TARGET= 29 | KANG= 30 | SECTION= 31 | 32 | while [ "${#}" -gt 0 ]; do 33 | case "${1}" in 34 | --only-common ) 35 | ONLY_COMMON=true 36 | ;; 37 | --only-target ) 38 | ONLY_TARGET=true 39 | ;; 40 | -n | --no-cleanup ) 41 | CLEAN_VENDOR=false 42 | ;; 43 | -k | --kang ) 44 | KANG="--kang" 45 | ;; 46 | -s | --section ) 47 | SECTION="${2}"; shift 48 | CLEAN_VENDOR=false 49 | ;; 50 | * ) 51 | SRC="${1}" 52 | ;; 53 | esac 54 | shift 55 | done 56 | 57 | if [ -z "${SRC}" ]; then 58 | SRC="adb" 59 | fi 60 | 61 | function blob_fixup() { 62 | case "${1}" in 63 | vendor/etc/camera/camxoverridesettings.txt) 64 | sed -i "s/0x10082/0/g" "${2}" 65 | sed -i "s/0x1F/0x0/g" "${2}" 66 | ;; 67 | vendor/etc/init/android.hardware.keymaster@4.0-service-qti.rc) 68 | sed -i "s/4\.0/4\.1/g" "${2}" 69 | ;; 70 | vendor/lib64/camera/components/com.qti.node.watermark.so) 71 | grep -q "libpiex_shim.so" "${2}" || "${PATCHELF}" --add-needed "libpiex_shim.so" "${2}" 72 | ;; 73 | vendor/lib64/hw/fingerprint.fpc.default.so) 74 | # NOP out report_input_event() 75 | "${SIGSCAN}" -p "30 00 00 90 11 3a 42 f9" -P "30 00 00 90 1f 20 03 d5" -f "${2}" 76 | ;; 77 | vendor/lib64/libvendor.goodix.hardware.biometrics.fingerprint@2.1.so) 78 | sed -i "s|libhidlbase.so|v32hidlbase.so|g" "${2}" 79 | ;; 80 | system_ext/etc/init/wfdservice.rc) 81 | sed -i "/^service/! s/wfdservice$/wfdservice64/g" "${2}" 82 | ;; 83 | # Remove dependency on android.hidl.base@1.0 for WFD native library. 84 | system_ext/lib64/libwfdnative.so) 85 | "${PATCHELF}" --remove-needed "android.hidl.base@1.0.so" "${2}" 86 | ;; 87 | esac 88 | } 89 | 90 | if [ -z "${ONLY_TARGET}" ]; then 91 | # Initialize the helper for common device 92 | setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}" 93 | 94 | extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" 95 | fi 96 | 97 | if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then 98 | # Reinitialize the helper for device 99 | source "${MY_DIR}/../${DEVICE}/extract-files.sh" 100 | setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" 101 | 102 | extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" 103 | fi 104 | 105 | "${MY_DIR}/setup-makefiles.sh" 106 | -------------------------------------------------------------------------------- /fastcharge/Android.bp: -------------------------------------------------------------------------------- 1 | cc_binary { 2 | name: "vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250", 3 | relative_install_path: "hw", 4 | init_rc: ["vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250.rc"], 5 | vintf_fragments: ["vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250.xml"], 6 | vendor: true, 7 | shared_libs: [ 8 | "libbase", 9 | "libbinder", 10 | "libcutils", 11 | "libhidlbase", 12 | "libutils", 13 | "vendor.lineage.fastcharge@1.0", 14 | ], 15 | srcs: [ 16 | "FastCharge.cpp", 17 | "RestrictedCurrent.cpp", 18 | "service.cpp", 19 | ], 20 | } 21 | -------------------------------------------------------------------------------- /fastcharge/FastCharge.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "fastcharge@1.0-service.xiaomi_sm6250" 18 | 19 | #define FASTCHARGE_DEFAULT_SETTING true 20 | #define FASTCHARGE_PATH "/sys/class/qcom-battery/restrict_chg" 21 | 22 | #include "FastCharge.h" 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | namespace vendor { 29 | namespace lineage { 30 | namespace fastcharge { 31 | namespace V1_0 { 32 | namespace implementation { 33 | 34 | /* 35 | * Write value to path and close file. 36 | */ 37 | template static void set(const std::string &path, const T &value) { 38 | std::ofstream file(path); 39 | 40 | if (!file) { 41 | PLOG(ERROR) << "Failed to open: " << path; 42 | return; 43 | } 44 | 45 | LOG(DEBUG) << "write: " << path << " value: " << value; 46 | 47 | file << value << std::endl; 48 | 49 | if (!file) { 50 | PLOG(ERROR) << "Failed to write: " << path << " value: " << value; 51 | } 52 | } 53 | 54 | template static T get(const std::string &path, const T &def) { 55 | std::ifstream file(path); 56 | 57 | if (!file) { 58 | PLOG(ERROR) << "Failed to open: " << path; 59 | return def; 60 | } 61 | 62 | T result; 63 | 64 | file >> result; 65 | 66 | if (file.fail()) { 67 | PLOG(ERROR) << "Failed to read: " << path; 68 | return def; 69 | } else { 70 | LOG(DEBUG) << "read: " << path << " value: " << result; 71 | return result; 72 | } 73 | } 74 | 75 | FastCharge::FastCharge() {} 76 | 77 | Return FastCharge::isEnabled() { return get(FASTCHARGE_PATH, 0) < 1; } 78 | 79 | Return FastCharge::setEnabled(bool enable) { 80 | bool success = false; 81 | set(FASTCHARGE_PATH, enable ? 0 : 1); 82 | if (enable == isEnabled()){ 83 | success = true; 84 | } 85 | return success; 86 | } 87 | 88 | } // namespace implementation 89 | } // namespace V1_0 90 | } // namespace fastcharge 91 | } // namespace lineage 92 | } // namespace vendor 93 | -------------------------------------------------------------------------------- /fastcharge/FastCharge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace vendor { 24 | namespace lineage { 25 | namespace fastcharge { 26 | namespace V1_0 { 27 | namespace implementation { 28 | 29 | using ::android::sp; 30 | using ::android::hardware::hidl_array; 31 | using ::android::hardware::hidl_memory; 32 | using ::android::hardware::hidl_string; 33 | using ::android::hardware::hidl_vec; 34 | using ::android::hardware::Return; 35 | using ::android::hardware::Void; 36 | 37 | using ::vendor::lineage::fastcharge::V1_0::IFastCharge; 38 | 39 | struct FastCharge : public IFastCharge { 40 | FastCharge(); 41 | 42 | Return isEnabled() override; 43 | Return setEnabled(bool enable) override; 44 | }; 45 | 46 | } // namespace implementation 47 | } // namespace V1_0 48 | } // namespace fastcharge 49 | } // namespace lineage 50 | } // namespace vendor 51 | -------------------------------------------------------------------------------- /fastcharge/RestrictedCurrent.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "fastcharge@1.0-service.xiaomi_sm6250" 18 | 19 | #define RESTRICTED_CURRENT_PATH "/sys/class/qcom-battery/restrict_cur" 20 | 21 | #define MAX_SUPPORTED_CURRENT 3000 /*mA*/ 22 | 23 | #include "RestrictedCurrent.h" 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace vendor { 30 | namespace lineage { 31 | namespace fastcharge { 32 | namespace V1_0 { 33 | namespace implementation { 34 | 35 | /* 36 | * Write value to path and close file. 37 | */ 38 | template static void set(const std::string &path, const T &value) { 39 | std::ofstream file(path); 40 | 41 | if (!file) { 42 | PLOG(ERROR) << "Failed to open: " << path; 43 | return; 44 | } 45 | 46 | LOG(DEBUG) << "write: " << path << " value: " << value; 47 | 48 | file << value << std::endl; 49 | 50 | if (!file) { 51 | PLOG(ERROR) << "Failed to write: " << path << " value: " << value; 52 | } 53 | } 54 | 55 | template static T get(const std::string &path, const T &def) { 56 | std::ifstream file(path); 57 | 58 | if (!file) { 59 | PLOG(ERROR) << "Failed to open: " << path; 60 | return def; 61 | } 62 | 63 | T result; 64 | 65 | file >> result; 66 | 67 | if (file.fail()) { 68 | PLOG(ERROR) << "Failed to read: " << path; 69 | return def; 70 | } else { 71 | LOG(DEBUG) << "read: " << path << " value: " << result; 72 | return result; 73 | } 74 | } 75 | 76 | RestrictedCurrent::RestrictedCurrent() {} 77 | 78 | /* 79 | * Get the restricted current value from the corresponding sysnode 80 | */ 81 | Return RestrictedCurrent::getRestrictedCurrent() { 82 | int current_uA = get(RESTRICTED_CURRENT_PATH, 0); /* current is stored in microampere */ 83 | int current_mA = current_uA / 1000; /* convert to miliampere */ 84 | return current_mA; /* always return mA */ 85 | } 86 | 87 | /* 88 | * Set the maximum allowed current (restricted current), when fast charging is disabled 89 | */ 90 | Return RestrictedCurrent::setRestrictedCurrent(int32_t current_mA) { 91 | bool success = false; 92 | if (current_mA > 0 && current_mA <= MAX_SUPPORTED_CURRENT) { /* validate */ 93 | int current_uA = current_mA * 1000; /* convert to microampere */ 94 | set(RESTRICTED_CURRENT_PATH, current_uA); /* store */ 95 | if (current_mA == getRestrictedCurrent()) { /* check */ 96 | success = true; 97 | } 98 | } 99 | return success; 100 | } 101 | 102 | /* 103 | * Get the maximum supported current 104 | */ 105 | Return RestrictedCurrent::getMaxSupportedCurrent() { 106 | return MAX_SUPPORTED_CURRENT; /* always return mA */ 107 | } 108 | 109 | } // namespace implementation 110 | } // namespace V1_0 111 | } // namespace fastcharge 112 | } // namespace lineage 113 | } // namespace vendor 114 | -------------------------------------------------------------------------------- /fastcharge/RestrictedCurrent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace vendor { 25 | namespace lineage { 26 | namespace fastcharge { 27 | namespace V1_0 { 28 | namespace implementation { 29 | 30 | using ::android::sp; 31 | using ::android::hardware::hidl_array; 32 | using ::android::hardware::hidl_memory; 33 | using ::android::hardware::hidl_string; 34 | using ::android::hardware::hidl_vec; 35 | using ::android::hardware::Return; 36 | using ::android::hardware::Void; 37 | 38 | using ::vendor::lineage::fastcharge::V1_0::IRestrictedCurrent; 39 | 40 | struct RestrictedCurrent : public IRestrictedCurrent { 41 | RestrictedCurrent(); 42 | 43 | Return getRestrictedCurrent() override; 44 | Return setRestrictedCurrent(int32_t current_mA) override; 45 | Return getMaxSupportedCurrent() override; 46 | }; 47 | 48 | } // namespace implementation 49 | } // namespace V1_0 50 | } // namespace fastcharge 51 | } // namespace lineage 52 | } // namespace vendor 53 | -------------------------------------------------------------------------------- /fastcharge/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "fastcharge@1.0-service.xiaomi_sm6250" 18 | 19 | #include 20 | #include 21 | 22 | #include "FastCharge.h" 23 | #include "RestrictedCurrent.h" 24 | 25 | using android::hardware::configureRpcThreadpool; 26 | using android::hardware::joinRpcThreadpool; 27 | 28 | using vendor::lineage::fastcharge::V1_0::IFastCharge; 29 | using vendor::lineage::fastcharge::V1_0::implementation::FastCharge; 30 | using vendor::lineage::fastcharge::V1_0::implementation::RestrictedCurrent; 31 | 32 | using android::OK; 33 | using android::status_t; 34 | 35 | int main() { 36 | android::sp scharge = new FastCharge(); 37 | android::sp scurrent = new RestrictedCurrent(); 38 | 39 | configureRpcThreadpool(1, true); 40 | 41 | status_t status = scharge->registerAsService(); 42 | if (status != OK) { 43 | LOG(ERROR) << "Could not register service for FastCharge HAL FastCharge Iface."; 44 | return 1; 45 | } 46 | 47 | status = scurrent->registerAsService(); 48 | if (status != OK) { 49 | LOG(ERROR) << "Could not register service for FastCharge HAL RestrictedCurrent Iface."; 50 | return 1; 51 | } 52 | 53 | LOG(INFO) << "FastCharge HAL service ready."; 54 | 55 | joinRpcThreadpool(); 56 | 57 | // In normal operation, we don't expect the thread pool to shutdown 58 | LOG(ERROR) << "FastCharge HAL service is shutting down."; 59 | return 1; 60 | } 61 | -------------------------------------------------------------------------------- /fastcharge/vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250.rc: -------------------------------------------------------------------------------- 1 | service vendor.fastcharge-hal-1-0 /vendor/bin/hw/vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250 2 | class hal 3 | user system 4 | group system 5 | -------------------------------------------------------------------------------- /fastcharge/vendor.lineage.fastcharge@1.0-service.xiaomi_sm6250.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | vendor.lineage.fastcharge 4 | hwbinder 5 | @1.0::IFastCharge/default 6 | @1.0::IRestrictedCurrent/default 7 | 8 | 9 | -------------------------------------------------------------------------------- /generate_sha1_from_commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #============================================================================== 4 | # SYNOPSIS 5 | # generate_sha1_from_commit.sh args ... 6 | # 7 | # DESCRIPTION 8 | # The script generates and updates proprietary-files.txt sha1sum from a 9 | # vendor commit id. 10 | # 11 | # EXAMPLES 12 | # ./generate_sha1_from_commit.sh 1a2b3c4d 13 | # 14 | # AUTHOR 15 | # Chenyang Zhong 16 | # 17 | # HISTORY 18 | # 2020/06/19 : Script creation 19 | # 2020/09/29 : Updated script to handle added and deleted blobs 20 | # 21 | #============================================================================== 22 | # 23 | # SPDX-License-Identifier: Apache-2.0 24 | # 25 | 26 | set -e 27 | 28 | MY_DIR="${PWD}" 29 | 30 | VENDOR_DIR="${MY_DIR}"/../../../vendor/xiaomi 31 | DEVICE=sm6250-common 32 | DIR_PREFIX="proprietary/" 33 | 34 | cd "${VENDOR_DIR}/${DEVICE}" 35 | 36 | # get commit id from input 37 | if [ "${#}" -eq 1 ]; 38 | then 39 | COMMIT="${1}" 40 | else 41 | echo >&2 "Please specify a vendor commit id." 42 | exit 1 43 | fi 44 | 45 | # display commit id and title 46 | echo "$(git show -s --format='%h %s' ${COMMIT})" 47 | echo "========================================================" 48 | 49 | # iterate through changed files in the commit 50 | git diff-tree --no-commit-id --name-status -r ${COMMIT} | while read line ; 51 | do 52 | # separate status and file name 53 | read -ra arr_line <<< "${line}" 54 | status=${arr_line[0]} 55 | file=${arr_line[1]} 56 | 57 | # remove directory prefix from filename 58 | file_stripped=${file#"${DIR_PREFIX}"} 59 | 60 | # blob status is deleted 61 | if [[ "$status" == "D" ]]; then 62 | echo "deleting ${file_stripped}" 63 | sed -i "\%^${file_stripped}%d" "${MY_DIR}/proprietary-files.txt" 64 | continue 65 | fi 66 | 67 | # generate sha1 68 | r="$(sha1sum "$file")" 69 | r_arr=($r) 70 | sha1="${r_arr[0]}" 71 | 72 | # blob is newly added 73 | if [[ "$status" == "A" ]]; then 74 | echo "adding ${file_stripped}" 75 | echo "${file_stripped}|${sha1}" >> "${MY_DIR}/proprietary-files.txt" 76 | continue 77 | fi 78 | 79 | # the rest files already exist in the list and are modified 80 | # iterate through lines in proprietary-files.txt until the first 81 | # non-comment match 82 | for line in $(grep "$file_stripped" "${MY_DIR}/proprietary-files.txt") 83 | do 84 | # continue if this line starts with # 85 | [[ $line =~ ^#.* ]] && continue 86 | 87 | # check if it has a sha1sum already 88 | if [[ "$line" == *"|"* ]]; then 89 | # remove the old sha1sum and append the new one 90 | newline="${line:0:${#line}-40}${sha1}" 91 | else 92 | # append the new sha1sum to it 93 | newline="${line}|${sha1}" 94 | fi 95 | 96 | # display which line is getting replaced 97 | echo "$line ---> $newline" 98 | 99 | # use % as delimiter because file path contains "/" 100 | sedstr="s%^$line\$%$newline%" 101 | sed -i "$sedstr" "${MY_DIR}/proprietary-files.txt" 102 | 103 | # exit after the first replacement 104 | break 105 | done 106 | 107 | done 108 | -------------------------------------------------------------------------------- /gps/Android.bp: -------------------------------------------------------------------------------- 1 | GNSS_CFLAGS = [ 2 | "-Werror", 3 | "-Wno-undefined-bool-conversion", 4 | ] 5 | 6 | /* Activate the following for debug purposes only, 7 | comment out for production */ 8 | GNSS_SANITIZE_DIAG = { 9 | /* 10 | diag: { 11 | cfi: true, 12 | misc_undefined: [ 13 | "bounds", 14 | "null", 15 | "unreachable", 16 | "integer", 17 | ], 18 | }, 19 | */ 20 | } 21 | -------------------------------------------------------------------------------- /gps/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),) 2 | 3 | # Set required flags 4 | GNSS_CFLAGS := \ 5 | -Werror \ 6 | -Wno-undefined-bool-conversion 7 | 8 | GNSS_HIDL_VERSION = 2.1 9 | 10 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8937 11 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8953 12 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8998 13 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += apq8098_latv 14 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm710 15 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += qcs605 16 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm845 17 | GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm660 18 | 19 | ifneq (,$(filter $(GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST),$(TARGET_BOARD_PLATFORM))) 20 | GNSS_HIDL_LEGACY_MEASURMENTS = true 21 | endif 22 | 23 | LOCAL_PATH := $(call my-dir) 24 | include $(call all-makefiles-under,$(LOCAL_PATH)) 25 | 26 | GNSS_SANITIZE_DIAG := cfi bounds null unreachable integer address 27 | 28 | endif # ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),) 29 | -------------------------------------------------------------------------------- /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/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/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/android/2.1/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := android.hardware.gnss@2.1-impl-qti 5 | # activate the following line for debug purposes only, comment out for production 6 | #LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG) 7 | LOCAL_VENDOR_MODULE := true 8 | LOCAL_MODULE_RELATIVE_PATH := hw 9 | LOCAL_SRC_FILES := \ 10 | AGnss.cpp \ 11 | Gnss.cpp \ 12 | AGnssRil.cpp \ 13 | GnssMeasurement.cpp \ 14 | GnssConfiguration.cpp \ 15 | GnssBatching.cpp \ 16 | GnssGeofencing.cpp \ 17 | GnssNi.cpp \ 18 | GnssDebug.cpp \ 19 | GnssAntennaInfo.cpp \ 20 | MeasurementCorrections.cpp \ 21 | GnssVisibilityControl.cpp 22 | 23 | LOCAL_SRC_FILES += \ 24 | location_api/GnssAPIClient.cpp \ 25 | location_api/MeasurementAPIClient.cpp \ 26 | location_api/GeofenceAPIClient.cpp \ 27 | location_api/BatchingAPIClient.cpp \ 28 | location_api/LocationUtil.cpp \ 29 | 30 | ifeq ($(GNSS_HIDL_LEGACY_MEASURMENTS),true) 31 | LOCAL_CFLAGS += \ 32 | -DGNSS_HIDL_LEGACY_MEASURMENTS 33 | endif 34 | 35 | LOCAL_C_INCLUDES:= \ 36 | $(LOCAL_PATH)/location_api 37 | 38 | LOCAL_HEADER_LIBRARIES := \ 39 | libgps.utils_headers \ 40 | libloc_core_headers \ 41 | libloc_pla_headers \ 42 | liblocation_api_headers \ 43 | liblocbatterylistener_headers 44 | 45 | LOCAL_SHARED_LIBRARIES := \ 46 | liblog \ 47 | libhidlbase \ 48 | libcutils \ 49 | libutils \ 50 | android.hardware.gnss@1.0 \ 51 | android.hardware.gnss@1.1 \ 52 | android.hardware.gnss@2.0 \ 53 | android.hardware.gnss@2.1 \ 54 | android.hardware.gnss.measurement_corrections@1.0 \ 55 | android.hardware.gnss.measurement_corrections@1.1 \ 56 | android.hardware.gnss.visibility_control@1.0 \ 57 | android.hardware.health@1.0 \ 58 | android.hardware.health@2.0 \ 59 | android.hardware.health@2.1 \ 60 | android.hardware.power@1.2 \ 61 | libbase 62 | 63 | LOCAL_SHARED_LIBRARIES += \ 64 | libloc_core \ 65 | libgps.utils \ 66 | libdl \ 67 | liblocation_api \ 68 | 69 | LOCAL_CFLAGS += $(GNSS_CFLAGS) 70 | LOCAL_STATIC_LIBRARIES := liblocbatterylistener 71 | LOCAL_STATIC_LIBRARIES += libhealthhalutils 72 | include $(BUILD_SHARED_LIBRARY) 73 | 74 | include $(CLEAR_VARS) 75 | LOCAL_MODULE := android.hardware.gnss@2.1-service-qti 76 | 77 | # activate the following line for debug purposes only, comment out for production 78 | #LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG) 79 | LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@2.1-service-qti.xml 80 | LOCAL_VENDOR_MODULE := true 81 | LOCAL_MODULE_RELATIVE_PATH := hw 82 | LOCAL_INIT_RC := android.hardware.gnss@2.1-service-qti.rc 83 | LOCAL_SRC_FILES := \ 84 | service.cpp \ 85 | 86 | LOCAL_HEADER_LIBRARIES := \ 87 | libgps.utils_headers \ 88 | libloc_core_headers \ 89 | libloc_pla_headers \ 90 | liblocation_api_headers 91 | 92 | 93 | LOCAL_SHARED_LIBRARIES := \ 94 | liblog \ 95 | libcutils \ 96 | libdl \ 97 | libbase \ 98 | libutils \ 99 | libgps.utils \ 100 | libqti_vndfwk_detect \ 101 | 102 | LOCAL_SHARED_LIBRARIES += \ 103 | libhidlbase \ 104 | android.hardware.gnss@1.0 \ 105 | android.hardware.gnss@1.1 \ 106 | android.hardware.gnss@2.0 \ 107 | android.hardware.gnss@2.1 \ 108 | 109 | LOCAL_CFLAGS += $(GNSS_CFLAGS) 110 | 111 | ifneq ($(LOC_HIDL_VERSION),) 112 | LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"' 113 | endif 114 | 115 | include $(BUILD_EXECUTABLE) 116 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/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/android/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(call all-subdir-makefiles) 3 | -------------------------------------------------------------------------------- /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 | export_include_dirs: ["."], 37 | } 38 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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/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/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/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 | -------------------------------------------------------------------------------- /idc/uinput-fpc.idc: -------------------------------------------------------------------------------- 1 | # 2 | # FPC1020 Touch sensor driver 3 | # 4 | # Copyright (c) 2013,2014 Fingerprint Cards AB 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License Version 2 8 | # as published by the Free Software Foundation. 9 | # 10 | 11 | device.internal = 1 12 | 13 | keyboard.layout = uinput-fpc 14 | keyboard.builtIn = 1 15 | keyboard.orientationAware = 1 16 | -------------------------------------------------------------------------------- /idc/uinput-goodix.idc: -------------------------------------------------------------------------------- 1 | # 2 | # FPC1020 Touch sensor driver 3 | # 4 | # Copyright (c) 2013,2014 Fingerprint Cards AB 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License Version 2 8 | # as published by the Free Software Foundation. 9 | # 10 | 11 | device.internal = 1 12 | 13 | keyboard.layout = uinput-gf 14 | keyboard.builtIn = 1 15 | keyboard.orientationAware = 1 16 | -------------------------------------------------------------------------------- /keylayout/gpio-keys.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, 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 | key 115 VOLUME_UP 29 | key 114 VOLUME_DOWN 30 | key 102 HOME 31 | key 528 FOCUS 32 | key 766 CAMERA 33 | -------------------------------------------------------------------------------- /keylayout/uinput-fpc.kl: -------------------------------------------------------------------------------- 1 | # 2 | # FPC1020 Touch sensor driver 3 | # 4 | # Copyright (c) 2013,2014 Fingerprint Cards AB 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License Version 2 8 | # as published by the Free Software Foundation. 9 | # 10 | 11 | #key 96 DPAD_CENTER 12 | #key 102 HOME 13 | #key 105 DPAD_LEFT 14 | #key 106 DPAD_RIGHT 15 | -------------------------------------------------------------------------------- /keylayout/uinput-goodix.kl: -------------------------------------------------------------------------------- 1 | # 2 | # Goodix fingerprint sensor driver 3 | # 4 | # Copyright (c) 2013,2014 Fingerprint Cards AB 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License Version 2 8 | # as published by the Free Software Foundation. 9 | # 10 | 11 | #key 96 DPAD_CENTER 12 | #key 102 HOME 13 | #key 105 DPAD_LEFT 14 | #key 106 DPAD_RIGHT 15 | -------------------------------------------------------------------------------- /libinit/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_library_static { 8 | name: "libinit_xiaomi_atoll", 9 | srcs: [ 10 | "libinit_dalvik_heap.cpp", 11 | "libinit_variant.cpp", 12 | "libinit_utils.cpp", 13 | ], 14 | whole_static_libs: ["libbase"], 15 | export_include_dirs: ["include"], 16 | recovery_available: true, 17 | } 18 | 19 | cc_library_static { 20 | name: "init_xiaomi_atoll", 21 | srcs: ["init_xiaomi_atoll.cpp"], 22 | whole_static_libs: ["libinit_xiaomi_atoll"], 23 | include_dirs: ["system/core/init"], 24 | recovery_available: true, 25 | } 26 | -------------------------------------------------------------------------------- /libinit/include/libinit_dalvik_heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #ifndef LIBINIT_DALVIK_HEAP_H 8 | #define LIBINIT_DALVIK_HEAP_H 9 | 10 | #include 11 | 12 | typedef struct dalvik_heap_info { 13 | std::string heapstartsize; 14 | std::string heapgrowthlimit; 15 | std::string heapsize; 16 | std::string heapminfree; 17 | std::string heapmaxfree; 18 | std::string heaptargetutilization; 19 | } dalvik_heap_info_t; 20 | 21 | void set_dalvik_heap(void); 22 | 23 | #endif // LIBINIT_DALVIK_HEAP_H 24 | -------------------------------------------------------------------------------- /libinit/include/libinit_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #ifndef LIBINIT_UTILS_H 8 | #define LIBINIT_UTILS_H 9 | 10 | #include 11 | 12 | void property_override(std::string prop, std::string value, bool add = true); 13 | 14 | void set_ro_build_prop(const std::string &prop, const std::string &value, bool product = false); 15 | 16 | std::string fingerprint_to_description(std::string fingerprint); 17 | 18 | #endif // LIBINIT_UTILS_H 19 | -------------------------------------------------------------------------------- /libinit/include/libinit_variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #ifndef LIBINIT_VARIANT_H 8 | #define LIBINIT_VARIANT_H 9 | 10 | #include 11 | #include 12 | 13 | typedef struct variant_info { 14 | std::string hwc_value; 15 | 16 | std::string brand; 17 | std::string device; 18 | std::string model; 19 | std::string build_fingerprint; 20 | } variant_info_t; 21 | 22 | void search_variant(const std::vector variants); 23 | 24 | void set_variant_props(const variant_info_t variant); 25 | 26 | #endif // LIBINIT_VARIANT_H 27 | -------------------------------------------------------------------------------- /libinit/init_xiaomi_atoll.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include 8 | 9 | #include "vendor_init.h" 10 | 11 | void vendor_load_properties() { 12 | set_dalvik_heap(); 13 | } 14 | -------------------------------------------------------------------------------- /libinit/libinit_dalvik_heap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | #define HEAPSTARTSIZE_PROP "dalvik.vm.heapstartsize" 13 | #define HEAPGROWTHLIMIT_PROP "dalvik.vm.heapgrowthlimit" 14 | #define HEAPSIZE_PROP "dalvik.vm.heapsize" 15 | #define HEAPMINFREE_PROP "dalvik.vm.heapminfree" 16 | #define HEAPMAXFREE_PROP "dalvik.vm.heapmaxfree" 17 | #define HEAPTARGETUTILIZATION_PROP "dalvik.vm.heaptargetutilization" 18 | 19 | #define GB(b) (b * 1024ull * 1024 * 1024) 20 | 21 | static const dalvik_heap_info_t dalvik_heap_info_6144 = { 22 | .heapstartsize = "16m", 23 | .heapgrowthlimit = "256m", 24 | .heapsize = "512m", 25 | .heapminfree = "8m", 26 | .heapmaxfree = "32m", 27 | .heaptargetutilization = "0.5", 28 | }; 29 | 30 | static const dalvik_heap_info_t dalvik_heap_info_4096 = { 31 | .heapstartsize = "8m", 32 | .heapgrowthlimit = "256m", 33 | .heapsize = "512m", 34 | .heapminfree = "8m", 35 | .heapmaxfree = "16m", 36 | .heaptargetutilization = "0.6", 37 | }; 38 | 39 | static const dalvik_heap_info_t dalvik_heap_info_2048 = { 40 | .heapstartsize = "8m", 41 | .heapgrowthlimit = "192m", 42 | .heapsize = "512m", 43 | .heapminfree = "512k", 44 | .heapmaxfree = "8m", 45 | .heaptargetutilization = "0.75", 46 | }; 47 | 48 | void set_dalvik_heap() { 49 | struct sysinfo sys; 50 | const dalvik_heap_info_t *dhi; 51 | 52 | sysinfo(&sys); 53 | 54 | if (sys.totalram > GB(5)) 55 | dhi = &dalvik_heap_info_6144; 56 | else if (sys.totalram > GB(3)) 57 | dhi = &dalvik_heap_info_4096; 58 | else 59 | dhi = &dalvik_heap_info_2048; 60 | 61 | property_override(HEAPSTARTSIZE_PROP, dhi->heapstartsize); 62 | property_override(HEAPGROWTHLIMIT_PROP, dhi->heapgrowthlimit); 63 | property_override(HEAPSIZE_PROP, dhi->heapsize); 64 | property_override(HEAPTARGETUTILIZATION_PROP, dhi->heaptargetutilization); 65 | property_override(HEAPMINFREE_PROP, dhi->heapminfree); 66 | property_override(HEAPMAXFREE_PROP, dhi->heapmaxfree); 67 | } 68 | -------------------------------------------------------------------------------- /libinit/libinit_utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | void property_override(std::string prop, std::string value, bool add) { 14 | auto pi = (prop_info *) __system_property_find(prop.c_str()); 15 | if (pi != nullptr) { 16 | __system_property_update(pi, value.c_str(), value.length()); 17 | } else if (add) { 18 | __system_property_add(prop.c_str(), prop.length(), value.c_str(), value.length()); 19 | } 20 | } 21 | 22 | std::vector ro_props_default_source_order = { 23 | "odm.", 24 | "odm_dlkm.", 25 | "product.", 26 | "system.", 27 | "system_ext.", 28 | "vendor.", 29 | "vendor_dlkm.", 30 | "", 31 | }; 32 | 33 | void set_ro_build_prop(const std::string &prop, const std::string &value, bool product) { 34 | std::string prop_name; 35 | 36 | for (const auto &source : ro_props_default_source_order) { 37 | if (product) 38 | prop_name = "ro.product." + source + prop; 39 | else 40 | prop_name = "ro." + source + "build." + prop; 41 | 42 | property_override(prop_name, value, true); 43 | } 44 | } 45 | 46 | #define FIND_AND_REMOVE(s, delimiter, variable_name) \ 47 | std::string variable_name = s.substr(0, s.find(delimiter)); \ 48 | s.erase(0, s.find(delimiter) + delimiter.length()); 49 | 50 | #define APPEND_STRING(s, to_append) \ 51 | s.append(" "); \ 52 | s.append(to_append); 53 | 54 | std::string fingerprint_to_description(std::string fingerprint) { 55 | std::string delimiter = "/"; 56 | std::string delimiter2 = ":"; 57 | std::string build_fingerprint_copy = fingerprint; 58 | 59 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, brand) 60 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, product) 61 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter2, device) 62 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, platform_version) 63 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, build_id) 64 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter2, build_number) 65 | FIND_AND_REMOVE(build_fingerprint_copy, delimiter, build_variant) 66 | std::string build_version_tags = build_fingerprint_copy; 67 | 68 | std::string description = product + "-" + build_variant; 69 | APPEND_STRING(description, platform_version) 70 | APPEND_STRING(description, build_id) 71 | APPEND_STRING(description, build_number) 72 | APPEND_STRING(description, build_version_tags) 73 | 74 | return description; 75 | } 76 | -------------------------------------------------------------------------------- /libinit/libinit_variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | using android::base::GetProperty; 13 | 14 | #define HWC_PROP "ro.boot.hwc" 15 | #define HWNAME_PROP "ro.boot.hwname" 16 | 17 | void search_variant(const std::vector variants) { 18 | std::string hwc_value = GetProperty(HWC_PROP, ""); 19 | std::string hwname_value = GetProperty(HWNAME_PROP, ""); 20 | 21 | for (const auto& variant : variants) { 22 | if ((variant.hwc_value == "" || variant.hwc_value == hwc_value) && (variant.device == hwname_value)) { 23 | set_variant_props(variant); 24 | break; 25 | } 26 | } 27 | } 28 | 29 | void set_variant_props(const variant_info_t variant) { 30 | set_ro_build_prop("brand", variant.brand, true); 31 | set_ro_build_prop("device", variant.device, true); 32 | set_ro_build_prop("model", variant.model, true); 33 | 34 | set_ro_build_prop("fingerprint", variant.build_fingerprint); 35 | property_override("ro.bootimage.build.fingerprint", variant.build_fingerprint); 36 | 37 | property_override("ro.build.description", fingerprint_to_description(variant.build_fingerprint)); 38 | } 39 | -------------------------------------------------------------------------------- /libqti-perfd-client/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_shared { 2 | name: "libqti-perfd-client", 3 | proprietary: true, 4 | defaults: ["hidl_defaults"], 5 | srcs: [ 6 | "client.c", 7 | ], 8 | cflags: [ 9 | "-Werror", 10 | "-Wextra", 11 | "-Wall", 12 | ], 13 | shared_libs: [ 14 | "liblog", 15 | "libutils", 16 | ], 17 | } 18 | -------------------------------------------------------------------------------- /libqti-perfd-client/client.c: -------------------------------------------------------------------------------- 1 | #define LOG_TAG "libqti-perfd-client" 2 | 3 | #include 4 | #include 5 | 6 | void perf_get_feedback() {} 7 | void perf_hint() {} 8 | int perf_lock_acq(int handle, int duration, int arg3[], int arg4) { 9 | ALOGI("perf_lock_acq: handle: %d, duration: %d, arg3[0]: %d, arg4: %d", 10 | handle, duration, arg3[0], arg4); 11 | if (handle > 0) 12 | return handle; 13 | 14 | return 233; 15 | } 16 | void perf_lock_cmd() {} 17 | int perf_lock_rel(int handle) { 18 | ALOGI("perf_lock_rel: handle: %d", handle); 19 | if (handle > 0) 20 | return handle; 21 | 22 | return 233; 23 | } 24 | void perf_lock_use_profile() {} 25 | -------------------------------------------------------------------------------- /media/media_codecs_vendor_audio.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /odm.prop: -------------------------------------------------------------------------------- 1 | # Fwk detect 2 | ro.vendor.qti.va_odm.support=1 3 | -------------------------------------------------------------------------------- /overlay/CarrierConfigResCommon/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 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 | -------------------------------------------------------------------------------- /overlay/CarrierConfigResCommon/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/SM6250Aperture/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 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/SM6250Aperture/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/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/SM6250Frameworks/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 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/SM6250Frameworks/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /overlay/SM6250Frameworks/res/values/evolution_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | true 10 | 11 | 12 | /sys/class/power_supply/bms/fastcharge_mode 13 | 14 | 15 | 1 16 | 17 | 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /overlay/SM6250Settings/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "SM6250Settings", 8 | product_specific: true, 9 | } 10 | -------------------------------------------------------------------------------- /overlay/SM6250Settings/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/SM6250Settings/res/values/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | false 17 | 18 | -------------------------------------------------------------------------------- /overlay/SM6250Settings/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | true 11 | 12 | 13 | -------------------------------------------------------------------------------- /overlay/SM6250Settings/res/values/evolution_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | https://t.me/EvolutionXMiatoll 10 | SonalSingh 11 | https://www.paypal.me/Sonal18 12 | 13 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 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/SM6250SystemUI/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/res/values-land/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 3 23 | 24 | 25 | 2 26 | 27 | 28 | 6 29 | 30 | 31 | true 32 | false 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/res/values-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 0dp 18 | 19 | 21 | 0dp 22 | 0dp 23 | 24 | 25 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | 25 | /sys/devices/virtual/thermal/thermal_zone0/temp 26 | 27 | 28 | 1000 29 | 30 | 31 | /sys/class/drm/sde-crtc-0/measured_fps 32 | 33 | 34 | 5 35 | 5 36 | 37 | 39 | true 40 | 41 | 42 | -------------------------------------------------------------------------------- /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 | 24.0px 20 | 21 | 22 | 0dp 23 | 24 | 25 | 1dp 26 | 27 | 28 | 20dp 29 | 30 | 31 | 8dp 32 | 33 | 34 | 9sp 35 | 36 | 37 | 3.5dp 38 | 39 | 40 | 13.5sp 41 | 42 | 43 | -------------------------------------------------------------------------------- /overlay/SM6250SystemUI/res/values/evolution_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | wifi,cell,bt,flashlight,sound,reboot,location,hotspot,screenrecord,cast,caffeine,airplane,battery,night,reduce_brightness,dark,fpsinfo,cpuinfo,rotation,qr_code_scanner,sleep_mode 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /overlay/TelephonyResCommon/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 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/TelephonyResCommon/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /overlay/WifiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | runtime_resource_overlay { 7 | name: "WifiOverlay", 8 | vendor: true 9 | } 10 | -------------------------------------------------------------------------------- /overlay/WifiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /permissions/privapp-permissions-hotword.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /releasetools.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2021 The LineageOS 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 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | import common 14 | 15 | def FullOTA_InstallEnd(info): 16 | OTA_InstallEnd(info) 17 | return 18 | 19 | def IncrementalOTA_InstallEnd(info): 20 | OTA_InstallEnd(info) 21 | return 22 | 23 | def AddImage(info, basename, dest): 24 | path = "IMAGES/" + basename 25 | if path not in info.input_zip.namelist(): 26 | return 27 | 28 | data = info.input_zip.read(path) 29 | common.ZipWriteStr(info.output_zip, basename, data) 30 | info.script.AppendExtra('package_extract_file("%s", "%s");' % (basename, dest)) 31 | 32 | def OTA_InstallEnd(info): 33 | info.script.Print("Patching firmware images...") 34 | AddImage(info, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo") 35 | AddImage(info, "vbmeta.img", "/dev/block/bootdevice/by-name/vbmeta") 36 | AddImage(info, "vbmeta_system.img", "/dev/block/bootdevice/by-name/vbmeta_system") 37 | return 38 | -------------------------------------------------------------------------------- /rootdir/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | // Init scripts 8 | sh_binary { 9 | name: "init.qcom.early_boot.sh", 10 | src: "bin/init.qcom.early_boot.sh", 11 | vendor: true, 12 | } 13 | 14 | sh_binary { 15 | name: "init.qcom.sh", 16 | src: "bin/init.qcom.sh", 17 | vendor: true, 18 | } 19 | 20 | sh_binary { 21 | name: "init.qti.chg_policy.sh", 22 | src: "bin/init.qti.chg_policy.sh", 23 | vendor: true, 24 | } 25 | 26 | sh_binary { 27 | name: "init.sensors_fixup.sh", 28 | src: "bin/init.sensors_fixup.sh", 29 | vendor: true, 30 | } 31 | 32 | // fstab 33 | prebuilt_etc { 34 | name: "fstab.qcom", 35 | src: "etc/fstab.qcom", 36 | vendor: true, 37 | } 38 | 39 | // Init configuration files 40 | prebuilt_etc { 41 | name: "init.qcom.power.rc", 42 | src: "etc/init.qcom.power.rc", 43 | sub_dir: "init/hw", 44 | vendor: true, 45 | } 46 | 47 | prebuilt_etc { 48 | name: "init.qcom.rc", 49 | src: "etc/init.qcom.rc", 50 | sub_dir: "init/hw", 51 | vendor: true, 52 | } 53 | 54 | prebuilt_etc { 55 | name: "init.target.rc", 56 | src: "etc/init.target.rc", 57 | sub_dir: "init/hw", 58 | vendor: true, 59 | } 60 | 61 | prebuilt_etc { 62 | name: "ueventd.qcom.rc", 63 | filename: "ueventd.rc", 64 | src: "etc/ueventd.qcom.rc", 65 | vendor: true, 66 | } 67 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /rootdir/bin/init.sensors_fixup.sh: -------------------------------------------------------------------------------- 1 | #!/vendor/bin/sh 2 | # 3 | # Copyright (C) 2023 The LineageOS Project 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | 8 | sed -i '/sensor_temperature/d' /mnt/vendor/persist/sensors/sensors_list.txt 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sepolicy/vendor/audioserver.te: -------------------------------------------------------------------------------- 1 | get_prop(audioserver, vendor_audio_prop) 2 | 3 | allow audioserver unlabeled:file { read write open getattr }; 4 | allow hal_audio_default hal_audio_default:process { execmem }; 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sepolicy/vendor/device.te: -------------------------------------------------------------------------------- 1 | type fingerprint_device, dev_type; 2 | 3 | type lirc_device, dev_type; 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_ir_default.te: -------------------------------------------------------------------------------- 1 | allow hal_ir_default lirc_device:{ 2 | chr_file 3 | file 4 | } rw_file_perms; 5 | -------------------------------------------------------------------------------- /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/hal_lineage_fastcharge_default.te: -------------------------------------------------------------------------------- 1 | get_prop(hal_lineage_fastcharge, vendor_fastcharge_prop) 2 | set_prop(hal_lineage_fastcharge, vendor_fastcharge_prop) 3 | 4 | # Fast Charge Node Service Permissions 5 | allow hal_lineage_fastcharge_default sysfs_battery_supply:dir search; 6 | allow hal_lineage_fastcharge_default sysfs_battery_supply:file rw_file_perms; 7 | 8 | allow hal_lineage_fastcharge_default vendor_sysfs_battery_supply:dir search; 9 | allow hal_lineage_fastcharge_default vendor_sysfs_battery_supply:file rw_file_perms; 10 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_lineage_health_default.te: -------------------------------------------------------------------------------- 1 | r_dir_file(hal_lineage_health_default, sysfs_batteryinfo) 2 | allow hal_lineage_health_default sysfs_batteryinfo:file rw_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_power_default.te: -------------------------------------------------------------------------------- 1 | allow hal_power_default { 2 | vendor_sysfs_devfreq 3 | sysfs_touchpanel 4 | }:dir search; 5 | 6 | allow hal_power_default { 7 | vendor_sysfs_devfreq 8 | sysfs_devices_system_cpu 9 | vendor_sysfs_graphics 10 | vendor_sysfs_kgsl 11 | sysfs_touchpanel 12 | vendor_sysfs_scsi_host 13 | }:file rw_file_perms; 14 | 15 | # To get/set powerhal state property 16 | set_prop(hal_power_default, vendor_power_prop) 17 | -------------------------------------------------------------------------------- /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 | 13 | # Needed for reporting thermal stats event 14 | allow hal_thermal_default fwk_stats_service:service_manager find; 15 | binder_call(hal_thermal_default, servicemanager) 16 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sepolicy/vendor/property.te: -------------------------------------------------------------------------------- 1 | vendor_internal_prop(vendor_power_prop) 2 | 3 | vendor_internal_prop(vendor_thermal_prop) 4 | 5 | vendor_internal_prop(vendor_timekeep_prop) 6 | 7 | vendor_internal_prop(vendor_fastcharge_prop); 8 | 9 | vendor_restricted_prop(vendor_fingerprint_prop) 10 | -------------------------------------------------------------------------------- /sepolicy/vendor/property_contexts: -------------------------------------------------------------------------------- 1 | # Camera 2 | vendor.camera. u:object_r:vendor_camera_prop:s0 3 | 4 | # Fastcharge HAL 5 | persist.vendor.sec.fastchg_enabled u:object_r:vendor_fastcharge_prop:s0 6 | 7 | # Fingerprint 8 | persist.vendor.sys.fp. u:object_r:vendor_fingerprint_prop:s0 9 | vendor.sys.fp u:object_r:vendor_fingerprint_prop:s0 10 | 11 | # Power 12 | vendor.powerhal. u:object_r:vendor_power_prop:s0 13 | 14 | # Thermal 15 | vendor.thermal. u:object_r:vendor_thermal_prop:s0 16 | 17 | # Time 18 | persist.vendor.timeadjust u:object_r:vendor_timekeep_prop:s0 19 | -------------------------------------------------------------------------------- /sepolicy/vendor/seapp_contexts: -------------------------------------------------------------------------------- 1 | user=system seinfo=platform name=com.sony.timekeep domain=vendor_timekeep_app 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/service_contexts: -------------------------------------------------------------------------------- 1 | # NFC 2 | vendor.nxp.nxpnfc_aidl.INxpNfc/default u:object_r:hal_nfc_service: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 | -------------------------------------------------------------------------------- /sepolicy/vendor/timekeep.te: -------------------------------------------------------------------------------- 1 | type timekeep, domain; 2 | type timekeep_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(timekeep) 5 | 6 | allow timekeep self:capability sys_time; 7 | 8 | allow timekeep vendor_time_data_file:dir rw_dir_perms; 9 | allow timekeep vendor_time_data_file:file create_file_perms; 10 | 11 | r_dir_file(timekeep, sysfs_rtc) 12 | 13 | set_prop(timekeep, vendor_timekeep_prop) 14 | -------------------------------------------------------------------------------- /sepolicy/vendor/timekeep_app.te: -------------------------------------------------------------------------------- 1 | type vendor_timekeep_app, domain; 2 | 3 | app_domain(vendor_timekeep_app) 4 | 5 | allow vendor_timekeep_app activity_service:service_manager find; 6 | 7 | allow vendor_timekeep_app vendor_time_data_file:dir search; 8 | allow vendor_timekeep_app vendor_time_data_file:file create_file_perms; 9 | 10 | r_dir_file(vendor_timekeep_app, sysfs_rtc) 11 | 12 | set_prop(vendor_timekeep_app, vendor_timekeep_prop) 13 | -------------------------------------------------------------------------------- /sepolicy/vendor/vendor_init.te: -------------------------------------------------------------------------------- 1 | set_prop(vendor_init, vendor_power_prop) 2 | 3 | allow vendor_init proc_dirty:file w_file_perms; 4 | -------------------------------------------------------------------------------- /setup-makefiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2016 The CyanogenMod Project 4 | # Copyright (C) 2017-2020 The LineageOS Project 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | # 8 | 9 | set -e 10 | 11 | # Load extract_utils and do some sanity checks 12 | MY_DIR="${BASH_SOURCE%/*}" 13 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi 14 | 15 | ANDROID_ROOT="${MY_DIR}/../../.." 16 | 17 | HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" 18 | if [ ! -f "${HELPER}" ]; then 19 | echo "Unable to find helper script at ${HELPER}" 20 | exit 1 21 | fi 22 | source "${HELPER}" 23 | 24 | # Initialize the helper for common 25 | setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true 26 | 27 | # Warning headers and guards 28 | write_headers "curtana excalibur gram joyeuse miatoll" 29 | 30 | # The standard common blobs 31 | write_makefiles "${MY_DIR}/proprietary-files.txt" true 32 | 33 | # Finish 34 | write_footers 35 | 36 | if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then 37 | # Reinitialize the helper for device 38 | setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false 39 | 40 | # Warning headers and guards 41 | write_headers 42 | 43 | # The standard device blobs 44 | write_makefiles "${MY_DIR}/../${DEVICE}/proprietary-files.txt" true 45 | 46 | # Finish 47 | write_footers 48 | fi 49 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # Audio 2 | audio.offload.min.duration.secs=30 3 | 4 | # Charger 5 | ro.charger.enable_suspend=true 6 | 7 | # CNE 8 | persist.vendor.cne.feature=1 9 | 10 | # Display 11 | debug.sf.enable_hwc_vds=1 12 | 13 | # DPM 14 | persist.vendor.dpm.feature=11 15 | 16 | # FUSE 17 | persist.sys.fuse.passthrough.enable=true 18 | 19 | # Fwk detect 20 | ro.vendor.qti.va_aosp.support=1 21 | 22 | # IMS 23 | persist.dbg.volte_avail_ovr=1 24 | persist.dbg.vt_avail_ovr=1 25 | persist.dbg.wfc_avail_ovr=1 26 | 27 | # Media 28 | media.stagefright.thumbnail.prefer_hw_codecs=true 29 | ro.media.recorder-max-base-layer-fps=60 30 | persist.mm.enable.prefetch=true 31 | vendor.mm.enable.qcom_parser=16777199 32 | 33 | # WFD 34 | persist.debug.wfd.enable=1 35 | vendor.sys.video.disable.ubwc=1 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------