├── Android.bp ├── Android.mk ├── AndroidProducts.mk ├── BoardConfig.mk ├── README ├── amplifier ├── Android.mk └── audio_amplifier.c ├── audio ├── aanc_tuning_mixer.txt ├── audio_effects.xml ├── audio_platform_info.xml ├── audio_policy_configuration.xml └── mixer_paths.xml ├── bluetooth └── bdroid_buildcfg.h ├── board-info.txt ├── camera ├── Android.mk ├── CleanSpec.mk ├── MODULE_LICENSE_BSD ├── QCamera2 │ ├── Android.mk │ ├── HAL │ │ ├── Android.mk │ │ ├── QCamera2Factory.cpp │ │ ├── QCamera2Factory.h │ │ ├── QCamera2HWI.cpp │ │ ├── QCamera2HWI.h │ │ ├── QCamera2HWICallbacks.cpp │ │ ├── QCamera2Hal.cpp │ │ ├── QCameraAllocator.h │ │ ├── QCameraChannel.cpp │ │ ├── QCameraChannel.h │ │ ├── QCameraMem.cpp │ │ ├── QCameraMem.h │ │ ├── QCameraParameters.cpp │ │ ├── QCameraParameters.h │ │ ├── QCameraPostProc.cpp │ │ ├── QCameraPostProc.h │ │ ├── QCameraStateMachine.cpp │ │ ├── QCameraStateMachine.h │ │ ├── QCameraStream.cpp │ │ ├── QCameraStream.h │ │ ├── QCameraThermalAdapter.cpp │ │ ├── QCameraThermalAdapter.h │ │ ├── tsMakeuplib │ │ │ └── include │ │ │ │ ├── ts_detectface_engine.h │ │ │ │ ├── ts_makeup_data.h │ │ │ │ ├── ts_makeup_engine.h │ │ │ │ └── ts_makeup_image.h │ │ └── wrapper │ │ │ ├── QualcommCamera.cpp │ │ │ └── QualcommCamera.h │ ├── stack │ │ ├── Android.mk │ │ ├── common │ │ │ ├── cam_intf.h │ │ │ ├── cam_list.h │ │ │ ├── cam_queue.h │ │ │ ├── cam_semaphore.h │ │ │ ├── cam_types.h │ │ │ ├── mm_camera_interface.h │ │ │ └── mm_jpeg_interface.h │ │ ├── mm-camera-interface │ │ │ ├── Android.mk │ │ │ ├── inc │ │ │ │ ├── mm_camera.h │ │ │ │ ├── mm_camera_dbg.h │ │ │ │ └── mm_camera_sock.h │ │ │ └── src │ │ │ │ ├── cam_intf.c │ │ │ │ ├── mm_camera.c │ │ │ │ ├── mm_camera_channel.c │ │ │ │ ├── mm_camera_interface.c │ │ │ │ ├── mm_camera_sock.c │ │ │ │ ├── mm_camera_stream.c │ │ │ │ └── mm_camera_thread.c │ │ └── mm-jpeg-interface │ │ │ ├── Android.mk │ │ │ ├── inc │ │ │ ├── mm_jpeg.h │ │ │ ├── mm_jpeg_dbg.h │ │ │ ├── mm_jpeg_inlines.h │ │ │ └── mm_jpeg_ionbuf.h │ │ │ └── src │ │ │ ├── mm_jpeg.c │ │ │ ├── mm_jpeg_exif.c │ │ │ ├── mm_jpeg_interface.c │ │ │ ├── mm_jpeg_ionbuf.c │ │ │ ├── mm_jpeg_queue.c │ │ │ ├── mm_jpegdec.c │ │ │ └── mm_jpegdec_interface.c │ └── util │ │ ├── QCameraCmdThread.cpp │ │ ├── QCameraCmdThread.h │ │ ├── QCameraQueue.cpp │ │ └── QCameraQueue.h ├── QCameraParameters.h ├── QCamera_Intf.h └── mm-image-codec │ ├── Android.mk │ ├── qexif │ └── qexif.h │ └── qomx_core │ ├── Android.mk │ ├── QOMX_JpegExtensions.h │ ├── qomx_core.c │ └── qomx_core.h ├── config.fs ├── configs ├── dsi_config.xml ├── ld.config.txt ├── lowi.conf ├── media_codecs.xml ├── media_codecs_performance.xml ├── media_profiles_V1_0.xml ├── netmgr_config.xml ├── p2p_supplicant_overlay.conf ├── qmi_config.xml ├── sec_config ├── sensors │ └── _hals.conf ├── thermal-engine.conf └── wpa_supplicant_overlay.conf ├── device.mk ├── doze ├── Android.mk ├── AndroidManifest.xml ├── proguard.flags ├── res │ ├── color │ │ └── switch_bar_bg.xml │ ├── drawable │ │ └── switchbar_background.xml │ ├── layout │ │ ├── doze.xml │ │ └── switch_bar.xml │ ├── values-night │ │ └── colors.xml │ ├── values │ │ ├── colors.xml │ │ └── styles.xml │ └── xml │ │ └── doze_settings.xml └── src │ └── org │ └── lineageos │ └── settings │ └── doze │ ├── BootCompletedReceiver.java │ ├── DozeSettings.java │ ├── DozeSettingsFragment.java │ ├── OrientationSensor.java │ ├── PickUpSensor.java │ ├── ProximitySensor.java │ ├── SensorsDozeService.java │ └── Utils.java ├── extract-files.sh ├── fingerprint ├── Android.bp ├── BiometricsFingerprint.cpp ├── BiometricsFingerprint.h ├── android.hardware.biometrics.fingerprint@1.0-service.kiwi.rc └── service.cpp ├── gps ├── Android.mk ├── core │ ├── Android.mk │ ├── ContextBase.cpp │ ├── ContextBase.h │ ├── LBSProxyBase.h │ ├── LocAdapterBase.cpp │ ├── LocAdapterBase.h │ ├── LocAdapterProxyBase.h │ ├── LocApiBase.cpp │ ├── LocApiBase.h │ ├── LocDualContext.cpp │ ├── LocDualContext.h │ ├── UlpProxyBase.h │ ├── gps_extended.h │ ├── gps_extended_c.h │ ├── loc_core_log.cpp │ └── loc_core_log.h ├── flp.conf ├── gps.conf ├── izat.conf ├── loc_api │ ├── Android.mk │ ├── ds_api │ │ ├── Android.mk │ │ ├── ds_client.c │ │ └── ds_client.h │ └── libloc_api_50001 │ │ ├── Android.mk │ │ ├── LocEngAdapter.cpp │ │ ├── LocEngAdapter.h │ │ ├── Makefile.am │ │ ├── gps.c │ │ ├── loc.cpp │ │ ├── loc.h │ │ ├── loc_eng.cpp │ │ ├── loc_eng.h │ │ ├── loc_eng_agps.cpp │ │ ├── loc_eng_agps.h │ │ ├── loc_eng_dmn_conn.cpp │ │ ├── loc_eng_dmn_conn.h │ │ ├── loc_eng_dmn_conn_glue_msg.c │ │ ├── loc_eng_dmn_conn_glue_msg.h │ │ ├── loc_eng_dmn_conn_glue_pipe.c │ │ ├── loc_eng_dmn_conn_glue_pipe.h │ │ ├── loc_eng_dmn_conn_handler.cpp │ │ ├── loc_eng_dmn_conn_handler.h │ │ ├── loc_eng_dmn_conn_thread_helper.c │ │ ├── loc_eng_dmn_conn_thread_helper.h │ │ ├── loc_eng_log.cpp │ │ ├── loc_eng_log.h │ │ ├── loc_eng_msg.h │ │ ├── loc_eng_ni.cpp │ │ ├── loc_eng_ni.h │ │ ├── loc_eng_nmea.cpp │ │ ├── loc_eng_nmea.h │ │ ├── loc_eng_xtra.cpp │ │ └── loc_eng_xtra.h ├── sap.conf └── utils │ ├── Android.mk │ ├── LocHeap.cpp │ ├── LocHeap.h │ ├── LocSharedLock.h │ ├── LocThread.cpp │ ├── LocThread.h │ ├── LocTimer.cpp │ ├── LocTimer.h │ ├── Makefile.am │ ├── MsgTask.cpp │ ├── MsgTask.h │ ├── linked_list.c │ ├── linked_list.h │ ├── loc_cfg.cpp │ ├── loc_cfg.h │ ├── loc_log.cpp │ ├── loc_log.h │ ├── loc_misc_utils.cpp │ ├── loc_misc_utils.h │ ├── loc_target.cpp │ ├── loc_target.h │ ├── loc_timer.h │ ├── log_util.h │ ├── msg_q.c │ ├── msg_q.h │ └── platform_lib_abstractions │ ├── elapsed_millis_since_boot.cpp │ ├── platform_lib_includes.h │ ├── platform_lib_macros.h │ └── platform_lib_time.h ├── init ├── Android.bp └── init_kiwi.cpp ├── keylayout ├── cyttsp5_mt.kl ├── goodix.kl └── gpio-keys.kl ├── libhidl └── Android.mk ├── libshims ├── Android.bp ├── hw_cutils.c ├── hw_log.c └── icu55.c ├── libwcnss_qmi ├── Android.bp ├── NOTICE ├── wcnss_qmi.c └── wcnss_qmi.h ├── light ├── Android.bp ├── Light.cpp ├── Light.h ├── android.hardware.light@2.0-service.kiwi.rc └── service.cpp ├── lineage.dependencies ├── lineage_kiwi.mk ├── manifest.xml ├── overlay ├── frameworks │ └── base │ │ ├── core │ │ └── res │ │ │ └── res │ │ │ ├── values │ │ │ └── config.xml │ │ │ └── xml │ │ │ └── power_profile.xml │ │ └── packages │ │ ├── SettingsProvider │ │ └── res │ │ │ └── values │ │ │ └── defaults.xml │ │ └── SystemUI │ │ └── res │ │ ├── values-sw372dp │ │ └── dimens.xml │ │ └── values │ │ └── config.xml ├── lineage-sdk │ └── lineage │ │ └── res │ │ └── res │ │ └── values │ │ └── config.xml └── packages │ ├── apps │ ├── CarrierConfig │ │ └── res │ │ │ └── xml │ │ │ └── vendor.xml │ ├── Dialer │ │ └── java │ │ │ └── com │ │ │ └── android │ │ │ └── dialer │ │ │ └── callrecord │ │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ ├── FlipFlap │ │ └── res │ │ │ └── values │ │ │ ├── config.xml │ │ │ └── dimens.xml │ ├── LineageParts │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ └── Snap │ │ └── res │ │ └── values │ │ └── qcomstrings.xml │ └── services │ └── Telecomm │ └── res │ └── values │ └── config.xml ├── proprietary-files.txt ├── recovery ├── Android.mk └── recovery_updater.cpp ├── releasetools └── releasetools.py ├── ril-wrapper ├── .clang-format ├── Android.mk └── ril-wrapper.c ├── rootdir ├── Android.mk ├── bin │ ├── init.class_main.sh │ └── init.qcom.bt.sh └── etc │ ├── fstab.qcom │ ├── init.qcom.power.rc │ ├── init.qcom.rc │ ├── init.qcom.usb.rc │ ├── init.recovery.qcom.rc │ ├── init.target-from-init.rc │ ├── init.target.rc │ └── ueventd.qcom.rc ├── seccomp └── mediacodec-seccomp.policy ├── sensors ├── Android.bp ├── Android.mk ├── SensorEventQueue.cpp ├── SensorEventQueue.h ├── multihal.cpp └── multihal.h ├── sepolicy ├── app_zygote.te ├── audioserver.te ├── bluetooth_loader.te ├── device.te ├── file.te ├── file_contexts ├── fsck.te ├── genfs_contexts ├── hal_audio_default.te ├── hal_fingerprint_default.te ├── hal_gnss_default.te ├── hal_light_default.te ├── hal_lineage_livedisplay_qti.te ├── hal_lineage_touch_kiwi.te ├── hal_power_default.te ├── hal_wifi_default.te ├── hal_wifi_supplicant_default.te ├── healthd.te ├── hostapd.te ├── init.te ├── kernel.te ├── libqmi_oem_main.te ├── mediaserver.te ├── mm-qcamerad.te ├── netmgrd.te ├── oeminfo.te ├── perfd.te ├── property.te ├── property_contexts ├── qmuxd.te ├── qti_init_shell.te ├── rild.te ├── rmt_storage.te ├── signinfolistener.te ├── system_app.te ├── system_server.te ├── time_daemon.te ├── ueventd.te ├── vendor_init.te └── wcnss_service.te ├── setup-makefiles.sh ├── system.prop ├── touch ├── .clang-format ├── Android.bp ├── GloveMode.cpp ├── GloveMode.h ├── TouchscreenGesture.cpp ├── TouchscreenGesture.h ├── service.cpp └── vendor.lineage.touch@1.0-service.kiwi.rc ├── update-files.sh └── wifi ├── WCNSS_cfg.dat ├── WCNSS_qcom_cfg.ini ├── WCNSS_qcom_wlan_nv.bin └── WCNSS_wlan_dictionary.dat /Android.bp: -------------------------------------------------------------------------------- 1 | subdirs = [ 2 | "sensors", 3 | "fingerprint", 4 | ] 5 | -------------------------------------------------------------------------------- /AndroidProducts.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 The CyanogenMod Project 3 | # Copyright (C) 2019 The LineageOS Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | PRODUCT_MAKEFILES := $(LOCAL_DIR)/lineage_kiwi.mk 18 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Device tree for Huawei Honor 5x 2 | -------------------------------------------------------------------------------- /amplifier/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SHARED_LIBRARIES := \ 6 | libdl liblog libutils libcutils libtinyalsa 7 | 8 | LOCAL_HEADER_LIBRARIES := generated_kernel_headers 9 | 10 | LOCAL_C_INCLUDES := \ 11 | $(call project-path-for,qcom-audio)/hal/ \ 12 | external/tinyalsa/include \ 13 | hardware/libhardware/include 14 | 15 | LOCAL_SRC_FILES := \ 16 | audio_amplifier.c 17 | 18 | LOCAL_MODULE := audio_amplifier.msm8916 19 | LOCAL_MODULE_RELATIVE_PATH := hw 20 | LOCAL_MODULE_TAGS := optional 21 | LOCAL_CFLAGS = -Werror 22 | 23 | include $(BUILD_SHARED_LIBRARY) 24 | -------------------------------------------------------------------------------- /audio/aanc_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 | AIF1_CAP Mixer SLIM TX1:1 8 | AIF1_CAP Mixer SLIM TX2:1 9 | SLIM TX1 MUX:DEC1 10 | DEC1 MUX:DMIC4 11 | SLIM TX2 MUX:DEC2 12 | DEC2 MUX:DMIC3 13 | SLIM_0_TX Channels:Two 14 | MultiMedia1 Mixer SLIM_0_TX:1 15 | 16 | disable 17 | MultiMedia1 Mixer SLIM_0_TX:0 18 | AIF1_CAP Mixer SLIM TX1:0 19 | AIF1_CAP Mixer SLIM TX2:0 20 | SLIM TX1 MUX:ZERO 21 | SLIM TX2 MUX:ZERO 22 | DEC1 MUX:ZERO 23 | DEC2 MUX:ZERO 24 | 25 | #ANC_TEST_S_PATH_MIC_STEREO Capture 26 | acdb_dev_id:88 27 | !Capture 28 | Txdevice:0 29 | 30 | enable 31 | AIF1_CAP Mixer SLIM TX1:1 32 | AIF1_CAP Mixer SLIM TX2:1 33 | SLIM TX1 MUX:DEC3 34 | DEC3 MUX:ANCFBTUNE1 35 | ANC1 MUX:DMIC4 36 | SLIM TX2 MUX:DEC4 37 | DEC4 MUX:ANCFBTUNE2 38 | ANC2 MUX:DMIC4 39 | ANC1 FB MUX:EAR_HPH_L 40 | SLIM_0_TX Channels:Two 41 | MultiMedia1 Mixer SLIM_0_TX:1 42 | 43 | disable 44 | MultiMedia1 Mixer SLIM_0_TX:0 45 | AIF1_CAP Mixer SLIM TX1:0 46 | AIF1_CAP Mixer SLIM TX2:0 47 | SLIM TX1 MUX:ZERO 48 | DEC3 MUX:ZERO 49 | ANC1 MUX:ZERO 50 | SLIM TX2 MUX:ZERO 51 | DEC4 MUX:ZERO 52 | ANC2 MUX:ZERO 53 | ANC1 FB MUX:ZERO 54 | 55 | #ANC_TEST_E_PATH_MIC_STEREO Capture 56 | acdb_dev_id:91 57 | !Capture 58 | Txdevice:0 59 | 60 | enable 61 | AIF1_CAP Mixer SLIM TX1:1 62 | AIF1_CAP Mixer SLIM TX2:1 63 | SLIM TX1 MUX:DEC3 64 | DEC3 MUX:ANCFBTUNE1 65 | ANC1 MUX:DMIC3 66 | SLIM TX2 MUX:DEC4 67 | DEC4 MUX:ANCFBTUNE2 68 | ANC2 MUX:DMIC3 69 | ANC1 FB MUX:EAR_HPH_L 70 | SLIM_0_TX Channels:Two 71 | MultiMedia1 Mixer SLIM_0_TX:1 72 | 73 | disable 74 | MultiMedia1 Mixer SLIM_0_TX:0 75 | AIF1_CAP Mixer SLIM TX1:0 76 | AIF1_CAP Mixer SLIM TX2:0 77 | SLIM TX1 MUX:ZERO 78 | DEC3 MUX:ZERO 79 | ANC1 MUX:ZERO 80 | SLIM TX2 MUX:ZERO 81 | DEC4 MUX:ZERO 82 | ANC2 MUX:ZERO 83 | ANC1 FB MUX:ZERO 84 | 85 | #ANC_TEST_S_PATH_HANDSET_SPKR_ANC_MONO 86 | acdb_dev_id:86 87 | !Playback 88 | Rxdevice:0 89 | 90 | enable 91 | ANC Function:ON 92 | SLIM RX1 MUX:AIF1_PB 93 | SLIM_0_RX Channels:One 94 | RX1 MIX1 INP1:RX1 95 | CLASS_H_DSM MUX:RX_HPHL 96 | RDAC3 MUX:DEM2 97 | RX1 Digital Volume:87 98 | DAC1 Switch:1 99 | ANC Slot:7 100 | SLIMBUS_0_RX Audio Mixer MultiMedia1:1 101 | 102 | disable 103 | SLIMBUS_0_RX Audio Mixer MultiMedia1:0 104 | ANC Slot:0 105 | SLIM RX1 MUX:ZERO 106 | RX1 MIX1 INP1:ZERO 107 | RX1 Digital Volume:0 108 | RDAC3 MUX:ZERO 109 | DAC1 Switch:0 110 | ANC Function:OFF 111 | 112 | #ANC_TEST_E_PATH_HANDSET_SPKR_ANC_MONO 113 | acdb_dev_id:89 114 | !Playback 115 | Rxdevice:0 116 | 117 | enable 118 | ANC Function:ON 119 | SLIM RX1 MUX:AIF1_PB 120 | SLIM_0_RX Channels:One 121 | RX1 MIX1 INP1:RX1 122 | CLASS_H_DSM MUX:RX_HPHL 123 | RDAC3 MUX:DEM2 124 | RX1 Digital Volume:87 125 | DAC1 Switch:1 126 | ANC Slot:8 127 | SLIMBUS_0_RX Audio Mixer MultiMedia1:1 128 | 129 | disable 130 | SLIMBUS_0_RX Audio Mixer MultiMedia1:0 131 | ANC Slot:0 132 | SLIM RX1 MUX:ZERO 133 | RX1 MIX1 INP1:ZERO 134 | RX1 Digital Volume:0 135 | RDAC3 MUX:ZERO 136 | DAC1 Switch:0 137 | ANC Function:OFF 138 | -------------------------------------------------------------------------------- /audio/audio_platform_info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /bluetooth/bdroid_buildcfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The CyanogenMod Project 3 | * Copyright (C) 2018 The LineageOS Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef _BDROID_BUILDCFG_H 19 | #define _BDROID_BUILDCFG_H 20 | 21 | #define BTM_DEF_LOCAL_NAME "HUAWEI" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /board-info.txt: -------------------------------------------------------------------------------- 1 | require version-trustzone=TZ.BF.3.0.C3-00025 2 | -------------------------------------------------------------------------------- /camera/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /camera/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 | $(call add-clean-step, find $(OUT_DIR) -name "camera.msm8916*" -print0 | xargs -0 rm -rf) 48 | -------------------------------------------------------------------------------- /camera/MODULE_LICENSE_BSD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_device_huawei_kiwi/8d2f206ad19bf34f6d61bfcfbc8c60c79dd4f894/camera/MODULE_LICENSE_BSD -------------------------------------------------------------------------------- /camera/QCamera2/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /camera/QCamera2/HAL/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | QCamera2Factory.cpp \ 6 | QCamera2Hal.cpp \ 7 | QCamera2HWI.cpp \ 8 | QCameraMem.cpp \ 9 | ../util/QCameraQueue.cpp \ 10 | ../util/QCameraCmdThread.cpp \ 11 | QCameraStateMachine.cpp \ 12 | QCameraChannel.cpp \ 13 | QCameraStream.cpp \ 14 | QCameraPostProc.cpp \ 15 | QCamera2HWICallbacks.cpp \ 16 | QCameraParameters.cpp \ 17 | QCameraThermalAdapter.cpp \ 18 | wrapper/QualcommCamera.cpp 19 | 20 | LOCAL_CFLAGS += -Wall -Wextra -Werror 21 | LOCAL_CFLAGS += -DHAS_MULTIMEDIA_HINTS 22 | 23 | #use media extension 24 | #ifeq ($(TARGET_USES_MEDIA_EXTENSIONS), true) 25 | LOCAL_CFLAGS += -DUSE_MEDIA_EXTENSIONS 26 | #endif 27 | 28 | #Debug logs are enabled 29 | #LOCAL_CFLAGS += -DDISABLE_DEBUG_LOG 30 | 31 | #ifeq ($(TARGET_USES_AOSP),true) 32 | #LOCAL_CFLAGS += -DVANILLA_HAL 33 | #endif 34 | 35 | LOCAL_C_INCLUDES := \ 36 | $(LOCAL_PATH)/../stack/common \ 37 | frameworks/native/include/media/openmax \ 38 | $(call project-path-for,qcom-display)/libgralloc \ 39 | $(call project-path-for,qcom-display)/libqdutils \ 40 | $(call project-path-for,qcom-display)/libqservice \ 41 | $(call project-path-for,qcom-media)/libstagefrighthw \ 42 | system/media/camera/include \ 43 | $(LOCAL_PATH)/../../mm-image-codec/qexif \ 44 | $(LOCAL_PATH)/../../mm-image-codec/qomx_core \ 45 | $(LOCAL_PATH)/../util \ 46 | $(LOCAL_PATH)/wrapper \ 47 | system/media/camera/include \ 48 | $(TARGET_OUT_HEADERS)/qcom/display 49 | 50 | LOCAL_C_INCLUDES += $(call project-path-for,qcom-display)/libgralloc 51 | ifeq ($(TARGET_TS_MAKEUP),true) 52 | LOCAL_CFLAGS += -DTARGET_TS_MAKEUP 53 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/tsMakeuplib/include 54 | endif 55 | 56 | LOCAL_HEADER_LIBRARIES := generated_kernel_headers 57 | LOCAL_SHARED_LIBRARIES := libcamera_client liblog libhardware libutils libcutils libdl 58 | LOCAL_SHARED_LIBRARIES += libmmcamera_interface libmmjpeg_interface libqdMetaData 59 | ifeq ($(TARGET_TS_MAKEUP),true) 60 | LOCAL_SHARED_LIBRARIES += libts_face_beautify_hal libts_detected_face_hal 61 | endif 62 | LOCAL_SHARED_LIBRARIES += libqdMetaData libqservice libbinder 63 | 64 | LOCAL_MODULE_RELATIVE_PATH := hw 65 | LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM) 66 | LOCAL_32_BIT_ONLY := true 67 | LOCAL_VENDOR_MODULE := true 68 | LOCAL_MODULE_TAGS := optional 69 | 70 | include $(BUILD_SHARED_LIBRARY) 71 | -------------------------------------------------------------------------------- /camera/QCamera2/HAL/QCamera2Factory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, 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 __QCAMERA2FACTORY_H__ 31 | #define __QCAMERA2FACTORY_H__ 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #include "QCamera2HWI.h" 38 | 39 | namespace qcamera { 40 | 41 | class QCamera2Factory 42 | { 43 | public: 44 | QCamera2Factory(); 45 | virtual ~QCamera2Factory(); 46 | 47 | static int get_number_of_cameras(); 48 | static int get_camera_info(int camera_id, struct camera_info *info); 49 | 50 | private: 51 | int getNumberOfCameras(); 52 | int getCameraInfo(int camera_id, struct camera_info *info); 53 | int cameraDeviceOpen(int camera_id, struct hw_device_t **hw_device); 54 | static int camera_device_open(const struct hw_module_t *module, const char *id, 55 | struct hw_device_t **hw_device); 56 | 57 | public: 58 | static struct hw_module_methods_t mModuleMethods; 59 | 60 | private: 61 | int mNumOfCameras; 62 | }; 63 | 64 | }; /*namespace qcamera*/ 65 | 66 | extern camera_module_t HAL_MODULE_INFO_SYM; 67 | 68 | #endif /* ANDROID_HARDWARE_QUALCOMM_CAMERA_H */ 69 | -------------------------------------------------------------------------------- /camera/QCamera2/HAL/QCamera2Hal.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2015, The Linux Foundataion. 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 | #include "QCamera2Factory.h" 31 | 32 | static hw_module_t camera_common = { 33 | .tag = HARDWARE_MODULE_TAG, 34 | .module_api_version = CAMERA_MODULE_API_VERSION_1_0, 35 | .hal_api_version = HARDWARE_HAL_API_VERSION, 36 | .id = CAMERA_HARDWARE_MODULE_ID, 37 | .name = "QCamera Module", 38 | .author = "Qualcomm Innovation Center Inc", 39 | .methods = &qcamera::QCamera2Factory::mModuleMethods, 40 | .dso = NULL, 41 | .reserved = {0}, 42 | }; 43 | 44 | camera_module_t HAL_MODULE_INFO_SYM = { 45 | .common = camera_common, 46 | .get_number_of_cameras = qcamera::QCamera2Factory::get_number_of_cameras, 47 | .get_camera_info = qcamera::QCamera2Factory::get_camera_info, 48 | .set_callbacks = NULL, 49 | .get_vendor_tag_ops = NULL, 50 | .open_legacy = NULL, 51 | .set_torch_mode = NULL, 52 | .init = NULL, 53 | .reserved = {0} 54 | }; 55 | -------------------------------------------------------------------------------- /camera/QCamera2/HAL/QCameraAllocator.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2014, The Linux Foundataion. 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 __QCAMERA_ALLOCATOR__ 31 | #define __QCAMERA_ALLOCATOR__ 32 | 33 | extern "C" { 34 | #include 35 | } 36 | 37 | namespace qcamera { 38 | 39 | class QCameraMemory; 40 | class QCameraHeapMemory; 41 | 42 | class QCameraAllocator { 43 | public: 44 | virtual QCameraMemory *allocateStreamBuf(cam_stream_type_t stream_type, 45 | size_t size, int stride, int scanline, uint8_t &bufferCnt) = 0; 46 | virtual int32_t allocateMoreStreamBuf(QCameraMemory *mem_obj, 47 | size_t size, uint8_t &bufferCnt) = 0; 48 | virtual QCameraHeapMemory *allocateStreamInfoBuf(cam_stream_type_t stream_type) = 0; 49 | virtual ~QCameraAllocator() {} 50 | }; 51 | 52 | }; /* namespace qcamera */ 53 | #endif /* __QCAMERA_ALLOCATOR__ */ 54 | -------------------------------------------------------------------------------- /camera/QCamera2/HAL/tsMakeuplib/include/ts_makeup_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014,2015 Thundersoft Corporation 3 | * All rights Reserved 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | #ifndef __TS_MAKEUP_DATA_H__ 18 | #define __TS_MAKEUP_DATA_H__ 19 | 20 | #define TS_OK (0x00000000) //Successful 21 | #define TS_ERROR_PARAM (0x00000001) //Parameters error 22 | #define TS_ERROR_IO (0x00000002) //Input or output error 23 | #define TS_ERROR_INTERNAL (0x00000003) //Internal error 24 | #define TS_NO_MEMORY (0x00000004) //No memory error 25 | 26 | 27 | /** 28 | * Data struct : rectangle 29 | */ 30 | typedef struct __tag_tsrect 31 | { 32 | long left; 33 | long top; 34 | long right; 35 | long bottom; 36 | } TSRect; 37 | 38 | /** 39 | * Data struct : point 40 | */ 41 | typedef struct __tag_tsmakeuppoint 42 | { 43 | long x; 44 | long y; 45 | } TSPoint; 46 | 47 | 48 | #endif // __TS_MAKEUP_DATA_H__ 49 | -------------------------------------------------------------------------------- /camera/QCamera2/HAL/tsMakeuplib/include/ts_makeup_image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014,2015 Thundersoft Corporation 3 | * All rights Reserved 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | #ifndef __TS_MAKEUP_IMGAGE_H__ 18 | #define __TS_MAKEUP_IMGAGE_H__ 19 | 20 | /** 21 | * Data struct : TSMakeupData 22 | */ 23 | typedef struct __tag_tsmakeupdata 24 | { 25 | int frameWidth; //NV21 Frame width.MUST > 0. 26 | int frameHeight; //NV21 Frame height. MUST > 0. 27 | unsigned char *yBuf; //NV21 Y buffer pointer.MUST not null. 28 | unsigned char *uvBuf; //NV21 UV buffer pointer.MUST not null. 29 | }TSMakeupData; 30 | 31 | 32 | #endif // __TS_MAKEUP_IMGAGE_H__ 33 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/common/cam_list.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 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 | /* This file is a slave copy from /vendor/qcom/propreitary/mm-cammera/common, 31 | * Please do not modify it directly here. */ 32 | 33 | #ifndef __CAMLIST_H 34 | #define __CAMLIST_H 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #define member_of(ptr, type, member) ({ \ 41 | const typeof(((type *)0)->member) *__mptr = (ptr); \ 42 | (type *)((char *)__mptr - offsetof(type,member));}) 43 | 44 | struct cam_list { 45 | struct cam_list *next, *prev; 46 | }; 47 | 48 | static inline void cam_list_init(struct cam_list *ptr) 49 | { 50 | ptr->next = ptr; 51 | ptr->prev = ptr; 52 | } 53 | 54 | static inline void cam_list_add_tail_node(struct cam_list *item, 55 | struct cam_list *head) 56 | { 57 | struct cam_list *prev = head->prev; 58 | 59 | head->prev = item; 60 | item->next = head; 61 | item->prev = prev; 62 | prev->next = item; 63 | } 64 | 65 | static inline void cam_list_insert_before_node(struct cam_list *item, 66 | struct cam_list *node) 67 | { 68 | item->next = node; 69 | item->prev = node->prev; 70 | item->prev->next = item; 71 | node->prev = item; 72 | } 73 | 74 | static inline void cam_list_del_node(struct cam_list *ptr) 75 | { 76 | struct cam_list *prev = ptr->prev; 77 | struct cam_list *next = ptr->next; 78 | 79 | next->prev = ptr->prev; 80 | prev->next = ptr->next; 81 | ptr->next = ptr; 82 | ptr->prev = ptr; 83 | } 84 | 85 | #endif /* __CAMLIST_H */ 86 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/common/cam_semaphore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, 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 __QCAMERA_SEMAPHORE_H__ 31 | #define __QCAMERA_SEMAPHORE_H__ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Implement semaphore with mutex and conditional variable. 38 | * Reason being, POSIX semaphore on Android are not used or 39 | * well tested. 40 | */ 41 | 42 | typedef struct { 43 | int val; 44 | pthread_mutex_t mutex; 45 | pthread_cond_t cond; 46 | } cam_semaphore_t; 47 | 48 | static inline void cam_sem_init(cam_semaphore_t *s, int n) 49 | { 50 | pthread_mutex_init(&(s->mutex), NULL); 51 | pthread_cond_init(&(s->cond), NULL); 52 | s->val = n; 53 | } 54 | 55 | static inline void cam_sem_post(cam_semaphore_t *s) 56 | { 57 | pthread_mutex_lock(&(s->mutex)); 58 | s->val++; 59 | pthread_cond_signal(&(s->cond)); 60 | pthread_mutex_unlock(&(s->mutex)); 61 | } 62 | 63 | static inline int cam_sem_wait(cam_semaphore_t *s) 64 | { 65 | int rc = 0; 66 | pthread_mutex_lock(&(s->mutex)); 67 | while (s->val == 0) 68 | rc = pthread_cond_wait(&(s->cond), &(s->mutex)); 69 | s->val--; 70 | pthread_mutex_unlock(&(s->mutex)); 71 | return rc; 72 | } 73 | 74 | static inline void cam_sem_destroy(cam_semaphore_t *s) 75 | { 76 | pthread_mutex_destroy(&(s->mutex)); 77 | pthread_cond_destroy(&(s->cond)); 78 | s->val = 0; 79 | } 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* __QCAMERA_SEMAPHORE_H__ */ 86 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/mm-camera-interface/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SRC_FILES := \ 6 | src/mm_camera_interface.c \ 7 | src/mm_camera.c \ 8 | src/mm_camera_channel.c \ 9 | src/mm_camera_stream.c \ 10 | src/mm_camera_thread.c \ 11 | src/mm_camera_sock.c \ 12 | src/cam_intf.c 13 | 14 | ifeq ($(call is-board-platform-in-list, msm8974 msm8916 msm8226 msm8610 msm8909),true) 15 | LOCAL_CFLAGS += -DVENUS_PRESENT 16 | endif 17 | 18 | LOCAL_CFLAGS += -D_ANDROID_ 19 | 20 | LOCAL_COPY_HEADERS_TO := mm-camera-interface 21 | LOCAL_COPY_HEADERS += ../common/cam_intf.h 22 | LOCAL_COPY_HEADERS += ../common/cam_types.h 23 | 24 | LOCAL_C_INCLUDES := \ 25 | $(LOCAL_PATH)/inc \ 26 | $(LOCAL_PATH)/../common \ 27 | $(call project-path-for,qcom-media)/mm-core/inc \ 28 | system/media/camera/include 29 | 30 | LOCAL_CFLAGS += -Wall -Wextra -Werror 31 | 32 | LOCAL_MODULE := libmmcamera_interface 33 | LOCAL_32_BIT_ONLY := true 34 | LOCAL_HEADER_LIBRARIES := generated_kernel_headers 35 | LOCAL_SHARED_LIBRARIES := libdl libcutils liblog 36 | LOCAL_MODULE_TAGS := optional 37 | LOCAL_VENDOR_MODULE := true 38 | 39 | include $(BUILD_SHARED_LIBRARY) 40 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/mm-camera-interface/inc/mm_camera_sock.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 | 30 | #ifndef __MM_CAMERA_SOCKET_H__ 31 | #define __MM_CAMERA_SOCKET_H__ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | typedef enum { 39 | MM_CAMERA_SOCK_TYPE_UDP, 40 | MM_CAMERA_SOCK_TYPE_TCP, 41 | } mm_camera_sock_type_t; 42 | 43 | typedef union { 44 | struct sockaddr addr; 45 | struct sockaddr_un addr_un; 46 | } mm_camera_sock_addr_t; 47 | 48 | int mm_camera_socket_create(int cam_id, mm_camera_sock_type_t sock_type); 49 | 50 | int mm_camera_socket_sendmsg( 51 | int fd, 52 | void *msg, 53 | size_t buf_size, 54 | int sendfd); 55 | 56 | int mm_camera_socket_recvmsg( 57 | int fd, 58 | void *msg, 59 | uint32_t buf_size, 60 | int *rcvdfd); 61 | 62 | void mm_camera_socket_close(int fd); 63 | 64 | #endif /*__MM_CAMERA_SOCKET_H__*/ 65 | 66 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/mm-camera-interface/src/cam_intf.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #include "cam_intf.h" 31 | 32 | void *POINTER_OF_PARAM(cam_intf_parm_type_t PARAM_ID, 33 | void *table_ptr) 34 | { 35 | parm_buffer_new_t *TABLE_PTR = (parm_buffer_new_t *)table_ptr; 36 | void *tmp_p; 37 | size_t j = 0, i = TABLE_PTR->num_entry; 38 | tmp_p = (void *) &TABLE_PTR->entry[0]; 39 | parm_entry_type_new_t *curr_param = (parm_entry_type_new_t *) tmp_p; 40 | 41 | for (j = 0; j < i; j++) { 42 | if (PARAM_ID == curr_param->entry_type) { 43 | return (void *)&curr_param->data[0]; 44 | } 45 | curr_param = GET_NEXT_PARAM(curr_param, parm_entry_type_new_t); 46 | } 47 | tmp_p = (void *) &TABLE_PTR->entry[0]; 48 | curr_param = (parm_entry_type_new_t *) tmp_p; 49 | return (void *)&curr_param->data[0]; //should not be coming here 50 | //this is just to prevent a crash 51 | //for the caller 52 | } 53 | 54 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/mm-jpeg-interface/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_CFLAGS += -D_ANDROID_ 6 | 7 | LOCAL_CFLAGS += -Wall -Wextra -Werror 8 | 9 | LOCAL_C_INCLUDES += \ 10 | frameworks/native/include/media/openmax \ 11 | $(LOCAL_PATH)/inc \ 12 | $(LOCAL_PATH)/../common \ 13 | $(LOCAL_PATH)/../../../ \ 14 | $(LOCAL_PATH)/../../../mm-image-codec/qexif \ 15 | $(LOCAL_PATH)/../../../mm-image-codec/qomx_core 16 | 17 | ifeq ($(call is-board-platform-in-list, msm8974),true) 18 | LOCAL_CFLAGS += -DMM_JPEG_CONCURRENT_SESSIONS_COUNT=2 19 | else 20 | LOCAL_CFLAGS += -DMM_JPEG_CONCURRENT_SESSIONS_COUNT=1 21 | endif 22 | 23 | LOCAL_SRC_FILES := \ 24 | src/mm_jpeg_queue.c \ 25 | src/mm_jpeg_exif.c \ 26 | src/mm_jpeg.c \ 27 | src/mm_jpeg_interface.c \ 28 | src/mm_jpeg_ionbuf.c \ 29 | src/mm_jpegdec_interface.c \ 30 | src/mm_jpegdec.c 31 | 32 | LOCAL_MODULE := libmmjpeg_interface 33 | LOCAL_32_BIT_ONLY := true 34 | LOCAL_HEADER_LIBRARIES := generated_kernel_headers 35 | LOCAL_SHARED_LIBRARIES := libdl libcutils liblog libqomx_core 36 | LOCAL_MODULE_TAGS := optional 37 | LOCAL_VENDOR_MODULE := true 38 | 39 | include $(BUILD_SHARED_LIBRARY) 40 | -------------------------------------------------------------------------------- /camera/QCamera2/stack/mm-jpeg-interface/inc/mm_jpeg_ionbuf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013-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 | 30 | #ifndef __MM_JPEG_IONBUF_H__ 31 | #define __MM_JPEG_IONBUF_H__ 32 | 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include "mm_jpeg_dbg.h" 42 | 43 | typedef struct { 44 | struct ion_fd_data ion_info_fd; 45 | struct ion_allocation_data alloc; 46 | int p_pmem_fd; 47 | size_t size; 48 | int ion_fd; 49 | uint8_t *addr; 50 | } buffer_t; 51 | 52 | /** buffer_allocate: 53 | * 54 | * Arguments: 55 | * @p_buffer: ION buffer 56 | * 57 | * Return: 58 | * buffer address 59 | * 60 | * Description: 61 | * allocates ION buffer 62 | * 63 | **/ 64 | void* buffer_allocate(buffer_t *p_buffer, int cached); 65 | 66 | /** buffer_deallocate: 67 | * 68 | * Arguments: 69 | * @p_buffer: ION buffer 70 | * 71 | * Return: 72 | * error val 73 | * 74 | * Description: 75 | * deallocates ION buffer 76 | * 77 | **/ 78 | int buffer_deallocate(buffer_t *p_buffer); 79 | 80 | /** buffer_invalidate: 81 | * 82 | * Arguments: 83 | * @p_buffer: ION buffer 84 | * 85 | * Return: 86 | * error val 87 | * 88 | * Description: 89 | * Invalidates the cached buffer 90 | * 91 | **/ 92 | int buffer_invalidate(buffer_t *p_buffer); 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /camera/QCamera2/util/QCameraCmdThread.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, The Linux Foundataion. 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 __QCAMERA_CMD_THREAD_H__ 31 | #define __QCAMERA_CMD_THREAD_H__ 32 | 33 | #include 34 | #include 35 | 36 | #include "cam_types.h" 37 | #include "QCameraQueue.h" 38 | 39 | namespace qcamera { 40 | 41 | typedef enum 42 | { 43 | CAMERA_CMD_TYPE_NONE, 44 | CAMERA_CMD_TYPE_START_DATA_PROC, 45 | CAMERA_CMD_TYPE_STOP_DATA_PROC, 46 | CAMERA_CMD_TYPE_DO_NEXT_JOB, 47 | CAMERA_CMD_TYPE_EXIT, 48 | CAMERA_CMD_TYPE_MAX 49 | } camera_cmd_type_t; 50 | 51 | typedef struct { 52 | camera_cmd_type_t cmd; 53 | } camera_cmd_t; 54 | 55 | class QCameraCmdThread { 56 | public: 57 | QCameraCmdThread(); 58 | ~QCameraCmdThread(); 59 | 60 | int32_t launch(void *(*start_routine)(void *), void* user_data); 61 | int32_t setName(const char* name); 62 | int32_t exit(); 63 | int32_t sendCmd(camera_cmd_type_t cmd, uint8_t sync_cmd, uint8_t priority); 64 | camera_cmd_type_t getCmd(); 65 | 66 | QCameraQueue cmd_queue; /* cmd queue */ 67 | pthread_t cmd_pid; /* cmd thread ID */ 68 | cam_semaphore_t cmd_sem; /* semaphore for cmd thread */ 69 | cam_semaphore_t sync_sem; /* semaphore for synchronized call signal */ 70 | }; 71 | 72 | }; // namespace qcamera 73 | 74 | #endif /* __QCAMERA_CMD_THREAD_H__ */ 75 | -------------------------------------------------------------------------------- /camera/QCamera2/util/QCameraQueue.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, The Linux Foundataion. 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 __QCAMERA_QUEUE_H__ 31 | #define __QCAMERA_QUEUE_H__ 32 | 33 | #include 34 | #include "cam_list.h" 35 | 36 | namespace qcamera { 37 | 38 | typedef bool (*match_fn_data)(void *data, void *user_data, void *match_data); 39 | typedef void (*release_data_fn)(void* data, void *user_data); 40 | typedef bool (*match_fn)(void *data, void *user_data); 41 | 42 | class QCameraQueue { 43 | public: 44 | QCameraQueue(); 45 | QCameraQueue(release_data_fn data_rel_fn, void *user_data); 46 | virtual ~QCameraQueue(); 47 | bool enqueue(void *data); 48 | bool enqueueWithPriority(void *data); 49 | void flush(); 50 | void flushNodes(match_fn match); 51 | void flushNodes(match_fn_data match, void *spec_data); 52 | void* dequeue(bool bFromHead = true); 53 | bool isEmpty(); 54 | int getCurrentSize() {return m_size;} 55 | private: 56 | typedef struct { 57 | struct cam_list list; 58 | void* data; 59 | } camera_q_node; 60 | 61 | camera_q_node m_head; // dummy head 62 | int m_size; 63 | pthread_mutex_t m_lock; 64 | release_data_fn m_dataFn; 65 | void * m_userData; 66 | }; 67 | 68 | }; // namespace qcamera 69 | 70 | #endif /* __QCAMERA_QUEUE_H__ */ 71 | -------------------------------------------------------------------------------- /camera/mm-image-codec/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /camera/mm-image-codec/qomx_core/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_CFLAGS := -Wall -Wextra -Werror -g -O0 8 | 9 | LOCAL_C_INCLUDES := \ 10 | frameworks/native/include/media/openmax \ 11 | $(LOCAL_PATH)/../qexif 12 | 13 | LOCAL_SRC_FILES := qomx_core.c 14 | 15 | LOCAL_MODULE := libqomx_core 16 | LOCAL_32_BIT_ONLY := true 17 | LOCAL_SHARED_LIBRARIES := libcutils libdl liblog 18 | LOCAL_VENDOR_MODULE := true 19 | 20 | include $(BUILD_SHARED_LIBRARY) 21 | -------------------------------------------------------------------------------- /config.fs: -------------------------------------------------------------------------------- 1 | [firmware/] 2 | mode: 0771 3 | user: AID_SYSTEM 4 | group: AID_SYSTEM 5 | caps: 0 6 | 7 | [persist/] 8 | mode: 0771 9 | user: AID_SYSTEM 10 | group: AID_SYSTEM 11 | caps: 0 12 | -------------------------------------------------------------------------------- /configs/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) 2012-2013 Qualcomm Atheros, Inc. 9 | # All Rights Reserved. 10 | # Qualcomm Atheros Confidential and Proprietary. 11 | # 12 | # Export of this technology or software is regulated by the U.S. Government. 13 | # Diversion contrary to U.S. law prohibited. 14 | #=============================================================================*/ 15 | 16 | # X86 ONLY - UBUNTU: 17 | # Copy this file in the same directory where the executable is 18 | 19 | # The RSSI threshold used in the RTT outlier detection in half decibels. Default value recommended by the 20 | # system team currently is -140 (corresponding to -70 dB). 21 | LOWI_RSSI_THRESHOLD_FOR_RTT = -140 22 | 23 | # Number of measurment per AP for RTS/CTS 24 | LOWI_RTS_CTS_NUM_MEAS = 5 25 | 26 | # Maximum Number of Outstanding Requests supported 27 | LOWI_MAX_OUTSTANDING_REQUEST = 255 28 | 29 | # Maximum number of records in Cache 30 | LOWI_MAX_NUM_CACHE_RECORDS = 200 31 | 32 | # Default threshold before issuing another fresh scan (ms) 33 | LOWI_FRESH_SCAN_THRESHOLD = 500 34 | 35 | # Timeout in case no result is reported by the driver (seconds) 36 | LOWI_NO_RESULT_WAIT_TOLERANCE = 10 37 | 38 | # Use Fake Wifi driver. Only valid for engineering builds 39 | LOWI_USE_FAKE_WIFI_DRIVER = 0 40 | 41 | # Use ROME Wifi driver. Only valid for engineering builds 42 | # Will be removed later only for development support 43 | LOWI_USE_ROME_WIFI_DRIVER = 0 44 | 45 | # Use LOWI LP. 46 | # When enabled the Discovery Request will be routed to LOWI-LP 47 | LOWI_USE_LOWI_LP = 0 48 | 49 | # Log level 50 | # EL_LOG_OFF = 0, EL_ERROR = 1, EL_WARNING = 2, EL_INFO = 3, EL_DEBUG = 4, EL_VERBOSE = 5, EL_LOG_ALL = 100 51 | LOWI_LOG_LEVEL = 2 52 | -------------------------------------------------------------------------------- /configs/p2p_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | p2p_no_group_iface=1 3 | p2p_search_delay=100 4 | -------------------------------------------------------------------------------- /configs/sec_config: -------------------------------------------------------------------------------- 1 | /* IPC Security Config */ 2 | /* :: */ 3 | 16:4294967295:1000:3004 4 | /* :: */ 5 | 56:4294967295:1021:3004 6 | /* Allow SS CTL service to be used by system and net_raw processes */ 7 | 43:4294967295:1000:3004 8 | /* :: */ 9 | 71:4294967295:1001 10 | /* :: */ 11 | 50:4294967295:1001 12 | /* Allow RCS service to aquire net_raw permission */ 13 | 18:4294967295:1001:3004 14 | /* Allow QMID service to aquire net_raw permission */ 15 | 3:4294967295:1001:1021:3004 16 | 2:4294967295:1000:1001:3004 17 | 42:4294967295:1001:3004 18 | 18:4294967295:1001:3004 19 | 9:4294967295:1001:3004 20 | 1:4294967295:1001:3004 21 | /* :: */ 22 | 57:4294967295:1000 23 | -------------------------------------------------------------------------------- /configs/sensors/_hals.conf: -------------------------------------------------------------------------------- 1 | sensors.kiwi.so 2 | -------------------------------------------------------------------------------- /configs/wpa_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | p2p_disabled=1 3 | p2p_no_group_iface=1 4 | tdls_external_control=1 5 | interworking=1 6 | hs20=1 7 | auto_interworking=0 8 | -------------------------------------------------------------------------------- /doze/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE_TAGS := optional 5 | 6 | LOCAL_SRC_FILES := $(call all-java-files-under, src) 7 | 8 | LOCAL_PACKAGE_NAME := KiwiDoze 9 | LOCAL_CERTIFICATE := platform 10 | LOCAL_PRIVATE_PLATFORM_APIS := true 11 | LOCAL_PRIVILEGED_MODULE := true 12 | 13 | LOCAL_USE_AAPT2 := true 14 | 15 | LOCAL_STATIC_ANDROID_LIBRARIES := \ 16 | androidx.core_core \ 17 | androidx.preference_preference 18 | 19 | LOCAL_PROGUARD_FLAG_FILES := proguard.flags 20 | 21 | LOCAL_RESOURCE_DIR := \ 22 | $(LOCAL_PATH)/res \ 23 | $(TOP)/packages/resources/devicesettings/res 24 | 25 | ifneq ($(INCREMENTAL_BUILDS),) 26 | LOCAL_PROGUARD_ENABLED := disabled 27 | LOCAL_JACK_ENABLED := incremental 28 | endif 29 | 30 | include frameworks/base/packages/SettingsLib/common.mk 31 | 32 | include $(BUILD_PACKAGE) 33 | 34 | -------------------------------------------------------------------------------- /doze/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /doze/proguard.flags: -------------------------------------------------------------------------------- 1 | -keepclasseswithmembers class * { 2 | public (android.content.Context, android.util.AttributeSet); 3 | } 4 | 5 | -keep class ** extends android.support.v14.preference.PreferenceFragment 6 | -keep class org.lineageos.settings.doze.* { 7 | *; 8 | } 9 | -------------------------------------------------------------------------------- /doze/res/color/switch_bar_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doze/res/drawable/switchbar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doze/res/layout/doze.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /doze/res/layout/switch_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 24 | 25 | 37 | 38 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /doze/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #82000000 20 | @android:color/black 21 | 22 | -------------------------------------------------------------------------------- /doze/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | @*android:color/material_grey_600 20 | #BFFFFFFF 21 | @android:color/white 22 | 23 | -------------------------------------------------------------------------------- /doze/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 26 | 27 | 34 | 35 | 38 | 39 | 45 | 46 | 51 | 52 | 58 | 59 | -------------------------------------------------------------------------------- /doze/res/xml/doze_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 22 | 23 | 28 | 29 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 The CyanogenMod Project 3 | * Copyright (c) 2017-2021 The LineageOS Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.lineageos.settings.doze; 19 | 20 | import android.content.BroadcastReceiver; 21 | import android.content.Context; 22 | import android.content.Intent; 23 | import android.util.Log; 24 | 25 | public class BootCompletedReceiver extends BroadcastReceiver { 26 | static final String TAG = "KiwiDoze"; 27 | 28 | @Override 29 | public void onReceive(final Context context, Intent intent) { 30 | Log.d(TAG, "Booting"); 31 | Utils.checkDozeService(context); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /doze/src/org/lineageos/settings/doze/DozeSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 The CyanogenMod Project 3 | * Copyright (C) 2017 The LineageOS Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.lineageos.settings.doze; 18 | 19 | import android.os.Bundle; 20 | import android.preference.PreferenceActivity; 21 | 22 | public class DozeSettings extends PreferenceActivity { 23 | 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | 27 | getFragmentManager().beginTransaction().replace(android.R.id.content, 28 | new DozeSettingsFragment()).commit(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /extract-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2016 The CyanogenMod Project 4 | # (C) 2017 The LineageOS Project 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | set -e 20 | 21 | DEVICE=kiwi 22 | VENDOR=huawei 23 | 24 | # Load extractutils and do some sanity checks 25 | MY_DIR="${BASH_SOURCE%/*}" 26 | if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi 27 | 28 | LINEAGE_ROOT="$MY_DIR"/../../.. 29 | 30 | HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh 31 | if [ ! -f "$HELPER" ]; then 32 | echo "Unable to find helper script at $HELPER" 33 | exit 1 34 | fi 35 | . "$HELPER" 36 | 37 | if [ $# -eq 0 ]; then 38 | SRC=adb 39 | else 40 | if [ $# -eq 1 ]; then 41 | SRC=$1 42 | else 43 | echo "$0: bad number of arguments" 44 | echo "" 45 | echo "usage: $0 [PATH_TO_EXPANDED_ROM]" 46 | echo "" 47 | echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from" 48 | echo "the device using adb pull." 49 | exit 1 50 | fi 51 | fi 52 | 53 | # Initialize the helper 54 | setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" 55 | 56 | extract "$MY_DIR"/proprietary-files.txt "$SRC" 57 | 58 | "$MY_DIR"/setup-makefiles.sh 59 | -------------------------------------------------------------------------------- /fingerprint/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2017 The Android Open Source Project 3 | // Copyright (C) 2017-2020 The LineageOS Project 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | cc_binary { 17 | name: "android.hardware.biometrics.fingerprint@1.0-service.kiwi", 18 | relative_install_path: "hw", 19 | init_rc: ["android.hardware.biometrics.fingerprint@1.0-service.kiwi.rc"], 20 | srcs: ["service.cpp", "BiometricsFingerprint.cpp"], 21 | shared_libs: [ 22 | "libutils", 23 | "liblog", 24 | "libhidlbase", 25 | "libhardware", 26 | "android.hardware.biometrics.fingerprint@2.1", 27 | ], 28 | proprietary: true, 29 | } 30 | -------------------------------------------------------------------------------- /fingerprint/android.hardware.biometrics.fingerprint@1.0-service.kiwi.rc: -------------------------------------------------------------------------------- 1 | service fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@1.0-service.kiwi 2 | # "class hal" causes a race condition on some devices due to files created 3 | # in /data. As a workaround, postpone startup until later in boot once 4 | # /data is mounted. 5 | class late_start 6 | user system 7 | group system input uhid 8 | -------------------------------------------------------------------------------- /fingerprint/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source 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 "android.hardware.biometrics.fingerprint@1.0-service.kiwi" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "BiometricsFingerprint.h" 26 | 27 | using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint; 28 | using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint; 29 | using android::hardware::configureRpcThreadpool; 30 | using android::hardware::joinRpcThreadpool; 31 | using android::sp; 32 | 33 | static void setProcessTitle(char* currentTitle, const char* newTitle) { 34 | auto currentLength = std::strlen(currentTitle); 35 | auto newLength = std::strlen(newTitle); 36 | 37 | if (currentLength < newLength) { 38 | ALOGE("Cannot set new process title"); 39 | return; 40 | } 41 | 42 | std::memset(currentTitle, 0, currentLength); 43 | std::memcpy(currentTitle, newTitle, newLength); 44 | } 45 | 46 | int main(int, char** argv) { 47 | setProcessTitle(argv[0], "/system/bin/fingerprintd"); 48 | android::sp bio = BiometricsFingerprint::getInstance(); 49 | 50 | configureRpcThreadpool(1, true /*callerWillJoin*/); 51 | 52 | if (bio == nullptr) { 53 | ALOGE("Can't create instance of BiometricsFingerprint, nullptr"); 54 | } else if (bio->registerAsService() != android::OK) { 55 | ALOGE("Cannot register kiwi fingerprint service"); 56 | } 57 | 58 | joinRpcThreadpool(); 59 | 60 | return 0; // should never get here 61 | } 62 | -------------------------------------------------------------------------------- /gps/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The CyanogenMod 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 | LOCAL_PATH := $(call my-dir) 18 | 19 | include $(call all-subdir-makefiles,$(LOCAL_PATH)) 20 | -------------------------------------------------------------------------------- /gps/core/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(BUILD_TINY_ANDROID),true) 2 | 3 | LOCAL_PATH := $(call my-dir) 4 | 5 | include $(CLEAR_VARS) 6 | 7 | LOCAL_MODULE := libloc_core 8 | LOCAL_MODULE_OWNER := qcom 9 | LOCAL_VENDOR_MODULE := true 10 | 11 | LOCAL_MODULE_TAGS := optional 12 | 13 | ifeq ($(TARGET_DEVICE),apq8026_lw) 14 | LOCAL_CFLAGS += -DPDK_FEATURE_SET 15 | else ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true) 16 | LOCAL_CFLAGS += -DPDK_FEATURE_SET 17 | endif 18 | 19 | ifeq ($(QCPATH),) 20 | LOCAL_CFLAGS += -DOSS_BUILD 21 | endif 22 | 23 | LOCAL_SHARED_LIBRARIES := \ 24 | liblog \ 25 | libutils \ 26 | libcutils \ 27 | libgps.utils \ 28 | libdl 29 | 30 | LOCAL_SRC_FILES += \ 31 | LocApiBase.cpp \ 32 | LocAdapterBase.cpp \ 33 | ContextBase.cpp \ 34 | LocDualContext.cpp \ 35 | loc_core_log.cpp 36 | 37 | LOCAL_CFLAGS += \ 38 | -fno-short-enums \ 39 | -D_ANDROID_ \ 40 | -Wno-unused-parameter 41 | 42 | LOCAL_C_INCLUDES:= \ 43 | $(TARGET_OUT_HEADERS)/gps.utils \ 44 | $(TARGET_OUT_HEADERS)/libflp 45 | 46 | LOCAL_COPY_HEADERS_TO:= libloc_core/ 47 | LOCAL_COPY_HEADERS:= \ 48 | LocApiBase.h \ 49 | LocAdapterBase.h \ 50 | ContextBase.h \ 51 | LocDualContext.h \ 52 | LBSProxyBase.h \ 53 | UlpProxyBase.h \ 54 | gps_extended_c.h \ 55 | gps_extended.h \ 56 | loc_core_log.h \ 57 | LocAdapterProxyBase.h 58 | 59 | LOCAL_PRELINK_MODULE := false 60 | 61 | include $(BUILD_SHARED_LIBRARY) 62 | 63 | endif # not BUILD_TINY_ANDROID 64 | -------------------------------------------------------------------------------- /gps/core/loc_core_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_CORE_LOG_H 31 | #define LOC_CORE_LOG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" 35 | { 36 | #endif 37 | 38 | #include 39 | #include 40 | 41 | const char* loc_get_gps_status_name(GpsStatusValue gps_status); 42 | const char* loc_get_position_mode_name(GpsPositionMode mode); 43 | const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur); 44 | const char* loc_get_aiding_data_mask_names(GpsAidingData data); 45 | const char* loc_get_agps_type_name(AGpsType type); 46 | const char* loc_get_ni_type_name(GpsNiType type); 47 | const char* loc_get_ni_response_name(GpsUserResponseType response); 48 | const char* loc_get_ni_encoding_name(GpsNiEncodingType 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(AGpsStatusValue status); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* LOC_CORE_LOG_H */ 59 | -------------------------------------------------------------------------------- /gps/flp.conf: -------------------------------------------------------------------------------- 1 | ################################### 2 | ##### FLP settings ##### 3 | ################################### 4 | 5 | ################################### 6 | # FLP BATCHING SIZE 7 | ################################### 8 | # The number of batched locations 9 | # requested to modem. The desired number 10 | # defined below may not be satisfied, as 11 | # the modem can only return the number 12 | # of batched locations that can be allocated, 13 | # which is limited by memory. The default 14 | # batch size defined as 20 as below. 15 | BATCH_SIZE=20 16 | 17 | ################################### 18 | # FLP BATCHING SESSION TIMEOUT 19 | ################################### 20 | # Duration with which batch session timeout 21 | # happens in milliseconds. If not specified 22 | # or set to zero, batching session timeout 23 | # defaults to 20 seconds by the modem. 24 | # BATCH_SESSION_TIMEOUT=20000 25 | 26 | ################################### 27 | # FLP CAPABILITIES BIT MASK 28 | ################################### 29 | # GEOFENCE = 0x01 30 | # BATCHING = 0x02 31 | # default = GEOFENCE | BATCHING 32 | CAPABILITIES=0x03 33 | 34 | ################################### 35 | # FLP BATCHING ACCURACY 36 | ################################### 37 | # Set to one of the defined values below 38 | # to define the accuracy of batching. 39 | # If not specified, accuracy defaults 40 | # to LOW. 41 | # FLP BATCHING ACCURACY values: 42 | # Low accuracy = 0 43 | # Medium accuracy = 1 44 | # High accuracy = 2 45 | ACCURACY=1 46 | 47 | ################################### 48 | # FLP GEOFENCE RESPONSIVENESS 49 | ################################### 50 | # If set to one of the defined values below, 51 | # it will override the responsiveness for 52 | # FLP geofence, which implements the fused 53 | # location API. If not set to a value defined 54 | # below, which is default, it will not 55 | # override the responsivness. 56 | # FLP_GEOFENCE_RESPONSIVENESS_OVERRIDE Values: 57 | # 1: LOW responsiveness 58 | # 2: MEDIUM responsiveness 59 | # 3: HIGH responsiveness 60 | FLP_GEOFENCE_RESPONSIVENESS_OVERRIDE = 0 61 | -------------------------------------------------------------------------------- /gps/loc_api/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 The CyanogenMod 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 | LOCAL_PATH := $(call my-dir) 18 | 19 | include $(call all-subdir-makefiles,$(LOCAL_PATH)) 20 | -------------------------------------------------------------------------------- /gps/loc_api/ds_api/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(QCPATH),) 2 | ifneq ($(BUILD_TINY_ANDROID),true) 3 | 4 | LOCAL_PATH := $(call my-dir) 5 | 6 | include $(CLEAR_VARS) 7 | 8 | LOCAL_MODULE := libloc_ds_api 9 | 10 | LOCAL_MODULE_TAGS := optional 11 | 12 | LOCAL_SHARED_LIBRARIES := \ 13 | libutils \ 14 | libcutils \ 15 | libqmi_cci \ 16 | libqmi_common_so \ 17 | libgps.utils \ 18 | libdsi_netctrl \ 19 | libqmiservices 20 | 21 | LOCAL_SRC_FILES += \ 22 | ds_client.c 23 | 24 | LOCAL_CFLAGS += \ 25 | -fno-short-enums \ 26 | -D_ANDROID_ 27 | 28 | LOCAL_COPY_HEADERS_TO:= libloc_ds_api/ 29 | 30 | LOCAL_COPY_HEADERS:= \ 31 | ds_client.h 32 | 33 | LOCAL_LDFLAGS += -Wl,--export-dynamic 34 | 35 | ## Includes 36 | LOCAL_C_INCLUDES := \ 37 | $(TARGET_OUT_HEADERS)/libloc_eng \ 38 | $(TARGET_OUT_HEADERS)/qmi-framework/inc \ 39 | $(TARGET_OUT_HEADERS)/qmi/inc \ 40 | $(TARGET_OUT_HEADERS)/gps.utils \ 41 | $(TARGET_OUT_HEADERS)/data/inc 42 | 43 | 44 | LOCAL_PRELINK_MODULE := false 45 | 46 | include $(BUILD_SHARED_LIBRARY) 47 | 48 | endif # not BUILD_TINY_ANDROID 49 | endif # QCPATH 50 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(BUILD_TINY_ANDROID),true) 2 | #Compile this library only for builds with the latest modem image 3 | 4 | LOCAL_PATH := $(call my-dir) 5 | 6 | include $(CLEAR_VARS) 7 | 8 | LOCAL_MODULE := libloc_eng 9 | LOCAL_MODULE_OWNER := qcom 10 | LOCAL_VENDOR_MODULE := true 11 | 12 | LOCAL_MODULE_TAGS := optional 13 | 14 | LOCAL_SHARED_LIBRARIES := \ 15 | libutils \ 16 | libcutils \ 17 | libdl \ 18 | liblog \ 19 | libloc_core \ 20 | libgps.utils \ 21 | libprocessgroup 22 | 23 | LOCAL_SRC_FILES += \ 24 | loc_eng.cpp \ 25 | loc_eng_agps.cpp \ 26 | loc_eng_xtra.cpp \ 27 | loc_eng_ni.cpp \ 28 | loc_eng_log.cpp \ 29 | loc_eng_nmea.cpp \ 30 | LocEngAdapter.cpp 31 | 32 | LOCAL_SRC_FILES += \ 33 | loc_eng_dmn_conn.cpp \ 34 | loc_eng_dmn_conn_handler.cpp \ 35 | loc_eng_dmn_conn_thread_helper.c \ 36 | loc_eng_dmn_conn_glue_msg.c \ 37 | loc_eng_dmn_conn_glue_pipe.c 38 | 39 | LOCAL_CFLAGS += \ 40 | -fno-short-enums \ 41 | -D_ANDROID_ 42 | 43 | ifeq ($(QCPATH),) 44 | LOCAL_CFLAGS += -DOSS_BUILD 45 | endif 46 | 47 | LOCAL_C_INCLUDES:= \ 48 | $(TARGET_OUT_HEADERS)/gps.utils \ 49 | $(TARGET_OUT_HEADERS)/libloc_core \ 50 | $(LOCAL_PATH) \ 51 | $(TARGET_OUT_HEADERS)/libflp 52 | 53 | LOCAL_COPY_HEADERS_TO:= libloc_eng/ 54 | LOCAL_COPY_HEADERS:= \ 55 | LocEngAdapter.h \ 56 | loc.h \ 57 | loc_eng.h \ 58 | loc_eng_xtra.h \ 59 | loc_eng_ni.h \ 60 | loc_eng_agps.h \ 61 | loc_eng_msg.h \ 62 | loc_eng_log.h 63 | 64 | LOCAL_PRELINK_MODULE := false 65 | 66 | include $(BUILD_SHARED_LIBRARY) 67 | 68 | include $(CLEAR_VARS) 69 | 70 | LOCAL_MODULE := gps.$(TARGET_BOARD_PLATFORM) 71 | LOCAL_MODULE_OWNER := qcom 72 | LOCAL_VENDOR_MODULE := true 73 | 74 | LOCAL_MODULE_TAGS := optional 75 | 76 | ## Libs 77 | 78 | LOCAL_SHARED_LIBRARIES := \ 79 | libutils \ 80 | libcutils \ 81 | liblog \ 82 | libloc_eng \ 83 | libloc_core \ 84 | libgps.utils \ 85 | libdl \ 86 | libprocessgroup 87 | 88 | ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false) 89 | endif 90 | 91 | LOCAL_SRC_FILES += \ 92 | loc.cpp \ 93 | gps.c 94 | 95 | LOCAL_CFLAGS += \ 96 | -fno-short-enums \ 97 | -D_ANDROID_ \ 98 | -Wno-unused-parameter 99 | 100 | ifeq ($(TARGET_USES_QCOM_BSP), true) 101 | LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP 102 | endif 103 | 104 | ifeq ($(QCPATH),) 105 | LOCAL_CFLAGS += -DOSS_BUILD 106 | endif 107 | 108 | ## Includes 109 | LOCAL_C_INCLUDES:= \ 110 | $(TARGET_OUT_HEADERS)/gps.utils \ 111 | $(TARGET_OUT_HEADERS)/libloc_core \ 112 | $(TARGET_OUT_HEADERS)/libflp 113 | 114 | LOCAL_PRELINK_MODULE := false 115 | LOCAL_MODULE_RELATIVE_PATH := hw 116 | 117 | include $(BUILD_SHARED_LIBRARY) 118 | 119 | endif # not BUILD_TINY_ANDROID 120 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | -I../../utils \ 3 | -I../../platform_lib_abstractions \ 4 | -fno-short-enums \ 5 | -DFEATURE_GNSS_BIT_API 6 | 7 | libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp 8 | 9 | if USE_GLIB 10 | libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 11 | libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 12 | libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 13 | else 14 | libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) 15 | libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 16 | libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 17 | endif 18 | libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la 19 | 20 | 21 | libloc_eng_so_la_SOURCES = \ 22 | loc_eng.cpp \ 23 | loc_eng_agps.cpp \ 24 | loc_eng_xtra.cpp \ 25 | loc_eng_ni.cpp \ 26 | loc_eng_log.cpp \ 27 | loc_eng_dmn_conn.cpp \ 28 | loc_eng_dmn_conn_handler.cpp \ 29 | loc_eng_dmn_conn_thread_helper.c \ 30 | loc_eng_dmn_conn_glue_msg.c \ 31 | loc_eng_dmn_conn_glue_pipe.c 32 | 33 | 34 | if USE_GLIB 35 | libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 36 | libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 37 | libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 38 | else 39 | libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) 40 | libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 41 | libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 42 | endif 43 | 44 | libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la 45 | 46 | 47 | libgps_default_so_la_SOURCES = \ 48 | loc.cpp \ 49 | gps.c 50 | 51 | if USE_GLIB 52 | libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 53 | libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 54 | libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 55 | else 56 | libgps_default_so_la_CFLAGS = $(AM_CFLAGS) 57 | libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 58 | libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 59 | endif 60 | 61 | libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la 62 | 63 | library_include_HEADERS = \ 64 | LocEngAdapter.h \ 65 | loc.h \ 66 | loc_eng.h \ 67 | loc_eng_xtra.h \ 68 | loc_eng_ni.h \ 69 | loc_eng_agps.h \ 70 | loc_eng_msg.h \ 71 | loc_eng_log.h 72 | 73 | library_includedir = $(pkgincludedir)/libloc_api_50001 74 | 75 | #Create and Install libraries 76 | lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la 77 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/gps.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011,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 | #include 31 | 32 | #include 33 | #include 34 | 35 | extern const GpsInterface* get_gps_interface(); 36 | 37 | const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev) 38 | { 39 | return get_gps_interface(); 40 | } 41 | 42 | static int open_gps(const struct hw_module_t* module, char const* name, 43 | struct hw_device_t** device) 44 | { 45 | struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t)); 46 | 47 | if(dev == NULL) 48 | return -1; 49 | 50 | memset(dev, 0, sizeof(*dev)); 51 | 52 | dev->common.tag = HARDWARE_DEVICE_TAG; 53 | dev->common.version = 0; 54 | dev->common.module = (struct hw_module_t*)module; 55 | dev->get_gps_interface = gps__get_gps_interface; 56 | 57 | *device = (struct hw_device_t*)dev; 58 | return 0; 59 | } 60 | 61 | static struct hw_module_methods_t gps_module_methods = { 62 | .open = open_gps 63 | }; 64 | 65 | struct hw_module_t HAL_MODULE_INFO_SYM = { 66 | .tag = HARDWARE_MODULE_TAG, 67 | .module_api_version = 1, 68 | .hal_api_version = 0, 69 | .id = GPS_HARDWARE_MODULE_ID, 70 | .name = "loc_api GPS Module", 71 | .author = "Qualcomm USA, Inc.", 72 | .methods = &gps_module_methods, 73 | }; 74 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011,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 | 30 | #ifndef __LOC_H__ 31 | #define __LOC_H__ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif /* __cplusplus */ 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #define XTRA_DATA_MAX_SIZE 100000 /*bytes*/ 43 | 44 | typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt); 45 | typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt); 46 | typedef void* (*loc_ext_parser)(void* data); 47 | 48 | typedef struct { 49 | loc_location_cb_ext location_cb; 50 | gps_status_callback status_cb; 51 | loc_sv_status_cb_ext sv_status_cb; 52 | gps_nmea_callback nmea_cb; 53 | gps_set_capabilities set_capabilities_cb; 54 | gps_acquire_wakelock acquire_wakelock_cb; 55 | gps_release_wakelock release_wakelock_cb; 56 | gps_create_thread create_thread_cb; 57 | loc_ext_parser location_ext_parser; 58 | loc_ext_parser sv_ext_parser; 59 | gps_request_utc_time request_utc_time_cb; 60 | } LocCallbacks; 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif /* __cplusplus */ 65 | 66 | #endif //__LOC_H__ 67 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_dmn_conn.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-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_ENG_DATA_SERVER_H 30 | #define LOC_ENG_DATA_SERVER_H 31 | 32 | #include "loc_eng_dmn_conn_thread_helper.h" 33 | 34 | #ifdef _ANDROID_ 35 | 36 | #define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q" 37 | #define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q" 38 | #define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q" 39 | #define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q" 40 | #define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q" 41 | 42 | #else 43 | 44 | #define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q" 45 | #define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q" 46 | #define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q" 47 | #define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q" 48 | #define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q" 49 | 50 | #endif 51 | 52 | int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb, 53 | const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle); 54 | int loc_eng_dmn_conn_loc_api_server_unblock(void); 55 | int loc_eng_dmn_conn_loc_api_server_join(void); 56 | int loc_eng_dmn_conn_loc_api_server_data_conn(int, int); 57 | 58 | #endif /* LOC_ENG_DATA_SERVER_H */ 59 | 60 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, 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_ENG_DMN_CONN_GLUE_MSG_H 30 | #define LOC_ENG_DMN_CONN_GLUE_MSG_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif /* __cplusplus */ 35 | 36 | 37 | #include 38 | #include "loc_eng_dmn_conn_glue_pipe.h" 39 | 40 | int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode); 41 | int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid); 42 | int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz); 43 | int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz); 44 | int loc_eng_dmn_conn_glue_msgflush(int msgqid); 45 | int loc_eng_dmn_conn_glue_msgunblock(int msgqid); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif /* __cplusplus */ 50 | 51 | #endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */ 52 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, 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_ENG_DMN_CONN_GLUE_PIPE_H 30 | #define LOC_ENG_DMN_CONN_GLUE_PIPE_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif /* __cplusplus */ 35 | 36 | #include 37 | 38 | int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode); 39 | int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd); 40 | int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz); 41 | int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz); 42 | 43 | int loc_eng_dmn_conn_glue_pipeflush(int fd); 44 | int loc_eng_dmn_conn_glue_pipeunblock(int fd); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif /* __cplusplus */ 49 | 50 | #endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */ 51 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_log.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #define LOG_NDDEBUG 0 31 | #define LOG_TAG "LocSvc_eng" 32 | 33 | #include "loc_log.h" 34 | #include "loc_eng_log.h" 35 | 36 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_ENG_LOG_H 31 | #define LOC_ENG_LOG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" 35 | { 36 | #endif 37 | 38 | #include 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* LOC_ENG_LOG_H */ 45 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_ni.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009,2011,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 | 30 | #ifndef LOC_ENG_NI_H 31 | #define LOC_ENG_NI_H 32 | 33 | #include 34 | #include 35 | 36 | #define LOC_NI_NO_RESPONSE_TIME 20 /* secs */ 37 | #define LOC_NI_NOTIF_KEY_ADDRESS "Address" 38 | #define GPS_NI_RESPONSE_IGNORE 4 39 | 40 | typedef struct { 41 | pthread_t thread; /* NI thread */ 42 | int respTimeLeft; /* examine time for NI response */ 43 | bool respRecvd; /* NI User reponse received or not from Java layer*/ 44 | void* rawRequest; 45 | int reqID; /* ID to check against response */ 46 | GpsUserResponseType resp; 47 | pthread_cond_t tCond; 48 | pthread_mutex_t tLock; 49 | LocEngAdapter* adapter; 50 | } loc_eng_ni_session_s_type; 51 | 52 | typedef struct { 53 | loc_eng_ni_session_s_type session; /* SUPL NI Session */ 54 | loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */ 55 | int reqIDCounter; 56 | } loc_eng_ni_data_s_type; 57 | 58 | 59 | #endif /* LOC_ENG_NI_H */ 60 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_nmea.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_ENG_NMEA_H 31 | #define LOC_ENG_NMEA_H 32 | 33 | #include 34 | #include 35 | 36 | #define NMEA_SENTENCE_MAX_LENGTH 200 37 | 38 | void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p); 39 | int loc_eng_nmea_put_checksum(char *pNmea, int maxSize); 40 | void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const QcomSvStatus &svStatus, const GpsLocationExtended &locationExtended); 41 | void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea); 42 | 43 | #endif // LOC_ENG_NMEA_H 44 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_xtra.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009,2011 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_ENG_XTRA_H 31 | #define LOC_ENG_XTRA_H 32 | 33 | #include 34 | 35 | // Module data 36 | typedef struct 37 | { 38 | // loc_eng_ioctl_cb_data_s_type ioctl_cb_data; 39 | gps_xtra_download_request download_request_cb; 40 | report_xtra_server report_xtra_server_cb; 41 | 42 | // XTRA data buffer 43 | char *xtra_data_for_injection; // NULL if no pending data 44 | int xtra_data_len; 45 | } loc_eng_xtra_data_s_type; 46 | 47 | #endif // LOC_ENG_XTRA_H 48 | -------------------------------------------------------------------------------- /gps/sap.conf: -------------------------------------------------------------------------------- 1 | ################################ 2 | # Sensor Settings 3 | ################################ 4 | #The following parameters are optional. 5 | #Internal defaults support MEMS sensors 6 | #native to most handset devices. 7 | #Device specific sensor characterization 8 | #for improved performance is possible as 9 | #described in SAP application notes. 10 | #GYRO_BIAS_RANDOM_WALK= 11 | #ACCEL_RANDOM_WALK_SPECTRAL_DENSITY= 12 | #ANGLE_RANDOM_WALK_SPECTRAL_DENSITY= 13 | #RATE_RANDOM_WALK_SPECTRAL_DENSITY= 14 | #VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY= 15 | 16 | # Sensor Sampling Rate Parameters for Low-Data Rate Filter (should be greater than 0) 17 | # used in loc_eng_reinit 18 | SENSOR_ACCEL_BATCHES_PER_SEC=2 19 | SENSOR_ACCEL_SAMPLES_PER_BATCH=5 20 | SENSOR_GYRO_BATCHES_PER_SEC=2 21 | SENSOR_GYRO_SAMPLES_PER_BATCH=5 22 | # Sensor Sampling Rate Parameters for High-Data Rate Filter (should be greater than 0) 23 | SENSOR_ACCEL_BATCHES_PER_SEC_HIGH=4 24 | SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH=25 25 | SENSOR_GYRO_BATCHES_PER_SEC_HIGH=4 26 | SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH=25 27 | 28 | # Sensor Control Mode (0=AUTO, 1=FORCE_ON) 29 | # used in loc_eng_reinit 30 | SENSOR_CONTROL_MODE=0 31 | 32 | # Enable or Disable Sensors for GPS use (0=Enable, 1=Disable) 33 | # used in loc_eng_reinit 34 | SENSOR_USAGE=1 35 | 36 | # Choose GSIFF sensor provider (1=Snapdragon Sensors Core, 2=Android NDK) 37 | SENSOR_PROVIDER=1 38 | 39 | # Bit mask used to define which sensor algorithms are used. 40 | # Setting each bit has the following definition: 41 | # 0x1 - DISABLE_INS_POSITIONING_FILTER 42 | # 0x0 - ENABLE_INS_POSITIONING_FILTER 43 | SENSOR_ALGORITHM_CONFIG_MASK=0x1 44 | 45 | # Time source used by Sensor HAL 46 | # Setting this value controls accuracy of location sensor services. 47 | # 0 - Unknown 48 | # 1 - CLOCK_BOOTTIME 49 | # 2 - CLOCK_MONOTONIC 50 | # 3 - CLOCK_REALTIME 51 | # 4 - CLOCK_BOOTTIME using Alarm timer interface 52 | NDK_PROVIDER_TIME_SOURCE=1 53 | 54 | -------------------------------------------------------------------------------- /gps/utils/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(BUILD_TINY_ANDROID),true) 2 | #Compile this library only for builds with the latest modem image 3 | 4 | LOCAL_PATH := $(call my-dir) 5 | 6 | include $(CLEAR_VARS) 7 | 8 | ## Libs 9 | LOCAL_SHARED_LIBRARIES := \ 10 | libutils \ 11 | libcutils \ 12 | liblog \ 13 | libprocessgroup 14 | 15 | LOCAL_SRC_FILES += \ 16 | loc_log.cpp \ 17 | loc_cfg.cpp \ 18 | msg_q.c \ 19 | linked_list.c \ 20 | loc_target.cpp \ 21 | platform_lib_abstractions/elapsed_millis_since_boot.cpp \ 22 | LocHeap.cpp \ 23 | LocTimer.cpp \ 24 | LocThread.cpp \ 25 | MsgTask.cpp \ 26 | loc_misc_utils.cpp 27 | 28 | # Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true 29 | LOCAL_CFLAGS += \ 30 | -fno-short-enums \ 31 | -D_ANDROID_ 32 | 33 | ifeq ($(TARGET_BUILD_VARIANT),user) 34 | LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER 35 | endif 36 | 37 | LOCAL_LDFLAGS += -Wl,--export-dynamic 38 | 39 | ## Includes 40 | LOCAL_C_INCLUDES:= \ 41 | $(LOCAL_PATH)/platform_lib_abstractions 42 | 43 | LOCAL_COPY_HEADERS_TO:= gps.utils/ 44 | LOCAL_COPY_HEADERS:= \ 45 | loc_log.h \ 46 | loc_cfg.h \ 47 | log_util.h \ 48 | linked_list.h \ 49 | msg_q.h \ 50 | MsgTask.h \ 51 | LocHeap.h \ 52 | LocThread.h \ 53 | LocTimer.h \ 54 | loc_target.h \ 55 | loc_timer.h \ 56 | LocSharedLock.h \ 57 | platform_lib_abstractions/platform_lib_includes.h \ 58 | platform_lib_abstractions/platform_lib_time.h \ 59 | platform_lib_abstractions/platform_lib_macros.h \ 60 | loc_misc_utils.h 61 | 62 | LOCAL_MODULE := libgps.utils 63 | LOCAL_MODULE_OWNER := qcom 64 | LOCAL_VENDOR_MODULE := true 65 | 66 | LOCAL_MODULE_TAGS := optional 67 | 68 | LOCAL_PRELINK_MODULE := false 69 | 70 | include $(BUILD_SHARED_LIBRARY) 71 | endif # not BUILD_TINY_ANDROID 72 | -------------------------------------------------------------------------------- /gps/utils/LocSharedLock.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 | #ifndef __LOC_SHARED_LOCK__ 30 | #define __LOC_SHARED_LOCK__ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | // This is a utility created for use cases such that there are more than 37 | // one client who need to share the same lock, but it is not predictable 38 | // which of these clients is to last to go away. This shared lock deletes 39 | // itself when the last client calls its drop() method. To add a cient, 40 | // this share lock's share() method has to be called, so that the obj 41 | // can maintain an accurate client count. 42 | class LocSharedLock { 43 | volatile int32_t mRef; 44 | pthread_mutex_t mMutex; 45 | inline ~LocSharedLock() { pthread_mutex_destroy(&mMutex); } 46 | public: 47 | // first client to create this LockSharedLock 48 | inline LocSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); } 49 | // following client(s) are to *share()* this lock created by the first client 50 | inline LocSharedLock* share() { android_atomic_inc(&mRef); return this; } 51 | // whe a client no longer needs this shared lock, drop() shall be called. 52 | inline void drop() { if (1 == android_atomic_dec(&mRef)) delete this; } 53 | // locking the lock to enter critical section 54 | inline void lock() { pthread_mutex_lock(&mMutex); } 55 | // unlocking the lock to leave the critical section 56 | inline void unlock() { pthread_mutex_unlock(&mMutex); } 57 | }; 58 | 59 | #endif //__LOC_SHARED_LOCK__ 60 | -------------------------------------------------------------------------------- /gps/utils/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -Wundef \ 2 | -MD \ 3 | -Wno-trigraphs \ 4 | -g -O0 \ 5 | -fno-inline \ 6 | -fno-short-enums \ 7 | -fpic \ 8 | -I../platform_lib_abstractions 9 | 10 | libgps_utils_so_la_h_sources = log_util.h \ 11 | msg_q.h \ 12 | linked_list.h \ 13 | loc_cfg.h \ 14 | loc_log.h \ 15 | ../platform_lib_abstractions/platform_lib_includes.h \ 16 | ../platform_lib_abstractions/platform_lib_time.h \ 17 | ../platform_lib_abstractions/platform_lib_macros.h 18 | 19 | libgps_utils_so_la_c_sources = linked_list.c \ 20 | msg_q.c \ 21 | loc_cfg.cpp \ 22 | loc_log.cpp \ 23 | ../platform_lib_abstractions/elapsed_millis_since_boot.cpp 24 | 25 | library_includedir = $(pkgincludedir)/utils 26 | 27 | library_include_HEADERS = $(libgps_utils_so_la_h_sources) 28 | 29 | libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources) 30 | 31 | if USE_GLIB 32 | libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ 33 | libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 34 | libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ 35 | else 36 | libgps_utils_so_la_CFLAGS = $(AM_CFLAGS) 37 | libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 38 | libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) 39 | endif 40 | 41 | libgps_utils_so_la_LIBADD = -lstdc++ -lcutils 42 | 43 | #Create and Install libraries 44 | lib_LTLIBRARIES = libgps_utils_so.la 45 | -------------------------------------------------------------------------------- /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/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/platform_lib_abstractions/elapsed_millis_since_boot.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include 30 | #include 31 | #include "platform_lib_time.h" 32 | 33 | int64_t systemTime(int /*clock*/) 34 | { 35 | struct timeval t; 36 | t.tv_sec = t.tv_usec = 0; 37 | gettimeofday(&t, NULL); 38 | return t.tv_sec*1000000LL + t.tv_usec; 39 | } 40 | 41 | 42 | int64_t elapsedMillisSinceBoot() 43 | { 44 | int64_t t_us = systemTime(0); 45 | return (int64_t) t_us / 1000LL; 46 | } 47 | -------------------------------------------------------------------------------- /gps/utils/platform_lib_abstractions/platform_lib_includes.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef _PLATFORM_LIB_INCLUDES_H_ 30 | #define _PLATFORM_LIB_INCLUDES_H_ 31 | 32 | #include "platform_lib_time.h" 33 | #include "platform_lib_macros.h" 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /gps/utils/platform_lib_abstractions/platform_lib_time.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef _PLATFORM_LIB_TIME_H_ 30 | #define _PLATFORM_LIB_TIME_H_ 31 | 32 | int64_t systemTime(int clock); 33 | int64_t elapsedMillisSinceBoot(); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /init/Android.bp: -------------------------------------------------------------------------------- 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 | cc_library_static { 17 | name: "libinit_kiwi", 18 | recovery_available: true, 19 | srcs: ["init_kiwi.cpp"], 20 | include_dirs: [ 21 | "system/core/base/include", 22 | "system/core/init", 23 | ], 24 | static_libs: [ 25 | "libbase", 26 | ], 27 | cflags: ["-Wall"] 28 | } 29 | -------------------------------------------------------------------------------- /keylayout/cyttsp5_mt.kl: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 The CyanogenMod 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 | key 59 WAKEUP VIRTUAL 16 | -------------------------------------------------------------------------------- /keylayout/goodix.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013, The Linux Foundation. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are 5 | # met: 6 | # * Redistributions of source code must retain the above copyright 7 | # notice, this list of conditions and the following disclaimer. 8 | # * Redistributions in binary form must reproduce the above 9 | # copyright notice, this list of conditions and the following 10 | # disclaimer in the documentation and/or other materials provided 11 | # with the distribution. 12 | # * Neither the name of The Linux Foundation nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | 27 | key 139 MENU VIRTUAL 28 | key 102 HOME VIRTUAL 29 | key 158 BACK VIRTUAL 30 | key 116 POWER 31 | -------------------------------------------------------------------------------- /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 | 27 | key 115 VOLUME_UP 28 | key 114 VOLUME_DOWN 29 | key 102 HOME 30 | key 528 FOCUS 31 | key 766 CAMERA 32 | -------------------------------------------------------------------------------- /libhidl/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2017 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 | include $(CLEAR_VARS) 17 | LOCAL_SHARED_LIBRARIES := libhidltransport 18 | LOCAL_MODULE := android.hidl.base@1.0 19 | LOCAL_MODULE_TAGS := optional 20 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 21 | include $(BUILD_SHARED_LIBRARY) 22 | 23 | include $(CLEAR_VARS) 24 | LOCAL_SHARED_LIBRARIES := libhidltransport 25 | LOCAL_MODULE := android.hidl.manager@1.0 26 | LOCAL_MODULE_TAGS := optional 27 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 28 | include $(BUILD_SHARED_LIBRARY) 29 | -------------------------------------------------------------------------------- /libshims/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 The CyanogenMod Project 2 | // Copyright (C) 2020 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 | cc_library_shared { 17 | name: "libshim_cutils", 18 | srcs: [ 19 | "hw_cutils.c", 20 | "hw_log.c", 21 | ], 22 | 23 | } 24 | 25 | cc_library_shared { 26 | name: "libshim_signinfolistener", 27 | srcs: ["icu55.c"], 28 | shared_libs: [ 29 | "libandroidicu", 30 | ], 31 | 32 | compile_multilib: "32", 33 | } 34 | -------------------------------------------------------------------------------- /libshims/hw_cutils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The CyanogenMod 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 | #ifdef HW_LIBC_DEBUG 18 | #define LOG_TAG "HWAppInfo" 19 | #include 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /* 28 | * References in kernel: 29 | * fs/proc/app_info.c 30 | * include/misc/app_info.h 31 | */ 32 | 33 | #define APP_INFO_PATH "/proc/app_info" 34 | #define APP_INFO_VALUE_LENGTH 32 35 | 36 | int get_app_info(char* key, char* value) { 37 | char buf[128] = { 0 }; 38 | char* tok; 39 | FILE* f; 40 | 41 | #ifdef HW_LIBC_DEBUG 42 | ALOGI("Getting App Info for %s", key); 43 | #endif 44 | 45 | if(key == NULL) { 46 | #ifdef HW_LIBC_DEBUG 47 | ALOGE("Key is null"); 48 | #endif 49 | return -1; 50 | } 51 | 52 | f = fopen(APP_INFO_PATH, "rb"); 53 | if(f == NULL) { 54 | #ifdef HW_LIBC_DEBUG 55 | ALOGE("Failed to open %s: %s", APP_INFO_PATH, strerror(errno)); 56 | #endif 57 | return -2; 58 | } 59 | 60 | while (!feof(f)) { 61 | if (fgets(buf, 128, f) != NULL && 62 | strstr(buf, key) != NULL) { 63 | tok = strchr(buf, ':'); 64 | if (tok != NULL) 65 | tok = strtok(tok, ": "); 66 | if (tok != NULL) { 67 | snprintf(value, APP_INFO_VALUE_LENGTH, "%s", tok); 68 | strtok(value, "\n"); 69 | } 70 | break; 71 | } 72 | } 73 | 74 | fclose(f); 75 | 76 | #ifdef HW_LIBC_DEBUG 77 | ALOGI("%s=%s", key, value); 78 | #endif 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /libshims/hw_log.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The CyanogenMod 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 | void __android_logPower_print(void) { 18 | } 19 | 20 | int __android_janklog_print(void) { 21 | return 0; 22 | } 23 | 24 | int __android_log_exception_write(void) { 25 | return 0; 26 | } 27 | 28 | int isLogEnabled(void) { 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /libshims/icu55.c: -------------------------------------------------------------------------------- 1 | #include "unicode/ucnv.h" 2 | 3 | U_STABLE UConverter* U_EXPORT2 4 | ucnv_open_55(const char *converterName, UErrorCode *err) 5 | { 6 | return ucnv_open(converterName, err); 7 | } 8 | 9 | U_STABLE void U_EXPORT2 10 | ucnv_close_55(UConverter * converter) 11 | { 12 | return ucnv_close(converter); 13 | } 14 | 15 | U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP_55( 16 | const void *context, 17 | UConverterFromUnicodeArgs *fromUArgs, 18 | const UChar* codeUnits, 19 | int32_t length, 20 | UChar32 codePoint, 21 | UConverterCallbackReason reason, 22 | UErrorCode * err) 23 | { 24 | UCNV_FROM_U_CALLBACK_STOP (context, fromUArgs, codeUnits, length, codePoint, reason, err); 25 | } 26 | 27 | U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP_55( 28 | const void *context, 29 | UConverterToUnicodeArgs *toUArgs, 30 | const char* codeUnits, 31 | int32_t length, 32 | UConverterCallbackReason reason, 33 | UErrorCode * err) { 34 | UCNV_TO_U_CALLBACK_STOP (context, toUArgs, codeUnits, length, reason, err); 35 | } 36 | 37 | U_STABLE void U_EXPORT2 38 | ucnv_setToUCallBack_55(UConverter * converter, 39 | UConverterToUCallback newAction, 40 | const void* newContext, 41 | UConverterToUCallback *oldAction, 42 | const void** oldContext, 43 | UErrorCode * err) 44 | { 45 | ucnv_setToUCallBack(converter, newAction, newContext, oldAction, oldContext, err); 46 | } 47 | 48 | U_STABLE void U_EXPORT2 49 | ucnv_setFromUCallBack_55(UConverter * converter, 50 | UConverterFromUCallback newAction, 51 | const void *newContext, 52 | UConverterFromUCallback *oldAction, 53 | const void **oldContext, 54 | UErrorCode * err) 55 | { 56 | ucnv_setFromUCallBack(converter, newAction, newContext, oldAction, oldContext, err); 57 | } 58 | 59 | U_STABLE void U_EXPORT2 60 | ucnv_convertEx_55(UConverter *targetCnv, UConverter *sourceCnv, 61 | char **target, const char *targetLimit, 62 | const char **source, const char *sourceLimit, 63 | UChar *pivotStart, UChar **pivotSource, 64 | UChar **pivotTarget, const UChar *pivotLimit, 65 | UBool reset, UBool flush, 66 | UErrorCode *pErrorCode) 67 | { 68 | ucnv_convertEx(targetCnv, sourceCnv, target, targetLimit, source, sourceLimit, 69 | pivotStart, pivotSource, pivotTarget, pivotLimit, reset, flush, 70 | pErrorCode); 71 | } 72 | -------------------------------------------------------------------------------- /libwcnss_qmi/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Rudolf Tammekivi 3 | // Copyright (C) 2020 The LineageOS Project 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see [http://www.gnu.org/licenses/]. 17 | // 18 | 19 | cc_library_shared { 20 | name: "libwcnss_qmi", 21 | 22 | shared_libs: [ 23 | "libdl", 24 | "liblog", 25 | ], 26 | 27 | srcs: ["wcnss_qmi.c"], 28 | 29 | cflags: ["-Wall"], 30 | } 31 | -------------------------------------------------------------------------------- /libwcnss_qmi/wcnss_qmi.h: -------------------------------------------------------------------------------- 1 | #ifndef _WCNSS_QMI_H_ 2 | #define _WCNSS_QMI_H_ 3 | 4 | #define RMT_OEMINFO_WIFI_MAC_ENC 0x34 5 | #define MAC_SIZE 6 6 | 7 | #define OEM_INFO_LIB_NAME "liboeminfo.so" 8 | #define HUAWEI_SECURE_LIB_NAME "libhuawei_secure.so" 9 | 10 | /* libhuawei_secure.so */ 11 | struct otp_key { 12 | uint8_t key1[0x104]; 13 | uint8_t key2[0x104]; 14 | } __attribute__((packed)); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /light/Android.bp: -------------------------------------------------------------------------------- 1 | soong_namespace { 2 | imports: [ 3 | "vendor/huawei/kiwi", 4 | ], 5 | } 6 | 7 | cc_binary { 8 | name: "android.hardware.light@2.0-service.kiwi", 9 | init_rc: ["android.hardware.light@2.0-service.kiwi.rc"], 10 | defaults: ["hidl_defaults"], 11 | relative_install_path: "hw", 12 | 13 | srcs: [ 14 | "service.cpp", 15 | "Light.cpp", 16 | ], 17 | 18 | shared_libs: [ 19 | "libcutils", 20 | "libdl", 21 | "libhardware", 22 | "libhidlbase", 23 | "liblog", 24 | "libutils", 25 | "android.hardware.light@2.0", 26 | ], 27 | 28 | vendor: true, 29 | } 30 | -------------------------------------------------------------------------------- /light/Light.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source 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 | #ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H 17 | #define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace android { 27 | namespace hardware { 28 | namespace light { 29 | namespace V2_0 { 30 | namespace implementation { 31 | 32 | struct Light : public ILight { 33 | Light(std::ofstream&& backlight, void* qmiApi); 34 | 35 | // Methods from ::android::hardware::light::V2_0::ILight follow. 36 | Return setLight(Type type, const LightState& state) override; 37 | Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; 38 | 39 | private: 40 | void setAttentionLight(const LightState& state); 41 | void setBacklight(const LightState& state); 42 | void setBatteryLight(const LightState& state); 43 | void setNotificationLight(const LightState& state); 44 | void setSpeakerBatteryLightLocked(); 45 | void setSpeakerLightLocked(const LightState& state); 46 | 47 | std::ofstream mBacklight; 48 | 49 | LightState mAttentionState; 50 | LightState mBatteryState; 51 | LightState mNotificationState; 52 | 53 | std::unordered_map> mLights; 54 | std::mutex mLock; 55 | 56 | int (*oem_qmi_common_stream_from_modem_len)(int id, void *buf_in, 57 | size_t buf_in_size, void *buf_out, size_t *buf_out_size); 58 | }; 59 | } // namespace implementation 60 | } // namespace V2_0 61 | } // namespace light 62 | } // namespace hardware 63 | } // namespace android 64 | 65 | #endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H 66 | -------------------------------------------------------------------------------- /light/android.hardware.light@2.0-service.kiwi.rc: -------------------------------------------------------------------------------- 1 | service light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.kiwi 2 | class hal 3 | user system 4 | group system 5 | shutdown critical 6 | -------------------------------------------------------------------------------- /light/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 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 "android.hardware.light@2.0-service.kiwi" 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "Light.h" 24 | 25 | #define QMI_OEM_API_LIB_NAME "libqmi_oem_api.so" 26 | 27 | // libhwbinder: 28 | using android::OK; 29 | using android::status_t; 30 | using android::hardware::configureRpcThreadpool; 31 | using android::hardware::joinRpcThreadpool; 32 | 33 | // Generated HIDL files 34 | using android::hardware::light::V2_0::ILight; 35 | using android::hardware::light::V2_0::implementation::Light; 36 | 37 | const static std::string kBacklightPath = "/sys/class/leds/lcd-backlight/brightness"; 38 | 39 | int main() { 40 | android::sp service; 41 | status_t status = OK; 42 | void* qmiApi; 43 | 44 | std::ofstream backlight(kBacklightPath); 45 | if (!backlight) { 46 | int error = errno; 47 | ALOGE("Failed to open %s (%d): %s", kBacklightPath.c_str(), error, strerror(error)); 48 | return -error; 49 | } 50 | 51 | /* 52 | * Open the qmi api. 53 | */ 54 | qmiApi = dlopen(QMI_OEM_API_LIB_NAME, RTLD_NOW); 55 | if (!qmiApi) { 56 | ALOGE("%s: failed to load %s: %s\n", __func__, QMI_OEM_API_LIB_NAME, dlerror()); 57 | goto shutdown; 58 | } 59 | 60 | service = new Light(std::move(backlight), qmiApi); 61 | 62 | configureRpcThreadpool(1, true); 63 | 64 | status = service->registerAsService(); 65 | if (status != android::OK) { 66 | ALOGE("Cannot register Light HAL service"); 67 | return 1; 68 | } 69 | 70 | ALOGI("Light HAL Ready."); 71 | joinRpcThreadpool(); 72 | 73 | shutdown: 74 | if (qmiApi != nullptr) { 75 | dlclose(qmiApi); 76 | } 77 | 78 | // Under normal cases, execution will not reach this line. 79 | ALOGE("Light HAL failed to join thread pool."); 80 | 81 | return 1; 82 | } 83 | -------------------------------------------------------------------------------- /lineage.dependencies: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "repository": "android_kernel_huawei_kiwi", 4 | "target_path": "kernel/huawei/kiwi" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /lineage_kiwi.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 The CyanogenMod Project 3 | # Copyright (C) 2019 The LineageOS Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Inherit from those products. Most specific first. 18 | $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) 19 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk) 20 | $(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_l.mk) 21 | 22 | # Inherit from kiwi device 23 | $(call inherit-product, device/huawei/kiwi/device.mk) 24 | 25 | # Inherit some common LineageOS stuff. 26 | $(call inherit-product, vendor/lineage/config/common_full_phone.mk) 27 | 28 | # Device identifier. This must come after all inclusions 29 | PRODUCT_BRAND := HONOR 30 | PRODUCT_DEVICE := kiwi 31 | PRODUCT_MANUFACTURER := HUAWEI 32 | PRODUCT_MODEL := KIW-L24 33 | PRODUCT_NAME := lineage_kiwi 34 | 35 | PRODUCT_GMS_CLIENTID_BASE := android-huawei 36 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | true 21 | 22 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/values-sw372dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 0dp 20 | 0dp 21 | 22 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | true 25 | 26 | -------------------------------------------------------------------------------- /overlay/packages/apps/CarrierConfig/res/xml/vendor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://xtrapath1.izatcloud.net/xtra3grc.bin 5 | https://xtrapath2.izatcloud.net/xtra3grc.bin 6 | https://xtrapath3.izatcloud.net/xtra3grc.bin 7 | supl.google.com 8 | 7275 9 | 0x20000 10 | 1 11 | 0 12 | 0 13 | 1 14 | 0 15 | 0 16 | 17 | 18 | -------------------------------------------------------------------------------- /overlay/packages/apps/Dialer/java/com/android/dialer/callrecord/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | true 20 | 4 21 | 22 | -------------------------------------------------------------------------------- /overlay/packages/apps/FlipFlap/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 29 | 3 30 | 31 | 32 | -------------------------------------------------------------------------------- /overlay/packages/apps/FlipFlap/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 0px 25 | 0px 26 | 1080px 27 | 720px 28 | 29 | -------------------------------------------------------------------------------- /overlay/packages/apps/LineageParts/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 22 | 23 | 2 24 | 5 25 | 6 26 | 3 27 | 28 | -------------------------------------------------------------------------------- /overlay/packages/apps/Snap/res/values/qcomstrings.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | false 25 | 26 | -------------------------------------------------------------------------------- /overlay/packages/services/Telecomm/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | true 20 | 21 | -------------------------------------------------------------------------------- /recovery/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_C_INCLUDES := \ 6 | bootable/recovery \ 7 | bootable/recovery/edify/include \ 8 | bootable/recovery/otautil/include \ 9 | bootable/recovery/updater/include 10 | 11 | LOCAL_SRC_FILES := recovery_updater.cpp 12 | LOCAL_MODULE := librecovery_updater_kiwi 13 | include $(BUILD_STATIC_LIBRARY) 14 | -------------------------------------------------------------------------------- /releasetools/releasetools.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 The CyanogenMod 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 | import re 16 | 17 | def FullOTA_Assertions(info): 18 | AddTrustZoneAssertion(info, info.input_zip) 19 | 20 | def IncrementalOTA_Assertions(info): 21 | AddTrustZoneAssertion(info, info.input_zip) 22 | 23 | def AddTrustZoneAssertion(info, input_zip): 24 | android_info = info.input_zip.read("OTA/android-info.txt") 25 | m = re.search(r'require\s+version-trustzone\s*=\s*(\S+)', android_info) 26 | if m: 27 | versions = m.group(1).split('|') 28 | if len(versions) and '*' not in versions: 29 | cmd = 'assert(kiwi.verify_trustzone(' + ','.join(['"%s"' % tz for tz in versions]) + ') == "1");' 30 | info.script.AppendExtra(cmd) 31 | -------------------------------------------------------------------------------- /ril-wrapper/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortBlocksOnASingleLine: false 3 | AllowShortFunctionsOnASingleLine: false 4 | 5 | AccessModifierOffset: -2 6 | ColumnLimit: 100 7 | CommentPragmas: NOLINT:.* 8 | DerivePointerAlignment: false 9 | IndentWidth: 4 10 | PointerAlignment: Left 11 | TabWidth: 4 12 | UseTab: Never 13 | PenaltyExcessCharacter: 32 -------------------------------------------------------------------------------- /ril-wrapper/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := libril-wrapper 5 | LOCAL_MULTILIB := 64 6 | LOCAL_VENDOR_MODULE := true 7 | LOCAL_SRC_FILES := ril-wrapper.c 8 | LOCAL_SHARED_LIBRARIES := libdl liblog libril libcutils 9 | LOCAL_CFLAGS := -Wall -Werror 10 | include $(BUILD_SHARED_LIBRARY) 11 | -------------------------------------------------------------------------------- /rootdir/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | # Init scripts 4 | include $(CLEAR_VARS) 5 | LOCAL_MODULE := init.class_main.sh 6 | LOCAL_MODULE_TAGS := optional 7 | LOCAL_MODULE_CLASS := ETC 8 | LOCAL_SRC_FILES := bin/init.class_main.sh 9 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) 10 | include $(BUILD_PREBUILT) 11 | 12 | include $(CLEAR_VARS) 13 | LOCAL_MODULE := fstab.qcom 14 | LOCAL_MODULE_TAGS := optional 15 | LOCAL_MODULE_CLASS := ETC 16 | LOCAL_SRC_FILES := etc/fstab.qcom 17 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC) 18 | include $(BUILD_PREBUILT) 19 | 20 | include $(CLEAR_VARS) 21 | LOCAL_MODULE := init.target.rc 22 | LOCAL_MODULE_TAGS := optional 23 | LOCAL_MODULE_CLASS := ETC 24 | LOCAL_SRC_FILES := etc/init.target.rc 25 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 26 | include $(BUILD_PREBUILT) 27 | 28 | include $(CLEAR_VARS) 29 | LOCAL_MODULE := init.qcom.bt.sh 30 | LOCAL_MODULE_TAGS := optional 31 | LOCAL_MODULE_CLASS := ETC 32 | LOCAL_SRC_FILES := bin/init.qcom.bt.sh 33 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) 34 | include $(BUILD_PREBUILT) 35 | 36 | include $(CLEAR_VARS) 37 | LOCAL_MODULE := init.qcom.power.rc 38 | LOCAL_MODULE_TAGS := optional 39 | LOCAL_MODULE_CLASS := ETC 40 | LOCAL_SRC_FILES := etc/init.qcom.power.rc 41 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 42 | include $(BUILD_PREBUILT) 43 | 44 | include $(CLEAR_VARS) 45 | LOCAL_MODULE := init.qcom.rc 46 | LOCAL_MODULE_TAGS := optional 47 | LOCAL_MODULE_CLASS := ETC 48 | LOCAL_SRC_FILES := etc/init.qcom.rc 49 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 50 | include $(BUILD_PREBUILT) 51 | 52 | include $(CLEAR_VARS) 53 | LOCAL_MODULE := init.qcom.usb.rc 54 | LOCAL_MODULE_TAGS := optional 55 | LOCAL_MODULE_CLASS := ETC 56 | LOCAL_SRC_FILES := etc/init.qcom.usb.rc 57 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 58 | include $(BUILD_PREBUILT) 59 | 60 | include $(CLEAR_VARS) 61 | LOCAL_MODULE := init.target-from-init.rc 62 | LOCAL_MODULE_TAGS := optional 63 | LOCAL_MODULE_CLASS := ETC 64 | LOCAL_SRC_FILES := etc/init.target-from-init.rc 65 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 66 | include $(BUILD_PREBUILT) 67 | 68 | include $(CLEAR_VARS) 69 | LOCAL_MODULE := init.recovery.qcom.rc 70 | LOCAL_MODULE_TAGS := optional 71 | LOCAL_MODULE_CLASS := ETC 72 | LOCAL_SRC_FILES := etc/init.recovery.qcom.rc 73 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT) 74 | include $(BUILD_PREBUILT) 75 | 76 | include $(CLEAR_VARS) 77 | LOCAL_MODULE := ueventd.qcom.rc 78 | LOCAL_MODULE_STEM := ueventd.rc 79 | LOCAL_MODULE_TAGS := optional 80 | LOCAL_MODULE_CLASS := ETC 81 | LOCAL_SRC_FILES := etc/ueventd.qcom.rc 82 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR) 83 | include $(BUILD_PREBUILT) 84 | -------------------------------------------------------------------------------- /rootdir/etc/fstab.qcom: -------------------------------------------------------------------------------- 1 | # Android fstab file. 2 | # The filesystem that contains the filesystem checker binary (typically /system) cannot 3 | # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK 4 | 5 | #TODO: Add 'check' as fs_mgr_flags with data partition. 6 | # Currently we dont have e2fsck compiled. So fs check would failed. 7 | 8 | # 9 | /dev/block/bootdevice/by-name/log /log vfat nosuid,nodev,uid=1000,gid=1007,fmask=0007,dmask=0007 wait,check 10 | /dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait,recoveryonly 11 | /dev/block/bootdevice/by-name/userdata /data f2fs nosuid,nodev,noatime,inline_xattr latemount,wait,check,encryptable=footer,reservedsize=128M 12 | /dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,noatime,barrier=1,noauto_da_alloc latemount,wait,check,encryptable=footer,reservedsize=128M 13 | /dev/block/bootdevice/by-name/cache /cache f2fs nosuid,nodev,noatime,inline_xattr wait,check 14 | /dev/block/bootdevice/by-name/cache /cache ext4 nosuid,nodev,noatime,barrier=1 wait,check 15 | /dev/block/bootdevice/by-name/persist /persist ext4 nosuid,nodev,noatime,barrier=1 wait,check 16 | /dev/block/bootdevice/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1000,dmask=222,fmask=333,context=u:object_r:firmware_file:s0 wait 17 | /devices/soc.0/7864900.sdhci/mmc_host/* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata 18 | /dev/block/zram0 none swap defaults zramsize=1073741824,max_comp_streams=3 19 | /devices/platform/msm_hsusb* auto auto defaults voldmanaged=usbdisk:auto 20 | /dev/block/bootdevice/by-name/config /frp emmc defaults defaults 21 | /dev/block/bootdevice/by-name/pad /persistent emmc defaults defaults 22 | /dev/block/bootdevice/by-name/boot /boot emmc defaults recoveryonly 23 | /dev/block/bootdevice/by-name/recovery /recovery emmc defaults recoveryonly 24 | /dev/block/bootdevice/by-name/misc /misc emmc defaults defaults 25 | -------------------------------------------------------------------------------- /rootdir/etc/init.recovery.qcom.rc: -------------------------------------------------------------------------------- 1 | on fs 2 | wait /dev/block/platform/soc.0/${ro.boot.bootdevice} 3 | symlink /dev/block/platform/soc.0/${ro.boot.bootdevice} /dev/block/bootdevice 4 | 5 | setprop sys.usb.ffs.aio_compat 1 6 | setprop persist.adb.nonblocking_ffs 0 7 | setprop ro.adb.nonblocking_ffs 0 8 | 9 | on property:init.svc.recovery=running 10 | trigger enable-low-power 11 | -------------------------------------------------------------------------------- /seccomp/mediacodec-seccomp.policy: -------------------------------------------------------------------------------- 1 | # device specific syscalls 2 | # extension of services/mediacodec/minijail/seccomp_policy/mediacodec-seccomp-arm.policy 3 | pselect6: 1 4 | eventfd2: 1 5 | sendto: 1 6 | recvfrom: 1 7 | -------------------------------------------------------------------------------- /sensors/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_static { 2 | name: "multihal-kiwi", 3 | vendor: true, 4 | srcs: [ 5 | "multihal.cpp", 6 | "SensorEventQueue.cpp" 7 | ], 8 | shared_libs: [ 9 | "liblog", 10 | "libcutils", 11 | "libutils", 12 | "libdl" 13 | ], 14 | export_include_dirs: ["."], 15 | } 16 | -------------------------------------------------------------------------------- /sensors/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM) 6 | 7 | LOCAL_MODULE_RELATIVE_PATH := hw 8 | LOCAL_PROPRIETARY_MODULE := true 9 | 10 | LOCAL_CFLAGS := -DLOG_TAG=\"MultiHal\" 11 | 12 | LOCAL_SRC_FILES := \ 13 | multihal.cpp \ 14 | SensorEventQueue.cpp \ 15 | 16 | LOCAL_SHARED_LIBRARIES := \ 17 | libcutils \ 18 | libdl \ 19 | liblog \ 20 | libutils \ 21 | 22 | LOCAL_STRIP_MODULE := false 23 | 24 | include $(BUILD_SHARED_LIBRARY) 25 | -------------------------------------------------------------------------------- /sensors/SensorEventQueue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source 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 | #include 21 | 22 | #include "SensorEventQueue.h" 23 | 24 | SensorEventQueue::SensorEventQueue(int capacity) { 25 | mCapacity = capacity; 26 | 27 | mStart = 0; 28 | mSize = 0; 29 | mData = new sensors_event_t[mCapacity]; 30 | pthread_cond_init(&mSpaceAvailableCondition, NULL); 31 | } 32 | 33 | SensorEventQueue::~SensorEventQueue() { 34 | delete[] mData; 35 | mData = NULL; 36 | pthread_cond_destroy(&mSpaceAvailableCondition); 37 | } 38 | 39 | int SensorEventQueue::getWritableRegion(int requestedLength, sensors_event_t** out) { 40 | if (mSize == mCapacity || requestedLength <= 0) { 41 | *out = NULL; 42 | return 0; 43 | } 44 | // Start writing after the last readable record. 45 | int firstWritable = (mStart + mSize) % mCapacity; 46 | 47 | int lastWritable = firstWritable + requestedLength - 1; 48 | 49 | // Don't go past the end of the data array. 50 | if (lastWritable > mCapacity - 1) { 51 | lastWritable = mCapacity - 1; 52 | } 53 | // Don't go into the readable region. 54 | if (firstWritable < mStart && lastWritable >= mStart) { 55 | lastWritable = mStart - 1; 56 | } 57 | *out = &mData[firstWritable]; 58 | return lastWritable - firstWritable + 1; 59 | } 60 | 61 | void SensorEventQueue::markAsWritten(int count) { 62 | mSize += count; 63 | } 64 | 65 | int SensorEventQueue::getSize() { 66 | return mSize; 67 | } 68 | 69 | sensors_event_t* SensorEventQueue::peek() { 70 | if (mSize == 0) return NULL; 71 | return &mData[mStart]; 72 | } 73 | 74 | void SensorEventQueue::dequeue() { 75 | if (mSize == 0) return; 76 | if (mSize == mCapacity) { 77 | pthread_cond_broadcast(&mSpaceAvailableCondition); 78 | } 79 | mSize--; 80 | mStart = (mStart + 1) % mCapacity; 81 | } 82 | 83 | // returns true if it waited, or false if it was a no-op. 84 | bool SensorEventQueue::waitForSpace(pthread_mutex_t* mutex) { 85 | bool waited = false; 86 | while (mSize == mCapacity) { 87 | waited = true; 88 | pthread_cond_wait(&mSpaceAvailableCondition, mutex); 89 | } 90 | return waited; 91 | } 92 | -------------------------------------------------------------------------------- /sensors/multihal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source 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 | #ifndef HARDWARE_LIBHARDWARE_MODULES_SENSORS_MULTIHAL_H_ 17 | #define HARDWARE_LIBHARDWARE_MODULES_SENSORS_MULTIHAL_H_ 18 | 19 | #include 20 | #include 21 | 22 | static const char* MULTI_HAL_CONFIG_FILE_PATH = "/vendor/etc/sensors/_hals.conf"; 23 | 24 | // Depracated because system partition HAL config file does not satisfy treble requirements. 25 | static const char* DEPRECATED_MULTI_HAL_CONFIG_FILE_PATH = "/system/etc/sensors/_hals.conf"; 26 | 27 | struct sensors_module_t *get_multi_hal_module_info(void); 28 | 29 | #endif // HARDWARE_LIBHARDWARE_MODULES_SENSORS_MULTIHAL_H_ 30 | -------------------------------------------------------------------------------- /sepolicy/app_zygote.te: -------------------------------------------------------------------------------- 1 | allow app_zygote ion_device:chr_file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/audioserver.te: -------------------------------------------------------------------------------- 1 | allow audioserver smartamp_device:chr_file rw_file_perms; 2 | allow audioserver sysfs:dir { open read }; 3 | 4 | r_dir_file(audioserver, hw_audio_info_sysfs) 5 | r_dir_file(hal_audio_default, hw_audio_info_sysfs) 6 | -------------------------------------------------------------------------------- /sepolicy/bluetooth_loader.te: -------------------------------------------------------------------------------- 1 | allow bluetooth_loader bluetooth_data_file:dir rw_dir_perms; 2 | allow bluetooth_loader bluetooth_data_file:file create_file_perms; 3 | 4 | allow bluetooth_loader oeminfo_device:dir { remove_name write search }; 5 | allow bluetooth_loader oeminfo_device:file { getattr open read unlink }; 6 | allow bluetooth_loader oeminfo:unix_stream_socket connectto; 7 | allow bluetooth_loader oeminfo_socket:sock_file write; 8 | -------------------------------------------------------------------------------- /sepolicy/device.te: -------------------------------------------------------------------------------- 1 | type bluetooth_device, dev_type; 2 | type fingerprint_device, dev_type; 3 | type rfkill_device, dev_type; 4 | type smartamp_device, dev_type; 5 | 6 | type fsc_block_device, dev_type; 7 | type oem_block_device, dev_type; 8 | -------------------------------------------------------------------------------- /sepolicy/file.te: -------------------------------------------------------------------------------- 1 | type fingerprint_sysfs, sysfs_type, file_type; 2 | type gesture_sysfs, sysfs_type, file_type; 3 | type hw_audio_info_sysfs, sysfs_type, file_type; 4 | type proc_app_info, file_type, proc_type; 5 | type proc_kernel_sched, fs_type, proc_type; 6 | type proc_printk, fs_type, proc_type; 7 | -------------------------------------------------------------------------------- /sepolicy/file_contexts: -------------------------------------------------------------------------------- 1 | # Fingerprint 2 | /data/fpc(/.*)? u:object_r:fingerprintd_data_file:s0 3 | /dev/fpc1020 u:object_r:fingerprint_device:s0 4 | /sys/devices/platform/fingerprint(/.*)? u:object_r:fingerprint_sysfs:s0 5 | 6 | # Lights 7 | /sys/devices/soc\.0/gpio-leds\.[a-z0-9]+/leds(/.*)? u:object_r:sysfs_leds:s0 8 | 9 | # Oem Info 10 | /dev/oinv(/.*)? u:object_r:oeminfo_device:s0 11 | /dev/socket/oeminfo_nvm u:object_r:oeminfo_socket:s0 12 | /system/vendor/bin/huawei_version u:object_r:oeminfo_exec:s0 13 | /system/vendor/bin/oeminfo_nvm_server u:object_r:oeminfo_exec:s0 14 | /system/vendor/bin/rmt_oeminfo u:object_r:oeminfo_exec:s0 15 | 16 | /dev/block/platform/soc.0/7824900.sdhci/mmcblk0p18 u:object_r:fsc_block_device:s0 17 | /dev/block/platform/soc.0/7824900.sdhci/mmcblk0p9 u:object_r:oem_block_device:s0 18 | /dev/bluetooth u:object_r:bluetooth_device:s0 19 | /dev/i2c-1 u:object_r:smartamp_device:s0 20 | /dev/rfkill u:object_r:rfkill_device:s0 21 | 22 | /sys/bus/platform/drivers/hw_audio_info(/.*)? u:object_r:hw_audio_info_sysfs:s0 23 | /sys/touch_screen/easy_wakeup_gesture u:object_r:gesture_sysfs:s0 24 | /sys/touch_screen/tap_to_wake u:object_r:gesture_sysfs:s0 25 | /sys/touch_screen/glove_func/signal_disparity u:object_r:gesture_sysfs:s0 26 | /system/vendor/bin/libqmi_oem_main u:object_r:libqmi_oem_main_exec:s0 27 | /system/vendor/bin/signinfolistener u:object_r:signinfolistener_exec:s0 28 | /system/vendor/bin/teecd u:object_r:tee_exec:s0 29 | 30 | /dev/stune(/.*)? u:object_r:cgroup:s0 31 | 32 | # HALs 33 | /system/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@1\.0-service\.kiwi u:object_r:hal_fingerprint_default_exec:s0 34 | /system/vendor/bin/hw/android\.hardware\.light@2\.0-service\.kiwi u:object_r:hal_light_default_exec:s0 35 | /system/vendor/bin/hw/vendor\.lineage\.touch@1\.0-service\.kiwi u:object_r:hal_lineage_touch_kiwi_exec:s0 36 | -------------------------------------------------------------------------------- /sepolicy/fsck.te: -------------------------------------------------------------------------------- 1 | allow fsck fsc_block_device:blk_file rw_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/genfs_contexts: -------------------------------------------------------------------------------- 1 | genfscon proc /app_info u:object_r:proc_app_info:s0 2 | genfscon proc /sys/kernel/sched_boost u:object_r:proc_kernel_sched:s0 3 | genfscon proc /sys/kernel/sched_window_stats_policy u:object_r:proc_kernel_sched:s0 4 | genfscon proc /sys/kernel/sched_ravg_hist_size u:object_r:proc_kernel_sched:s0 5 | genfscon proc /sys/kernel/sched_small_task u:object_r:proc_kernel_sched:s0 6 | genfscon proc /sys/kernel/sched_mostly_idle_load u:object_r:proc_kernel_sched:s0 7 | genfscon proc /sys/kernel/sched_mostly_idle_nr_run u:object_r:proc_kernel_sched:s0 8 | genfscon proc /sys/kernel/sched_upmigrate u:object_r:proc_kernel_sched:s0 9 | genfscon proc /sys/kernel/sched_downmigrate u:object_r:proc_kernel_sched:s0 10 | genfscon proc /sys/kernel/sched_freq_inc_notify u:object_r:proc_kernel_sched:s0 11 | genfscon proc /sys/kernel/sched_freq_dec_notify u:object_r:proc_kernel_sched:s0 12 | genfscon proc /sys/kernel/printk u:object_r:proc_printk:s0 13 | -------------------------------------------------------------------------------- /sepolicy/hal_audio_default.te: -------------------------------------------------------------------------------- 1 | # hal needs to access /dev/i2c-1 2 | allow hal_audio_default smartamp_device:chr_file { ioctl open read write }; 3 | -------------------------------------------------------------------------------- /sepolicy/hal_fingerprint_default.te: -------------------------------------------------------------------------------- 1 | allow hal_fingerprint_default fingerprintd_data_file:dir write; 2 | allow hal_fingerprint_default fingerprint_device:chr_file rw_file_perms; 3 | allow hal_fingerprint_default fingerprint_sysfs:dir rw_dir_perms; 4 | allow hal_fingerprint_default fingerprint_sysfs:file rw_file_perms; 5 | allow hal_fingerprint_default tee_device:chr_file rw_file_perms; 6 | 7 | allow hal_fingerprint_default tee:unix_stream_socket connectto; 8 | -------------------------------------------------------------------------------- /sepolicy/hal_gnss_default.te: -------------------------------------------------------------------------------- 1 | allow hal_gnss_default ssr_device:chr_file { open read }; 2 | allow hal_gnss_default location_data_file:fifo_file rw_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/hal_light_default.te: -------------------------------------------------------------------------------- 1 | allow hal_light_default libqmi_oem_main:unix_stream_socket connectto; 2 | -------------------------------------------------------------------------------- /sepolicy/hal_lineage_livedisplay_qti.te: -------------------------------------------------------------------------------- 1 | allow hal_lineage_livedisplay_qti pps_socket:sock_file w_file_perms; 2 | allow hal_lineage_livedisplay_qti mm-pp-daemon:unix_stream_socket connectto; 3 | -------------------------------------------------------------------------------- /sepolicy/hal_lineage_touch_kiwi.te: -------------------------------------------------------------------------------- 1 | type hal_lineage_touch_kiwi, domain, coredomain; 2 | hal_server_domain(hal_lineage_touch_kiwi, hal_lineage_touch) 3 | 4 | type hal_lineage_touch_kiwi_exec, exec_type, file_type; 5 | init_daemon_domain(hal_lineage_touch_kiwi) 6 | 7 | allow hal_lineage_touch_kiwi gesture_sysfs:file rw_file_perms; 8 | -------------------------------------------------------------------------------- /sepolicy/hal_power_default.te: -------------------------------------------------------------------------------- 1 | allow hal_power_default gesture_sysfs:file { getattr open read write }; 2 | -------------------------------------------------------------------------------- /sepolicy/hal_wifi_default.te: -------------------------------------------------------------------------------- 1 | allow hal_wifi_default firmware_file:dir search; 2 | allow hal_wifi_default proc_net:file write; 3 | -------------------------------------------------------------------------------- /sepolicy/hal_wifi_supplicant_default.te: -------------------------------------------------------------------------------- 1 | allow hal_wifi_supplicant_default rfkill_device:chr_file rw_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/healthd.te: -------------------------------------------------------------------------------- 1 | # Battery HealthD charger controls. 2 | allow healthd device:dir r_dir_perms; 3 | allow healthd rtc_device:chr_file rw_file_perms; 4 | -------------------------------------------------------------------------------- /sepolicy/hostapd.te: -------------------------------------------------------------------------------- 1 | allow hostapd rfkill_device:chr_file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/init.te: -------------------------------------------------------------------------------- 1 | # required for LD_SHIM_LIBS 2 | allow init { domain -lmkd -crash_dump }:process noatsecure; 3 | -------------------------------------------------------------------------------- /sepolicy/kernel.te: -------------------------------------------------------------------------------- 1 | # ashmem shrinker causes this denial from kswapd 2 | allow kernel { untrusted_app priv_app }:fd use; 3 | allow kernel appdomain_tmpfs:file write; 4 | -------------------------------------------------------------------------------- /sepolicy/libqmi_oem_main.te: -------------------------------------------------------------------------------- 1 | type libqmi_oem_main, domain; 2 | type libqmi_oem_main_exec, exec_type, file_type; 3 | init_daemon_domain(libqmi_oem_main) 4 | 5 | allow libqmi_oem_main diag_device:chr_file rw_file_perms; 6 | allow libqmi_oem_main qmuxd:unix_stream_socket connectto; 7 | allow libqmi_oem_main qmuxd_socket:dir { write add_name search remove_name }; 8 | allow libqmi_oem_main qmuxd_socket:sock_file { write create setattr unlink }; 9 | allow libqmi_oem_main self:capability { fsetid dac_override }; 10 | allow libqmi_oem_main self:socket { read create bind write }; 11 | 12 | 13 | allow libqmi_oem_main sysfs:file r_file_perms; 14 | 15 | set_prop(libqmi_oem_main, debug_prop); 16 | 17 | # HAX 18 | allow libqmi_oem_main properties_device:dir { open read }; 19 | allow libqmi_oem_main self:socket ioctl; 20 | allowxperm libqmi_oem_main self:socket ioctl { 0xc302 0xc304 }; 21 | -------------------------------------------------------------------------------- /sepolicy/mediaserver.te: -------------------------------------------------------------------------------- 1 | allow mediaserver smartamp_device:chr_file { read write ioctl open }; 2 | allow mediaserver audiod:binder call; 3 | allow mediaserver camera_data_file:dir search; 4 | -------------------------------------------------------------------------------- /sepolicy/mm-qcamerad.te: -------------------------------------------------------------------------------- 1 | allow mm-qcamerad system_data_file:dir w_dir_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/netmgrd.te: -------------------------------------------------------------------------------- 1 | allow netmgrd self:capability dac_override; 2 | -------------------------------------------------------------------------------- /sepolicy/oeminfo.te: -------------------------------------------------------------------------------- 1 | type oeminfo, domain; 2 | type oeminfo_device, dev_type; 3 | type oeminfo_exec, exec_type, file_type; 4 | type oeminfo_socket, file_type; 5 | type_transition oeminfo socket_device:sock_file oeminfo_socket; 6 | type_transition oeminfo device:{ file dir } oeminfo_device; 7 | 8 | init_daemon_domain(oeminfo) 9 | 10 | allow oeminfo oem_block_device:blk_file rw_file_perms; 11 | allow oeminfo self:capability { fowner chown fsetid }; 12 | 13 | allow oeminfo proc_app_info:file r_file_perms; 14 | allow oeminfo self:socket { read bind create write }; 15 | 16 | allow oeminfo oeminfo_device:dir { add_name create setattr write search }; 17 | allow oeminfo oeminfo_device:file { create open setattr write }; 18 | allow oeminfo oeminfo_socket:sock_file { create setattr }; 19 | 20 | # HAX 21 | allow oeminfo block_device:dir search; 22 | allow oeminfo properties_device:dir { open read }; 23 | allow oeminfo socket_device:dir { add_name write }; # /dev/socket 24 | allow oeminfo self:socket ioctl; 25 | allowxperm oeminfo self:socket ioctl IPC_ROUTER_IOCTL_BIND_CONTROL_PORT; 26 | allowxperm oeminfo oem_block_device:blk_file ioctl BLKGETSIZE; 27 | 28 | r_dir_file(oeminfo, sysfs); 29 | 30 | set_prop(oeminfo, hw_version_prop); 31 | unix_socket_connect(oeminfo, qmuxd, libqmi_oem_main); 32 | -------------------------------------------------------------------------------- /sepolicy/perfd.te: -------------------------------------------------------------------------------- 1 | allow perfd proc_kernel_sched:file { open read write }; 2 | 3 | # neverallow - ignore the spam 4 | dontaudit perfd self:capability sys_ptrace; 5 | -------------------------------------------------------------------------------- /sepolicy/property.te: -------------------------------------------------------------------------------- 1 | type hw_version_prop, property_type; 2 | -------------------------------------------------------------------------------- /sepolicy/property_contexts: -------------------------------------------------------------------------------- 1 | ro.boardserialno u:object_r:hw_version_prop:s0 2 | ro.confg.hw_bootversion u:object_r:hw_version_prop:s0 3 | ro.confg.hw_systemversion u:object_r:hw_version_prop:s0 4 | ro.confg.hw_recoveryversion u:object_r:hw_version_prop:s0 5 | ro.confg.hw_hardwareversion u:object_r:hw_version_prop:s0 6 | ro.confg.hw_modemversion u:object_r:hw_version_prop:s0 7 | ro.confg.hw_efsversion u:object_r:hw_version_prop:s0 8 | ro.confg.hw_chipidversion u:object_r:hw_version_prop:s0 9 | ro.product.CustCVersion u:object_r:hw_version_prop:s0 10 | ro.product.CustDVersion u:object_r:hw_version_prop:s0 11 | -------------------------------------------------------------------------------- /sepolicy/qmuxd.te: -------------------------------------------------------------------------------- 1 | set_prop(qmuxd, radio_prop); 2 | -------------------------------------------------------------------------------- /sepolicy/qti_init_shell.te: -------------------------------------------------------------------------------- 1 | allow qti_init_shell bluetooth_data_file:dir rw_dir_perms; 2 | allow qti_init_shell bluetooth_data_file:file create_file_perms; 3 | allow qti_init_shell bluetooth_device:chr_file rw_file_perms; 4 | allow qti_init_shell bluetooth_loader_exec:file r_file_perms; 5 | allow qti_init_shell btnvtool_exec:file { read getattr open execute execute_no_trans }; 6 | allow qti_init_shell socket_device:sock_file write; 7 | allow qti_init_shell oeminfo:unix_stream_socket connectto; 8 | allow qti_init_shell hci_attach_dev:chr_file rw_file_perms; 9 | -------------------------------------------------------------------------------- /sepolicy/rild.te: -------------------------------------------------------------------------------- 1 | allow rild libqmi_oem_main:unix_stream_socket connectto; 2 | 3 | # rild is somehow trying to execute /system/bin/ip 4 | # we don't allow it and we don't want it logged all the time 5 | dontaudit rild system_file:file execute_no_trans; 6 | 7 | # Another one - but this time no clue what it wants to execute 8 | dontaudit rild shell_exec:file execute; 9 | -------------------------------------------------------------------------------- /sepolicy/rmt_storage.te: -------------------------------------------------------------------------------- 1 | allow rmt_storage self:capability net_raw; 2 | -------------------------------------------------------------------------------- /sepolicy/signinfolistener.te: -------------------------------------------------------------------------------- 1 | type signinfolistener, domain; 2 | type signinfolistener_exec, exec_type, file_type; 3 | 4 | allow signinfolistener tee_device:chr_file rw_file_perms; 5 | allow signinfolistener hal_fingerprint_default:dir r_dir_perms; 6 | allow signinfolistener hal_fingerprint_default:file r_file_perms; 7 | 8 | allow signinfolistener ion_device:chr_file rw_file_perms; 9 | 10 | # It read /data/system/packages.xml which I am afraid to relabel, so let's let it do 11 | # crazy reading of system data files. 12 | allow signinfolistener system_data_file:file r_file_perms; 13 | 14 | # Somehow everyone wants to read the attributes of this 15 | # just ignore it 16 | dontaudit domain signinfolistener_exec:file { read getattr }; 17 | 18 | init_daemon_domain(signinfolistener) 19 | -------------------------------------------------------------------------------- /sepolicy/system_app.te: -------------------------------------------------------------------------------- 1 | allow system_app gesture_sysfs:file rw_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/system_server.te: -------------------------------------------------------------------------------- 1 | allow system_server gesture_sysfs:file rw_file_perms; 2 | allow system_server oeminfo:unix_stream_socket connectto; 3 | allow system_server oeminfo_socket:sock_file write; 4 | allow system_server proc_app_info:file r_file_perms; 5 | allow system_server shell_exec:file { read execute open }; 6 | allow system_server app_zygote:process getpgid; 7 | 8 | unix_socket_connect(system_server, qmuxd, libqmi_oem_main); 9 | -------------------------------------------------------------------------------- /sepolicy/time_daemon.te: -------------------------------------------------------------------------------- 1 | set_prop(time_daemon, system_prop) 2 | -------------------------------------------------------------------------------- /sepolicy/ueventd.te: -------------------------------------------------------------------------------- 1 | allow ueventd fingerprint_sysfs:file rw_file_perms; 2 | allow ueventd self:capability sys_nice; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor_init.te: -------------------------------------------------------------------------------- 1 | allow vendor_init fingerprintd_data_file:dir { create setattr }; 2 | allow vendor_init wifi_data_file:dir create_dir_perms; 3 | allow vendor_init proc_kernel_sched:file write; 4 | allow vendor_init proc_printk:file write; 5 | -------------------------------------------------------------------------------- /sepolicy/wcnss_service.te: -------------------------------------------------------------------------------- 1 | allow wcnss_service oeminfo:unix_stream_socket connectto; 2 | 3 | allow wcnss_service oeminfo_device:dir { remove_name write search }; 4 | allow wcnss_service oeminfo_device:file { getattr open read unlink }; 5 | allow wcnss_service oeminfo_socket:sock_file write; 6 | -------------------------------------------------------------------------------- /setup-makefiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2016 The CyanogenMod Project 4 | # (C) 2017 The LineageOS Project 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | set -e 20 | 21 | DEVICE=kiwi 22 | VENDOR=huawei 23 | 24 | INITIAL_COPYRIGHT_YEAR=2016 25 | 26 | # Load extractutils and do some sanity checks 27 | MY_DIR="${BASH_SOURCE%/*}" 28 | if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi 29 | 30 | LINEAGE_ROOT="$MY_DIR"/../../.. 31 | 32 | HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh 33 | if [ ! -f "$HELPER" ]; then 34 | echo "Unable to find helper script at $HELPER" 35 | exit 1 36 | fi 37 | . "$HELPER" 38 | 39 | # Initialize the helper 40 | setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" 41 | 42 | # Copyright headers and guards 43 | write_headers 44 | 45 | # The blobs 46 | write_makefiles "$MY_DIR"/proprietary-files.txt 47 | 48 | # We are done! 49 | write_footers 50 | -------------------------------------------------------------------------------- /touch/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AccessModifierOffset: -2 3 | AllowShortFunctionsOnASingleLine: Inline 4 | ColumnLimit: 100 5 | CommentPragmas: NOLINT:.* 6 | DerivePointerAlignment: false 7 | IndentWidth: 4 8 | PointerAlignment: Left 9 | TabWidth: 4 10 | UseTab: Never 11 | PenaltyExcessCharacter: 32 12 | -------------------------------------------------------------------------------- /touch/Android.bp: -------------------------------------------------------------------------------- 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 | cc_binary { 17 | name: "vendor.lineage.touch@1.0-service.kiwi", 18 | init_rc: ["vendor.lineage.touch@1.0-service.kiwi.rc"], 19 | defaults: ["hidl_defaults"], 20 | relative_install_path: "hw", 21 | vendor: true, 22 | srcs: [ 23 | "TouchscreenGesture.cpp", 24 | "GloveMode.cpp", 25 | "service.cpp", 26 | ], 27 | shared_libs: [ 28 | "libbase", 29 | "libhidlbase", 30 | "libhidltransport", 31 | "libutils", 32 | "vendor.lineage.touch@1.0", 33 | ], 34 | } 35 | -------------------------------------------------------------------------------- /touch/GloveMode.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 "GloveMode.h" 22 | 23 | namespace vendor { 24 | namespace lineage { 25 | namespace touch { 26 | namespace V1_0 { 27 | namespace implementation { 28 | 29 | constexpr const char kControlPath[] = "/sys/touch_screen/glove_func/signal_disparity"; 30 | 31 | GloveMode::GloveMode() { 32 | mHasGloveMode = !access(kControlPath, F_OK); 33 | } 34 | 35 | // Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow. 36 | Return GloveMode::isEnabled() { 37 | std::string buf; 38 | 39 | if (!mHasGloveMode) return false; 40 | 41 | if (!android::base::ReadFileToString(kControlPath, &buf)) { 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 GloveMode::setEnabled(bool enabled) { 50 | if (!mHasGloveMode) return false; 51 | 52 | if (!android::base::WriteStringToFile((enabled ? "1" : "0"), kControlPath)) { 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/GloveMode.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_GLOVEMODE_H 18 | #define VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_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 GloveMode : public IGloveMode { 31 | public: 32 | GloveMode(); 33 | // Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow. 34 | Return isEnabled() override; 35 | Return setEnabled(bool enabled) override; 36 | 37 | private: 38 | bool mHasGloveMode; 39 | }; 40 | 41 | } // namespace implementation 42 | } // namespace V1_0 43 | } // namespace touch 44 | } // namespace lineage 45 | } // namespace vendor 46 | 47 | #endif // VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H 48 | -------------------------------------------------------------------------------- /touch/TouchscreenGesture.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 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 "TouchscreenGestureService" 18 | 19 | #include "TouchscreenGesture.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace vendor { 26 | namespace lineage { 27 | namespace touch { 28 | namespace V1_0 { 29 | namespace implementation { 30 | 31 | const std::string kGesturePath = "/sys/touch_screen/easy_wakeup_gesture"; 32 | 33 | const std::map TouchscreenGesture::kGestureInfoMap = { 34 | // clang-format off 35 | {0, {66, "Letter C"}}, 36 | {1, {67, "Letter e"}}, 37 | {2, {68, "Letter M"}}, 38 | {3, {87, "Letter W"}}, 39 | // clang-format on 40 | }; 41 | 42 | const std::vector kGestureMasks = { 43 | 0x080, // C gesture mask 44 | 0x100, // e gesture mask 45 | 0x200, // M gesture mask 46 | 0x400, // W gesture mask 47 | }; 48 | 49 | Return TouchscreenGesture::getSupportedGestures(getSupportedGestures_cb resultCb) { 50 | std::vector gestures; 51 | 52 | for (const auto& entry : kGestureInfoMap) { 53 | gestures.push_back({entry.first, entry.second.name, entry.second.keycode}); 54 | } 55 | resultCb(gestures); 56 | 57 | return Void(); 58 | } 59 | 60 | Return TouchscreenGesture::setGestureEnabled( 61 | const ::vendor::lineage::touch::V1_0::Gesture& gesture, bool enabled) { 62 | uint16_t gestureMode; 63 | uint16_t mask = kGestureMasks[gesture.id]; 64 | std::string line; 65 | std::stringstream ss; 66 | std::fstream file(kGesturePath); 67 | 68 | file >> line; 69 | ss << std::hex << line.substr(2); 70 | ss >> gestureMode; 71 | 72 | if (enabled) { 73 | gestureMode |= mask; 74 | } else { 75 | gestureMode &= ~mask; 76 | } 77 | 78 | file << gestureMode; 79 | 80 | return !file.fail(); 81 | } 82 | 83 | } // namespace implementation 84 | } // namespace V1_0 85 | } // namespace touch 86 | } // namespace lineage 87 | } // namespace vendor 88 | -------------------------------------------------------------------------------- /touch/TouchscreenGesture.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 | #pragma once 18 | 19 | #include 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 | using ::android::hardware::Void; 30 | 31 | class TouchscreenGesture : public ITouchscreenGesture { 32 | public: 33 | // Methods from ::vendor::lineage::touch::V1_0::ITouchscreenGesture follow. 34 | Return getSupportedGestures(getSupportedGestures_cb resultCb) override; 35 | Return setGestureEnabled(const ::vendor::lineage::touch::V1_0::Gesture& gesture, 36 | bool enabled) override; 37 | 38 | private: 39 | typedef struct { 40 | int32_t keycode; 41 | const char* name; 42 | } GestureInfo; 43 | static const std::map kGestureInfoMap; // id -> info 44 | }; 45 | 46 | } // namespace implementation 47 | } // namespace V1_0 48 | } // namespace touch 49 | } // namespace lineage 50 | } // namespace vendor 51 | -------------------------------------------------------------------------------- /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.kiwi" 18 | 19 | #include 20 | #include 21 | 22 | #include "GloveMode.h" 23 | #include "TouchscreenGesture.h" 24 | 25 | using ::android::OK; 26 | using ::android::sp; 27 | 28 | using ::vendor::lineage::touch::V1_0::IGloveMode; 29 | using ::vendor::lineage::touch::V1_0::ITouchscreenGesture; 30 | using ::vendor::lineage::touch::V1_0::implementation::GloveMode; 31 | using ::vendor::lineage::touch::V1_0::implementation::TouchscreenGesture; 32 | 33 | int main() { 34 | sp gloveMode = new GloveMode(); 35 | android::sp touchscreenGesture = new TouchscreenGesture(); 36 | 37 | android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/); 38 | 39 | if (gloveMode->registerAsService() != OK) { 40 | LOG(ERROR) << "Cannot register glove mode HAL service."; 41 | return 1; 42 | } 43 | 44 | if (touchscreenGesture->registerAsService() != android::OK) { 45 | LOG(ERROR) << "Cannot register touchscreen gesture HAL service."; 46 | return 1; 47 | } 48 | 49 | LOG(INFO) << "Touchscreen HAL service ready."; 50 | 51 | android::hardware::joinRpcThreadpool(); 52 | 53 | LOG(ERROR) << "Touchscreen HAL service failed to join thread pool."; 54 | return 1; 55 | } 56 | -------------------------------------------------------------------------------- /touch/vendor.lineage.touch@1.0-service.kiwi.rc: -------------------------------------------------------------------------------- 1 | on boot 2 | # Glove mode 3 | chown system system /sys/touch_screen/glove_func/signal_disparity 4 | chmod 0664 /sys/touch_screen/glove_func/signal_disparity 5 | 6 | # Gestures 7 | chown system system /sys/touch_screen/easy_wakeup_gesture 8 | chmod 0664 /sys/touch_screen/easy_wakeup_gesture 9 | 10 | service touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.kiwi 11 | class hal 12 | user system 13 | group system 14 | -------------------------------------------------------------------------------- /update-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #set -e 4 | export DEVICE=kiwi 5 | export VENDOR=huawei 6 | 7 | if [ $# -eq 4 ]; then 8 | OLD_ROOT=$1 9 | OLD_RAMDISK=$2 10 | NEW_ROOT=$3 11 | NEW_RAMDISK=$4 12 | else 13 | echo "$0: bad number of arguments" 14 | echo "" 15 | echo "usage: $0 OLD_ROOT OLD_RAMDISK NEW_ROOT NEW_RAMDISK" 16 | exit 1 17 | fi 18 | 19 | BASE=../../../vendor/$VENDOR/$DEVICE/proprietary 20 | 21 | for FILE in `egrep -v '(^#|^$)' proprietary-files.txt`; do 22 | OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS 23 | FILES=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"` 24 | FILE=${PARSING_ARRAY[1]} 25 | if [ -z $FILE ] 26 | then 27 | FILE=$FILES 28 | fi 29 | if [ "${FILE:0:6}" = "/sbin/" ]; then 30 | OLD_DIR=$OLD_RAMDISK 31 | NEW_DIR=$NEW_RAMDISK 32 | else 33 | OLD_DIR=$OLD_ROOT/system 34 | NEW_DIR=$NEW_ROOT/system 35 | fi 36 | if [ ! -f $OLD_DIR/$FILE ]; then 37 | echo "Not in old release: $FILE" 38 | elif [ ! -f $NEW_DIR/$FILE ]; then 39 | echo "Not in new release: $FILE" 40 | elif diff -q $OLD_DIR/$FILE $BASE/$FILE > /dev/null ; then 41 | cp $NEW_DIR/$FILE $BASE/$FILE 42 | else 43 | echo "Not from old release: $FILE" 44 | fi 45 | done | sort 46 | -------------------------------------------------------------------------------- /wifi/WCNSS_cfg.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_device_huawei_kiwi/8d2f206ad19bf34f6d61bfcfbc8c60c79dd4f894/wifi/WCNSS_cfg.dat -------------------------------------------------------------------------------- /wifi/WCNSS_qcom_wlan_nv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_device_huawei_kiwi/8d2f206ad19bf34f6d61bfcfbc8c60c79dd4f894/wifi/WCNSS_qcom_wlan_nv.bin --------------------------------------------------------------------------------