├── Android.bp ├── BoardConfigCommon.mk ├── README.md ├── audio ├── audio_effects.xml ├── audio_output_policy.conf ├── audio_policy_configuration.xml ├── audio_tuning_mixer.txt ├── sound_trigger_mixer_paths.xml └── sound_trigger_platform_info.xml ├── config.fs ├── configs ├── powerhint.xml ├── privapp-permissions-qti.xml ├── qti_whitelist.xml ├── telephony_system-ext_privapp-permissions-qti.xml └── thermal-engine.conf ├── extract-files.py ├── gps ├── Android.bp ├── CleanSpec.mk ├── Makefile.am ├── android │ ├── 2.0 │ │ ├── AGnss.cpp │ │ ├── AGnss.h │ │ ├── AGnssRil.cpp │ │ ├── AGnssRil.h │ │ ├── Android.bp │ │ ├── Gnss.cpp │ │ ├── Gnss.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 │ │ ├── android.hardware.gnss@2.0-service-qti.rc │ │ ├── android.hardware.gnss@2.0-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 │ │ ├── measurement_corrections │ │ ├── service.cpp │ │ └── visibility_control │ ├── measurement_corrections │ │ └── 1.0 │ │ │ ├── MeasurementCorrections.cpp │ │ │ └── MeasurementCorrections.h │ ├── utils │ │ ├── Android.bp │ │ ├── battery_listener.cpp │ │ └── battery_listener.h │ └── visibility_control │ │ └── 1.0 │ │ ├── GnssVisibilityControl.cpp │ │ └── GnssVisibilityControl.h ├── batching │ ├── Android.bp │ ├── BatchingAdapter.cpp │ ├── BatchingAdapter.h │ ├── Makefile.am │ ├── configure.ac │ ├── location-batching.pc.in │ └── location_batching.cpp ├── configure.ac ├── 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 │ ├── Makefile.am │ ├── SystemStatus.cpp │ ├── SystemStatus.h │ ├── SystemStatusOsObserver.cpp │ ├── SystemStatusOsObserver.h │ ├── configure.ac │ ├── data-items │ │ ├── DataItemConcreteTypesBase.h │ │ ├── DataItemId.h │ │ ├── DataItemsFactoryProxy.cpp │ │ ├── DataItemsFactoryProxy.h │ │ └── IDataItemCore.h │ ├── loc-core.pc.in │ ├── loc_core_log.cpp │ ├── loc_core_log.h │ └── observer │ │ ├── IDataItemObserver.h │ │ ├── IDataItemSubscription.h │ │ ├── IFrameworkActionReq.h │ │ └── IOsObserver.h ├── etc │ ├── Android.bp │ ├── flp.conf │ ├── gps.conf │ ├── izat.conf │ ├── lowi.conf │ ├── sap.conf │ └── xtwifi.conf ├── geofence │ ├── Android.bp │ ├── GeofenceAdapter.cpp │ ├── GeofenceAdapter.h │ ├── Makefile.am │ ├── configure.ac │ ├── location-geofence.pc.in │ └── location_geofence.cpp ├── gnss │ ├── Agps.cpp │ ├── Agps.h │ ├── Android.bp │ ├── GnssAdapter.cpp │ ├── GnssAdapter.h │ ├── Makefile.am │ ├── XtraSystemStatusObserver.cpp │ ├── XtraSystemStatusObserver.h │ └── location_gnss.cpp ├── gps_vendor_board.mk ├── gps_vendor_product.mk ├── loc-hal.pc.in ├── location │ ├── Android.bp │ ├── ILocationAPI.h │ ├── LocationAPI.cpp │ ├── LocationAPI.h │ ├── LocationAPIClientBase.cpp │ ├── LocationAPIClientBase.h │ ├── LocationDataTypes.h │ ├── Makefile.am │ ├── configure.ac │ ├── location-api.pc.in │ └── 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 │ ├── LocSharedLock.h │ ├── LocThread.cpp │ ├── LocThread.h │ ├── LocTimer.cpp │ ├── LocTimer.h │ ├── LocUnorderedSetMap.h │ ├── LogBuffer.cpp │ ├── LogBuffer.h │ ├── Makefile.am │ ├── MsgTask.cpp │ ├── MsgTask.h │ ├── SkipList.h │ ├── configure.ac │ ├── gps-utils.pc.in │ ├── 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 ├── init ├── Android.bp └── init_msm8953.cpp ├── keylayout ├── ft5435_ts.kl ├── gf3208.kl ├── goodix-ts.kl ├── gpio-keys.kl ├── ist30xx_ts_input.kl ├── msm8953-snd-card-mtp_Button_Jack.kl └── uinput-fpc.kl ├── light ├── Android.bp ├── BacklightDevice.cpp ├── BacklightDevice.h ├── Devices.cpp ├── Devices.h ├── IDumpable.h ├── LedDevice.cpp ├── LedDevice.h ├── Lights.cpp ├── Lights.h ├── RgbLedDevice.cpp ├── RgbLedDevice.h ├── Utils.cpp ├── Utils.h ├── android.hardware.light-service.xiaomi_msm8953.rc ├── android.hardware.light-service.xiaomi_msm8953.xml └── service.cpp ├── lineage.dependencies ├── manifest.xml ├── media ├── media_codecs.xml ├── media_codecs_performance.xml └── media_profiles_V1_0.xml ├── msm8953.mk ├── odm.prop ├── overlay-lineage ├── lineage-sdk │ └── lineage │ │ └── res │ │ └── res │ │ └── values │ │ └── config.xml └── packages │ └── apps │ └── Dialer │ └── java │ └── com │ └── android │ └── dialer │ └── callrecord │ └── res │ └── values │ └── config.xml ├── overlay ├── frameworks │ └── base │ │ ├── core │ │ └── res │ │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ │ └── packages │ │ └── SystemUI │ │ └── res │ │ └── values │ │ ├── config.xml │ │ └── dimens.xml └── packages │ ├── apps │ └── Settings │ │ └── res │ │ └── values │ │ └── arrays.xml │ └── services │ └── Telephony │ └── res │ └── values │ └── config.xml ├── product.prop ├── proprietary-files.txt ├── rootdir ├── Android.bp ├── bin │ ├── init.qcom.post_boot.sh │ └── init.qcom.sh └── etc │ ├── fstab.zram │ ├── init.msm.usb.configfs.rc │ ├── init.qcom.rc │ ├── init.qcom.usb.rc │ ├── init.recovery.qcom.rc │ ├── init.target.rc │ └── ueventd.qcom.rc ├── rro_overlays ├── CarrierConfigOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── xml │ │ └── vendor.xml ├── TetheringOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml └── WifiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ └── values │ └── config.xml ├── sepolicy ├── private │ └── network_stack.te └── vendor │ ├── device.te │ ├── file.te │ ├── file_contexts │ ├── genfs_contexts │ ├── hal_bluetooth_default.te │ ├── hal_camera_default.te │ ├── hal_cas_default.te │ ├── hal_fingerprint_default.te │ ├── hal_gnss_qti.te │ ├── hal_imsrtp.te │ ├── hal_ir_default.te │ ├── hal_lineage_touch_default.te │ ├── hal_power_default.te │ ├── hwservice_contexts │ ├── init.te │ ├── kernel.te │ ├── mm-qcamerad.te │ ├── netmgrd.te │ ├── poweroffalarm_app.app │ ├── property.te │ ├── property_contexts │ ├── qti_init_shell.te │ ├── radio.te │ ├── rild.te │ ├── rmt_storage.te │ ├── seapp_contexts │ ├── system_app.te │ ├── system_server.te │ ├── tee.te │ ├── timekeep.te │ ├── timekeep_app.te │ ├── ueventd.te │ ├── vendor_init.te │ ├── vndservice.te │ ├── vndservice_contexts │ └── vold.te ├── setup-makefiles.py ├── system.prop ├── system_ext.prop ├── touch ├── Android.bp ├── KeyDisabler.cpp ├── KeyDisabler.h ├── service.cpp ├── vendor.lineage.touch@1.0-service.xiaomi_8953.rc └── vendor.lineage.touch@1.0-service.xiaomi_8953.xml ├── vendor.prop └── wifi ├── WCNSS_cfg.dat ├── WCNSS_qcom_cfg.ini ├── p2p_supplicant_overlay.conf └── wpa_supplicant_overlay.conf /Android.bp: -------------------------------------------------------------------------------- 1 | soong_namespace { 2 | } 3 | 4 | install_symlink { 5 | name: "firmware_wcnss_qcom_cfg.bin_symlink", 6 | vendor: true, 7 | installed_location: "firmware/wlan/prima/WCNSS_qcom_cfg.ini", 8 | symlink_target: "/vendor/etc/wifi/WCNSS_qcom_cfg.ini", 9 | } 10 | 11 | install_symlink { 12 | name: "firmware_wcnss_qcom_wlan_nv.bin_symlink", 13 | vendor: true, 14 | installed_location: "firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin", 15 | symlink_target: "/mnt/vendor/persist/WCNSS_qcom_wlan_nv.bin", 16 | } 17 | 18 | install_symlink { 19 | name: "firmware_wcnss_wlan_dictionary.dat_symlink", 20 | vendor: true, 21 | installed_location: "firmware/wlan/prima/WCNSS_wlan_dictionary.dat", 22 | symlink_target: "/mnt/vendor/persist/WCNSS_wlan_dictionary.dat", 23 | } 24 | 25 | install_symlink { 26 | name: "firmware_wlan_mac.bin_symlink", 27 | vendor: true, 28 | installed_location: "firmware/wlan/prima/wlan_mac.bin", 29 | symlink_target: "/mnt/vendor/persist/wlan_mac.bin", 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Common device tree for Xiaomi MSM8953 devices 2 | 3 | ``` 4 | # 5 | # Copyright (C) 2017-2021 The LineageOS Project 6 | # 7 | # SPDX-License-Identifier: Apache-2.0 8 | # 9 | ``` 10 | -------------------------------------------------------------------------------- /audio/audio_output_policy.conf: -------------------------------------------------------------------------------- 1 | # List of profiles for the output device session where stream is routed. 2 | # A stream opened with the inputs attributes which match the "flags" and 3 | # "formats" as specified in the profile is routed to a device at 4 | # sample rate specified under "sampling_rates" and bit width under 5 | # "bit_width" and the topology extracted from the acdb data against 6 | # the "app_type". 7 | # 8 | # the flags and formats are specified using the strings corresponding to 9 | # enums in audio.h and audio_policy.h. They are concatenated with "|" 10 | # without space or "\n". 11 | # the flags and formats should match the ones in "audio_policy.conf" 12 | 13 | outputs { 14 | default { 15 | flags AUDIO_OUTPUT_FLAG_PRIMARY 16 | formats AUDIO_FORMAT_PCM_16_BIT 17 | sampling_rates 48000 18 | bit_width 16 19 | app_type 69937 20 | } 21 | deep_buffer { 22 | flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER 23 | formats AUDIO_FORMAT_PCM_16_BIT 24 | sampling_rates 48000 25 | bit_width 16 26 | app_type 69936 27 | } 28 | direct_pcm_16 { 29 | flags AUDIO_OUTPUT_FLAG_DIRECT 30 | formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT 31 | sampling_rates 44100|48000|96000|192000 32 | bit_width 16 33 | app_type 69936 34 | } 35 | direct_pcm_24 { 36 | flags AUDIO_OUTPUT_FLAG_DIRECT 37 | formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT 38 | sampling_rates 44100|48000|96000|192000 39 | bit_width 24 40 | app_type 69940 41 | } 42 | compress_offload_16 { 43 | flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING 44 | formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_WMA|AUDIO_FORMAT_WMA_PRO|AUDIO_FORMAT_VORBIS|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2 45 | sampling_rates 44100|48000|96000|192000 46 | bit_width 16 47 | app_type 69936 48 | } 49 | compress_offload_24 { 50 | flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING 51 | formats AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_VORBIS 52 | sampling_rates 44100|48000|96000|192000 53 | bit_width 24 54 | app_type 69940 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /audio/audio_tuning_mixer.txt: -------------------------------------------------------------------------------- 1 | #ANC_TEST_P_PATH_MIC_STEREO Capture 2 | acdb_dev_id:85 3 | !Capture 4 | Txdevice:0 5 | 6 | enable 7 | TX7 HPF Switch:0 8 | TX8 HPF Switch:0 9 | AIF1_CAP Mixer SLIM TX7:1 10 | AIF1_CAP Mixer SLIM TX8:1 11 | SLIM TX7 MUX:DEC9 12 | DEC9 MUX:DMIC4 13 | SLIM TX8 MUX:DEC10 14 | DEC10 MUX:DMIC3 15 | SLIM_0_TX Channels:Two 16 | MultiMedia1 Mixer SLIM_0_TX:1 17 | 18 | disable 19 | MultiMedia1 Mixer SLIM_0_TX:0 20 | AIF1_CAP Mixer SLIM TX7:0 21 | AIF1_CAP Mixer SLIM TX8:0 22 | SLIM TX7 MUX:ZERO 23 | SLIM TX8 MUX:ZERO 24 | DEC10 MUX:ZERO 25 | DEC9 MUX:ZERO 26 | TX7 HPF Switch:0 27 | TX8 HPF Switch:0 28 | 29 | #ANC_TEST_S_PATH_MIC_STEREO Capture 30 | acdb_dev_id:88 31 | !Capture 32 | Txdevice:0 33 | 34 | enable 35 | TX7 HPF Switch:0 36 | TX8 HPF Switch:0 37 | AIF1_CAP Mixer SLIM TX7:1 38 | AIF1_CAP Mixer SLIM TX8:1 39 | SLIM TX7 MUX:DEC8 40 | DEC7 MUX:ANC2_FB 41 | ANC2 MUX:DMIC3 42 | SLIM TX8 MUX:DEC7 43 | DEC8 MUX:ANC1_FB 44 | ANC1 MUX:DMIC3 45 | ANC1 FB MUX:EAR_HPH_L 46 | SLIM_0_TX Channels:Two 47 | MultiMedia1 Mixer SLIM_0_TX:1 48 | 49 | disable 50 | MultiMedia1 Mixer SLIM_0_TX:0 51 | AIF1_CAP Mixer SLIM TX7:0 52 | AIF1_CAP Mixer SLIM TX8:0 53 | SLIM TX7 MUX:ZERO 54 | SLIM TX8 MUX:ZERO 55 | DEC7 MUX:ZERO 56 | ANC2 MUX:ZERO 57 | ANC1 MUX:ZERO 58 | DEC8 MUX:ZERO 59 | ANC1 FB MUX:ZERO 60 | TX7 HPF Switch:0 61 | TX8 HPF Switch:0 62 | 63 | #ANC_TEST_E_PATH_MIC_STEREO Capture 64 | acdb_dev_id:91 65 | !Capture 66 | Txdevice:0 67 | 68 | enable 69 | TX7 HPF Switch:0 70 | TX8 HPF Switch:0 71 | AIF1_CAP Mixer SLIM TX7:1 72 | AIF1_CAP Mixer SLIM TX8:1 73 | SLIM TX7 MUX:DEC8 74 | DEC7 MUX:ANC2_FB 75 | ANC2 MUX:DMIC4 76 | ANC1 MUX:DMIC4 77 | SLIM TX8 MUX:DEC7 78 | DEC8 MUX:ANC1_FB 79 | ANC1 FB MUX:EAR_HPH_L 80 | SLIM_0_TX Channels:Two 81 | MultiMedia1 Mixer SLIM_0_TX:1 82 | 83 | disable 84 | MultiMedia1 Mixer SLIM_0_TX:0 85 | AIF1_CAP Mixer SLIM TX7:0 86 | AIF1_CAP Mixer SLIM TX8:0 87 | SLIM TX7 MUX:ZERO 88 | SLIM TX8 MUX:ZERO 89 | DEC7 MUX:ZERO 90 | ANC2 MUX:ZERO 91 | DEC10 MUX:ZERO 92 | ANC1 FB MUX:ZERO 93 | TX7 HPF Switch:0 94 | TX8 HPF Switch:0 95 | 96 | #ANC_TEST_S_PATH_HANDSET_SPKR_ANC_MONO 97 | acdb_dev_id:86 98 | !Playback 99 | Rxdevice:0 100 | 101 | enable 102 | ANC Function:ON 103 | SLIM RX1 MUX:AIF1_PB 104 | SLIM_0_RX Channels:One 105 | RX1 MIX1 INP1:RX1 106 | CLASS_H_DSM MUX:DSM_HPHL_RX1 107 | RX1 Digital Volume:87 108 | DAC1 Switch:1 109 | ANC Slot:7 110 | SLIMBUS_0_RX Audio Mixer MultiMedia1:1 111 | 112 | disable 113 | SLIMBUS_0_RX Audio Mixer MultiMedia1:0 114 | ANC Slot:0 115 | SLIM RX1 MUX:ZERO 116 | RX1 MIX1 INP1:ZERO 117 | RX1 Digital Volume:0 118 | DAC1 Switch:0 119 | ANC Function:OFF 120 | 121 | #ANC_TEST_E_PATH_HANDSET_SPKR_ANC_MONO 122 | acdb_dev_id:89 123 | !Playback 124 | Rxdevice:0 125 | 126 | enable 127 | ANC Function:ON 128 | SLIM RX1 MUX:AIF1_PB 129 | SLIM_0_RX Channels:One 130 | RX1 MIX1 INP1:RX1 131 | CLASS_H_DSM MUX:DSM_HPHL_RX1 132 | RX1 Digital Volume:87 133 | DAC1 Switch:1 134 | ANC Slot:8 135 | SLIMBUS_0_RX Audio Mixer MultiMedia1:1 136 | 137 | disable 138 | SLIMBUS_0_RX Audio Mixer MultiMedia1:0 139 | ANC Slot:0 140 | SLIM RX1 MUX:ZERO 141 | RX1 MIX1 INP1:ZERO 142 | RX1 Digital Volume:0 143 | DAC1 Switch:0 144 | ANC Function:OFF 145 | -------------------------------------------------------------------------------- /configs/privapp-permissions-qti.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /configs/telephony_system-ext_privapp-permissions-qti.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 29 | 30 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /extract-files.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3 2 | # 3 | # SPDX-FileCopyrightText: 2024 The LineageOS Project 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | from extract_utils.fixups_blob import ( 8 | blob_fixup, 9 | blob_fixups_user_type, 10 | ) 11 | from extract_utils.fixups_lib import ( 12 | lib_fixup_remove, 13 | lib_fixups, 14 | lib_fixups_user_type, 15 | ) 16 | from extract_utils.main import ( 17 | ExtractUtils, 18 | ExtractUtilsModule, 19 | ) 20 | 21 | namespace_imports = [ 22 | 'device/xiaomi/msm8953-common', 23 | 'hardware/qcom-caf/msm8996', 24 | 'vendor/qcom/opensource/dataservices', 25 | ] 26 | 27 | 28 | def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs): 29 | return f'{lib}_{partition}' if partition == 'vendor' else None 30 | 31 | 32 | lib_fixups: lib_fixups_user_type = { 33 | **lib_fixups, 34 | ( 35 | 'com.qualcomm.qti.dpm.api@1.0', 36 | 'vendor.qti.ims.callinfo@1.0', 37 | 'vendor.qti.ims.rcsconfig@1.0', 38 | 'vendor.qti.imsrtpservice@2.0', 39 | 'vendor.qti.imsrtpservice@2.1', 40 | ): lib_fixup_vendor_suffix, 41 | ('libwifi-hal-ctrl'): lib_fixup_remove, 42 | } 43 | 44 | blob_fixups: blob_fixups_user_type = { 45 | ('system_ext/etc/init/dpmd.rc', 'system_ext/etc/permissions/com.qti.dpmframework.xml', 'system_ext/etc/permissions/dpmapi.xml', 'system_ext/etc/permissions/qcrilhook.xml', 'system_ext/etc/permissions/telephonyservice.xml'): blob_fixup() 46 | .regex_replace('/product/', '/system_ext/'), 47 | ('system_ext/lib/libdpmframework.so', 'system_ext/lib64/libdpmframework.so'): blob_fixup() 48 | .add_needed('libcutils_shim.so'), 49 | ('system_ext/lib64/lib-imscamera.so', 'system_ext/lib64/lib-imsvideocodec.so'): blob_fixup() 50 | .add_needed('libgui_shim.so'), 51 | 'vendor/bin/pm-service': blob_fixup() 52 | .add_needed('libutils-v33.so'), 53 | ('vendor/etc/data/dsi_config.xml', 'vendor/etc/data/netmgr_config.xml'): blob_fixup() 54 | .fix_xml(), 55 | ('vendor/lib64/mediadrm/libwvdrmengine.so', 'vendor/lib64/libwvhidl.so'): blob_fixup() 56 | .add_needed('libcrypto_shim.so'), 57 | } # fmt: skip 58 | 59 | module = ExtractUtilsModule( 60 | 'msm8953-common', 61 | 'xiaomi', 62 | blob_fixups=blob_fixups, 63 | lib_fixups=lib_fixups, 64 | namespace_imports=namespace_imports, 65 | ) 66 | 67 | if __name__ == '__main__': 68 | utils = ExtractUtils.device(module) 69 | utils.run() 70 | -------------------------------------------------------------------------------- /gps/Android.bp: -------------------------------------------------------------------------------- 1 | GNSS_CFLAGS = [ 2 | "-Werror", 3 | "-Wno-undefined-bool-conversion", 4 | ] 5 | -------------------------------------------------------------------------------- /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/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - Automake script for gps loc_api 2 | # 3 | 4 | ACLOCAL_AMFLAGS = -I m4 5 | 6 | SUBDIRS = gnss 7 | 8 | pkgconfigdir = $(libdir)/pkgconfig 9 | pkgconfig_DATA = loc-hal.pc 10 | EXTRA_DIST = $(pkgconfig_DATA) 11 | -------------------------------------------------------------------------------- /gps/android/2.0/AGnss.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0 { 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 | struct AGnss : public V2_0::IAGnss { 42 | 43 | AGnss(Gnss* gnss); 44 | ~AGnss(); 45 | /* 46 | * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow. 47 | * These declarations were generated from IAGnss.hal. 48 | */ 49 | Return setCallback(const sp& callback) override; 50 | 51 | Return dataConnClosed() override; 52 | 53 | Return dataConnFailed() override; 54 | 55 | Return dataConnOpen(uint64_t networkHandle, const hidl_string& apn, 56 | V2_0::IAGnss::ApnIpType apnIpType) override; 57 | 58 | Return setServer(V2_0::IAGnssCallback::AGnssType type, 59 | const hidl_string& hostname, int32_t port) override; 60 | 61 | void statusCb(AGpsExtType type, LocAGpsStatusValue status); 62 | 63 | /* Data call setup callback passed down to GNSS HAL implementation */ 64 | static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status); 65 | 66 | private: 67 | Gnss* mGnss = nullptr; 68 | sp mAGnssCbIface = nullptr; 69 | }; 70 | 71 | } // namespace implementation 72 | } // namespace V2_0 73 | } // namespace gnss 74 | } // namespace hardware 75 | } // namespace android 76 | 77 | #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H 78 | -------------------------------------------------------------------------------- /gps/android/2.0/AGnssRil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0 { 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_0 80 | } // namespace gnss 81 | } // namespace hardware 82 | } // namespace android 83 | 84 | #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_ 85 | -------------------------------------------------------------------------------- /gps/android/2.0/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_shared { 2 | name: "android.hardware.gnss@2.0-impl-qti", 3 | vendor: true, 4 | relative_install_path: "hw", 5 | srcs: [ 6 | "AGnss.cpp", 7 | "Gnss.cpp", 8 | "AGnssRil.cpp", 9 | "GnssMeasurement.cpp", 10 | "GnssConfiguration.cpp", 11 | "GnssBatching.cpp", 12 | "GnssGeofencing.cpp", 13 | "GnssNi.cpp", 14 | "GnssDebug.cpp", 15 | "measurement_corrections/1.0/MeasurementCorrections.cpp", 16 | "visibility_control/1.0/GnssVisibilityControl.cpp", 17 | ] + [ 18 | "location_api/GnssAPIClient.cpp", 19 | "location_api/MeasurementAPIClient.cpp", 20 | "location_api/GeofenceAPIClient.cpp", 21 | "location_api/BatchingAPIClient.cpp", 22 | "location_api/LocationUtil.cpp", 23 | ], 24 | 25 | local_include_dirs: [ 26 | "location_api", 27 | "measurement_corrections/1.0", 28 | "visibility_control/1.0", 29 | "location_api", 30 | ], 31 | 32 | header_libs: [ 33 | "libgps.utils_headers", 34 | "libloc_core_headers", 35 | "libloc_pla_headers", 36 | "liblocation_api_headers", 37 | "liblocbatterylistener_headers", 38 | ], 39 | 40 | shared_libs: [ 41 | "liblog", 42 | "libhidlbase", 43 | "libcutils", 44 | "libutils", 45 | "android.hardware.gnss@1.0", 46 | "android.hardware.gnss@1.1", 47 | "android.hardware.gnss@2.0", 48 | "android.hardware.gnss.measurement_corrections@1.0", 49 | "android.hardware.gnss.visibility_control@1.0", 50 | "android.hardware.health@1.0", 51 | "android.hardware.health@2.0", 52 | "android.hardware.power@1.2", 53 | "libbase", 54 | ] + [ 55 | "libloc_core", 56 | "libgps.utils", 57 | "libdl", 58 | "liblocation_api", 59 | ], 60 | 61 | cflags: GNSS_CFLAGS, 62 | static_libs: ["liblocbatterylistener"] + ["libhealthhalutils"], 63 | } 64 | 65 | cc_binary { 66 | name: "android.hardware.gnss@2.0-service-qti", 67 | vintf_fragments: ["android.hardware.gnss@2.0-service-qti.xml"], 68 | vendor: true, 69 | relative_install_path: "hw", 70 | init_rc: ["android.hardware.gnss@2.0-service-qti.rc"], 71 | srcs: ["service.cpp"], 72 | 73 | header_libs: [ 74 | "libgps.utils_headers", 75 | "libloc_core_headers", 76 | "libloc_pla_headers", 77 | "liblocation_api_headers", 78 | ], 79 | 80 | shared_libs: [ 81 | "liblog", 82 | "libcutils", 83 | "libdl", 84 | "libbase", 85 | "libutils", 86 | "libgps.utils", 87 | "libqti_vndfwk_detect", 88 | ] + [ 89 | "libhidlbase", 90 | "android.hardware.gnss@1.0", 91 | "android.hardware.gnss@1.1", 92 | "android.hardware.gnss@2.0", 93 | ], 94 | 95 | cflags: GNSS_CFLAGS + ["-DLOC_HIDL_VERSION=\"3.0\""], 96 | } 97 | -------------------------------------------------------------------------------- /gps/android/2.0/GnssBatching.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0 { 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_0 80 | } // namespace gnss 81 | } // namespace hardware 82 | } // namespace android 83 | 84 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H 85 | -------------------------------------------------------------------------------- /gps/android/2.0/GnssConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0_GNSSCONFIGURATION_H 23 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H 24 | 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_0 { 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 | /* 41 | * Interface for passing GNSS configuration info from platform to HAL. 42 | */ 43 | struct Gnss; 44 | struct GnssConfiguration : public V2_0::IGnssConfiguration { 45 | GnssConfiguration(Gnss* gnss); 46 | ~GnssConfiguration() = default; 47 | 48 | /* 49 | * Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow. 50 | * These declarations were generated from IGnssConfiguration.hal. 51 | */ 52 | Return setSuplVersion(uint32_t version) override; 53 | Return setSuplMode(uint8_t mode) override; 54 | Return setSuplEs(bool enabled) override; 55 | Return setLppProfile(uint8_t lppProfile) override; 56 | Return setGlonassPositioningProtocol(uint8_t protocol) override; 57 | Return setEmergencySuplPdn(bool enable) override; 58 | Return setGpsLock(uint8_t lock) override; 59 | 60 | // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow. 61 | Return setBlacklist( 62 | const hidl_vec& blacklist) override; 63 | 64 | // Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow. 65 | Return setEsExtensionSec(uint32_t emergencyExtensionSeconds) override; 66 | 67 | private: 68 | Gnss* mGnss = nullptr; 69 | bool setBlacklistedSource( 70 | GnssSvIdSource& copyToSource, 71 | const GnssConfiguration::BlacklistedSource& copyFromSource); 72 | }; 73 | 74 | } // namespace implementation 75 | } // namespace V2_0 76 | } // namespace gnss 77 | } // namespace hardware 78 | } // namespace android 79 | 80 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H 81 | -------------------------------------------------------------------------------- /gps/android/2.0/GnssDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0 { 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_0 58 | } // namespace gnss 59 | } // namespace hardware 60 | } // namespace android 61 | 62 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H 63 | -------------------------------------------------------------------------------- /gps/android/2.0/GnssMeasurement.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_GNSSMEASUREMENT_H 22 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace android { 29 | namespace hardware { 30 | namespace gnss { 31 | namespace V2_0 { 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_0::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 | private: 63 | struct GnssMeasurementDeathRecipient : hidl_death_recipient { 64 | GnssMeasurementDeathRecipient(sp gnssMeasurement) : 65 | mGnssMeasurement(gnssMeasurement) { 66 | } 67 | ~GnssMeasurementDeathRecipient() = default; 68 | virtual void serviceDied(uint64_t cookie, const wp& who) override; 69 | sp mGnssMeasurement; 70 | }; 71 | 72 | private: 73 | sp mGnssMeasurementDeathRecipient = nullptr; 74 | sp mGnssMeasurementCbIface = nullptr; 75 | sp mGnssMeasurementCbIface_1_1 = nullptr; 76 | sp mGnssMeasurementCbIface_2_0 = nullptr; 77 | MeasurementAPIClient* mApi; 78 | }; 79 | 80 | } // namespace implementation 81 | } // namespace V2_0 82 | } // namespace gnss 83 | } // namespace hardware 84 | } // namespace android 85 | 86 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H 87 | -------------------------------------------------------------------------------- /gps/android/2.0/GnssNi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0 { 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_0 83 | } // namespace gnss 84 | } // namespace hardware 85 | } // namespace android 86 | -------------------------------------------------------------------------------- /gps/android/2.0/GnssNi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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_0 { 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_0 71 | } // namespace gnss 72 | } // namespace hardware 73 | } // namespace android 74 | 75 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H 76 | -------------------------------------------------------------------------------- /gps/android/2.0/android.hardware.gnss@2.0-service-qti.rc: -------------------------------------------------------------------------------- 1 | service gnss_service /vendor/bin/hw/android.hardware.gnss@2.0-service-qti 2 | class hal 3 | user gps 4 | group system gps radio vendor_qti_diag 5 | -------------------------------------------------------------------------------- /gps/android/2.0/android.hardware.gnss@2.0-service-qti.xml: -------------------------------------------------------------------------------- 1 | 28 | 29 | 30 | android.hardware.gnss 31 | hwbinder 32 | @1.1::IGnss/default 33 | @2.0::IGnss/default 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gps/android/2.0/location_api/LocationUtil.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 LOCATION_UTIL_H 31 | #define LOCATION_UTIL_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | namespace android { 38 | namespace hardware { 39 | namespace gnss { 40 | namespace V2_0 { 41 | namespace implementation { 42 | 43 | void convertGnssLocation(Location& in, V1_0::GnssLocation& out); 44 | void convertGnssLocation(Location& in, V2_0::GnssLocation& out); 45 | void convertGnssLocation(const V1_0::GnssLocation& in, Location& out); 46 | void convertGnssLocation(const V2_0::GnssLocation& in, Location& out); 47 | void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out); 48 | void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out); 49 | void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); 50 | void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); 51 | void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); 52 | 53 | } // namespace implementation 54 | } // namespace V2_0 55 | } // namespace gnss 56 | } // namespace hardware 57 | } // namespace android 58 | #endif // LOCATION_UTIL_H 59 | -------------------------------------------------------------------------------- /gps/android/2.0/measurement_corrections: -------------------------------------------------------------------------------- 1 | ../measurement_corrections -------------------------------------------------------------------------------- /gps/android/2.0/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, 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.0-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_0::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 | if (vendorEnhanced) { 64 | #ifdef LOC_HIDL_VERSION 65 | #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so" 66 | 67 | void* libHandle = NULL; 68 | vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*) 69 | dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main"); 70 | if (NULL != vendorEnhancedMainMethod) { 71 | (*vendorEnhancedMainMethod)(0, NULL); 72 | } 73 | #else 74 | ALOGE("LOC_HIDL_VERSION not defined."); 75 | #endif 76 | } 77 | 78 | joinRpcThreadpool(); 79 | 80 | } else { 81 | ALOGE("Error while registering IGnss 2.0 service: %d", status); 82 | } 83 | 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /gps/android/2.0/visibility_control: -------------------------------------------------------------------------------- 1 | ../visibility_control/ -------------------------------------------------------------------------------- /gps/android/measurement_corrections/1.0/MeasurementCorrections.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #define LOG_TAG "LocSvc_MeasurementCorrectionsInterface" 31 | 32 | #include 33 | #include "MeasurementCorrections.h" 34 | 35 | namespace android { 36 | namespace hardware { 37 | namespace gnss { 38 | namespace measurement_corrections { 39 | namespace V1_0 { 40 | namespace implementation { 41 | 42 | using ::android::hardware::hidl_array; 43 | using ::android::hardware::hidl_memory; 44 | using ::android::hardware::hidl_string; 45 | using ::android::hardware::hidl_vec; 46 | using ::android::hardware::Return; 47 | using ::android::hardware::Void; 48 | using ::android::sp; 49 | using ::android::hardware::gnss::V1_0::GnssLocation; 50 | 51 | MeasurementCorrections::MeasurementCorrections() { 52 | } 53 | 54 | MeasurementCorrections::~MeasurementCorrections() { 55 | } 56 | 57 | Return MeasurementCorrections::setCorrections(const ::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections& /*corrections*/) { 58 | return true; 59 | } 60 | 61 | Return MeasurementCorrections::setCallback( 62 | const sp& /*callback*/) { 63 | return true; 64 | } 65 | 66 | } // namespace implementation 67 | } // namespace V1_0 68 | } // namespace measurement_corrections 69 | } // namespace gnss 70 | } // namespace hardware 71 | } // namespace android 72 | -------------------------------------------------------------------------------- /gps/android/measurement_corrections/1.0/MeasurementCorrections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef ANDROID_HARDWARE_GNSS_V1_0_MeasurementCorrections_H 31 | #define ANDROID_HARDWARE_GNSS_V1_0_MeasurementCorrections_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 measurement_corrections { 44 | namespace V1_0 { 45 | namespace implementation { 46 | 47 | using ::android::hardware::hidl_array; 48 | using ::android::hardware::hidl_memory; 49 | using ::android::hardware::hidl_string; 50 | using ::android::hardware::hidl_vec; 51 | using ::android::hardware::Return; 52 | using ::android::hardware::Void; 53 | using ::android::sp; 54 | using ::android::hardware::gnss::V1_0::GnssLocation; 55 | using ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback; 56 | 57 | struct MeasurementCorrections : public IMeasurementCorrections { 58 | MeasurementCorrections(); 59 | ~MeasurementCorrections(); 60 | 61 | // Methods from ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections follow. 62 | Return setCorrections(const ::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections& corrections) override; 63 | 64 | Return setCallback(const sp& callback) override; 65 | 66 | }; 67 | 68 | 69 | } // namespace implementation 70 | } // namespace V1_0 71 | } // namespace measurement_corrections 72 | } // namespace gnss 73 | } // namespace hardware 74 | } // namespace android 75 | 76 | #endif // ANDROID_HARDWARE_GNSS_V1_0_MeasurementCorrections_H 77 | -------------------------------------------------------------------------------- /gps/android/utils/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_static { 2 | 3 | name: "liblocbatterylistener", 4 | vendor: true, 5 | 6 | cflags: GNSS_CFLAGS + ["-DBATTERY_LISTENER_ENABLED"], 7 | local_include_dirs: ["."], 8 | 9 | srcs: ["battery_listener.cpp"], 10 | 11 | shared_libs: [ 12 | "liblog", 13 | "libhidlbase", 14 | "libcutils", 15 | "libutils", 16 | "android.hardware.health@1.0", 17 | "android.hardware.health@2.0", 18 | "android.hardware.power@1.2", 19 | "libbase", 20 | ], 21 | 22 | static_libs: ["libhealthhalutils"], 23 | 24 | header_libs: [ 25 | "libloc_pla_headers", 26 | ], 27 | } 28 | 29 | cc_library_headers { 30 | 31 | name: "liblocbatterylistener_headers", 32 | vendor: true, 33 | export_include_dirs: ["."], 34 | } 35 | -------------------------------------------------------------------------------- /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 | shared_libs: [ 8 | "libutils", 9 | "libcutils", 10 | "liblog", 11 | "libloc_core", 12 | "libgps.utils", 13 | "libdl", 14 | ], 15 | 16 | srcs: [ 17 | "location_batching.cpp", 18 | "BatchingAdapter.cpp", 19 | ], 20 | 21 | header_libs: [ 22 | "libgps.utils_headers", 23 | "libloc_core_headers", 24 | "libloc_pla_headers", 25 | "liblocation_api_headers", 26 | ], 27 | 28 | cflags: GNSS_CFLAGS, 29 | } 30 | -------------------------------------------------------------------------------- /gps/batching/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(GPSUTILS_CFLAGS) \ 3 | $(LOCCORE_CFLAGS) \ 4 | -I./ \ 5 | -std=c++1y \ 6 | -D__func__=__PRETTY_FUNCTION__ \ 7 | -fno-short-enums 8 | 9 | ACLOCAL_AMFLAGS = -I m4 10 | 11 | requiredlibs = \ 12 | $(GPSUTILS_LIBS) \ 13 | $(LOCCORE_LIBS) \ 14 | -llog 15 | 16 | h_sources = \ 17 | BatchingAdapter.h 18 | 19 | libbatching_la_SOURCES = \ 20 | location_batching.cpp \ 21 | BatchingAdapter.cpp 22 | 23 | if USE_GLIB 24 | libbatching_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 25 | #libbatching_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread $(requiredlibs) @GLIB_LIBS@ -shared -avoid-version 26 | libbatching_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread $(requiredlibs) @GLIB_LIBS@ -avoid-version 27 | libbatching_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 28 | else 29 | libbatching_la_CFLAGS = $(AM_CFLAGS) 30 | libbatching_la_LDFLAGS = -Wl,-z,defs -lpthread $(requiredlibs) -shared -version-info 1:0:0 31 | libbatching_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 32 | endif 33 | 34 | library_include_HEADERS = $(h_sources) 35 | 36 | library_includedir = $(pkgincludedir) 37 | 38 | #Create and Install libraries 39 | lib_LTLIBRARIES = libbatching.la 40 | 41 | pkgconfigdir = $(libdir)/pkgconfig 42 | pkgconfig_DATA = location-batching.pc 43 | sysconf_DATA = $(WORKSPACE)/hardware/qcom/gps/etc/flp.conf 44 | EXTRA_DIST = $(pkgconfig_DATA) 45 | 46 | -------------------------------------------------------------------------------- /gps/batching/configure.ac: -------------------------------------------------------------------------------- 1 | # configure.ac -- Autoconf script for gps location-batching 2 | # 3 | # Process this file with autoconf to produce a configure script 4 | 5 | # Requires autoconf tool later than 2.61 6 | AC_PREREQ(2.61) 7 | # Initialize the gps location-batching package version 1.0.0 8 | AC_INIT([location-batching],1.0.0) 9 | # Does not strictly follow GNU Coding standards 10 | AM_INIT_AUTOMAKE([foreign]) 11 | # Disables auto rebuilding of configure, Makefile.ins 12 | AM_MAINTAINER_MODE 13 | # Verifies the --srcdir is correct by checking for the path 14 | AC_CONFIG_SRCDIR([Makefile.am]) 15 | # defines some macros variable to be included by source 16 | AC_CONFIG_HEADERS([config.h]) 17 | AC_CONFIG_MACRO_DIR([m4]) 18 | 19 | # Checks for programs. 20 | AC_PROG_LIBTOOL 21 | AC_PROG_CXX 22 | AC_PROG_CC 23 | AM_PROG_CC_C_O 24 | AC_PROG_AWK 25 | AC_PROG_CPP 26 | AC_PROG_INSTALL 27 | AC_PROG_LN_S 28 | AC_PROG_MAKE_SET 29 | PKG_PROG_PKG_CONFIG 30 | 31 | # Checks for libraries. 32 | PKG_CHECK_MODULES([GPSUTILS], [gps-utils]) 33 | AC_SUBST([GPSUTILS_CFLAGS]) 34 | AC_SUBST([GPSUTILS_LIBS]) 35 | 36 | PKG_CHECK_MODULES([LOCCORE], [loc-core]) 37 | AC_SUBST([LOCCORE_CFLAGS]) 38 | AC_SUBST([LOCCORE_LIBS]) 39 | 40 | PKG_CHECK_MODULES([GEOFENCE], [location-geofence]) 41 | AC_SUBST([GEOFENCE_CFLAGS]) 42 | AC_SUBST([GEOFENCE_LIBS]) 43 | 44 | AC_ARG_WITH([locpla_includes], 45 | AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@], 46 | [specify the path to locpla-includes in loc-pla_git.bb]), 47 | [locpla_incdir=$withval], 48 | with_locpla_includes=no) 49 | 50 | if test "x$with_locpla_includes" != "xno"; then 51 | AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}") 52 | fi 53 | 54 | AC_ARG_WITH([glib], 55 | AC_HELP_STRING([--with-glib], 56 | [enable glib, building HLOS systems which use glib])) 57 | 58 | if (test "x${with_glib}" = "xyes"); then 59 | AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) 60 | PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, 61 | AC_MSG_ERROR(GThread >= 2.16 is required)) 62 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, 63 | AC_MSG_ERROR(GLib >= 2.16 is required)) 64 | GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" 65 | GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" 66 | 67 | AC_SUBST(GLIB_CFLAGS) 68 | AC_SUBST(GLIB_LIBS) 69 | fi 70 | 71 | AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") 72 | 73 | AC_CONFIG_FILES([ \ 74 | Makefile \ 75 | location-batching.pc 76 | ]) 77 | 78 | AC_OUTPUT 79 | -------------------------------------------------------------------------------- /gps/batching/location-batching.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: location-batching 7 | Description: QTI GPS Batching 8 | Version: @VERSION 9 | Libs: -L${libdir} -lbatching 10 | Cflags: -I${includedir}/location-batching 11 | -------------------------------------------------------------------------------- /gps/configure.ac: -------------------------------------------------------------------------------- 1 | # configure.ac -- Autoconf script for gps loc_hal 2 | # 3 | # Process this file with autoconf to produce a configure script 4 | 5 | # Requires autoconf tool later than 2.61 6 | AC_PREREQ(2.61) 7 | # Initialize the gps loc-hal package version 1.0.0 8 | AC_INIT([loc-hal],1.0.0) 9 | # Does not strictly follow GNU Coding standards 10 | AM_INIT_AUTOMAKE([foreign subdir-objects]) 11 | # Disables auto rebuilding of configure, Makefile.ins 12 | AM_MAINTAINER_MODE 13 | # Verifies the --srcdir is correct by checking for the path 14 | AC_CONFIG_SRCDIR([Makefile.am]) 15 | # defines some macros variable to be included by source 16 | AC_CONFIG_HEADERS([config.h]) 17 | AC_CONFIG_MACRO_DIR([m4]) 18 | 19 | # Checks for programs. 20 | AC_PROG_LIBTOOL 21 | AC_PROG_CXX 22 | AC_PROG_CC 23 | AM_PROG_CC_C_O 24 | AC_PROG_AWK 25 | AC_PROG_CPP 26 | AC_PROG_INSTALL 27 | AC_PROG_LN_S 28 | AC_PROG_MAKE_SET 29 | PKG_PROG_PKG_CONFIG 30 | 31 | # Checks for libraries. 32 | PKG_CHECK_MODULES([GPSUTILS], [gps-utils]) 33 | AC_SUBST([GPSUTILS_CFLAGS]) 34 | AC_SUBST([GPSUTILS_LIBS]) 35 | 36 | PKG_CHECK_MODULES([LOCCORE], [loc-core]) 37 | AC_SUBST([LOCCORE_CFLAGS]) 38 | AC_SUBST([LOCCORE_LIBS]) 39 | 40 | AC_ARG_WITH([core_includes], 41 | AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], 42 | [Specify the location of the core headers]), 43 | [core_incdir=$withval], 44 | with_core_includes=no) 45 | 46 | if test "x$with_core_includes" != "xno"; then 47 | CPPFLAGS="${CPPFLAGS} -I${core_incdir}" 48 | fi 49 | 50 | AC_ARG_WITH([locpla_includes], 51 | AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@], 52 | [specify the path to locpla-includes in loc-pla_git.bb]), 53 | [locpla_incdir=$withval], 54 | with_locpla_includes=no) 55 | 56 | if test "x$with_locpla_includes" != "xno"; then 57 | AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}") 58 | fi 59 | 60 | AC_SUBST([CPPFLAGS]) 61 | 62 | AC_ARG_WITH([glib], 63 | AC_HELP_STRING([--with-glib], 64 | [enable glib, building HLOS systems which use glib])) 65 | 66 | if (test "x${with_glib}" = "xyes"); then 67 | AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) 68 | PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, 69 | AC_MSG_ERROR(GThread >= 2.16 is required)) 70 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, 71 | AC_MSG_ERROR(GLib >= 2.16 is required)) 72 | GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" 73 | GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" 74 | 75 | AC_SUBST(GLIB_CFLAGS) 76 | AC_SUBST(GLIB_LIBS) 77 | fi 78 | 79 | AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") 80 | 81 | AC_CONFIG_FILES([ \ 82 | Makefile \ 83 | gnss/Makefile \ 84 | loc-hal.pc \ 85 | ]) 86 | 87 | AC_OUTPUT 88 | -------------------------------------------------------------------------------- /gps/core/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "libloc_core", 5 | vendor: true, 6 | 7 | shared_libs: [ 8 | "liblog", 9 | "libutils", 10 | "libcutils", 11 | "libgps.utils", 12 | "libdl", 13 | "liblog", 14 | ], 15 | 16 | srcs: [ 17 | "LocApiBase.cpp", 18 | "LocAdapterBase.cpp", 19 | "ContextBase.cpp", 20 | "LocContext.cpp", 21 | "loc_core_log.cpp", 22 | "data-items/DataItemsFactoryProxy.cpp", 23 | "SystemStatusOsObserver.cpp", 24 | "SystemStatus.cpp", 25 | ], 26 | 27 | cflags: [ 28 | "-fno-short-enums", 29 | "-D_ANDROID_", 30 | ] + GNSS_CFLAGS, 31 | 32 | local_include_dirs: [ 33 | "data-items", 34 | "observer", 35 | ], 36 | 37 | header_libs: [ 38 | "libutils_headers", 39 | "libgps.utils_headers", 40 | "libloc_pla_headers", 41 | "liblocation_api_headers", 42 | ], 43 | 44 | } 45 | 46 | cc_library_headers { 47 | 48 | name: "libloc_core_headers", 49 | vendor: true, 50 | export_include_dirs: ["."] + [ 51 | "data-items", 52 | "observer", 53 | ], 54 | } 55 | -------------------------------------------------------------------------------- /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.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2014, 2017-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 | #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(LocThread::tCreate tCreator, 43 | const char* name, bool joinable = true); 44 | static const MsgTask* getMsgTask(const char* name, bool joinable = true); 45 | static pthread_mutex_t mGetLocContextMutex; 46 | 47 | protected: 48 | LocContext(const MsgTask* msgTask); 49 | inline virtual ~LocContext() {} 50 | 51 | public: 52 | static const char* mLBSLibName; 53 | static const char* mLocationHalName; 54 | 55 | static ContextBase* getLocContext(LocThread::tCreate tCreator, LocMsg* firstMsg, 56 | const char* name, bool joinable = true); 57 | inline static ContextBase* getLocContext(const char* name, bool joinable = true) { 58 | return getLocContext(NULL, NULL, name, joinable); 59 | } 60 | 61 | static void injectFeatureConfig(ContextBase *context); 62 | }; 63 | 64 | } 65 | 66 | #endif //__LOC_CONTEXT__ 67 | -------------------------------------------------------------------------------- /gps/core/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | AM_CFLAGS = -I./ \ 4 | $(LOCPLA_CFLAGS) \ 5 | $(GPSUTILS_CFLAGS) \ 6 | -I./data-items/ \ 7 | -I./data-items/common \ 8 | -I./observer \ 9 | -I$(WORKSPACE)/gps-noship/flp \ 10 | -D__func__=__PRETTY_FUNCTION__ \ 11 | -fno-short-enums \ 12 | -std=c++11 13 | 14 | libloc_core_la_h_sources = \ 15 | LocApiBase.h \ 16 | LocAdapterBase.h \ 17 | ContextBase.h \ 18 | LocContext.h \ 19 | LBSProxyBase.h \ 20 | loc_core_log.h \ 21 | LocAdapterProxyBase.h \ 22 | EngineHubProxyBase.h \ 23 | data-items/DataItemId.h \ 24 | data-items/IDataItemCore.h \ 25 | data-items/DataItemConcreteTypesBase.h \ 26 | observer/IDataItemObserver.h \ 27 | observer/IDataItemSubscription.h \ 28 | observer/IFrameworkActionReq.h \ 29 | observer/IOsObserver.h \ 30 | SystemStatusOsObserver.h \ 31 | SystemStatus.h 32 | 33 | libloc_core_la_c_sources = \ 34 | LocApiBase.cpp \ 35 | LocAdapterBase.cpp \ 36 | ContextBase.cpp \ 37 | LocContext.cpp \ 38 | loc_core_log.cpp \ 39 | data-items/DataItemsFactoryProxy.cpp \ 40 | SystemStatusOsObserver.cpp \ 41 | SystemStatus.cpp 42 | 43 | library_includedir = $(pkgincludedir) 44 | 45 | library_include_HEADERS = $(libloc_core_la_h_sources) 46 | 47 | libloc_core_la_SOURCES = $(libloc_core_la_c_sources) 48 | 49 | if USE_GLIB 50 | libloc_core_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 51 | libloc_core_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 52 | libloc_core_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 53 | else 54 | libloc_core_la_CFLAGS = $(AM_CFLAGS) 55 | libloc_core_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0 56 | libloc_core_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 57 | endif 58 | 59 | if USE_FEATURE_AUTOMOTIVE 60 | AM_CFLAGS += -DFEATURE_AUTOMOTIVE 61 | endif 62 | 63 | libloc_core_la_LIBADD = -ldl $(GPSUTILS_LIBS) 64 | 65 | #Create and Install libraries 66 | lib_LTLIBRARIES = libloc_core.la 67 | 68 | pkgconfigdir = $(libdir)/pkgconfig 69 | pkgconfig_DATA = loc-core.pc 70 | EXTRA_DIST = $(pkgconfig_DATA) 71 | -------------------------------------------------------------------------------- /gps/core/configure.ac: -------------------------------------------------------------------------------- 1 | # configure.ac -- Autoconf script for gps loc-core 2 | # 3 | # Process this file with autoconf to produce a configure script 4 | 5 | # Requires autoconf tool later than 2.61 6 | AC_PREREQ(2.61) 7 | # Initialize the gps loc-hal package version 1.0.0 8 | AC_INIT([loc-core],1.0.0) 9 | # Does not strictly follow GNU Coding standards 10 | AM_INIT_AUTOMAKE([foreign subdir-objects]) 11 | # Disables auto rebuilding of configure, Makefile.ins 12 | AM_MAINTAINER_MODE 13 | # Verifies the --srcdir is correct by checking for the path 14 | AC_CONFIG_SRCDIR([loc-core.pc.in]) 15 | # defines some macros variable to be included by source 16 | AC_CONFIG_HEADERS([config.h]) 17 | AC_CONFIG_MACRO_DIR([m4]) 18 | 19 | # Checks for programs. 20 | AC_PROG_LIBTOOL 21 | AC_PROG_CXX 22 | AC_PROG_CC 23 | AM_PROG_CC_C_O 24 | AC_PROG_AWK 25 | AC_PROG_CPP 26 | AC_PROG_INSTALL 27 | AC_PROG_LN_S 28 | AC_PROG_MAKE_SET 29 | PKG_PROG_PKG_CONFIG 30 | 31 | # Checks for libraries. 32 | PKG_CHECK_MODULES([GPSUTILS], [gps-utils]) 33 | AC_SUBST([GPSUTILS_CFLAGS]) 34 | AC_SUBST([GPSUTILS_LIBS]) 35 | 36 | AC_ARG_WITH([core_includes], 37 | AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], 38 | [Specify the location of the core headers]), 39 | [core_incdir=$withval], 40 | with_core_includes=no) 41 | 42 | if test "x$with_core_includes" != "xno"; then 43 | CPPFLAGS="${CPPFLAGS} -I${core_incdir}" 44 | fi 45 | 46 | AC_ARG_WITH([locpla_includes], 47 | AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@], 48 | [specify the path to locpla-includes in loc-pla_git.bb]), 49 | [locpla_incdir=$withval], 50 | with_locpla_includes=no) 51 | 52 | if test "x$with_locpla_includes" != "xno"; then 53 | AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}") 54 | fi 55 | 56 | AC_SUBST([CPPFLAGS]) 57 | 58 | AC_ARG_WITH([glib], 59 | AC_HELP_STRING([--with-glib], 60 | [enable glib, building HLOS systems which use glib])) 61 | 62 | if (test "x${with_glib}" = "xyes"); then 63 | AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) 64 | PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, 65 | AC_MSG_ERROR(GThread >= 2.16 is required)) 66 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, 67 | AC_MSG_ERROR(GLib >= 2.16 is required)) 68 | GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" 69 | GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" 70 | 71 | AC_SUBST(GLIB_CFLAGS) 72 | AC_SUBST(GLIB_LIBS) 73 | fi 74 | 75 | AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") 76 | 77 | AC_ARG_WITH([auto_feature], 78 | AC_HELP_STRING([--with-auto_feature=@<:@dir@:>@], 79 | [Using Automotive feature]), 80 | [], 81 | with_auto_feature=no) 82 | 83 | if test "x$with_auto_feature" != "xno"; then 84 | CPPFLAGS="${CPPFLAGS} -DFEATURE_AUTOMOTIVE" 85 | fi 86 | 87 | AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "xyes") 88 | 89 | AC_CONFIG_FILES([ \ 90 | Makefile \ 91 | loc-core.pc \ 92 | ]) 93 | 94 | AC_OUTPUT 95 | -------------------------------------------------------------------------------- /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.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.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: loc-core 7 | Description: QTI GPS Loc Core 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lloc_core 10 | Cflags: -I${includedir}/loc-core 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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=40 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/etc/lowi.conf: -------------------------------------------------------------------------------- 1 | #*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====* 2 | # 3 | # LOWI Config file 4 | # 5 | # GENERAL DESCRIPTION 6 | # This file contains the config params for LOWI 7 | # 8 | # Copyright (c) 2019 Qualcomm Technologies, Inc. 9 | # All Rights Reserved. 10 | # Confidential and Proprietary - Qualcomm Technologies, Inc. 11 | # 12 | # 2012-2013 Qualcomm Atheros, Inc. 13 | # All Rights Reserved. 14 | # Qualcomm Atheros Confidential and Proprietary. 15 | # 16 | # Export of this technology or software is regulated by the U.S. Government. 17 | # Diversion contrary to U.S. law prohibited. 18 | #=============================================================================*/ 19 | 20 | # X86 ONLY - UBUNTU: 21 | # Copy this file in the same directory where the executable is 22 | 23 | # Log level 24 | # EL_LOG_OFF = 0, EL_ERROR = 1, EL_WARNING = 2, EL_INFO = 3, EL_DEBUG = 4, EL_VERBOSE = 5, EL_LOG_ALL = 100 25 | LOWI_LOG_LEVEL = 2 26 | LOWI_USE_LOWI_LP = 0 27 | 28 | -------------------------------------------------------------------------------- /gps/geofence/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | 3 | cc_library_shared { 4 | 5 | name: "libgeofencing", 6 | vendor: true, 7 | 8 | srcs: [ 9 | "GeofenceAdapter.cpp", 10 | "location_geofence.cpp", 11 | ], 12 | 13 | shared_libs: [ 14 | "libutils", 15 | "libcutils", 16 | "libgps.utils", 17 | "liblog", 18 | "libloc_core", 19 | ], 20 | 21 | header_libs: [ 22 | "libgps.utils_headers", 23 | "libloc_core_headers", 24 | "libloc_pla_headers", 25 | "liblocation_api_headers", 26 | ], 27 | 28 | cflags: GNSS_CFLAGS, 29 | } 30 | -------------------------------------------------------------------------------- /gps/geofence/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -Wundef \ 2 | -Wno-trigraphs \ 3 | -g -O0 \ 4 | -fno-inline \ 5 | -fno-short-enums \ 6 | -fpic \ 7 | ${GPSUTILS_CFLAGS} \ 8 | ${LOCCORE_CFLAGS} \ 9 | $(LOCPLA_CFLAGS) \ 10 | -D__func__=__PRETTY_FUNCTION__ \ 11 | -std=c++1y 12 | 13 | AM_CPPFLAGS = $(AM_CFLAGS) 14 | 15 | ACLOCAL_AMFLAGS = -I m4 16 | 17 | requiredlibs = \ 18 | ${LOCCORE_LIBS} \ 19 | $(GPSUTILS_LIBS) \ 20 | -llog 21 | 22 | h_sources = \ 23 | GeofenceAdapter.h 24 | 25 | c_sources = \ 26 | GeofenceAdapter.cpp \ 27 | location_geofence.cpp 28 | 29 | libgeofencing_la_SOURCES = $(c_sources) 30 | if USE_GLIB 31 | libgeofencing_la_CFLAGS = -DUSE_GLIB @GLIB_CFLAGS@ $(AM_CFLAGS) 32 | libgeofencing_la_CPPFLAGS = -DUSE_GLIB @GLIB_CFLAGS@ $(AM_CFLAGS) $(AM_CPPFLAGS) 33 | libgeofencing_la_LDFLAGS = -lstdc++ -Wl,-z,defs @GLIB_LIBS@ $(requiredlibs) -shared -version-info 1:0:0 34 | libgeofencing_la_LIBDADD = $(requiredlibs) -lstdc++ @GLIB_LIBS@ 35 | else 36 | libgeofencing_la_CFLAGS = $(AM_CFLAGS) 37 | libgeofencing_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 38 | libgeofencing_la_LDFLAGS = -lstdc++ -Wl,-z,defs $(requiredlibs) -shared -version-info 1:0:0 39 | libgeofencing_la_LIBDADD = $(requiredlibs) -lstdc++ 40 | endif 41 | 42 | library_include_HEADERS = $(h_sources) 43 | 44 | library_includedir = $(pkgincludedir) 45 | 46 | lib_LTLIBRARIES = libgeofencing.la 47 | 48 | pkgconfigdir = $(libdir)/pkgconfig 49 | pkgconfig_DATA = location-geofence.pc 50 | EXTRA_DIST = $(pkgconfig_DATA) 51 | -------------------------------------------------------------------------------- /gps/geofence/configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.61) 2 | AC_INIT([location-geofence], 1.0.0) 3 | AM_INIT_AUTOMAKE([foreign]) 4 | AC_CONFIG_SRCDIR([Makefile.am]) 5 | AC_CONFIG_HEADERS([config.h]) 6 | AC_CONFIG_MACRO_DIR([m4]) 7 | 8 | # Check for programs 9 | AC_PROG_LIBTOOL 10 | AC_PROG_CXX 11 | AC_PROG_CC 12 | AM_PROG_CC_C_O 13 | AC_PROG_AWK 14 | AC_PROG_CPP 15 | AC_PROG_INSTALL 16 | AC_PROG_LN_S 17 | AC_PROG_MAKE_SET 18 | PKG_PROG_PKG_CONFIG 19 | 20 | # Check for libraries 21 | PKG_CHECK_MODULES([GPSUTILS], [gps-utils]) 22 | AC_SUBST([GPSUTILS_CFLAGS]) 23 | AC_SUBST([GPSUTILS_LIBS]) 24 | 25 | PKG_CHECK_MODULES([LOCCORE], [loc-core]) 26 | AC_SUBST([LOCCORE_CFLAGS]) 27 | AC_SUBST([LOCCORE_LIBS]) 28 | 29 | AS_CASE([$host], 30 | [arm*], [ARM=yes], 31 | [ARM=no] 32 | ) 33 | 34 | AC_ARG_WITH([locpla_includes], 35 | AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@], 36 | [specify the path to locpla-includes in loc-pla_git.bb]), 37 | [locpla_incdir=$withval], 38 | with_locpla_includes=no) 39 | 40 | if test "x$with_locpla_includes" != "xno"; then 41 | AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}") 42 | fi 43 | 44 | AC_ARG_WITH([glib], 45 | AC_HELP_STRING([--with-glib], 46 | [enable glib, building HLOS systems which use glib])) 47 | 48 | if (test "x${with_glib}" = "xyes"); then 49 | AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) 50 | PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, 51 | AC_MSG_ERROR(GThread >= 2.16 is required)) 52 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, 53 | AC_MSG_ERROR(GLib >= 2.16 is required)) 54 | GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" 55 | GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" 56 | 57 | AC_SUBST(GLIB_CFLAGS) 58 | AC_SUBST(GLIB_LIBS) 59 | fi 60 | 61 | AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") 62 | 63 | AC_SUBST([CFLAGS]) 64 | AC_SUBST([CPPFLAGS]) 65 | AC_SUBST([LIBS]) 66 | 67 | AC_CONFIG_FILES([ \ 68 | Makefile \ 69 | location-geofence.pc 70 | ]) 71 | 72 | AC_OUTPUT 73 | -------------------------------------------------------------------------------- /gps/geofence/location-geofence.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: location-geofence 7 | Description: QTI GPS Geofence 8 | Version: @VERSION 9 | Libs: -L${libdir} -lgeofencing 10 | Cflags: -I${includedir}/location-geofence 11 | -------------------------------------------------------------------------------- /gps/gnss/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | 3 | cc_library_shared { 4 | 5 | name: "libgnss", 6 | vendor: true, 7 | 8 | shared_libs: [ 9 | "libutils", 10 | "libcutils", 11 | "libdl", 12 | "liblog", 13 | "libloc_core", 14 | "libgps.utils", 15 | ], 16 | 17 | srcs: [ 18 | "location_gnss.cpp", 19 | "GnssAdapter.cpp", 20 | "Agps.cpp", 21 | "XtraSystemStatusObserver.cpp", 22 | ], 23 | 24 | cflags: ["-fno-short-enums"] + GNSS_CFLAGS, 25 | header_libs: [ 26 | "libgps.utils_headers", 27 | "libloc_core_headers", 28 | "libloc_pla_headers", 29 | "liblocation_api_headers", 30 | ], 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gps/gnss/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(LOCPLA_CFLAGS) \ 3 | $(LOCHAL_CFLAGS) \ 4 | $(GPSUTILS_CFLAGS) \ 5 | $(LOCCORE_CFLAGS) \ 6 | -I./ \ 7 | -I../utils \ 8 | -I$(WORKSPACE)/hardware/qcom/gps/core/data-items \ 9 | -I../location \ 10 | -std=c++1y 11 | 12 | libgnss_la_SOURCES = \ 13 | location_gnss.cpp \ 14 | GnssAdapter.cpp \ 15 | XtraSystemStatusObserver.cpp \ 16 | Agps.cpp 17 | 18 | if USE_GLIB 19 | libgnss_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 20 | libgnss_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -avoid-version 21 | libgnss_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 22 | else 23 | libgnss_la_CFLAGS = $(AM_CFLAGS) 24 | libgnss_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0 25 | libgnss_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 26 | endif 27 | 28 | libgnss_la_LIBADD = -lstdc++ -ldl $(GPSUTILS_LIBS) $(LOCCORE_LIBS) 29 | 30 | #Create and Install libraries 31 | lib_LTLIBRARIES = libgnss.la 32 | -------------------------------------------------------------------------------- /gps/gps_vendor_board.mk: -------------------------------------------------------------------------------- 1 | # Flags from BoardConfigVendor.mk 2 | ifneq ($(TARGET_USES_QMAA),true) 3 | BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default 4 | else ifneq ($(TARGET_USES_QMAA_OVERRIDE_GPS),false) 5 | BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default 6 | endif 7 | 8 | -------------------------------------------------------------------------------- /gps/gps_vendor_product.mk: -------------------------------------------------------------------------------- 1 | # HAL packages 2 | ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),) 3 | 4 | # GPS-HIDL 5 | LOC_BOARD_PLATFORM_LIST += msm8937 6 | LOC_BOARD_PLATFORM_LIST += msm8953 7 | LOC_BOARD_PLATFORM_LIST += msm8998 8 | LOC_BOARD_PLATFORM_LIST += apq8098_latv 9 | LOC_BOARD_PLATFORM_LIST += sdm710 10 | LOC_BOARD_PLATFORM_LIST += qcs605 11 | LOC_BOARD_PLATFORM_LIST += sdm845 12 | LOC_BOARD_PLATFORM_LIST += sdm660 13 | LOC_BOARD_PLATFORM_LIST += msmnile 14 | LOC_BOARD_PLATFORM_LIST += sdmshrike 15 | LOC_BOARD_PLATFORM_LIST += $(MSMSTEPPE) 16 | LOC_BOARD_PLATFORM_LIST += $(TRINKET) 17 | LOC_BOARD_PLATFORM_LIST += kona 18 | LOC_BOARD_PLATFORM_LIST += atoll 19 | LOC_BOARD_PLATFORM_LIST += lito 20 | LOC_BOARD_PLATFORM_LIST += bengal 21 | LOC_BOARD_PLATFORM_LIST += lahaina 22 | 23 | # Add product packages 24 | ifneq (,$(filter $(LOC_BOARD_PLATFORM_LIST),$(TARGET_BOARD_PLATFORM))) 25 | 26 | PRODUCT_PACKAGES += gps.conf 27 | PRODUCT_PACKAGES += libloc_pla_headers 28 | PRODUCT_PACKAGES += liblocation_api_headers 29 | PRODUCT_PACKAGES += libgps.utils_headers 30 | PRODUCT_PACKAGES += liblocation_api 31 | PRODUCT_PACKAGES += libgps.utils 32 | PRODUCT_PACKAGES += libbatching 33 | PRODUCT_PACKAGES += libgeofencing 34 | PRODUCT_PACKAGES += libloc_core 35 | PRODUCT_PACKAGES += libgnss 36 | 37 | PRODUCT_PACKAGES += android.hardware.gnss@2.0-impl-qti 38 | PRODUCT_PACKAGES += android.hardware.gnss@2.0-service-qti 39 | 40 | endif # ifneq (,$(filter $(LOC_BOARD_PLATFORM_LIST),$(TARGET_BOARD_PLATFORM))) 41 | endif # ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),) 42 | -------------------------------------------------------------------------------- /gps/loc-hal.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: loc-hal 7 | Description: QTI GPS Loc HAL 8 | Version: @VERSION 9 | Libs: -L${libdir} -lgnss 10 | Cflags: -I${includedir} -I${includedir}/utils -I${includedir}/core -I${includedir}/loc-hal 11 | -------------------------------------------------------------------------------- /gps/location/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "liblocation_api", 5 | vendor: true, 6 | 7 | shared_libs: [ 8 | "libutils", 9 | "libcutils", 10 | "libgps.utils", 11 | "libdl", 12 | "liblog", 13 | ], 14 | 15 | srcs: [ 16 | "LocationAPI.cpp", 17 | "LocationAPIClientBase.cpp", 18 | ], 19 | 20 | cflags: ["-fno-short-enums"] + GNSS_CFLAGS, 21 | 22 | header_libs: [ 23 | "libloc_pla_headers", 24 | "libgps.utils_headers", 25 | ], 26 | 27 | } 28 | 29 | cc_library_headers { 30 | 31 | name: "liblocation_api_headers", 32 | export_include_dirs: ["."], 33 | vendor: true, 34 | } 35 | -------------------------------------------------------------------------------- /gps/location/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | AM_CFLAGS = \ 4 | -I./ \ 5 | -I../utils \ 6 | $(LOCPLA_CFLAGS) \ 7 | $(GPSUTILS_CFLAGS) \ 8 | -std=c++11 9 | 10 | liblocation_api_la_SOURCES = \ 11 | LocationAPI.cpp \ 12 | LocationAPIClientBase.cpp 13 | 14 | if USE_GLIB 15 | liblocation_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 16 | liblocation_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 17 | liblocation_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 18 | else 19 | liblocation_api_la_CFLAGS = $(AM_CFLAGS) 20 | liblocation_api_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0 21 | liblocation_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 22 | endif 23 | 24 | liblocation_api_la_LIBADD = -lstdc++ -ldl $(GPSUTILS_LIBS) 25 | 26 | library_include_HEADERS = \ 27 | LocationAPI.h \ 28 | LocationAPIClientBase.h \ 29 | location_interface.h \ 30 | LocationDataTypes.h \ 31 | ILocationAPI.h 32 | 33 | #Create and Install libraries 34 | lib_LTLIBRARIES = liblocation_api.la 35 | 36 | library_includedir = $(pkgincludedir) 37 | 38 | pkgconfigdir = $(libdir)/pkgconfig 39 | pkgconfig_DATA = location-api.pc 40 | EXTRA_DIST = $(pkgconfig_DATA) 41 | -------------------------------------------------------------------------------- /gps/location/configure.ac: -------------------------------------------------------------------------------- 1 | # configure.ac -- Autoconf script for gps location-api-iface 2 | # 3 | # Process this file with autoconf to produce a configure script 4 | 5 | # Requires autoconf tool later than 2.61 6 | AC_PREREQ(2.61) 7 | # Initialize the gps location-api-iface package version 1.0.0 8 | AC_INIT([location-api-iface],1.0.0) 9 | # Does not strictly follow GNU Coding standards 10 | AM_INIT_AUTOMAKE([foreign subdir-objects]) 11 | # Disables auto rebuilding of configure, Makefile.ins 12 | AM_MAINTAINER_MODE 13 | # Verifies the --srcdir is correct by checking for the path 14 | AC_CONFIG_SRCDIR([location-api.pc.in]) 15 | # defines some macros variable to be included by source 16 | AC_CONFIG_HEADERS([config.h]) 17 | AC_CONFIG_MACRO_DIR([m4]) 18 | 19 | # Checks for programs. 20 | AC_PROG_LIBTOOL 21 | AC_PROG_CXX 22 | AC_PROG_CC 23 | AM_PROG_CC_C_O 24 | AC_PROG_AWK 25 | AC_PROG_CPP 26 | AC_PROG_INSTALL 27 | AC_PROG_LN_S 28 | AC_PROG_MAKE_SET 29 | PKG_PROG_PKG_CONFIG 30 | 31 | # Checks for libraries. 32 | PKG_CHECK_MODULES([GPSUTILS], [gps-utils]) 33 | AC_SUBST([GPSUTILS_CFLAGS]) 34 | AC_SUBST([GPSUTILS_LIBS]) 35 | 36 | AC_ARG_WITH([core_includes], 37 | AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], 38 | [Specify the location of the core headers]), 39 | [core_incdir=$withval], 40 | with_core_includes=no) 41 | 42 | if test "x$with_core_includes" != "xno"; then 43 | CPPFLAGS="${CPPFLAGS} -I${core_incdir}" 44 | fi 45 | 46 | AC_ARG_WITH([locpla_includes], 47 | AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@], 48 | [Specify the path to locpla-includes in loc-pla_git.bb]), 49 | [locpla_incdir=$withval], 50 | with_locpla_includes=no) 51 | 52 | if test "x${with_locpla_includes}" != "xno"; then 53 | AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}") 54 | fi 55 | 56 | AC_SUBST([CPPFLAGS]) 57 | 58 | AC_ARG_WITH([glib], 59 | AC_HELP_STRING([--with-glib], 60 | [enable glib, building HLOS systems which use glib])) 61 | 62 | if (test "x${with_glib}" = "xyes"); then 63 | AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) 64 | PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, 65 | AC_MSG_ERROR(GThread >= 2.16 is required)) 66 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, 67 | AC_MSG_ERROR(GLib >= 2.16 is required)) 68 | GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" 69 | GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" 70 | 71 | AC_SUBST(GLIB_CFLAGS) 72 | AC_SUBST(GLIB_LIBS) 73 | fi 74 | 75 | AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") 76 | 77 | AC_CONFIG_FILES([ \ 78 | Makefile \ 79 | location-api.pc \ 80 | ]) 81 | 82 | AC_OUTPUT 83 | -------------------------------------------------------------------------------- /gps/location/location-api.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: location-api 7 | Description: Location API 8 | Version: @VERSION 9 | Libs: -L${libdir} -llocation_api 10 | Cflags: -I${includedir}/location-api 11 | -------------------------------------------------------------------------------- /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/pla/android/loc_pla.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 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_PLA__ 30 | #define __LOC_PLA__ 31 | 32 | #ifdef __cplusplus 33 | #include 34 | #define uptimeMillis android::uptimeMillis 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #define UID_GPS (AID_GPS) 48 | #define GID_GPS (AID_GPS) 49 | #define UID_LOCCLIENT (4021) 50 | #define GID_LOCCLIENT (4021) 51 | 52 | #define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf" 53 | #define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf" 54 | #define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf" 55 | #define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf" 56 | #define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf" 57 | #define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf" 58 | #define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf" 59 | #define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf" 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif /*__cplusplus */ 64 | 65 | #endif /* __LOC_PLA__ */ 66 | -------------------------------------------------------------------------------- /gps/utils/Android.bp: -------------------------------------------------------------------------------- 1 | 2 | cc_library_shared { 3 | 4 | name: "libgps.utils", 5 | vendor: true, 6 | 7 | //# Libs 8 | shared_libs: [ 9 | "libdl", 10 | "libutils", 11 | "libcutils", 12 | "liblog", 13 | "libprocessgroup", 14 | ], 15 | 16 | srcs: [ 17 | "loc_log.cpp", 18 | "loc_cfg.cpp", 19 | "msg_q.c", 20 | "linked_list.c", 21 | "loc_target.cpp", 22 | "LocHeap.cpp", 23 | "LocTimer.cpp", 24 | "LocThread.cpp", 25 | "MsgTask.cpp", 26 | "loc_misc_utils.cpp", 27 | "loc_nmea.cpp", 28 | "LocIpc.cpp", 29 | "LogBuffer.cpp", 30 | ], 31 | 32 | cflags: [ 33 | "-fno-short-enums", 34 | "-D_ANDROID_", 35 | ] + GNSS_CFLAGS, 36 | 37 | //# Includes 38 | ldflags: ["-Wl,--export-dynamic"], 39 | 40 | header_libs: [ 41 | "libutils_headers", 42 | "libloc_pla_headers", 43 | "liblocation_api_headers", 44 | ], 45 | } 46 | 47 | cc_library_headers { 48 | 49 | name: "libgps.utils_headers", 50 | export_include_dirs: ["."], 51 | vendor: true, 52 | } 53 | -------------------------------------------------------------------------------- /gps/utils/LocTimer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 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_TIMER_CPP_H__ 31 | #define __LOC_TIMER_CPP_H__ 32 | 33 | #include 34 | #include 35 | 36 | // opaque class to provide service implementation. 37 | class LocTimerDelegate; 38 | class LocSharedLock; 39 | 40 | // LocTimer client must extend this class and implementthe callback. 41 | // start() / stop() methods are to arm / disarm timer. 42 | class LocTimer 43 | { 44 | LocTimerDelegate* mTimer; 45 | LocSharedLock* mLock; 46 | // don't really want mLock to be manipulated by clients, yet LocTimer 47 | // has to have a reference to the lock so that the delete of LocTimer 48 | // and LocTimerDelegate can work together on their share resources. 49 | friend class LocTimerDelegate; 50 | 51 | public: 52 | LocTimer(); 53 | virtual ~LocTimer(); 54 | 55 | // timeOutInMs: timeout delay in ms 56 | // wakeOnExpire: true if to wake up CPU (if sleeping) upon timer 57 | // expiration and notify the client. 58 | // false if to wait until next time CPU wakes up (if 59 | // sleeping) and then notify the client. 60 | // return: true on success; 61 | // false on failure, e.g. timer is already running. 62 | bool start(uint32_t timeOutInMs, bool wakeOnExpire); 63 | 64 | // return: true on success; 65 | // false on failure, e.g. timer is not running. 66 | bool stop(); 67 | 68 | // LocTimer client Should implement this method. 69 | // This method is used for timeout calling back to client. This method 70 | // should be short enough (eg: send a message to your own thread). 71 | virtual void timeOutCallback() = 0; 72 | }; 73 | 74 | #endif //__LOC_DELAY_H__ 75 | -------------------------------------------------------------------------------- /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/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | AM_CFLAGS = -Wundef \ 4 | -MD \ 5 | -Wno-trigraphs \ 6 | -g -O0 \ 7 | -fno-inline \ 8 | -fno-short-enums \ 9 | -fpic \ 10 | -I./ \ 11 | -std=c++14 \ 12 | $(LOCPLA_CFLAGS) 13 | 14 | libgps_utils_la_h_sources = \ 15 | msg_q.h \ 16 | linked_list.h \ 17 | loc_cfg.h \ 18 | loc_log.h \ 19 | loc_target.h \ 20 | loc_timer.h \ 21 | MsgTask.h \ 22 | LocHeap.h \ 23 | LocThread.h \ 24 | LocTimer.h \ 25 | LocIpc.h \ 26 | SkipList.h\ 27 | loc_misc_utils.h \ 28 | loc_nmea.h \ 29 | gps_extended_c.h \ 30 | gps_extended.h \ 31 | loc_gps.h \ 32 | log_util.h \ 33 | LocSharedLock.h \ 34 | LocUnorderedSetMap.h 35 | 36 | libgps_utils_la_c_sources = \ 37 | linked_list.c \ 38 | msg_q.c \ 39 | loc_cfg.cpp \ 40 | loc_log.cpp \ 41 | loc_target.cpp \ 42 | LocHeap.cpp \ 43 | LocTimer.cpp \ 44 | LocThread.cpp \ 45 | LocIpc.cpp \ 46 | LogBuffer.cpp \ 47 | MsgTask.cpp \ 48 | loc_misc_utils.cpp \ 49 | loc_nmea.cpp 50 | 51 | library_includedir = $(pkgincludedir) 52 | 53 | library_include_HEADERS = $(libgps_utils_la_h_sources) 54 | 55 | libgps_utils_la_SOURCES = $(libgps_utils_la_c_sources) 56 | 57 | if USE_GLIB 58 | libgps_utils_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 59 | libgps_utils_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 60 | libgps_utils_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 61 | else 62 | libgps_utils_la_CFLAGS = $(AM_CFLAGS) 63 | libgps_utils_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0 64 | libgps_utils_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 65 | endif 66 | 67 | libgps_utils_la_LIBADD = $(CUTILS_LIBS) -ldl 68 | 69 | #Create and Install libraries 70 | lib_LTLIBRARIES = libgps_utils.la 71 | 72 | pkgconfigdir = $(libdir)/pkgconfig 73 | pkgconfig_DATA = gps-utils.pc 74 | EXTRA_DIST = $(pkgconfig_DATA) 75 | -------------------------------------------------------------------------------- /gps/utils/MsgTask.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-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 __MSG_TASK__ 30 | #define __MSG_TASK__ 31 | 32 | #include 33 | 34 | struct LocMsg { 35 | inline LocMsg() {} 36 | inline virtual ~LocMsg() {} 37 | virtual void proc() const = 0; 38 | inline virtual void log() const {} 39 | }; 40 | 41 | class MsgTask : public LocRunnable { 42 | const void* mQ; 43 | LocThread* mThread; 44 | friend class LocThreadDelegate; 45 | protected: 46 | virtual ~MsgTask(); 47 | public: 48 | MsgTask(LocThread::tCreate tCreator, const char* threadName = NULL, bool joinable = true); 49 | MsgTask(const char* threadName = NULL, bool joinable = true); 50 | // this obj will be deleted once thread is deleted 51 | void destroy(); 52 | void sendMsg(const LocMsg* msg) const; 53 | // Overrides of LocRunnable methods 54 | // This method will be repeated called until it returns false; or 55 | // until thread is stopped. 56 | virtual bool run(); 57 | 58 | // The method to be run before thread loop (conditionally repeatedly) 59 | // calls run() 60 | virtual void prerun(); 61 | 62 | // The method to be run after thread loop (conditionally repeatedly) 63 | // calls run() 64 | inline virtual void postrun() {} 65 | }; 66 | 67 | #endif //__MSG_TASK__ 68 | -------------------------------------------------------------------------------- /gps/utils/configure.ac: -------------------------------------------------------------------------------- 1 | # configure.ac -- Autoconf script for gps gps-utils 2 | # 3 | # Process this file with autoconf to produce a configure script 4 | 5 | # Requires autoconf tool later than 2.61 6 | AC_PREREQ(2.61) 7 | # Initialize the gps gps-utils package version 1.0.0 8 | AC_INIT([gps-utils],1.0.0) 9 | # Does not strictly follow GNU Coding standards 10 | AM_INIT_AUTOMAKE([foreign subdir-objects]) 11 | # Disables auto rebuilding of configure, Makefile.ins 12 | AM_MAINTAINER_MODE 13 | # Verifies the --srcdir is correct by checking for the path 14 | AC_CONFIG_SRCDIR([Makefile.am]) 15 | # defines some macros variable to be included by source 16 | AC_CONFIG_HEADERS([config.h]) 17 | AC_CONFIG_MACRO_DIR([m4]) 18 | 19 | # Checks for programs. 20 | AC_PROG_LIBTOOL 21 | AC_PROG_CXX 22 | AC_PROG_CC 23 | AM_PROG_CC_C_O 24 | AC_PROG_AWK 25 | AC_PROG_CPP 26 | AC_PROG_INSTALL 27 | AC_PROG_LN_S 28 | AC_PROG_MAKE_SET 29 | PKG_PROG_PKG_CONFIG 30 | 31 | AC_ARG_WITH([external_ap], 32 | AC_HELP_STRING([--with-external_ap=@<:@dir@:>@], 33 | [Using External Application Processor]), 34 | [], 35 | with_external_ap=no) 36 | 37 | if test "x$with_external_ap" != "xno"; then 38 | CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP" 39 | else 40 | # Checks for libraries. 41 | PKG_CHECK_MODULES([CUTILS], [libcutils]) 42 | AC_SUBST([CUTILS_CFLAGS]) 43 | AC_SUBST([CUTILS_LIBS]) 44 | fi 45 | 46 | AC_ARG_WITH([core_includes], 47 | AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], 48 | [Specify the location of the core headers]), 49 | [core_incdir=$withval], 50 | with_core_includes=no) 51 | 52 | if test "x$with_core_includes" != "xno"; then 53 | CPPFLAGS="${CPPFLAGS} -I${core_incdir}" 54 | fi 55 | 56 | AC_ARG_WITH([locpla_includes], 57 | AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@], 58 | [specify the path to locpla-includes in loc-pla_git.bb]), 59 | [locpla_incdir=$withval], 60 | with_locpla_includes=no) 61 | 62 | if test "x$with_locpla_includes" != "xno"; then 63 | AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}") 64 | fi 65 | 66 | AC_SUBST([CPPFLAGS]) 67 | 68 | AC_ARG_WITH([glib], 69 | AC_HELP_STRING([--with-glib], 70 | [enable glib, building HLOS systems which use glib])) 71 | 72 | if (test "x${with_glib}" = "xyes"); then 73 | AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) 74 | PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, 75 | AC_MSG_ERROR(GThread >= 2.16 is required)) 76 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, 77 | AC_MSG_ERROR(GLib >= 2.16 is required)) 78 | GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" 79 | GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" 80 | 81 | AC_SUBST(GLIB_CFLAGS) 82 | AC_SUBST(GLIB_LIBS) 83 | fi 84 | 85 | AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") 86 | 87 | AC_CONFIG_FILES([ \ 88 | Makefile \ 89 | gps-utils.pc 90 | ]) 91 | 92 | AC_OUTPUT 93 | -------------------------------------------------------------------------------- /gps/utils/gps-utils.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: gps-utils 7 | Description: QTI GPS Location utils 8 | Version: @VERSION 9 | Libs: -L${libdir} -lgps_utils 10 | Cflags: -I${includedir}/gps-utils 11 | -------------------------------------------------------------------------------- /gps/utils/loc_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2012, 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_LOG_H 31 | #define LOC_LOG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" 35 | { 36 | #endif 37 | 38 | #include 39 | #include 40 | #include "loc_target.h" 41 | 42 | typedef struct 43 | { 44 | const char *name; 45 | long val; 46 | } loc_name_val_s_type; 47 | 48 | #define NAME_VAL(x) {"" #x "", x } 49 | 50 | #define UNKNOWN_STR "UNKNOWN" 51 | 52 | #define CHECK_MASK(type, value, mask_var, mask) \ 53 | (((mask_var) & (mask)) ? (type) (value) : (type) (-1)) 54 | 55 | #define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0])) 56 | 57 | /* Get names from value */ 58 | const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask); 59 | const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value); 60 | const char* loc_get_msg_q_status(int status); 61 | const char* loc_get_target_name(unsigned int target); 62 | 63 | extern const char* log_succ_fail_string(int is_succ); 64 | 65 | extern char *loc_get_time(char *time_string, size_t buf_size); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* LOC_LOG_H */ 72 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /init/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2019-2021,2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_library_static { 8 | name: "libinit_msm8953", 9 | recovery_available: true, 10 | srcs: ["init_msm8953.cpp"], 11 | include_dirs: [ 12 | "system/core/init" 13 | ], 14 | shared_libs: [ 15 | "libbase", 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /keylayout/ft5435_ts.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 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 | key 158 BACK VIRTUAL 29 | key 139 APP_SWITCH VIRTUAL 30 | key 172 HOME VIRTUAL 31 | key 217 SEARCH VIRTUAL 32 | key 143 WAKEUP 33 | -------------------------------------------------------------------------------- /keylayout/gf3208.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 195 SYSTEM_NAVIGATION_UP 12 | key 196 SYSTEM_NAVIGATION_DOWN 13 | key 197 SYSTEM_NAVIGATION_LEFT 14 | key 198 SYSTEM_NAVIGATION_RIGHT 15 | key 105 SYSTEM_NAVIGATION_UP 16 | key 106 SYSTEM_NAVIGATION_DOWN 17 | key 108 SYSTEM_NAVIGATION_LEFT 18 | key 103 SYSTEM_NAVIGATION_RIGHT 19 | #key 353 CAMERA 20 | -------------------------------------------------------------------------------- /keylayout/goodix-ts.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 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 | key 158 BACK VIRTUAL 29 | key 139 APP_SWITCH VIRTUAL 30 | key 172 HOME VIRTUAL 31 | key 217 SEARCH VIRTUAL 32 | key 143 WAKEUP 33 | -------------------------------------------------------------------------------- /keylayout/gpio-keys.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 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 | key 115 VOLUME_UP 29 | key 114 VOLUME_DOWN 30 | key 102 HOME 31 | key 528 FOCUS 32 | key 766 CAMERA 33 | -------------------------------------------------------------------------------- /keylayout/ist30xx_ts_input.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 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 | key 158 BACK VIRTUAL 29 | key 139 APP_SWITCH VIRTUAL 30 | key 172 HOME VIRTUAL 31 | key 143 WAKEUP 32 | -------------------------------------------------------------------------------- /keylayout/msm8953-snd-card-mtp_Button_Jack.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 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 | key 226 HEADSETHOOK 29 | key 257 VOLUME_UP 30 | key 258 VOLUME_DOWN 31 | -------------------------------------------------------------------------------- /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 195 SYSTEM_NAVIGATION_UP 12 | key 196 SYSTEM_NAVIGATION_DOWN 13 | key 197 SYSTEM_NAVIGATION_LEFT 14 | key 198 SYSTEM_NAVIGATION_RIGHT 15 | #key 353 CAMERA 16 | -------------------------------------------------------------------------------- /light/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021-2024 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_binary { 8 | name: "android.hardware.light-service.xiaomi_msm8953", 9 | defaults: ["hidl_defaults"], 10 | vendor: true, 11 | relative_install_path: "hw", 12 | init_rc: ["android.hardware.light-service.xiaomi_msm8953.rc"], 13 | vintf_fragments: ["android.hardware.light-service.xiaomi_msm8953.xml"], 14 | srcs: [ 15 | "BacklightDevice.cpp", 16 | "Devices.cpp", 17 | "LedDevice.cpp", 18 | "Lights.cpp", 19 | "RgbLedDevice.cpp", 20 | "Utils.cpp", 21 | "service.cpp", 22 | ], 23 | shared_libs: [ 24 | "libbase", 25 | "libbinder_ndk", 26 | "android.hardware.light-V2-ndk", 27 | ], 28 | } 29 | -------------------------------------------------------------------------------- /light/BacklightDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include "BacklightDevice.h" 8 | 9 | #define LOG_TAG "BacklightDevice" 10 | 11 | #include 12 | #include 13 | #include "Utils.h" 14 | 15 | namespace aidl { 16 | namespace android { 17 | namespace hardware { 18 | namespace light { 19 | 20 | static const std::string kBacklightBasePath = "/sys/class/backlight/"; 21 | static const uint32_t kDefaultMaxBrightness = 255; 22 | 23 | static const std::string kBrightnessNode = "brightness"; 24 | static const std::string kMaxBrightnessNode = "max_brightness"; 25 | 26 | BacklightDevice::BacklightDevice(std::string name) 27 | : mName(name), mBasePath(kBacklightBasePath + name + "/") { 28 | if (!readFromFile(mBasePath + kMaxBrightnessNode, mMaxBrightness)) { 29 | mMaxBrightness = kDefaultMaxBrightness; 30 | } 31 | }; 32 | 33 | std::string BacklightDevice::getName() const { 34 | return mName; 35 | } 36 | 37 | bool BacklightDevice::exists() const { 38 | return std::ifstream(mBasePath + kBrightnessNode).good(); 39 | } 40 | 41 | bool BacklightDevice::setBrightness(uint8_t value) { 42 | return writeToFile(mBasePath + kBrightnessNode, scaleBrightness(value, mMaxBrightness)); 43 | } 44 | 45 | void BacklightDevice::dump(int fd) const { 46 | dprintf(fd, "Name: %s", mName.c_str()); 47 | dprintf(fd, ", exists: %d", exists()); 48 | dprintf(fd, ", base path: %s", mBasePath.c_str()); 49 | dprintf(fd, ", max brightness: %u", mMaxBrightness); 50 | } 51 | 52 | } // namespace light 53 | } // namespace hardware 54 | } // namespace android 55 | } // namespace aidl 56 | -------------------------------------------------------------------------------- /light/BacklightDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "IDumpable.h" 12 | 13 | namespace aidl { 14 | namespace android { 15 | namespace hardware { 16 | namespace light { 17 | 18 | /** 19 | * A Linux backlight device. 20 | * @see https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-backlight 21 | */ 22 | class BacklightDevice : public IDumpable { 23 | public: 24 | BacklightDevice() = delete; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param name The name of the backlight device 30 | */ 31 | BacklightDevice(std::string name); 32 | 33 | /** 34 | * Get the name of the backlight device. 35 | * 36 | * @return std::string The name of the backlight device 37 | */ 38 | std::string getName() const; 39 | 40 | /** 41 | * Return whether this backlight device exists. 42 | * 43 | * @return bool true if the backlight device exists, false otherwise 44 | */ 45 | bool exists() const; 46 | 47 | /** 48 | * Set the brightness of this backlight device. 49 | * 50 | * @param value The brightness value to set 51 | * @return bool true if the brightness was set successfully, false otherwise 52 | */ 53 | bool setBrightness(uint8_t value); 54 | 55 | void dump(int fd) const override; 56 | 57 | private: 58 | std::string mName; 59 | std::string mBasePath; 60 | uint32_t mMaxBrightness; 61 | }; 62 | 63 | } // namespace light 64 | } // namespace hardware 65 | } // namespace android 66 | } // namespace aidl 67 | -------------------------------------------------------------------------------- /light/Devices.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "BacklightDevice.h" 11 | #include "IDumpable.h" 12 | #include "LedDevice.h" 13 | #include "RgbLedDevice.h" 14 | #include "Utils.h" 15 | 16 | namespace aidl { 17 | namespace android { 18 | namespace hardware { 19 | namespace light { 20 | 21 | class Devices : public IDumpable { 22 | public: 23 | Devices(); 24 | 25 | bool hasBacklightDevices() const; 26 | bool hasButtonDevices() const; 27 | bool hasKeyboardDevices() const; 28 | bool hasNotificationDevices() const; 29 | 30 | void setBacklightColor(rgb color); 31 | void setButtonsColor(rgb color); 32 | void setKeyboardColor(rgb color); 33 | void setNotificationColor(rgb color, LightMode mode = LightMode::STATIC, uint32_t flashOnMs = 0, 34 | uint32_t flashOffMs = 0); 35 | 36 | void dump(int fd) const override; 37 | 38 | private: 39 | // Backlight 40 | std::vector mBacklightDevices; 41 | std::vector mBacklightLedDevices; 42 | 43 | // Buttons 44 | std::vector mButtonLedDevices; 45 | 46 | // Keyboard 47 | std::vector mKeyboardLedDevices; 48 | 49 | // Notifications 50 | std::vector mNotificationRgbLedDevices; 51 | std::vector mNotificationLedDevices; 52 | }; 53 | 54 | } // namespace light 55 | } // namespace hardware 56 | } // namespace android 57 | } // namespace aidl 58 | -------------------------------------------------------------------------------- /light/IDumpable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | namespace aidl { 10 | namespace android { 11 | namespace hardware { 12 | namespace light { 13 | 14 | /** 15 | * Interface for dumpable objects using AIDL dump()'s file descriptor. 16 | */ 17 | class IDumpable { 18 | public: 19 | virtual ~IDumpable() = default; 20 | 21 | /** 22 | * Write information regarding this object to the given file descriptor using dprintf(). 23 | * You should avoid ending newline, since the caller will add it. 24 | * @param fd The file descriptor to write to. 25 | */ 26 | virtual void dump(int fd) const = 0; 27 | }; 28 | 29 | } // namespace light 30 | } // namespace hardware 31 | } // namespace android 32 | } // namespace aidl 33 | -------------------------------------------------------------------------------- /light/LedDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "IDumpable.h" 12 | 13 | namespace aidl { 14 | namespace android { 15 | namespace hardware { 16 | namespace light { 17 | 18 | enum LightMode { 19 | STATIC, 20 | BREATH, 21 | TIMED, 22 | }; 23 | 24 | /** 25 | * A Linux LED device. 26 | * @see https://docs.kernel.org/leds/leds-class.html 27 | */ 28 | class LedDevice : public IDumpable { 29 | public: 30 | LedDevice() = delete; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param name The name of the LED device 36 | */ 37 | LedDevice(std::string name); 38 | 39 | /** 40 | * Get the name of the LED device. 41 | * 42 | * @return std::string The name of the LED device 43 | */ 44 | std::string getName() const; 45 | 46 | /** 47 | * Return whether this LED device exists. 48 | * 49 | * @return bool true if the LED device exists, false otherwise 50 | */ 51 | bool exists() const; 52 | 53 | /** 54 | * Return whether this LED device supports breathing. 55 | * When it doesn't, calling setBrightness with LightMode::BREATH will behave like 56 | * LightMode::STATIC. 57 | * 58 | * @return bool true if the LED device supports breathing, false otherwise 59 | */ 60 | bool supportsBreath() const; 61 | 62 | /** 63 | * Return whether this LED device supports timed mode. 64 | * When it doesn't, calling setBrightness with LightMode::TIMED will behave like 65 | * LightMode::BREATH. 66 | * 67 | * @return bool true if the LED device supports timed mode, false otherwise 68 | */ 69 | bool supportsTimed() const; 70 | 71 | /** 72 | * Set the brightness of the LED device. 73 | * 74 | * @param value The brightness value to set 75 | * @param mode The light mode to use 76 | * @return bool true if the brightness was set successfully, false otherwise 77 | */ 78 | bool setBrightness(uint8_t value, LightMode mode = LightMode::STATIC, uint32_t flashOnMs = 0, 79 | uint32_t flashOffMs = 0); 80 | 81 | /** 82 | * Set the index of the LED device. 83 | * 84 | * @param idx The index to set 85 | */ 86 | void setIdx(int idx); 87 | 88 | void dump(int fd) const override; 89 | 90 | private: 91 | std::string mName; 92 | int mIdx; 93 | std::string mBasePath; 94 | uint32_t mMaxBrightness; 95 | std::string mBreathNode; 96 | bool mSupportsTimed; 97 | }; 98 | 99 | } // namespace light 100 | } // namespace hardware 101 | } // namespace android 102 | } // namespace aidl 103 | -------------------------------------------------------------------------------- /light/Lights.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "Devices.h" 12 | 13 | namespace aidl { 14 | namespace android { 15 | namespace hardware { 16 | namespace light { 17 | 18 | class Lights : public BnLights { 19 | public: 20 | Lights(); 21 | 22 | ndk::ScopedAStatus setLightState(int32_t id, const HwLightState& state) override; 23 | ndk::ScopedAStatus getLights(std::vector* _aidl_return) override; 24 | 25 | binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; 26 | 27 | private: 28 | std::vector mLights; 29 | 30 | Devices mDevices; 31 | 32 | HwLightState mLastBatteryState; 33 | HwLightState mLastNotificationsState; 34 | HwLightState mLastAttentionState; 35 | std::mutex mLedMutex; 36 | 37 | void updateNotificationColor(); 38 | }; 39 | 40 | } // namespace light 41 | } // namespace hardware 42 | } // namespace android 43 | } // namespace aidl 44 | -------------------------------------------------------------------------------- /light/RgbLedDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "IDumpable.h" 10 | #include "LedDevice.h" 11 | #include "Utils.h" 12 | 13 | namespace aidl { 14 | namespace android { 15 | namespace hardware { 16 | namespace light { 17 | 18 | /** 19 | * A pool of LED devices that will be toggled based on the wanted color. 20 | * Support all types of LED combinations, with a maximum of 3 LEDs. 21 | * Also supports 2 color LEDs (*cough* ASUS *cough*). 22 | */ 23 | class RgbLedDevice : public IDumpable { 24 | public: 25 | RgbLedDevice() = delete; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param red The red LED device 31 | * @param green The green LED device 32 | * @param blue The blue LED device 33 | * @param rgbSyncNode The path to RGB sync trigger 34 | */ 35 | RgbLedDevice(LedDevice red, LedDevice green, LedDevice blue, std::string rgbSyncNode); 36 | 37 | /** 38 | * Return whether this RGB LED device exists. 39 | * This is true when at least one of the LEDs exists. 40 | * 41 | * @return bool true if the RGB LED device exists, false otherwise 42 | */ 43 | bool exists() const; 44 | 45 | /** 46 | * Return whether this RGB LED device supports breathing. 47 | * This is true when all existing LEDs support breathing. 48 | * In case this is false, calling setBrightness with LightMode::BREATH will behave like 49 | * LightMode::STATIC. 50 | * 51 | * @return bool true if the RGB LED device supports breathing, false otherwise 52 | */ 53 | bool supportsBreath() const; 54 | 55 | /** 56 | * Return whether this RGB LED device supports timed mode. 57 | * This is true when all existing LEDs support timed mode. 58 | * In case this is false, calling setBrightness with LightMode::TIMED will behave like 59 | * LightMode::BREATH. 60 | * 61 | * @return bool true if the RGB LED device supports timed mode, false otherwise 62 | */ 63 | bool supportsTimed() const; 64 | 65 | /** 66 | * Return whether this RGB LED device supports RGB sync. 67 | * 68 | * @return bool true if the RGB LED device supports RGB sync, false otherwise 69 | */ 70 | bool supportsRgbSync() const; 71 | 72 | /** 73 | * Set the brightness of this RGB LED device. 74 | * 75 | * @param color The color to set 76 | * @param mode The mode to set 77 | * @return bool true if the brightness was set successfully, false otherwise 78 | */ 79 | bool setBrightness(rgb color, LightMode mode = LightMode::STATIC, uint32_t flashOnMs = 0, 80 | uint32_t flashOffMs = 0); 81 | 82 | void dump(int fd) const override; 83 | 84 | enum Color { 85 | NONE = 0, 86 | RED = 1 << 0, 87 | GREEN = 1 << 1, 88 | BLUE = 1 << 2, 89 | ALL = RED | GREEN | BLUE, 90 | }; 91 | 92 | private: 93 | LedDevice mRed; 94 | LedDevice mGreen; 95 | LedDevice mBlue; 96 | std::string mRgbSyncNode; 97 | 98 | int mColors; 99 | }; 100 | 101 | } // namespace light 102 | } // namespace hardware 103 | } // namespace android 104 | } // namespace aidl 105 | -------------------------------------------------------------------------------- /light/Utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include "Utils.h" 8 | 9 | namespace aidl { 10 | namespace android { 11 | namespace hardware { 12 | namespace light { 13 | 14 | rgb::rgb() : red(0), green(0), blue(0) {} 15 | 16 | rgb::rgb(uint8_t r, uint8_t g, uint8_t b) : red(r), green(g), blue(b){}; 17 | 18 | rgb::rgb(uint32_t color) { 19 | // Extract brightness from AARRGGBB. 20 | uint8_t alpha = (color >> 24) & 0xFF; 21 | 22 | // Retrieve each of the RGB colors 23 | red = (color >> 16) & 0xFF; 24 | green = (color >> 8) & 0xFF; 25 | blue = color & 0xFF; 26 | 27 | // Scale RGB colors if a brightness has been applied by the user 28 | if (alpha > 0 && alpha < 0xFF) { 29 | red = red * alpha / 0xFF; 30 | green = green * alpha / 0xFF; 31 | blue = blue * alpha / 0xFF; 32 | } 33 | } 34 | 35 | bool rgb::isLit() { 36 | return !!red || !!green || !!blue; 37 | } 38 | 39 | static constexpr uint8_t kRedWeight = 77; 40 | static constexpr uint8_t kGreenWeight = 150; 41 | static constexpr uint8_t kBlueWeight = 29; 42 | 43 | uint8_t rgb::toBrightness() { 44 | return (kRedWeight * red + kGreenWeight * green + kBlueWeight * blue) >> 8; 45 | } 46 | 47 | uint32_t scaleBrightness(uint8_t brightness, uint32_t maxBrightness) { 48 | return brightness * maxBrightness / 0xFF; 49 | } 50 | 51 | } // namespace light 52 | } // namespace hardware 53 | } // namespace android 54 | } // namespace aidl 55 | -------------------------------------------------------------------------------- /light/Utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace aidl { 14 | namespace android { 15 | namespace hardware { 16 | namespace light { 17 | 18 | struct rgb { 19 | rgb(); 20 | rgb(uint8_t r, uint8_t g, uint8_t b); 21 | rgb(uint32_t color); 22 | 23 | uint8_t red; 24 | uint8_t green; 25 | uint8_t blue; 26 | 27 | bool isLit(); 28 | uint8_t toBrightness(); 29 | }; 30 | 31 | uint32_t scaleBrightness(uint8_t brightness, uint32_t maxBrightness); 32 | 33 | template 34 | bool readFromFile(const std::string& file, T& content) { 35 | std::ifstream fileStream(file); 36 | 37 | if (!fileStream) { 38 | return false; 39 | } 40 | 41 | fileStream >> content; 42 | return true; 43 | } 44 | 45 | template 46 | bool writeToFile(const std::string& file, const T content) { 47 | std::ofstream fileStream(file); 48 | 49 | if (!fileStream) { 50 | return false; 51 | } 52 | 53 | fileStream << content; 54 | return true; 55 | } 56 | 57 | } // namespace light 58 | } // namespace hardware 59 | } // namespace android 60 | } // namespace aidl 61 | -------------------------------------------------------------------------------- /light/android.hardware.light-service.xiaomi_msm8953.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.light 4 | 2 5 | ILights/default 6 | 7 | 8 | -------------------------------------------------------------------------------- /light/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include "Lights.h" 8 | 9 | #define LOG_TAG "android.hardware.light-service.xiaomi_msm8953" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | using ::aidl::android::hardware::light::Lights; 16 | 17 | int main() { 18 | ABinderProcess_setThreadPoolMaxThreadCount(0); 19 | std::shared_ptr lights = ndk::SharedRefBase::make(); 20 | 21 | const std::string instance = std::string() + Lights::descriptor + "/default"; 22 | binder_status_t status = AServiceManager_addService(lights->asBinder().get(), instance.c_str()); 23 | CHECK(status == STATUS_OK); 24 | 25 | ABinderProcess_joinThreadPool(); 26 | return EXIT_FAILURE; // should not reach 27 | } 28 | -------------------------------------------------------------------------------- /lineage.dependencies: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "repository": "android_hardware_sony_timekeep", 4 | "target_path": "hardware/sony/timekeep" 5 | }, 6 | { 7 | "repository": "android_hardware_xiaomi", 8 | "target_path": "hardware/xiaomi" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /odm.prop: -------------------------------------------------------------------------------- 1 | # Fwk detect 2 | ro.vendor.qti.va_odm.support=1 3 | -------------------------------------------------------------------------------- /overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 17 | true 18 | true 19 | 20 | 34 | 1 35 | 36 | 38 | true 39 | 40 | 45 | 1 46 | 47 | 48 | -------------------------------------------------------------------------------- /overlay-lineage/packages/apps/Dialer/java/com/android/dialer/callrecord/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | true 19 | 4 20 | 21 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | true 25 | 26 | 28 | true 29 | 30 | 31 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 32px 22 | 23 | -------------------------------------------------------------------------------- /overlay/packages/apps/Settings/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 24 | 25 | 0 26 | -1 27 | -1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /overlay/packages/services/Telephony/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 21 | 22 | 24 | 25 | 27 | 1 28 | 29 | 33 | 34 | true 35 | 36 | 37 | false 38 | 39 | 40 | org.codeaurora.ims 41 | 42 | 43 | org.codeaurora.ims 44 | 45 | -------------------------------------------------------------------------------- /product.prop: -------------------------------------------------------------------------------- 1 | # IMS 2 | ro.telephony.block_binder_thread_on_incoming_calls=false 3 | 4 | # LMKD 5 | ro.lmk.low=1001 6 | ro.lmk.medium=800 7 | ro.lmk.critical=0 8 | ro.lmk.critical_upgrade=false 9 | ro.lmk.upgrade_pressure=100 10 | ro.lmk.downgrade_pressure=100 11 | ro.lmk.kill_heaviest_task=true 12 | ro.lmk.kill_timeout_ms=100 13 | ro.lmk.use_minfree_levels=true 14 | -------------------------------------------------------------------------------- /rootdir/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2024 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | prebuilt_etc { 8 | name: "fstab.zram", 9 | src: "etc/fstab.zram", 10 | vendor: true, 11 | } 12 | 13 | prebuilt_etc { 14 | name: "init.msm.usb.configfs.rc", 15 | src: "etc/init.msm.usb.configfs.rc", 16 | sub_dir: "init/hw", 17 | vendor: true, 18 | } 19 | 20 | prebuilt_etc { 21 | name: "init.qcom.rc", 22 | src: "etc/init.qcom.rc", 23 | sub_dir: "init/hw", 24 | vendor: true, 25 | } 26 | 27 | prebuilt_etc { 28 | name: "init.qcom.usb.rc", 29 | src: "etc/init.qcom.usb.rc", 30 | sub_dir: "init/hw", 31 | vendor: true, 32 | } 33 | 34 | prebuilt_etc { 35 | name: "init.recovery.qcom.rc", 36 | src: "etc/init.recovery.qcom.rc", 37 | sub_dir: "init", 38 | recovery: true, 39 | } 40 | 41 | prebuilt_etc { 42 | name: "init.target.rc", 43 | src: "etc/init.target.rc", 44 | sub_dir: "init/hw", 45 | vendor: true, 46 | } 47 | 48 | prebuilt_etc { 49 | name: "ueventd.qcom.rc", 50 | filename: "ueventd.rc", 51 | src: "etc/ueventd.qcom.rc", 52 | vendor: true, 53 | } 54 | 55 | sh_binary { 56 | name: "init.qcom.sh", 57 | src: "bin/init.qcom.sh", 58 | vendor: true, 59 | } 60 | 61 | sh_binary { 62 | name: "init.qcom.post_boot.sh", 63 | src: "bin/init.qcom.post_boot.sh", 64 | vendor: true, 65 | } 66 | -------------------------------------------------------------------------------- /rootdir/etc/fstab.zram: -------------------------------------------------------------------------------- 1 | # zram 2 | /dev/block/zram0 none swap defaults zramsize=75%,max_comp_streams=4,swapprio=10,notrim 3 | -------------------------------------------------------------------------------- /rootdir/etc/init.recovery.qcom.rc: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2018, 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 | 31 | mkdir /config 32 | mount configfs none /config 33 | mkdir /config/usb_gadget/g1 0770 shell shell 34 | write /config/usb_gadget/g1/bcdUSB 0x0200 35 | write /config/usb_gadget/g1/idVendor 0x18d1 36 | write /config/usb_gadget/g1/idProduct 0xd001 37 | mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell 38 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} 39 | write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} 40 | write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} 41 | mkdir /config/usb_gadget/g1/functions/ffs.adb 42 | write /config/usb_gadget/g1/os_desc/use 1 43 | write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 44 | write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" 45 | setprop sys.usb.configfs 1 46 | 47 | on property:ro.boot.usbcontroller=* 48 | setprop sys.usb.controller ${ro.boot.usbcontroller} 49 | 50 | on property:sys.usb.ffs.ready=1 51 | mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell 52 | symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 53 | mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell 54 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" 55 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 56 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} 57 | 58 | on fs 59 | wait /dev/block/platform/soc/${ro.boot.bootdevice} 60 | symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice 61 | -------------------------------------------------------------------------------- /rro_overlays/CarrierConfigOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | runtime_resource_overlay { 2 | name: "CarrierConfigOverlay", 3 | theme: "CarrierConfigOverlay", 4 | product_specific: true, 5 | aaptflags: ["--keep-raw-values"], 6 | } 7 | -------------------------------------------------------------------------------- /rro_overlays/CarrierConfigOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | 23 | 24 | -------------------------------------------------------------------------------- /rro_overlays/TetheringOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | runtime_resource_overlay { 2 | name: "TetheringConfigOverlay", 3 | theme: "TetheringConfigOverlay", 4 | vendor: true 5 | } 6 | -------------------------------------------------------------------------------- /rro_overlays/TetheringOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | -------------------------------------------------------------------------------- /rro_overlays/TetheringOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 192.168.42.2 25 | 192.168.42.254 26 | 192.168.43.2 27 | 192.168.43.254 28 | 192.168.44.2 29 | 192.168.44.254 30 | 192.168.45.2 31 | 192.168.45.254 32 | 192.168.46.2 33 | 192.168.46.254 34 | 192.168.47.2 35 | 192.168.47.254 36 | 192.168.48.2 37 | 192.168.48.254 38 | 192.168.49.2 39 | 192.168.49.254 40 | 192.168.50.2 41 | 192.168.50.254 42 | 192.168.51.2 43 | 192.168.51.254 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /rro_overlays/WifiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | runtime_resource_overlay { 2 | name: "WifiOverlay", 3 | theme: "WifiOverlay", 4 | vendor: true 5 | } 6 | -------------------------------------------------------------------------------- /rro_overlays/WifiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /rro_overlays/WifiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | true 22 | 23 | 24 | true 25 | 26 | 27 | true 28 | 29 | 31 | 524288,2097152,4194304,262144,524288,1048576 32 | 33 | 34 | true 35 | 36 | 37 | true 38 | 39 | 40 | 32 41 | 42 | 43 | false 44 | 45 | 46 | true 47 | 48 | 49 | true 50 | 51 | -------------------------------------------------------------------------------- /sepolicy/private/network_stack.te: -------------------------------------------------------------------------------- 1 | allow network_stack proc_net:file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/device.te: -------------------------------------------------------------------------------- 1 | type lirc_device, dev_type; 2 | type fingerprint_device, dev_type; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/file.te: -------------------------------------------------------------------------------- 1 | # Boot reason 2 | type proc_boot_reason, fs_type, proc_type; 3 | 4 | # Camera 5 | type camera_socket, file_type, data_file_type; 6 | 7 | # Fingerprint 8 | type fingerprint_data_file, file_type, core_data_file_type, data_file_type; 9 | type fingerprint_socket, file_type; 10 | type fingerprint_sysfs, fs_type, sysfs_type; 11 | 12 | # Rild 13 | type rild_file, file_type, vendor_file_type; 14 | 15 | # Rmt 16 | userdebug_or_eng(` 17 | type debugfs_rmt, debugfs_type, fs_type; 18 | ') 19 | 20 | # Touchscreen 21 | type proc_touchpanel, fs_type, sysfs_type, proc_type; 22 | 23 | -------------------------------------------------------------------------------- /sepolicy/vendor/genfs_contexts: -------------------------------------------------------------------------------- 1 | # Boot reason 2 | genfscon proc /sys/kernel/boot_reason u:object_r:proc_boot_reason:s0 3 | 4 | # Leds 5 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-00/200f000.qcom,spmi:qcom,pm8953@0:qcom,leds@a100 u:object_r:sysfs_leds:s0 6 | genfscon sysfs /devices/platform/soc/78b6000.i2c/i2c-2/2-0045/leds/ u:object_r:sysfs_leds:s0 7 | 8 | # Power 9 | genfscon sysfs /devices/soc/soc:qcom,bcl/power_supply u:object_r:sysfs_batteryinfo:s0 10 | genfscon sysfs /devices/soc/msm-bcl-21/power_supply u:object_r:sysfs_batteryinfo:s0 11 | genfscon sysfs /devices/soc/qpnp-typec-9/power_supply u:object_r:sysfs_batteryinfo:s0 12 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:vadc@3100 u:object_r:sysfs_battery_supply:s0 13 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8940@2:vadc@3100 u:object_r:sysfs_battery_supply:s0 14 | 15 | # Extcon 16 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/extcon u:object_r:sysfs_extcon:s0 17 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8940@2:qcom,qpnp-smbcharger/extcon u:object_r:sysfs_extcon:s0 18 | genfscon sysfs /devices/platform/soc/soc:qcom,mdss_wb_panel/extcon u:object_r:sysfs_extcon:s0 19 | 20 | # Mmc 21 | genfscon sysfs /devices/platform/soc/7824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0/queue/discard_max_bytes u:object_r:sysfs_mmc_host:s0 22 | 23 | # Rmt 24 | userdebug_or_eng(` 25 | genfscon debugfs /rmt_storage u:object_r:debugfs_rmt:s0 26 | ') 27 | 28 | # Time 29 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-00/200f000.qcom,spmi:qcom,pm8953@0:qcom,pm8953_rtc/rtc/rtc0/since_epoch u:object_r:sysfs_rtc:s0 30 | 31 | # Touchscreen 32 | genfscon proc /touchpanel u:object_r:proc_touchpanel:s0 33 | genfscon sysfs /touchpanel u:object_r:proc_touchpanel:s0 34 | 35 | # Vibrator 36 | genfscon sysfs /devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-03/200f000.qcom,spmi:qcom,pmi8940@3:qcom,haptics@c000/leds/vibrator u:object_r:sysfs_leds:s0 37 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_bluetooth_default.te: -------------------------------------------------------------------------------- 1 | typeattribute hal_bluetooth_default data_between_core_and_vendor_violators; 2 | 3 | allow hal_bluetooth_default bluetooth_data_file:dir search; 4 | allow hal_bluetooth_default bluetooth_data_file:file r_file_perms; 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_camera_default.te: -------------------------------------------------------------------------------- 1 | allow hal_camera_default camera_data_file:sock_file write; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_cas_default.te: -------------------------------------------------------------------------------- 1 | vndbinder_use(hal_cas_default); 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_fingerprint_default.te: -------------------------------------------------------------------------------- 1 | typeattribute hal_fingerprint_default data_between_core_and_vendor_violators; 2 | 3 | type_transition hal_fingerprint_default system_data_file:{ dir file } fingerprint_data_file; 4 | 5 | add_service(hal_fingerprint_default, goodix_fingerprint_vndservice); 6 | binder_use(hal_fingerprint_default); 7 | r_dir_file(hal_fingerprint_default, firmware_file); 8 | set_prop(hal_fingerprint_default, vendor_fp_prop) 9 | vndbinder_use(hal_fingerprint_default); 10 | 11 | # access to /data/system/users/[0-9]+/fpdata 12 | allow hal_fingerprint_default fingerprint_data_file:dir rw_dir_perms; 13 | allow hal_fingerprint_default fingerprint_data_file:dir create_dir_perms; 14 | allow hal_fingerprint_default fingerprint_data_file:file create_file_perms; 15 | 16 | allow hal_fingerprint_default { 17 | fingerprint_device 18 | tee_device 19 | vndbinder_device 20 | uhid_device 21 | }:chr_file rw_file_perms; 22 | 23 | allow hal_fingerprint_default fingerprint_sysfs:file rw_file_perms; 24 | allow hal_fingerprint_default fingerprint_sysfs:dir r_dir_perms; 25 | 26 | allow hal_fingerprint_default property_socket:sock_file write; 27 | allow hal_fingerprint_default init:unix_stream_socket connectto; 28 | allow hal_fingerprint_default self:netlink_socket create_socket_perms_no_ioctl; 29 | 30 | allow hal_fingerprint_default system_data_file:dir create_dir_perms; 31 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_gnss_qti.te: -------------------------------------------------------------------------------- 1 | get_prop(hal_gnss_qti, xtra_control_prop) 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_imsrtp.te: -------------------------------------------------------------------------------- 1 | binder_call(hal_imsrtp, radio) 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_ir_default.te: -------------------------------------------------------------------------------- 1 | allow hal_ir_default lirc_device:chr_file rw_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_lineage_touch_default.te: -------------------------------------------------------------------------------- 1 | allow hal_lineage_touch_default proc_touchpanel:dir search; 2 | allow hal_lineage_touch_default proc_touchpanel:file rw_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_power_default.te: -------------------------------------------------------------------------------- 1 | # Allow writing to files in /proc/touchpanel 2 | allow hal_power_default proc_touchpanel:dir search; 3 | allow hal_power_default proc_touchpanel:file rw_file_perms; 4 | -------------------------------------------------------------------------------- /sepolicy/vendor/hwservice_contexts: -------------------------------------------------------------------------------- 1 | vendor.goodix.hardware.fingerprint::IGoodixBiometricsFingerprint u:object_r:hal_fingerprint_hwservice:s0 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/init.te: -------------------------------------------------------------------------------- 1 | allow init proc_boot_reason:file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/kernel.te: -------------------------------------------------------------------------------- 1 | allow kernel kernel:capability { kill }; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/mm-qcamerad.te: -------------------------------------------------------------------------------- 1 | typeattribute mm-qcamerad data_between_core_and_vendor_violators; 2 | 3 | type_transition mm-qcamerad camera_data_file:sock_file camera_socket "cam_socket1"; 4 | type_transition mm-qcamerad camera_data_file:sock_file camera_socket "cam_socket2"; 5 | allow mm-qcamerad camera_socket:dir w_dir_perms; 6 | allow mm-qcamerad camera_socket:sock_file { create unlink write }; 7 | allow mm-qcamerad sysfs_graphics:file r_file_perms; 8 | allow mm-qcamerad camera_data_file:file create_file_perms; 9 | allow mm-qcamerad camera_data_file:dir w_dir_perms; 10 | allow mm-qcamerad fwk_sensor_hwservice:hwservice_manager find; 11 | -------------------------------------------------------------------------------- /sepolicy/vendor/netmgrd.te: -------------------------------------------------------------------------------- 1 | set_prop(netmgrd, vendor_xlat_prop) 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/poweroffalarm_app.app: -------------------------------------------------------------------------------- 1 | # Allow poweroffalarm_app access to files labeled as mnt_vendor_file as fallback 2 | # This is needed when /persist/alarm directory incorrectly inherits mnt_vendor_file label 3 | allow poweroffalarm_app mnt_vendor_file:dir rw_dir_perms; 4 | allow poweroffalarm_app mnt_vendor_file:file create_file_perms; 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/property.te: -------------------------------------------------------------------------------- 1 | # Fingerprint 2 | vendor_restricted_prop(vendor_fp_prop) 3 | 4 | # Time 5 | vendor_internal_prop(vendor_timekeep_prop) 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/property_contexts: -------------------------------------------------------------------------------- 1 | sys.listeners.registered u:object_r:vendor_tee_listener_prop:s0 2 | sys.post_boot.parsed u:object_r:vendor_mpctl_prop:s0 3 | persist.net.doxlat u:object_r:vendor_xlat_prop:s0 4 | camera.dual.mode u:object_r:camera_prop:s0 5 | persist.camera. u:object_r:camera_prop:s0 6 | persist.vendor.camera. u:object_r:camera_prop:s0 7 | vendor.camera. u:object_r:camera_prop:s0 8 | ctl.vendor.imsrcsd u:object_r:vendor_ctl_vendor_imsrcsservice_prop:s0 9 | persist.sys.fp. u:object_r:vendor_fp_prop:s0 10 | sys.fp.goodix u:object_r:vendor_fp_prop:s0 11 | sys.fp.vendor u:object_r:vendor_fp_prop:s0 12 | persist.vendor.timeadjust u:object_r:vendor_timekeep_prop:s0 13 | -------------------------------------------------------------------------------- /sepolicy/vendor/qti_init_shell.te: -------------------------------------------------------------------------------- 1 | typeattribute qti_init_shell data_between_core_and_vendor_violators; 2 | 3 | allow qti_init_shell proc_touchpanel:dir { r_dir_perms setattr }; 4 | allow qti_init_shell proc_touchpanel:file { getattr setattr }; 5 | allow qti_init_shell bluetooth_data_file:file r_file_perms; 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/radio.te: -------------------------------------------------------------------------------- 1 | binder_call(radio, cnd) 2 | allow radio hal_datafactory_hwservice:hwservice_manager find; 3 | allow radio hal_iwlan_hwservice:hwservice_manager find; 4 | allow radio { cameraserver_service mediaextractor_service mediaserver_service mediametrics_service drmserver_service audioserver_service }:service_manager find; 5 | 6 | get_prop(radio, vendor_qcom_ims_prop) 7 | -------------------------------------------------------------------------------- /sepolicy/vendor/rild.te: -------------------------------------------------------------------------------- 1 | allow rild rild_file:file r_file_perms; 2 | allow rild qtidataservices_app:binder call; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/rmt_storage.te: -------------------------------------------------------------------------------- 1 | # debugfs access 2 | userdebug_or_eng(` 3 | allow rmt_storage debugfs_rmt:dir search; 4 | allow rmt_storage debugfs_rmt:file rw_file_perms; 5 | ') 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/seapp_contexts: -------------------------------------------------------------------------------- 1 | user=system seinfo=platform name=com.sony.timekeep domain=vendor_timekeep_app type=app_data_file 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/system_app.te: -------------------------------------------------------------------------------- 1 | allow system_app fm_radio_device:chr_file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/system_server.te: -------------------------------------------------------------------------------- 1 | # Input devices 2 | r_dir_file(system_server, vendor_idc_file); 3 | r_dir_file(system_server, vendor_keylayout_file); 4 | -------------------------------------------------------------------------------- /sepolicy/vendor/tee.te: -------------------------------------------------------------------------------- 1 | typeattribute tee data_between_core_and_vendor_violators; 2 | 3 | # /data/goodix labeling 4 | type_transition tee system_data_file:{ dir file } fingerprint_data_file; 5 | 6 | allow tee fingerprint_data_file:dir rw_dir_perms; 7 | allow tee fingerprint_data_file:dir create_dir_perms; 8 | allow tee fingerprint_data_file:file create_file_perms; 9 | allow tee system_data_file:dir create_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 | dontaudit vendor_timekeep_app app_data_file:dir { getattr search }; 6 | 7 | allow vendor_timekeep_app activity_service:service_manager find; 8 | 9 | allow vendor_timekeep_app vendor_time_data_file:dir search; 10 | allow vendor_timekeep_app vendor_time_data_file:file create_file_perms; 11 | 12 | r_dir_file(vendor_timekeep_app, sysfs_rtc) 13 | 14 | set_prop(vendor_timekeep_app, vendor_timekeep_prop) 15 | -------------------------------------------------------------------------------- /sepolicy/vendor/ueventd.te: -------------------------------------------------------------------------------- 1 | typeattribute ueventd data_between_core_and_vendor_violators; 2 | 3 | allow ueventd fingerprint_sysfs:file rw_file_perms; 4 | allow ueventd wifi_vendor_data_file:dir r_dir_perms; 5 | allow ueventd wifi_vendor_data_file:file r_file_perms; 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/vendor_init.te: -------------------------------------------------------------------------------- 1 | typeattribute vendor_init data_between_core_and_vendor_violators; 2 | 3 | allow vendor_init { 4 | bluetooth_data_file 5 | camera_data_file 6 | fingerprint_data_file 7 | media_rw_data_file 8 | nfc_data_file 9 | system_data_file 10 | wifi_data_file 11 | wpa_socket 12 | }:dir { create search getattr open read setattr ioctl write add_name remove_name rmdir relabelfrom }; 13 | -------------------------------------------------------------------------------- /sepolicy/vendor/vndservice.te: -------------------------------------------------------------------------------- 1 | type goodix_fingerprint_vndservice, vndservice_manager_type; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/vndservice_contexts: -------------------------------------------------------------------------------- 1 | android.hardware.fingerprint.IGoodixFingerprintDaemon u:object_r:goodix_fingerprint_vndservice:s0 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/vold.te: -------------------------------------------------------------------------------- 1 | allow vold proc_touchpanel:dir r_dir_perms; 2 | -------------------------------------------------------------------------------- /setup-makefiles.py: -------------------------------------------------------------------------------- 1 | #!./extract-files.py --regenerate_makefiles 2 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # Fwk detect 2 | ro.vendor.qti.va_aosp.support=1 3 | -------------------------------------------------------------------------------- /system_ext.prop: -------------------------------------------------------------------------------- 1 | # DPM 2 | persist.vendor.dpm.feature=1 3 | persist.vendor.dpm.loglevel=0 4 | -------------------------------------------------------------------------------- /touch/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2019-2021 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_binary { 8 | name: "vendor.lineage.touch@1.0-service.xiaomi_8953", 9 | init_rc: ["vendor.lineage.touch@1.0-service.xiaomi_8953.rc"], 10 | defaults: ["hidl_defaults"], 11 | vintf_fragments: ["vendor.lineage.touch@1.0-service.xiaomi_8953.xml"], 12 | relative_install_path: "hw", 13 | vendor: true, 14 | srcs: [ 15 | "KeyDisabler.cpp", 16 | "service.cpp" 17 | ], 18 | shared_libs: [ 19 | "libbase", 20 | "libhidlbase", 21 | "libutils", 22 | "vendor.lineage.touch@1.0", 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /touch/KeyDisabler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 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 | #include 18 | #include 19 | #include 20 | 21 | #include "KeyDisabler.h" 22 | 23 | namespace vendor { 24 | namespace lineage { 25 | namespace touch { 26 | namespace V1_0 { 27 | namespace implementation { 28 | 29 | constexpr const char kControlPath[] = "/proc/touchpanel/capacitive_keys_disable"; 30 | 31 | KeyDisabler::KeyDisabler() { 32 | mHasKeyDisabler = !access(kControlPath, F_OK); 33 | } 34 | 35 | // Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow. 36 | Return KeyDisabler::isEnabled() { 37 | std::string buf; 38 | 39 | if (!mHasKeyDisabler) return false; 40 | 41 | if (!android::base::ReadFileToString(kControlPath, &buf, true)) { 42 | LOG(ERROR) << "Failed to read " << kControlPath; 43 | return false; 44 | } 45 | 46 | return std::stoi(android::base::Trim(buf)) == 1; 47 | } 48 | 49 | Return KeyDisabler::setEnabled(bool enabled) { 50 | if (!mHasKeyDisabler) return false; 51 | 52 | if (!android::base::WriteStringToFile((enabled ? "1" : "0"), kControlPath, true)) { 53 | LOG(ERROR) << "Failed to write " << kControlPath; 54 | return false; 55 | } 56 | 57 | return true; 58 | } 59 | 60 | } // namespace implementation 61 | } // namespace V1_0 62 | } // namespace touch 63 | } // namespace lineage 64 | } // namespace vendor 65 | -------------------------------------------------------------------------------- /touch/KeyDisabler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 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 | #ifndef VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H 18 | #define VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H 19 | 20 | #include 21 | 22 | namespace vendor { 23 | namespace lineage { 24 | namespace touch { 25 | namespace V1_0 { 26 | namespace implementation { 27 | 28 | using ::android::hardware::Return; 29 | 30 | class KeyDisabler : public IKeyDisabler { 31 | public: 32 | KeyDisabler(); 33 | 34 | // Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow. 35 | Return isEnabled() override; 36 | Return setEnabled(bool enabled) override; 37 | 38 | private: 39 | bool mHasKeyDisabler; 40 | }; 41 | 42 | } // namespace implementation 43 | } // namespace V1_0 44 | } // namespace touch 45 | } // namespace lineage 46 | } // namespace vendor 47 | 48 | #endif // VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H 49 | -------------------------------------------------------------------------------- /touch/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 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 "vendor.lineage.touch@1.0-service.xiaomi_8953" 18 | 19 | #include 20 | #include 21 | 22 | #include "KeyDisabler.h" 23 | 24 | using android::OK; 25 | using android::sp; 26 | using android::status_t; 27 | using android::hardware::configureRpcThreadpool; 28 | using android::hardware::joinRpcThreadpool; 29 | 30 | using ::vendor::lineage::touch::V1_0::IKeyDisabler; 31 | using ::vendor::lineage::touch::V1_0::implementation::KeyDisabler; 32 | 33 | int main() { 34 | sp keyDisabler; 35 | status_t status; 36 | 37 | LOG(INFO) << "Touch HAL service is starting."; 38 | 39 | keyDisabler = new KeyDisabler(); 40 | if (keyDisabler == nullptr) { 41 | LOG(ERROR) << "Can not create an instance of Touch HAL KeyDisabler Iface, exiting."; 42 | goto shutdown; 43 | } 44 | 45 | configureRpcThreadpool(1, true /*callerWillJoin*/); 46 | 47 | status = keyDisabler->registerAsService(); 48 | if (status != OK) { 49 | LOG(ERROR) << "Could not register service for Touch HAL KeyDisabler Iface (" 50 | << status << ")"; 51 | goto shutdown; 52 | } 53 | 54 | LOG(INFO) << "Touch HAL service is ready."; 55 | joinRpcThreadpool(); 56 | // Should not pass this line 57 | 58 | shutdown: 59 | // In normal operation, we don't expect the thread pool to shutdown 60 | LOG(ERROR) << "Touch HAL service is shutting down."; 61 | return 1; 62 | } 63 | -------------------------------------------------------------------------------- /touch/vendor.lineage.touch@1.0-service.xiaomi_8953.rc: -------------------------------------------------------------------------------- 1 | service vendor.touch-hal-1-0-xiaomi_8953 /vendor/bin/hw/vendor.lineage.touch@1.0-service.xiaomi_8953 2 | class hal 3 | user system 4 | group system 5 | -------------------------------------------------------------------------------- /touch/vendor.lineage.touch@1.0-service.xiaomi_8953.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | vendor.lineage.touch 4 | hwbinder 5 | 1.0 6 | 7 | IKeyDisabler 8 | default 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /wifi/WCNSS_cfg.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaomi-msm8953-devs/android_device_xiaomi_msm8953-common/c781ccf90ef922f3c83da9dc1c02f289ecbacaf1/wifi/WCNSS_cfg.dat -------------------------------------------------------------------------------- /wifi/p2p_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | p2p_no_group_iface=1 3 | persistent_reconnect=1 4 | -------------------------------------------------------------------------------- /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 | driver_param=use_p2p_group_interface=1 6 | pmf=0 7 | --------------------------------------------------------------------------------