├── Android.mk ├── AndroidBoard.mk ├── BoardConfig.mk ├── MODULE_LICENSE_APACHE2 ├── README.md ├── audio ├── acdb │ ├── MTP_Bluetooth_cal.acdb │ ├── MTP_General_cal.acdb │ ├── MTP_Global_cal.acdb │ ├── MTP_Handset_cal.acdb │ ├── MTP_Hdmi_cal.acdb │ ├── MTP_Headset_cal.acdb │ ├── MTP_Speaker_cal.acdb │ └── workspaceFile.qwsp ├── audio_effects.conf ├── audio_platform_info.xml ├── audio_policy.conf └── mixer_paths.xml ├── bacon.mk ├── bluetooth └── bdroid_buildcfg.h ├── board-info.txt ├── cmhw └── org │ └── cyanogenmod │ └── hardware │ ├── KeyDisabler.java │ └── TouchscreenGestures.java ├── configs ├── libnfc-brcm.conf ├── libnfc-nxp.conf ├── media_codecs.xml ├── media_codecs_performance.xml ├── media_profiles.xml ├── nfcee_access.xml ├── nfcee_access_debug.xml └── sec_config ├── extract-files.sh ├── gps ├── Android.mk ├── CleanSpec.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 │ └── 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 ├── quipc.conf ├── 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.mk └── init_bacon.cpp ├── liblight ├── Android.mk ├── NOTICE └── lights.c ├── lineage.dependencies ├── lineage.mk ├── overlay ├── frameworks │ └── base │ │ ├── core │ │ └── res │ │ │ └── res │ │ │ ├── values │ │ │ └── config.xml │ │ │ └── xml │ │ │ └── power_profile.xml │ │ └── packages │ │ ├── SettingsLib │ │ └── res │ │ │ └── values │ │ │ └── arrays.xml │ │ ├── SettingsProvider │ │ └── res │ │ │ └── values │ │ │ └── defaults.xml │ │ └── SystemUI │ │ └── res │ │ └── values │ │ └── config.xml ├── packages │ ├── apps │ │ ├── CMParts │ │ │ └── res │ │ │ │ └── values │ │ │ │ └── config.xml │ │ ├── CMUpdater │ │ │ └── res │ │ │ │ └── values │ │ │ │ └── config.xml │ │ ├── Dialer │ │ │ └── res │ │ │ │ └── values │ │ │ │ └── config.xml │ │ └── Settings │ │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ └── services │ │ └── Telephony │ │ └── res │ │ ├── values-mcc460 │ │ └── config.xml │ │ └── values │ │ ├── config.xml │ │ └── network_mode.xml └── vendor │ └── cmsdk │ └── cm │ └── res │ └── res │ └── values │ └── config.xml ├── power ├── Android.mk └── power.c ├── proprietary-files-qc.txt ├── proprietary-files.txt ├── recovery ├── Android.mk └── recovery_updater.cpp ├── releasetools.py ├── rootdir ├── Android.mk └── etc │ ├── fstab.bacon │ ├── init.bacon.rc │ ├── init.qcom.bt.sh │ ├── init.qcom.power.rc │ ├── init.qcom.usb.rc │ └── ueventd.qcom.rc ├── sepolicy ├── camera.te ├── cameraserver.te ├── device.te ├── file.te ├── file_contexts ├── fsck.te ├── genfs_contexts ├── healthd.te ├── location.te ├── mediaserver.te ├── mm-qcamerad.te ├── rmt_storage.te ├── shell.te ├── system_app.te ├── system_server.te ├── tee.te ├── ueventd.te └── vold.te ├── setup-makefiles.sh ├── system.prop ├── voice_processing ├── Android.mk └── voice_processing_descriptors.c └── wifi ├── Android.mk ├── WCNSS_cfg.dat ├── WCNSS_qcom_cfg.ini ├── WCNSS_qcom_wlan_nv.bin ├── hostapd.accept ├── hostapd.conf ├── hostapd.deny ├── p2p_supplicant_overlay.conf └── wpa_supplicant_overlay.conf /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 | ifeq ($(TARGET_DEVICE),bacon) 20 | 21 | include $(call all-subdir-makefiles,$(LOCAL_PATH)) 22 | 23 | include $(CLEAR_VARS) 24 | 25 | MODEM_IMAGES := \ 26 | modem.b00 modem.b01 modem.b02 modem.b03 modem.b04 modem.b05 \ 27 | modem.b06 modem.b07 modem.b08 modem.b09 modem.b10 modem.b11 \ 28 | modem.b12 modem.b13 modem.b14 modem.b15 modem.b16 modem.b17 \ 29 | modem.b18 modem.b19 modem.b20 modem.b21 modem.b22 modem.b23 \ 30 | modem.b24 modem.b25 modem.b26 modem.b27 modem.mdt 31 | 32 | MODEM_SYMLINKS := $(addprefix $(TARGET_OUT_ETC)/firmware/,$(notdir $(MODEM_IMAGES))) 33 | $(MODEM_SYMLINKS): $(LOCAL_INSTALLED_MODULE) 34 | @echo "Modem firmware link: $@" 35 | @mkdir -p $(dir $@) 36 | @rm -rf $@ 37 | $(hide) ln -sf /firmware/image/$(notdir $@) $@ 38 | 39 | ALL_DEFAULT_INSTALLED_MODULES += $(MODEM_SYMLINKS) 40 | 41 | MBA_IMAGES := \ 42 | mba.b00 mba.mdt 43 | 44 | MBA_SYMLINKS := $(addprefix $(TARGET_OUT_ETC)/firmware/,$(notdir $(MBA_IMAGES))) 45 | $(MBA_SYMLINKS): $(LOCAL_INSTALLED_MODULE) 46 | @echo "MBA firmware link: $@" 47 | @mkdir -p $(dir $@) 48 | @rm -rf $@ 49 | $(hide) ln -sf /firmware/image/$(notdir $@) $@ 50 | 51 | ALL_DEFAULT_INSTALLED_MODULES += $(MBA_SYMLINKS) 52 | 53 | # Create links for audcal data files 54 | $(shell mkdir -p $(TARGET_OUT)/etc/firmware/wcd9320; \ 55 | ln -sf /data/misc/audio/wcd9320_anc.bin \ 56 | $(TARGET_OUT)/etc/firmware/wcd9320/wcd9320_anc.bin;\ 57 | ln -sf /data/misc/audio/mbhc.bin \ 58 | $(TARGET_OUT)/etc/firmware/wcd9320/wcd9320_mbhc.bin; \ 59 | ln -sf /data/misc/audio/wcd9320_mad_audio.bin \ 60 | $(TARGET_OUT)/etc/firmware/wcd9320/wcd9320_mad_audio.bin) 61 | 62 | # Create a link for the WCNSS config file, which ends up as a writable 63 | # version in /data/misc/wifi 64 | $(shell mkdir -p $(TARGET_OUT)/etc/firmware/wlan/prima; \ 65 | ln -sf /data/misc/wifi/WCNSS_qcom_cfg.ini \ 66 | $(TARGET_OUT)/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini) 67 | 68 | endif 69 | -------------------------------------------------------------------------------- /AndroidBoard.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | #---------------------------------------------------------------------- 4 | # extra images 5 | #---------------------------------------------------------------------- 6 | include build/core/generate_extra_images.mk 7 | -------------------------------------------------------------------------------- /MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Device tree for One+One 2 | 3 | Copyright 2016, The CyanogenMod Project 4 | 5 | -------------------------------------------------------------------------------- /audio/acdb/MTP_Bluetooth_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_Bluetooth_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/MTP_General_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_General_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/MTP_Global_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_Global_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/MTP_Handset_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_Handset_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/MTP_Hdmi_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_Hdmi_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/MTP_Headset_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_Headset_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/MTP_Speaker_cal.acdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/audio/acdb/MTP_Speaker_cal.acdb -------------------------------------------------------------------------------- /audio/acdb/workspaceFile.qwsp: -------------------------------------------------------------------------------- 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 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /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 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /bluetooth/bdroid_buildcfg.h: -------------------------------------------------------------------------------- 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 | #ifndef _BDROID_BUILDCFG_H 18 | #define _BDROID_BUILDCFG_H 19 | 20 | #define BLUETOOTH_QTI_SW TRUE 21 | 22 | #define BTM_DEF_LOCAL_NAME "OnePlus One" 23 | // Disables read remote device feature 24 | #define BTA_SKIP_BLE_READ_REMOTE_FEAT FALSE 25 | #define MAX_L2CAP_CHANNELS 16 26 | #define BLE_VND_INCLUDED TRUE 27 | // skips conn update at conn completion 28 | #define BTA_BLE_SKIP_CONN_UPD FALSE 29 | #define BLE_PERIPHERAL_ADV_NAME FALSE 30 | #define BT_CLEAN_TURN_ON_DISABLED 1 31 | 32 | /* Defined if the kernel does not have support for CLOCK_BOOTTIME_ALARM */ 33 | #define KERNEL_MISSING_CLOCK_BOOTTIME_ALARM TRUE 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /board-info.txt: -------------------------------------------------------------------------------- 1 | require version-trustzone=TZ.BF.2.0-2.0.0123|TZ.BF.2.0-2.0.0134|TZ.BF.2.0-2.0.0137 2 | -------------------------------------------------------------------------------- /cmhw/org/cyanogenmod/hardware/KeyDisabler.java: -------------------------------------------------------------------------------- 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 | package org.cyanogenmod.hardware; 18 | 19 | import org.cyanogenmod.internal.util.FileUtils; 20 | 21 | /* 22 | * Disable capacitive keys 23 | * 24 | * This is intended for use on devices in which the capacitive keys 25 | * can be fully disabled for replacement with a soft navbar. You 26 | * really should not be using this on a device with mechanical or 27 | * otherwise visible-when-inactive keys 28 | */ 29 | 30 | public class KeyDisabler { 31 | 32 | private static String CONTROL_PATH = "/proc/touchpanel/keypad_enable"; 33 | 34 | public static boolean isSupported() { 35 | return FileUtils.isFileWritable(CONTROL_PATH); 36 | } 37 | 38 | public static boolean isActive() { 39 | return FileUtils.readOneLine(CONTROL_PATH).equals("0"); 40 | } 41 | 42 | public static boolean setActive(boolean state) { 43 | return FileUtils.writeLine(CONTROL_PATH, (state ? "0" : "1")); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /cmhw/org/cyanogenmod/hardware/TouchscreenGestures.java: -------------------------------------------------------------------------------- 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 | package org.cyanogenmod.hardware; 18 | 19 | import org.cyanogenmod.internal.util.FileUtils; 20 | 21 | import cyanogenmod.hardware.TouchscreenGesture; 22 | 23 | /** 24 | * Touchscreen gestures API 25 | * 26 | * A device may implement several touchscreen gestures for use while 27 | * the display is turned off, such as drawing alphabets and shapes. 28 | * These gestures can be interpreted by userspace to activate certain 29 | * actions and launch certain apps, such as to skip music tracks, 30 | * to turn on the flashlight, or to launch the camera app. 31 | * 32 | * This *should always* be supported by the hardware directly. 33 | * A lot of recent touch controllers have a firmware option for this. 34 | * 35 | * This API provides support for enumerating the gestures 36 | * supported by the touchscreen. 37 | */ 38 | public class TouchscreenGestures { 39 | 40 | private static final String[] GESTURE_PATHS = { 41 | "/proc/touchpanel/up_arrow_enable", 42 | "/proc/touchpanel/down_arrow_enable", 43 | "/proc/touchpanel/left_arrow_enable", 44 | "/proc/touchpanel/right_arrow_enable", 45 | "/proc/touchpanel/double_swipe_enable", 46 | "/proc/touchpanel/letter_o_enable", 47 | }; 48 | 49 | // Id, name, keycode 50 | private static final TouchscreenGesture[] TOUCHSCREEN_GESTURES = { 51 | new TouchscreenGesture(0, "Up arrow", 255), 52 | new TouchscreenGesture(1, "Down arrow", 252), 53 | new TouchscreenGesture(2, "Left arrow", 253), 54 | new TouchscreenGesture(3, "Right arrow", 254), 55 | new TouchscreenGesture(4, "Two finger down swipe", 251), 56 | new TouchscreenGesture(5, "Letter O", 250), 57 | }; 58 | 59 | /** 60 | * Whether device supports touchscreen gestures 61 | * 62 | * @return boolean Supported devices must return always true 63 | */ 64 | public static boolean isSupported() { 65 | for (String path : GESTURE_PATHS) { 66 | if (!FileUtils.isFileWritable(path) || 67 | !FileUtils.isFileReadable(path)) { 68 | return false; 69 | } 70 | } 71 | return true; 72 | } 73 | 74 | /* 75 | * Get the list of available gestures. A mode has an integer 76 | * identifier and a string name. 77 | * 78 | * It is the responsibility of the upper layers to 79 | * map the name to a human-readable format or perform translation. 80 | */ 81 | public static TouchscreenGesture[] getAvailableGestures() { 82 | return TOUCHSCREEN_GESTURES; 83 | } 84 | 85 | /** 86 | * This method allows to set the activation status of a gesture 87 | * 88 | * @param gesture The gesture to be activated 89 | * state The new activation status of the gesture 90 | * @return boolean Must be false if gesture is not supported 91 | * or the operation failed; true in any other case. 92 | */ 93 | public static boolean setGestureEnabled( 94 | final TouchscreenGesture gesture, final boolean state) { 95 | final String stateStr = state ? "1" : "0"; 96 | return FileUtils.writeLine(GESTURE_PATHS[gesture.id], stateStr); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /configs/nfcee_access.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /extract-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2016 The CyanogenMod 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 | set -e 19 | 20 | DEVICE=bacon 21 | VENDOR=oneplus 22 | 23 | # Load extractutils and do some sanity checks 24 | MY_DIR="${BASH_SOURCE%/*}" 25 | if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi 26 | 27 | CM_ROOT="$MY_DIR"/../../.. 28 | 29 | HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh 30 | if [ ! -f "$HELPER" ]; then 31 | echo "Unable to find helper script at $HELPER" 32 | exit 1 33 | fi 34 | . "$HELPER" 35 | 36 | if [ $# -eq 0 ]; then 37 | SRC=adb 38 | else 39 | if [ $# -eq 1 ]; then 40 | SRC=$1 41 | else 42 | echo "$0: bad number of arguments" 43 | echo "" 44 | echo "usage: $0 [PATH_TO_EXPANDED_ROM]" 45 | echo "" 46 | echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from" 47 | echo "the device using adb pull." 48 | exit 1 49 | fi 50 | fi 51 | 52 | # Initialize the helper 53 | setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" 54 | 55 | extract "$MY_DIR"/proprietary-files-qc.txt "$SRC" 56 | extract "$MY_DIR"/proprietary-files.txt "$SRC" 57 | 58 | "$MY_DIR"/setup-makefiles.sh 59 | -------------------------------------------------------------------------------- /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 | include $(call first-makefiles-under,$(call my-dir)) 18 | -------------------------------------------------------------------------------- /gps/CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libloc_api*) 51 | -------------------------------------------------------------------------------- /gps/core/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libloc_core 6 | LOCAL_MODULE_OWNER := qcom 7 | 8 | LOCAL_MODULE_TAGS := optional 9 | 10 | ifeq ($(TARGET_DEVICE),apq8026_lw) 11 | LOCAL_CFLAGS += -DPDK_FEATURE_SET 12 | else ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true) 13 | LOCAL_CFLAGS += -DPDK_FEATURE_SET 14 | endif 15 | 16 | LOCAL_SHARED_LIBRARIES := \ 17 | libutils \ 18 | libcutils \ 19 | libgps.utils \ 20 | libdl 21 | 22 | LOCAL_SRC_FILES += \ 23 | LocApiBase.cpp \ 24 | LocAdapterBase.cpp \ 25 | ContextBase.cpp \ 26 | LocDualContext.cpp \ 27 | loc_core_log.cpp 28 | 29 | LOCAL_CFLAGS += \ 30 | -fno-short-enums \ 31 | -D_ANDROID_ 32 | 33 | LOCAL_C_INCLUDES:= \ 34 | $(TARGET_OUT_HEADERS)/gps.utils \ 35 | $(TARGET_OUT_HEADERS)/libflp 36 | 37 | LOCAL_COPY_HEADERS_TO:= libloc_core/ 38 | LOCAL_COPY_HEADERS:= \ 39 | LocApiBase.h \ 40 | LocAdapterBase.h \ 41 | ContextBase.h \ 42 | LocDualContext.h \ 43 | LBSProxyBase.h \ 44 | UlpProxyBase.h \ 45 | gps_extended_c.h \ 46 | gps_extended.h \ 47 | loc_core_log.h \ 48 | LocAdapterProxyBase.h 49 | 50 | LOCAL_PRELINK_MODULE := false 51 | 52 | include $(BUILD_SHARED_LIBRARY) 53 | -------------------------------------------------------------------------------- /gps/core/LBSProxyBase.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef IZAT_PROXY_BASE_H 30 | #define IZAT_PROXY_BASE_H 31 | #include 32 | #include 33 | 34 | namespace loc_core { 35 | 36 | class LocApiBase; 37 | class LocAdapterBase; 38 | class ContextBase; 39 | 40 | class LBSProxyBase { 41 | friend class ContextBase; 42 | inline virtual LocApiBase* 43 | getLocApi(const MsgTask* msgTask, 44 | LOC_API_ADAPTER_EVENT_MASK_T exMask, 45 | ContextBase* context) const { 46 | return NULL; 47 | } 48 | protected: 49 | inline LBSProxyBase() {} 50 | public: 51 | inline virtual ~LBSProxyBase() {} 52 | inline virtual void requestUlp(LocAdapterBase* adapter, 53 | unsigned long capabilities) const {} 54 | inline virtual bool hasAgpsExtendedCapabilities() const { return false; } 55 | inline virtual bool hasCPIExtendedCapabilities() const { return false; } 56 | inline virtual void modemPowerVote(bool power) const {} 57 | virtual void injectFeatureConfig(ContextBase* context) const {} 58 | inline virtual IzatDevId_t getIzatDevId() const { return 0; } 59 | }; 60 | 61 | typedef LBSProxyBase* (getLBSProxy_t)(); 62 | 63 | } // namespace loc_core 64 | 65 | #endif // IZAT_PROXY_BASE_H 66 | -------------------------------------------------------------------------------- /gps/core/LocAdapterBase.cpp: -------------------------------------------------------------------------------- 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 | #define LOG_NDDEBUG 0 30 | #define LOG_TAG "LocSvc_LocAdapterBase" 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | namespace loc_core { 39 | 40 | // This is the top level class, so the constructor will 41 | // always gets called. Here we prepare for the default. 42 | // But if getLocApi(targetEnumType target) is overriden, 43 | // the right locApi should get created. 44 | LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, 45 | ContextBase* context, LocAdapterProxyBase *adapterProxyBase) : 46 | mEvtMask(mask), mContext(context), 47 | mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase), 48 | mMsgTask(context->getMsgTask()) 49 | { 50 | mLocApi->addAdapter(this); 51 | } 52 | 53 | void LocAdapterBase::handleEngineUpEvent() 54 | { 55 | if (mLocAdapterProxyBase) { 56 | mLocAdapterProxyBase->handleEngineUpEvent(); 57 | } 58 | } 59 | 60 | void LocAdapterBase::handleEngineDownEvent() 61 | { 62 | if (mLocAdapterProxyBase) { 63 | mLocAdapterProxyBase->handleEngineDownEvent(); 64 | } 65 | } 66 | 67 | void LocAdapterBase:: 68 | reportPosition(UlpLocation &location, 69 | GpsLocationExtended &locationExtended, 70 | void* locationExt, 71 | enum loc_sess_status status, 72 | LocPosTechMask loc_technology_mask) { 73 | if (mLocAdapterProxyBase == NULL || 74 | !mLocAdapterProxyBase->reportPosition(location, 75 | locationExtended, 76 | status, 77 | loc_technology_mask)) { 78 | DEFAULT_IMPL() 79 | } 80 | } 81 | 82 | void LocAdapterBase:: 83 | reportSv(HaxxSvStatus &svStatus, 84 | GpsLocationExtended &locationExtended, 85 | void* svExt) 86 | DEFAULT_IMPL() 87 | 88 | 89 | void LocAdapterBase:: 90 | reportStatus(GpsStatusValue status) 91 | DEFAULT_IMPL() 92 | 93 | 94 | void LocAdapterBase:: 95 | reportNmea(const char* nmea, int length) 96 | DEFAULT_IMPL() 97 | 98 | bool LocAdapterBase:: 99 | reportXtraServer(const char* url1, const char* url2, 100 | const char* url3, const int maxlength) 101 | DEFAULT_IMPL(false) 102 | 103 | bool LocAdapterBase:: 104 | requestXtraData() 105 | DEFAULT_IMPL(false) 106 | 107 | bool LocAdapterBase:: 108 | requestTime() 109 | DEFAULT_IMPL(false) 110 | 111 | bool LocAdapterBase:: 112 | requestLocation() 113 | DEFAULT_IMPL(false) 114 | 115 | bool LocAdapterBase:: 116 | requestATL(int connHandle, AGpsType agps_type) 117 | DEFAULT_IMPL(false) 118 | 119 | bool LocAdapterBase:: 120 | releaseATL(int connHandle) 121 | DEFAULT_IMPL(false) 122 | 123 | bool LocAdapterBase:: 124 | requestSuplES(int connHandle) 125 | DEFAULT_IMPL(false) 126 | 127 | bool LocAdapterBase:: 128 | reportDataCallOpened() 129 | DEFAULT_IMPL(false) 130 | 131 | bool LocAdapterBase:: 132 | reportDataCallClosed() 133 | DEFAULT_IMPL(false) 134 | 135 | bool LocAdapterBase:: 136 | requestNiNotify(GpsNiNotification ¬ify, const void* data) 137 | DEFAULT_IMPL(false) 138 | 139 | void LocAdapterBase:: 140 | reportGpsMeasurementData(GpsData &gpsMeasurementData) 141 | DEFAULT_IMPL() 142 | } // namespace loc_core 143 | -------------------------------------------------------------------------------- /gps/core/LocAdapterProxyBase.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_ADAPTER_PROXY_BASE_H 31 | #define LOC_ADAPTER_PROXY_BASE_H 32 | 33 | #include 34 | #include 35 | 36 | namespace loc_core { 37 | 38 | class LocAdapterProxyBase { 39 | private: 40 | LocAdapterBase *mLocAdapterBase; 41 | protected: 42 | inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, 43 | ContextBase* context): 44 | mLocAdapterBase(new LocAdapterBase(mask, context, this)) { 45 | } 46 | inline virtual ~LocAdapterProxyBase() { 47 | delete mLocAdapterBase; 48 | } 49 | inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event, 50 | loc_registration_mask_status isEnabled) { 51 | mLocAdapterBase->updateEvtMask(event,isEnabled); 52 | } 53 | 54 | public: 55 | inline ContextBase* getContext() const { 56 | return mLocAdapterBase->getContext(); 57 | } 58 | inline virtual void handleEngineUpEvent() {}; 59 | inline virtual void handleEngineDownEvent() {}; 60 | inline virtual bool reportPosition(UlpLocation &location, 61 | GpsLocationExtended &locationExtended, 62 | enum loc_sess_status status, 63 | LocPosTechMask loc_technology_mask) { 64 | return false; 65 | } 66 | }; 67 | 68 | } // namespace loc_core 69 | 70 | #endif //LOC_ADAPTER_PROXY_BASE_H 71 | -------------------------------------------------------------------------------- /gps/core/LocDualContext.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 | #ifndef __LOC_ENG_CONTEXT__ 30 | #define __LOC_ENG_CONTEXT__ 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace loc_core { 38 | 39 | class LocDualContext : public ContextBase { 40 | static const MsgTask* mMsgTask; 41 | static ContextBase* mFgContext; 42 | static ContextBase* mBgContext; 43 | static ContextBase* mInjectContext; 44 | static const MsgTask* getMsgTask(LocThread::tCreate tCreator, 45 | const char* name, bool joinable = true); 46 | static const MsgTask* getMsgTask(const char* name, bool joinable = true); 47 | static pthread_mutex_t mGetLocContextMutex; 48 | 49 | protected: 50 | LocDualContext(const MsgTask* msgTask, 51 | LOC_API_ADAPTER_EVENT_MASK_T exMask); 52 | inline virtual ~LocDualContext() {} 53 | 54 | public: 55 | static const char* mLBSLibName; 56 | static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask; 57 | static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask; 58 | static const char* mLocationHalName; 59 | 60 | static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg, 61 | const char* name, bool joinable = true); 62 | inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) { 63 | return getLocFgContext(NULL, NULL, name, joinable); 64 | } 65 | static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg, 66 | const char* name, bool joinable = true); 67 | inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) { 68 | return getLocBgContext(NULL, NULL, name, joinable); 69 | } 70 | 71 | static void injectFeatureConfig(ContextBase *context); 72 | }; 73 | 74 | } 75 | 76 | #endif //__LOC_ENG_CONTEXT__ 77 | -------------------------------------------------------------------------------- /gps/core/UlpProxyBase.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef ULP_PROXY_BASE_H 30 | #define ULP_PROXY_BASE_H 31 | 32 | #include 33 | 34 | struct FlpExtLocation_s; 35 | struct FlpExtBatchOptions; 36 | 37 | namespace loc_core { 38 | 39 | class LocAdapterBase; 40 | 41 | class UlpProxyBase { 42 | public: 43 | LocPosMode mPosMode; 44 | bool mFixSet; 45 | inline UlpProxyBase() { 46 | mPosMode.mode = LOC_POSITION_MODE_INVALID; 47 | mFixSet = false; 48 | } 49 | inline virtual ~UlpProxyBase() {} 50 | inline virtual bool sendStartFix() { mFixSet = true; return false; } 51 | inline virtual bool sendStopFix() { mFixSet = false; return false; } 52 | inline virtual bool sendFixMode(LocPosMode ¶ms) { 53 | mPosMode = params; 54 | return false; 55 | } 56 | 57 | inline virtual bool reportPosition(UlpLocation &location, 58 | GpsLocationExtended &locationExtended, 59 | void* locationExt, 60 | enum loc_sess_status status, 61 | LocPosTechMask loc_technology_mask) { 62 | return false; 63 | } 64 | inline virtual bool reportSv(HaxxSvStatus &svStatus, 65 | GpsLocationExtended &locationExtended, 66 | void* svExt) { 67 | return false; 68 | } 69 | inline virtual bool reportStatus(GpsStatusValue status) { 70 | return false; 71 | } 72 | inline virtual void setAdapter(LocAdapterBase* adapter) {} 73 | inline virtual void setCapabilities(unsigned long capabilities) {} 74 | inline virtual bool reportBatchingSession(FlpExtBatchOptions &options, 75 | bool active) { 76 | return false; 77 | } 78 | inline virtual bool reportPositions(const struct FlpExtLocation_s* locations, 79 | int32_t number_of_locations) { 80 | return false; 81 | } 82 | }; 83 | 84 | } // namespace loc_core 85 | 86 | #endif // ULP_PROXY_BASE_H 87 | -------------------------------------------------------------------------------- /gps/core/gps_extended.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 GPS_EXTENDED_H 30 | #define GPS_EXTENDED_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif /* __cplusplus */ 35 | 36 | #include 37 | 38 | struct LocPosMode 39 | { 40 | LocPositionMode mode; 41 | GpsPositionRecurrence recurrence; 42 | uint32_t min_interval; 43 | uint32_t preferred_accuracy; 44 | uint32_t preferred_time; 45 | char credentials[14]; 46 | char provider[8]; 47 | LocPosMode(LocPositionMode m, GpsPositionRecurrence recr, 48 | uint32_t gap, uint32_t accu, uint32_t time, 49 | const char* cred, const char* prov) : 50 | mode(m), recurrence(recr), 51 | min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap), 52 | preferred_accuracy(accu), preferred_time(time) { 53 | memset(credentials, 0, sizeof(credentials)); 54 | memset(provider, 0, sizeof(provider)); 55 | if (NULL != cred) { 56 | memcpy(credentials, cred, sizeof(credentials)-1); 57 | } 58 | if (NULL != prov) { 59 | memcpy(provider, prov, sizeof(provider)-1); 60 | } 61 | } 62 | 63 | inline LocPosMode() : 64 | mode(LOC_POSITION_MODE_MS_BASED), 65 | recurrence(GPS_POSITION_RECURRENCE_PERIODIC), 66 | min_interval(MIN_POSSIBLE_FIX_INTERVAL), 67 | preferred_accuracy(50), preferred_time(120000) { 68 | memset(credentials, 0, sizeof(credentials)); 69 | memset(provider, 0, sizeof(provider)); 70 | } 71 | 72 | inline bool equals(const LocPosMode &anotherMode) const 73 | { 74 | return anotherMode.mode == mode && 75 | anotherMode.recurrence == recurrence && 76 | anotherMode.min_interval == min_interval && 77 | anotherMode.preferred_accuracy == preferred_accuracy && 78 | anotherMode.preferred_time == preferred_time && 79 | !strncmp(anotherMode.credentials, credentials, sizeof(credentials)-1) && 80 | !strncmp(anotherMode.provider, provider, sizeof(provider)-1); 81 | } 82 | 83 | void logv() const; 84 | }; 85 | 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif /* __cplusplus */ 90 | 91 | #endif /* GPS_EXTENDED_H */ 92 | 93 | -------------------------------------------------------------------------------- /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=40 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=0 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/gps.conf: -------------------------------------------------------------------------------- 1 | XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin 2 | XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin 3 | XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin 4 | 5 | #Version check for XTRA 6 | #DISABLE = 0 7 | #AUTO = 1 8 | #XTRA2 = 2 9 | #XTRA3 = 3 10 | XTRA_VERSION_CHECK=0 11 | 12 | # Error Estimate 13 | # _SET = 1 14 | # _CLEAR = 0 15 | ERR_ESTIMATE=0 16 | 17 | #Test 18 | NTP_SERVER=time.gpsonextra.net 19 | #Asia 20 | # NTP_SERVER=asia.pool.ntp.org 21 | #Europe 22 | # NTP_SERVER=europe.pool.ntp.org 23 | #North America 24 | # NTP_SERVER=north-america.pool.ntp.org 25 | 26 | # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info 27 | # 4 - Debug, 5 - Verbose 28 | # If DEBUG_LEVEL is commented, Android's logging levels will be used 29 | DEBUG_LEVEL = 2 30 | 31 | # Intermediate position report, 1=enable, 0=disable 32 | INTERMEDIATE_POS=0 33 | 34 | # Below bit mask configures how GPS functionalities 35 | # should be locked when user turns off GPS on Settings 36 | # Set bit 0x1 if MO GPS functionalities are to be locked 37 | # Set bit 0x2 if NI GPS functionalities are to be locked 38 | # default - non is locked for backward compatibility 39 | #GPS_LOCK = 0 40 | 41 | # supl version 42 | # default = 0x20000 (from config.xml) 43 | #SUPL_VER= 44 | 45 | # Emergency SUPL, 1=enable, 0=disable 46 | SUPL_ES=1 47 | 48 | #Choose PDN for Emergency SUPL 49 | #1 - Use emergency PDN 50 | #0 - Use regular SUPL PDN for Emergency SUPL 51 | USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1 52 | 53 | #SUPL_MODE is a bit mask set in config.xml per carrier by default. 54 | #If it is uncommented here, this value will overwrite the value from 55 | #config.xml. 56 | #MSA=0X2 57 | #MSB=0X1 58 | #SUPL_MODE= 59 | 60 | # GPS Capabilities bit mask 61 | # SCHEDULING = 0x01 62 | # MSB = 0x02 63 | # MSA = 0x04 64 | # ON_DEMAND_TIME = 0x10 65 | # GEOFENCE = 0x20 66 | # default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE 67 | CAPABILITIES=0x31 68 | 69 | # Accuracy threshold for intermediate positions 70 | # less accurate positions are ignored, 0 for passing all positions 71 | # ACCURACY_THRES=5000 72 | 73 | ################################ 74 | ##### AGPS server settings ##### 75 | ################################ 76 | 77 | # FOR SUPL SUPPORT, set the following 78 | #SUPL_HOST=supl.google.com 79 | #SUPL_PORT=7276 80 | 81 | # FOR C2K PDE SUPPORT, set the following 82 | # C2K_HOST=c2k.pde.com or IP 83 | # C2K_PORT=1234 84 | 85 | # Bitmask of slots that are available 86 | # for write/install to, where 1s indicate writable, 87 | # and the default value is 0 where no slots 88 | # are writable. For example, AGPS_CERT_WRITABLE_MASK 89 | # of b1000001010 makes 3 slots available 90 | # and the remaining 7 slots unwritable. 91 | #AGPS_CERT_WRITABLE_MASK=0 92 | 93 | #################################### 94 | # LTE Positioning Profile Settings 95 | #################################### 96 | # 0: Enable RRLP on LTE(Default) 97 | # 1: Enable LPP_User_Plane on LTE 98 | # 2: Enable LPP_Control_Plane 99 | # 3: Enable both LPP_User_Plane and LPP_Control_Plane 100 | LPP_PROFILE = 3 101 | 102 | ################################ 103 | # EXTRA SETTINGS 104 | ################################ 105 | # NMEA provider (1=Modem Processor, 0=Application Processor) 106 | NMEA_PROVIDER=0 107 | # Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE) 108 | SGLTE_TARGET=0 109 | 110 | ################################################## 111 | # Select Positioning Protocol on A-GLONASS system 112 | ################################################## 113 | # 0x1: RRC CPlane 114 | # 0x2: RRLP UPlane 115 | # 0x4: LLP Uplane 116 | A_GLONASS_POS_PROTOCOL_SELECT = 0 117 | -------------------------------------------------------------------------------- /gps/loc_api/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/ 4 | 5 | #call the subfolders 6 | include $(addsuffix Android.mk, $(GPS_DIR_LIST)) -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/Android.mk: -------------------------------------------------------------------------------- 1 | #Compile this library only for builds with the latest modem image 2 | 3 | LOCAL_PATH := $(call my-dir) 4 | 5 | include $(CLEAR_VARS) 6 | 7 | LOCAL_MODULE := libloc_eng 8 | LOCAL_MODULE_OWNER := qcom 9 | 10 | LOCAL_MODULE_TAGS := optional 11 | 12 | LOCAL_SHARED_LIBRARIES := \ 13 | libutils \ 14 | libcutils \ 15 | libdl \ 16 | liblog \ 17 | libloc_core \ 18 | libgps.utils 19 | 20 | LOCAL_SRC_FILES += \ 21 | loc_eng.cpp \ 22 | loc_eng_agps.cpp \ 23 | loc_eng_xtra.cpp \ 24 | loc_eng_ni.cpp \ 25 | loc_eng_log.cpp \ 26 | loc_eng_nmea.cpp \ 27 | LocEngAdapter.cpp 28 | 29 | LOCAL_SRC_FILES += \ 30 | loc_eng_dmn_conn.cpp \ 31 | loc_eng_dmn_conn_handler.cpp \ 32 | loc_eng_dmn_conn_thread_helper.c \ 33 | loc_eng_dmn_conn_glue_msg.c \ 34 | loc_eng_dmn_conn_glue_pipe.c 35 | 36 | LOCAL_CFLAGS += \ 37 | -fno-short-enums \ 38 | -D_ANDROID_ 39 | 40 | LOCAL_C_INCLUDES:= \ 41 | $(TARGET_OUT_HEADERS)/gps.utils \ 42 | $(TARGET_OUT_HEADERS)/libloc_core \ 43 | $(LOCAL_PATH) \ 44 | $(TARGET_OUT_HEADERS)/libflp 45 | 46 | LOCAL_COPY_HEADERS_TO:= libloc_eng/ 47 | LOCAL_COPY_HEADERS:= \ 48 | LocEngAdapter.h \ 49 | loc.h \ 50 | loc_eng.h \ 51 | loc_eng_xtra.h \ 52 | loc_eng_ni.h \ 53 | loc_eng_agps.h \ 54 | loc_eng_msg.h \ 55 | loc_eng_log.h 56 | 57 | LOCAL_PRELINK_MODULE := false 58 | 59 | include $(BUILD_SHARED_LIBRARY) 60 | 61 | include $(CLEAR_VARS) 62 | 63 | LOCAL_MODULE := gps.$(TARGET_BOARD_PLATFORM) 64 | LOCAL_MODULE_OWNER := qcom 65 | 66 | LOCAL_MODULE_TAGS := optional 67 | 68 | ## Libs 69 | 70 | LOCAL_SHARED_LIBRARIES := \ 71 | libutils \ 72 | libcutils \ 73 | liblog \ 74 | libloc_eng \ 75 | libloc_core \ 76 | libgps.utils \ 77 | libdl 78 | 79 | LOCAL_SRC_FILES += \ 80 | loc.cpp \ 81 | gps.c 82 | 83 | LOCAL_CFLAGS += \ 84 | -fno-short-enums \ 85 | -D_ANDROID_ \ 86 | 87 | ifeq ($(TARGET_USES_QCOM_BSP), true) 88 | LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP 89 | endif 90 | 91 | ## Includes 92 | LOCAL_C_INCLUDES:= \ 93 | $(TARGET_OUT_HEADERS)/gps.utils \ 94 | $(TARGET_OUT_HEADERS)/libloc_core \ 95 | $(TARGET_OUT_HEADERS)/libflp 96 | 97 | LOCAL_PRELINK_MODULE := false 98 | LOCAL_MODULE_RELATIVE_PATH := hw 99 | 100 | include $(BUILD_SHARED_LIBRARY) 101 | -------------------------------------------------------------------------------- /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_dmn_conn_handler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-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 | #ifndef LOC_ENG_DATA_SERVER_HANDLER 30 | #define LOC_ENG_DATA_SERVER_HANDLER 31 | 32 | #include 33 | #include 34 | 35 | //for SSID_BUF_SIZE 36 | #include 37 | 38 | #ifndef SSID_BUF_SIZE 39 | #define SSID_BUF_SIZE (32+1) 40 | #endif 41 | 42 | enum { 43 | /* 0x0 - 0xEF is reserved for daemon internal */ 44 | GPSONE_LOC_API_IF_REQUEST = 0xF0, 45 | GPSONE_LOC_API_IF_RELEASE, 46 | GPSONE_LOC_API_RESPONSE, 47 | GPSONE_UNBLOCK, 48 | }; 49 | 50 | enum { 51 | GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0, 52 | GPSONE_LOC_API_IF_RELEASE_SUCCESS, 53 | GPSONE_LOC_API_IF_FAILURE, 54 | }; 55 | 56 | 57 | struct ctrl_msg_response { 58 | int result; 59 | }; 60 | 61 | struct ctrl_msg_unblock { 62 | int reserved; 63 | }; 64 | 65 | typedef enum { 66 | IF_REQUEST_TYPE_SUPL = 0, 67 | IF_REQUEST_TYPE_WIFI, 68 | IF_REQUEST_TYPE_ANY 69 | } ctrl_if_req_type_e_type; 70 | 71 | typedef enum { 72 | IF_REQUEST_SENDER_ID_QUIPC = 0, 73 | IF_REQUEST_SENDER_ID_MSAPM, 74 | IF_REQUEST_SENDER_ID_MSAPU, 75 | IF_REQUEST_SENDER_ID_GPSONE_DAEMON, 76 | IF_REQUEST_SENDER_ID_MODEM 77 | } ctrl_if_req_sender_id_e_type; 78 | 79 | struct ctrl_msg_if_request { 80 | ctrl_if_req_type_e_type type; 81 | ctrl_if_req_sender_id_e_type sender_id; 82 | unsigned long ipv4_addr; 83 | unsigned char ipv6_addr[16]; 84 | char ssid[SSID_BUF_SIZE]; 85 | char password[SSID_BUF_SIZE]; 86 | }; 87 | 88 | /* do not change this structure */ 89 | struct ctrl_msgbuf { 90 | size_t msgsz; 91 | uint16_t reserved1; 92 | uint32_t reserved2; 93 | uint8_t ctrl_type; 94 | union { 95 | struct ctrl_msg_response cmsg_response; 96 | struct ctrl_msg_unblock cmsg_unblock; 97 | struct ctrl_msg_if_request cmsg_if_request; 98 | } cmsg; 99 | }; 100 | 101 | extern void* loc_api_handle; 102 | 103 | int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len); 104 | int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len); 105 | 106 | #endif /* LOC_ENG_DATA_SERVER_HANDLER */ 107 | -------------------------------------------------------------------------------- /gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.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_THREAD_HELPER_H__ 30 | #define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif /* __cplusplus */ 35 | 36 | #include 37 | 38 | struct loc_eng_dmn_conn_thelper { 39 | unsigned char thread_exit; 40 | unsigned char thread_ready; 41 | pthread_cond_t thread_cond; 42 | pthread_mutex_t thread_mutex; 43 | pthread_t thread_id; 44 | void * thread_context; 45 | int (*thread_proc_init) (void * context); 46 | int (*thread_proc_pre) (void * context); 47 | int (*thread_proc) (void * context); 48 | int (*thread_proc_post) (void * context); 49 | }; 50 | 51 | typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg); 52 | int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper, 53 | int (*thread_proc_init) (void * context), 54 | int (*thread_proc_pre) (void * context), 55 | int (*thread_proc) (void * context), 56 | int (*thread_proc_post) (void * context), 57 | thelper_create_thread create_thread_cb, 58 | void * context); 59 | 60 | int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper); 61 | int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper); 62 | 63 | /* if only need to use signal */ 64 | int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper); 65 | int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper); 66 | int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper); 67 | int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper); 68 | int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif /* __cplusplus */ 73 | 74 | #endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */ 75 | -------------------------------------------------------------------------------- /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 HaxxSvStatus &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/quipc.conf: -------------------------------------------------------------------------------- 1 | # X86 ONLY - UBUNTU: 2 | # Set QUIPC_CONF_PATH environment variable to indicate the path of this file, e.g: 3 | # export QUIPC_CONF_PATH="/usr2/arahmat/quipc.conf" 4 | 5 | # URL for QUIPS server (N3) 6 | QUIPS_SERVER_URL = https://n3.indoor.izat-location.net/quipsds/LookupService 7 | 8 | # URL for RAS server 9 | RAS_SERVER_URL = https://r1.indoor.izat-location.net/ras/DeviceRegistration 10 | 11 | # Password for secured MSAP-enabled AP 12 | SSID_PWD = qu1pspsk 13 | -------------------------------------------------------------------------------- /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=0 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=0x0 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 | 14 | LOCAL_SRC_FILES += \ 15 | loc_log.cpp \ 16 | loc_cfg.cpp \ 17 | msg_q.c \ 18 | linked_list.c \ 19 | loc_target.cpp \ 20 | platform_lib_abstractions/elapsed_millis_since_boot.cpp \ 21 | LocHeap.cpp \ 22 | LocTimer.cpp \ 23 | LocThread.cpp \ 24 | MsgTask.cpp \ 25 | loc_misc_utils.cpp 26 | 27 | LOCAL_CFLAGS += \ 28 | -fno-short-enums \ 29 | -D_ANDROID_ \ 30 | -std=c++11 31 | 32 | ifeq ($(TARGET_BUILD_VARIANT),user) 33 | LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER 34 | endif 35 | 36 | LOCAL_LDFLAGS += -Wl,--export-dynamic 37 | 38 | ## Includes 39 | LOCAL_C_INCLUDES:= \ 40 | $(LOCAL_PATH)/platform_lib_abstractions 41 | 42 | LOCAL_COPY_HEADERS_TO:= gps.utils/ 43 | LOCAL_COPY_HEADERS:= \ 44 | loc_log.h \ 45 | loc_cfg.h \ 46 | log_util.h \ 47 | linked_list.h \ 48 | msg_q.h \ 49 | MsgTask.h \ 50 | LocHeap.h \ 51 | LocThread.h \ 52 | LocTimer.h \ 53 | loc_target.h \ 54 | loc_timer.h \ 55 | LocSharedLock.h \ 56 | platform_lib_abstractions/platform_lib_includes.h \ 57 | platform_lib_abstractions/platform_lib_time.h \ 58 | platform_lib_abstractions/platform_lib_macros.h \ 59 | loc_misc_utils.h 60 | 61 | LOCAL_MODULE := libgps.utils 62 | LOCAL_CLANG := false 63 | 64 | LOCAL_MODULE_TAGS := optional 65 | 66 | LOCAL_PRELINK_MODULE := false 67 | 68 | include $(BUILD_SHARED_LIBRARY) 69 | endif # not BUILD_TINY_ANDROID 70 | -------------------------------------------------------------------------------- /gps/utils/LocHeap.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_HEAP__ 30 | #define __LOC_HEAP__ 31 | 32 | #include 33 | #include 34 | 35 | // abstract class to be implemented by client to provide a rankable class 36 | class LocRankable { 37 | public: 38 | virtual inline ~LocRankable() {} 39 | 40 | // method to rank objects of such type for sorting purposes. 41 | // The pointer of the input node would be stored in the heap. 42 | // >0 if ranks higher than the input; 43 | // ==0 if equally ranks with the input; 44 | // <0 if ranks lower than the input 45 | virtual int ranks(LocRankable& rankable) = 0; 46 | 47 | // convenient method to rank objects of such type for sorting purposes. 48 | inline bool outRanks(LocRankable& rankable) { return ranks(rankable) > 0; } 49 | }; 50 | 51 | // opaque class to provide service implementation. 52 | class LocHeapNode; 53 | 54 | // a heap whose left and right children are not sorted. It is sorted only vertically, 55 | // i.e. parent always ranks higher than children, if they exist. Ranking algorithm is 56 | // implemented in Rankable. The reason that there is no sort between children is to 57 | // help beter balance the tree with lower cost. When a node is pushed to the tree, 58 | // it is guaranteed that the subtree that is smaller gets to have the new node. 59 | class LocHeap { 60 | protected: 61 | LocHeapNode* mTree; 62 | public: 63 | inline LocHeap() : mTree(NULL) {} 64 | ~LocHeap(); 65 | 66 | // push keeps the tree sorted by rank, it also tries to balance the 67 | // tree by adding the new node to the smaller of the subtrees. 68 | // node is reference to an obj that is managed by client, that client 69 | // creates and destroyes. The destroy should happen after the 70 | // node is popped out from the heap. 71 | void push(LocRankable& node); 72 | 73 | // Peeks the node data on tree top, which has currently the highest ranking 74 | // There is no change the tree structure with this operation 75 | // Returns NULL if the tree is empty, otherwise pointer to the node data of 76 | // the tree top. 77 | LocRankable* peek(); 78 | 79 | // pop keeps the tree sorted by rank, but it does not try to balance 80 | // the tree. 81 | // Return - pointer to the node popped out, or NULL if heap is already empty 82 | LocRankable* pop(); 83 | 84 | // navigating through the tree and find the node that ranks the same 85 | // as the input data, then remove it from the tree. Rank is implemented 86 | // by rankable obj. 87 | // returns the pointer to the node removed; or NULL (if failed). 88 | LocRankable* remove(LocRankable& rankable); 89 | 90 | #ifdef __LOC_UNIT_TEST__ 91 | bool checkTree(); 92 | uint32_t getTreeSize(); 93 | #endif 94 | }; 95 | 96 | #endif //__LOC_HEAP__ 97 | -------------------------------------------------------------------------------- /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/LocThread.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_THREAD__ 30 | #define __LOC_THREAD__ 31 | 32 | #include 33 | #include 34 | 35 | // abstract class to be implemented by client to provide a runnable class 36 | // which gets scheduled by LocThread 37 | class LocRunnable { 38 | public: 39 | inline LocRunnable() {} 40 | inline virtual ~LocRunnable() {} 41 | 42 | // The method to be implemented by thread clients 43 | // and be scheduled by LocThread 44 | // This method will be repeated called until it returns false; or 45 | // until thread is stopped. 46 | virtual bool run() = 0; 47 | 48 | // The method to be run before thread loop (conditionally repeatedly) 49 | // calls run() 50 | inline virtual void prerun() {} 51 | 52 | // The method to be run after thread loop (conditionally repeatedly) 53 | // calls run() 54 | inline virtual void postrun() {} 55 | }; 56 | 57 | // opaque class to provide service implementation. 58 | class LocThreadDelegate; 59 | 60 | // A utility class to create a thread and run LocRunnable 61 | // caller passes in. 62 | class LocThread { 63 | LocThreadDelegate* mThread; 64 | public: 65 | inline LocThread() : mThread(NULL) {} 66 | virtual ~LocThread(); 67 | 68 | typedef pthread_t (*tCreate)(const char* name, void* (*start)(void*), void* arg); 69 | // client starts thread with a runnable, which implements 70 | // the logics to fun in the created thread context. 71 | // The thread could be either joinable or detached. 72 | // runnable is an obj managed by client. Client creates and 73 | // frees it (but must be after stop() is called, or 74 | // this LocThread obj is deleted). 75 | // The obj will be deleted by LocThread if start() 76 | // returns true. Else it is client's responsibility 77 | // to delete the object 78 | // Returns 0 if success; false if failure. 79 | bool start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable = true); 80 | inline bool start(const char* threadName, LocRunnable* runnable, bool joinable = true) { 81 | return start(NULL, threadName, runnable, joinable); 82 | } 83 | 84 | // NOTE: if this is a joinable thread, this stop may block 85 | // for a while until the thread is joined. 86 | void stop(); 87 | 88 | // thread status check 89 | inline bool isRunning() { return NULL != mThread; } 90 | }; 91 | 92 | #endif //__LOC_THREAD__ 93 | -------------------------------------------------------------------------------- /gps/utils/LocTimer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __LOC_TIMER_CPP_H__ 31 | #define __LOC_TIMER_CPP_H__ 32 | 33 | #include 34 | #include 35 | 36 | // opaque class to provide service implementation. 37 | class LocTimerDelegate; 38 | class LocSharedLock; 39 | 40 | // LocTimer client must extend this class and implementthe callback. 41 | // start() / stop() methods are to arm / disarm timer. 42 | class LocTimer 43 | { 44 | LocTimerDelegate* mTimer; 45 | LocSharedLock* mLock; 46 | // don't really want mLock to be manipulated by clients, yet LocTimer 47 | // has to have a reference to the lock so that the delete of LocTimer 48 | // and LocTimerDelegate can work together on their share resources. 49 | friend class LocTimerDelegate; 50 | 51 | public: 52 | LocTimer(); 53 | virtual ~LocTimer(); 54 | 55 | // timeOutInMs: timeout delay in ms 56 | // wakeOnExpire: true if to wake up CPU (if sleeping) upon timer 57 | // expiration and notify the client. 58 | // false if to wait until next time CPU wakes up (if 59 | // sleeping) and then notify the client. 60 | // return: true on success; 61 | // false on failure, e.g. timer is already running. 62 | bool start(uint32_t timeOutInMs, bool wakeOnExpire); 63 | 64 | // return: true on success; 65 | // false on failure, e.g. timer is not running. 66 | bool stop(); 67 | 68 | // LocTimer client Should implement this method. 69 | // This method is used for timeout calling back to client. This method 70 | // should be short enough (eg: send a message to your own thread). 71 | virtual void timeOutCallback() = 0; 72 | }; 73 | 74 | #endif //__LOC_DELAY_H__ 75 | -------------------------------------------------------------------------------- /gps/utils/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.cpp: -------------------------------------------------------------------------------- 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 | #define LOG_NDDEBUG 0 30 | #define LOG_TAG "LocSvc_MsgTask" 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | static void LocMsgDestroy(void* msg) { 40 | delete (LocMsg*)msg; 41 | } 42 | 43 | MsgTask::MsgTask(LocThread::tCreate tCreator, 44 | const char* threadName, bool joinable) : 45 | mQ(msg_q_init2()), mThread(new LocThread()) { 46 | if (!mThread->start(tCreator, threadName, this, joinable)) { 47 | delete mThread; 48 | mThread = NULL; 49 | } 50 | } 51 | 52 | MsgTask::MsgTask(const char* threadName, bool joinable) : 53 | mQ(msg_q_init2()), mThread(new LocThread()) { 54 | if (!mThread->start(threadName, this, joinable)) { 55 | delete mThread; 56 | mThread = NULL; 57 | } 58 | } 59 | 60 | MsgTask::~MsgTask() { 61 | msg_q_flush((void*)mQ); 62 | msg_q_destroy((void**)&mQ); 63 | } 64 | 65 | void MsgTask::destroy() { 66 | LocThread* thread = mThread; 67 | msg_q_unblock((void*)mQ); 68 | if (thread) { 69 | mThread = NULL; 70 | delete thread; 71 | } else { 72 | delete this; 73 | } 74 | } 75 | 76 | void MsgTask::sendMsg(const LocMsg* msg) const { 77 | msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy); 78 | } 79 | 80 | void MsgTask::prerun() { 81 | // make sure we do not run in background scheduling group 82 | set_sched_policy(gettid(), SP_FOREGROUND); 83 | } 84 | 85 | bool MsgTask::run() { 86 | LOC_LOGV("MsgTask::loop() listening ...\n"); 87 | LocMsg* msg; 88 | msq_q_err_type result = msg_q_rcv((void*)mQ, (void **)&msg); 89 | if (eMSG_Q_SUCCESS != result) { 90 | LOC_LOGE("%s:%d] fail receiving msg: %s\n", __func__, __LINE__, 91 | loc_get_msg_q_status(result)); 92 | return false; 93 | } 94 | 95 | msg->log(); 96 | // there is where each individual msg handling is invoked 97 | msg->proc(); 98 | 99 | delete msg; 100 | 101 | return true; 102 | } 103 | -------------------------------------------------------------------------------- /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_cfg.h: -------------------------------------------------------------------------------- 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 | #ifndef LOC_CFG_H 31 | #define LOC_CFG_H 32 | 33 | #include 34 | #include 35 | 36 | #define LOC_MAX_PARAM_NAME 80 37 | #define LOC_MAX_PARAM_STRING 80 38 | #define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING) 39 | 40 | #define UTIL_UPDATE_CONF(conf_data, len, config_table) \ 41 | loc_update_conf((conf_data), (len), (config_table), \ 42 | sizeof(config_table) / sizeof(config_table[0])) 43 | 44 | #define UTIL_READ_CONF_DEFAULT(filename) \ 45 | loc_read_conf((filename), NULL, 0); 46 | 47 | #define UTIL_READ_CONF(filename, config_table) \ 48 | loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0])) 49 | 50 | /*============================================================================= 51 | * 52 | * MODULE TYPE DECLARATION 53 | * 54 | *============================================================================*/ 55 | typedef struct 56 | { 57 | const char *param_name; 58 | void *param_ptr; 59 | uint8_t *param_set; /* was this value set by config file? */ 60 | char param_type; /* 'n' for number, 61 | 's' for string, 62 | 'f' for float */ 63 | } loc_param_s_type; 64 | 65 | /*============================================================================= 66 | * 67 | * MODULE EXTERNAL DATA 68 | * 69 | *============================================================================*/ 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | /*============================================================================= 76 | * 77 | * MODULE EXPORTED FUNCTIONS 78 | * 79 | *============================================================================*/ 80 | void loc_read_conf(const char* conf_file_name, 81 | const loc_param_s_type* config_table, 82 | uint32_t table_length); 83 | int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, 84 | uint32_t table_length); 85 | int loc_update_conf(const char* conf_data, int32_t length, 86 | const loc_param_s_type* config_table, uint32_t table_length); 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif /* LOC_CFG_H */ 92 | -------------------------------------------------------------------------------- /gps/utils/loc_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2012, 2015 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef LOC_LOG_H 31 | #define LOC_LOG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" 35 | { 36 | #endif 37 | 38 | #include 39 | #include 40 | #include "loc_target.h" 41 | 42 | typedef struct 43 | { 44 | const char *name; 45 | long val; 46 | } loc_name_val_s_type; 47 | 48 | #define NAME_VAL(x) {"" #x "", x } 49 | 50 | #define UNKNOWN_STR "UNKNOWN" 51 | 52 | #define CHECK_MASK(type, value, mask_var, mask) \ 53 | (((mask_var) & (mask)) ? (type) (value) : (type) (-1)) 54 | 55 | #define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0])) 56 | 57 | /* Get names from value */ 58 | const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask); 59 | const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value); 60 | const char* loc_get_msg_q_status(int status); 61 | const char* loc_get_target_name(unsigned int target); 62 | 63 | extern const char* log_succ_fail_string(int is_succ); 64 | 65 | extern char *loc_get_time(char *time_string, size_t buf_size); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* LOC_LOG_H */ 72 | -------------------------------------------------------------------------------- /gps/utils/loc_misc_utils.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #define LOG_NDDEBUG 0 36 | #define LOG_TAG "LocSvc_misc_utils" 37 | 38 | int loc_util_split_string(char *raw_string, char **split_strings_ptr, 39 | int max_num_substrings, char delimiter) 40 | { 41 | int raw_string_index=0; 42 | int num_split_strings=0; 43 | unsigned char end_string=0; 44 | int raw_string_length=0; 45 | 46 | if(!raw_string || !split_strings_ptr) { 47 | LOC_LOGE("%s:%d]: NULL parameters", __func__, __LINE__); 48 | num_split_strings = -1; 49 | goto err; 50 | } 51 | LOC_LOGD("%s:%d]: raw string: %s\n", __func__, __LINE__, raw_string); 52 | raw_string_length = strlen(raw_string) + 1; 53 | split_strings_ptr[num_split_strings] = &raw_string[raw_string_index]; 54 | for(raw_string_index=0; raw_string_index < raw_string_length; raw_string_index++) { 55 | if(raw_string[raw_string_index] == '\0') 56 | end_string=1; 57 | if((raw_string[raw_string_index] == delimiter) || end_string) { 58 | raw_string[raw_string_index] = '\0'; 59 | LOC_LOGD("%s:%d]: split string: %s\n", 60 | __func__, __LINE__, split_strings_ptr[num_split_strings]); 61 | num_split_strings++; 62 | if(((raw_string_index + 1) < raw_string_length) && 63 | (num_split_strings < max_num_substrings)) { 64 | split_strings_ptr[num_split_strings] = &raw_string[raw_string_index+1]; 65 | } 66 | else { 67 | break; 68 | } 69 | } 70 | if(end_string) 71 | break; 72 | } 73 | err: 74 | LOC_LOGD("%s:%d]: num_split_strings: %d\n", __func__, __LINE__, num_split_strings); 75 | return num_split_strings; 76 | } 77 | 78 | void loc_util_trim_space(char *org_string) 79 | { 80 | char *scan_ptr, *write_ptr; 81 | char *first_nonspace = NULL, *last_nonspace = NULL; 82 | 83 | if(org_string == NULL) { 84 | LOC_LOGE("%s:%d]: NULL parameter", __func__, __LINE__); 85 | goto err; 86 | } 87 | 88 | scan_ptr = write_ptr = org_string; 89 | 90 | while (*scan_ptr) { 91 | //Find the first non-space character 92 | if ( !isspace(*scan_ptr) && first_nonspace == NULL) { 93 | first_nonspace = scan_ptr; 94 | } 95 | //Once the first non-space character is found in the 96 | //above check, keep shifting the characters to the left 97 | //to replace the spaces 98 | if (first_nonspace != NULL) { 99 | *(write_ptr++) = *scan_ptr; 100 | //Keep track of which was the last non-space character 101 | //encountered 102 | //last_nonspace will not be updated in the case where 103 | //the string ends with spaces 104 | if ( !isspace(*scan_ptr)) { 105 | last_nonspace = write_ptr; 106 | } 107 | } 108 | scan_ptr++; 109 | } 110 | //Add NULL terminator after the last non-space character 111 | if (last_nonspace) { *last_nonspace = '\0'; } 112 | err: 113 | return; 114 | } 115 | -------------------------------------------------------------------------------- /gps/utils/loc_misc_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef _LOC_MISC_UTILS_H_ 30 | #define _LOC_MISC_UTILS_H_ 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /*=========================================================================== 37 | FUNCTION loc_split_string 38 | 39 | DESCRIPTION: 40 | This function is used to split a delimiter separated string into 41 | sub-strings. This function does not allocate new memory to store the split 42 | strings. Instead, it places '\0' in places of delimiters and assings the 43 | starting address of the substring within the raw string as the string address 44 | The input raw_string no longer remains to be a collection of sub-strings 45 | after this function is executed. 46 | Please make a copy of the input string before calling this function if 47 | necessary 48 | 49 | PARAMETERS: 50 | char *raw_string: is the original string with delimiter separated substrings 51 | char **split_strings_ptr: is the arraw of pointers which will hold the addresses 52 | of individual substrings 53 | int max_num_substrings: is the maximum number of substrings that are expected 54 | by the caller. The array of pointers in the above parameter 55 | is usually this long 56 | char delimiter: is the delimiter that separates the substrings. Examples: ' ', ';' 57 | 58 | DEPENDENCIES 59 | N/A 60 | 61 | RETURN VALUE 62 | int Number of split strings 63 | 64 | SIDE EFFECTS 65 | The input raw_string no longer remains a delimiter separated single string. 66 | 67 | EXAMPLE 68 | delimiter = ' ' //space 69 | raw_string = "hello new user" //delimiter is space ' ' 70 | addresses = 0123456789abcd 71 | split_strings_ptr[0] = &raw_string[0]; //split_strings_ptr[0] contains "hello" 72 | split_strings_ptr[1] = &raw_string[6]; //split_strings_ptr[1] contains "new" 73 | split_strings_ptr[2] = &raw_string[a]; //split_strings_ptr[2] contains "user" 74 | 75 | ===========================================================================*/ 76 | int loc_util_split_string(char *raw_string, char **split_strings_ptr, int max_num_substrings, 77 | char delimiter); 78 | 79 | /*=========================================================================== 80 | FUNCTION trim_space 81 | 82 | DESCRIPTION 83 | Removes leading and trailing spaces of the string 84 | 85 | DEPENDENCIES 86 | N/A 87 | 88 | RETURN VALUE 89 | None 90 | 91 | SIDE EFFECTS 92 | N/A 93 | ===========================================================================*/ 94 | void loc_util_trim_space(char *org_string); 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif //_LOC_MISC_UTILS_H_ 100 | -------------------------------------------------------------------------------- /gps/utils/loc_target.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | #ifndef LOC_TARGET_H 30 | #define LOC_TARGET_H 31 | #define TARGET_SET(gnss,ssc) ( (gnss<<1)|ssc ) 32 | #define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC) 33 | #define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC) 34 | #define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC) 35 | #define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) 36 | #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) 37 | #define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC) 38 | #define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) 39 | #define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) 40 | #define getTargetGnssType(target) (target>>1) 41 | 42 | #ifdef __cplusplus 43 | extern "C" 44 | { 45 | #endif 46 | 47 | unsigned int loc_get_target(void); 48 | 49 | /*The character array passed to this function should have length 50 | of atleast PROPERTY_VALUE_MAX*/ 51 | void loc_get_target_baseband(char *baseband, int array_length); 52 | /*The character array passed to this function should have length 53 | of atleast PROPERTY_VALUE_MAX*/ 54 | void loc_get_platform_name(char *platform_name, int array_length); 55 | /*Reads the property ro.lean to identify if this is a lean target 56 | Returns: 57 | 0 if not a lean and mean target 58 | 1 if this is a lean and mean target*/ 59 | int loc_identify_lean_target(); 60 | 61 | /* Please remember to update 'target_name' in loc_log.cpp, 62 | if do any changes to this enum. */ 63 | typedef enum { 64 | GNSS_NONE = 0, 65 | GNSS_MSM, 66 | GNSS_GSS, 67 | GNSS_MDM, 68 | GNSS_QCA1530, 69 | GNSS_AUTO, 70 | GNSS_UNKNOWN 71 | }GNSS_TARGET; 72 | 73 | typedef enum { 74 | NO_SSC = 0, 75 | HAS_SSC 76 | }SSC_TYPE; 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /*LOC_TARGET_H*/ 83 | -------------------------------------------------------------------------------- /gps/utils/loc_timer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013,2015 The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation, nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __LOC_DELAY_H__ 31 | #define __LOC_DELAY_H__ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif /* __cplusplus */ 36 | #include 37 | 38 | /* 39 | user_data: client context pointer, passthrough. Originally received 40 | from calling client when loc_timer_start() is called. 41 | result: 0 if timer successfully timed out; else timer failed. 42 | */ 43 | typedef void (*loc_timer_callback)(void *user_data, int32_t result); 44 | 45 | 46 | /* 47 | delay_msec: timeout value for the timer. 48 | cb_func: callback function pointer, implemented by client. 49 | Can not be NULL. 50 | user_data: client context pointer, passthrough. Will be 51 | returned when loc_timer_callback() is called. 52 | wakeOnExpire: true if to wake up CPU (if sleeping) upon timer 53 | expiration and notify the client. 54 | false if to wait until next time CPU wakes up (if 55 | sleeping) and then notify the client. 56 | Returns the handle, which can be used to stop the timer 57 | NULL, if timer start fails (e.g. if cb_func is NULL). 58 | */ 59 | void* loc_timer_start(uint64_t delay_msec, 60 | loc_timer_callback cb_func, 61 | void *user_data, 62 | bool wake_on_expire=false); 63 | 64 | /* 65 | handle becomes invalid upon the return of the callback 66 | */ 67 | void loc_timer_stop(void*& handle); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif /* __cplusplus */ 72 | 73 | #endif //__LOC_DELAY_H__ 74 | -------------------------------------------------------------------------------- /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_macros.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_MACROS_H__ 30 | #define __PLATFORM_LIB_MACROS_H__ 31 | 32 | #include 33 | 34 | #define TS_PRINTF(format, x...) \ 35 | { \ 36 | struct timeval tv; \ 37 | struct timezone tz; \ 38 | int hh, mm, ss; \ 39 | gettimeofday(&tv, &tz); \ 40 | hh = tv.tv_sec/3600%24; \ 41 | mm = (tv.tv_sec%3600)/60; \ 42 | ss = tv.tv_sec%60; \ 43 | fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \ 44 | } 45 | 46 | 47 | #ifdef USE_GLIB 48 | 49 | #define strlcat g_strlcat 50 | #define strlcpy g_strlcpy 51 | 52 | #define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) 53 | #define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) 54 | #define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) 55 | #define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) 56 | #define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) 57 | 58 | #define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid)) 59 | 60 | #define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread 61 | #define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot()) 62 | 63 | 64 | #else 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | pid_t gettid(void); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #define GETTID_PLATFORM_LIB_ABSTRACTION (gettid()) 76 | #define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread 77 | #define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime()) 78 | 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /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.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | LOCAL_C_INCLUDES := system/core/init 7 | LOCAL_CFLAGS := -Wall 8 | LOCAL_SRC_FILES := init_bacon.cpp 9 | LOCAL_MODULE := libinit_bacon 10 | 11 | include $(BUILD_STATIC_LIBRARY) 12 | -------------------------------------------------------------------------------- /init/init_bacon.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016, The CyanogenMod Project 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 13 | * Neither the name of The Linux Foundation nor the names of its 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "vendor_init.h" 38 | #include "property_service.h" 39 | #include "log.h" 40 | #include "util.h" 41 | 42 | static int read_file2(const char *fname, char *data, int max_size) 43 | { 44 | int fd, rc; 45 | 46 | if (max_size < 1) 47 | return 0; 48 | 49 | fd = open(fname, O_RDONLY); 50 | if (fd < 0) { 51 | ERROR("failed to open '%s'\n", fname); 52 | return 0; 53 | } 54 | 55 | rc = read(fd, data, max_size - 1); 56 | if ((rc > 0) && (rc < max_size)) 57 | data[rc] = '\0'; 58 | else 59 | data[0] = '\0'; 60 | close(fd); 61 | 62 | return 1; 63 | } 64 | 65 | static void init_alarm_boot_properties() 66 | { 67 | char const *alarm_file = "/proc/sys/kernel/boot_reason"; 68 | char buf[64]; 69 | 70 | if (read_file2(alarm_file, buf, sizeof(buf))) { 71 | /* 72 | * Setup ro.alarm_boot value to true when it is RTC triggered boot up 73 | * For existing PMIC chips, the following mapping applies 74 | * for the value of boot_reason: 75 | * 76 | * 0 -> unknown 77 | * 1 -> hard reset 78 | * 2 -> sudden momentary power loss (SMPL) 79 | * 3 -> real time clock (RTC) 80 | * 4 -> DC charger inserted 81 | * 5 -> USB charger insertd 82 | * 6 -> PON1 pin toggled (for secondary PMICs) 83 | * 7 -> CBLPWR_N pin toggled (for external power supply) 84 | * 8 -> KPDPWR_N pin toggled (power key pressed) 85 | */ 86 | if (buf[0] == '3') 87 | property_set("ro.alarm_boot", "true"); 88 | else 89 | property_set("ro.alarm_boot", "false"); 90 | } 91 | } 92 | 93 | static void import_kernel_nv(const std::string& key, 94 | const std::string& value, bool for_emulator __attribute__((unused))) 95 | { 96 | if (key.empty()) return; 97 | 98 | if (key == "oppo.rf_version") { 99 | property_set("ro.oppo.rf_version", value.c_str()); 100 | } else if (key == "oppo.pcb_version") { 101 | property_set("ro.oppo.pcb_version", value.c_str()); 102 | } 103 | } 104 | 105 | void vendor_load_properties() 106 | { 107 | import_kernel_cmdline(0, import_kernel_nv); 108 | init_alarm_boot_properties(); 109 | } 110 | -------------------------------------------------------------------------------- /liblight/Android.mk: -------------------------------------------------------------------------------- 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 | LOCAL_PATH:= $(call my-dir) 16 | # HAL module implemenation stored in 17 | # hw/..so 18 | include $(CLEAR_VARS) 19 | 20 | LOCAL_SRC_FILES := lights.c 21 | LOCAL_MODULE_RELATIVE_PATH := hw 22 | LOCAL_SHARED_LIBRARIES := liblog libcutils 23 | 24 | LOCAL_MODULE := lights.msm8974 25 | LOCAL_MODULE_TAGS := optional 26 | 27 | include $(BUILD_SHARED_LIBRARY) 28 | -------------------------------------------------------------------------------- /lineage.dependencies: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "repository": "android_device_oppo_common", 4 | "target_path": "device/oppo/common" 5 | }, 6 | { 7 | "repository": "android_kernel_oneplus_msm8974", 8 | "target_path": "kernel/oneplus/msm8974" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /lineage.mk: -------------------------------------------------------------------------------- 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 | # Inherit from those products. Most specific first. 16 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk) 17 | 18 | # Inherit from bacon device 19 | $(call inherit-product, device/oneplus/bacon/bacon.mk) 20 | 21 | # Inherit some common CM stuff. 22 | $(call inherit-product, vendor/cm/config/common_full_phone.mk) 23 | 24 | PRODUCT_NAME := lineage_bacon 25 | PRODUCT_DEVICE := bacon 26 | PRODUCT_MANUFACTURER := OnePlus 27 | PRODUCT_MODEL := A0001 28 | 29 | PRODUCT_GMS_CLIENTID_BASE := android-oneplus 30 | 31 | PRODUCT_BRAND := oneplus 32 | TARGET_VENDOR := oneplus 33 | TARGET_VENDOR_PRODUCT_NAME := bacon 34 | TARGET_VENDOR_DEVICE_NAME := A0001 35 | PRODUCT_BUILD_PROP_OVERRIDES += TARGET_DEVICE=A0001 PRODUCT_NAME=bacon 36 | 37 | # Unofficial build ID 38 | TARGET_UNOFFICIAL_BUILD_ID := Sultan 39 | 40 | ## Use the latest approved GMS identifiers unless running a signed build 41 | ifneq ($(SIGN_BUILD),true) 42 | PRODUCT_BUILD_PROP_OVERRIDES += \ 43 | BUILD_FINGERPRINT=oneplus/bacon/A0001:6.0.1/MHC19Q/ZNH2KAS1KN:user/release-keys \ 44 | PRIVATE_BUILD_DESC="bacon-user 6.0.1 MHC19Q ZNH2KAS1KN release-keys" 45 | endif 46 | -------------------------------------------------------------------------------- /overlay/frameworks/base/core/res/res/xml/power_profile.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 0 23 | 71.55 24 | 211.6 25 | 59.22 26 | 0.7 27 | 3.30 28 | 62.09 29 | 52.1 30 | 0.1 31 | 0.1 32 | 20.9 33 | 34 | 185.6 35 | 122.68 36 | 37 | 38 | 1.16 39 | 2.15 40 | 41 | 43 | 44 | 384000 45 | 486000 46 | 594000 47 | 702000 48 | 810000 49 | 918000 50 | 1026000 51 | 1134000 52 | 1242000 53 | 1350000 54 | 1458000 55 | 1512000 56 | 57 | 58 | 3.5 59 | 10.43 60 | 61 | 62 | 92.6 63 | 108.6 64 | 118.8 65 | 121.4 66 | 127.3 67 | 133.1 68 | 173.3 69 | 209.5 70 | 216.5 71 | 228.5 72 | 236.0 73 | 239.7 74 | 75 | 76 | 3100 77 | 78 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SettingsLib/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 24 | 25 | 0 26 | -1 27 | -1 28 | 29 | 30 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 30000 22 | 23 | true 24 | 25 | 87 26 | 27 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 23 | 24 | 25 | 26 | true 27 | true 28 | 29 | 30 | -------------------------------------------------------------------------------- /overlay/packages/apps/CMParts/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 22 | 23 | 4 24 | 2 25 | 8 26 | 9 27 | 7 28 | 1 29 | 30 | 31 | -------------------------------------------------------------------------------- /overlay/packages/apps/CMUpdater/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | https://raw.githubusercontent.com/sultanxda/CMUpdater-API/cm-14.1/bacon/api.json 11 | 12 | -------------------------------------------------------------------------------- /overlay/packages/apps/Dialer/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | true 19 | 4 20 | 21 | -------------------------------------------------------------------------------- /overlay/packages/apps/Settings/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | true 21 | 22 | 0.270 23 | 24 | 0.540 25 | 26 | 27 | 28 | true 29 | 30 | ONE A0001 31 | 12739A-A0001 32 | 33 | 34 | 35 | true 36 | 37 | -------------------------------------------------------------------------------- /overlay/packages/services/Telephony/res/values-mcc460/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | true 19 | 20 | -------------------------------------------------------------------------------- /overlay/packages/services/Telephony/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 22 | true 23 | 24 | 25 | true 26 | 27 | true 28 | 29 | 30 | -------------------------------------------------------------------------------- /overlay/packages/services/Telephony/res/values/network_mode.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | LTE/CDMA/EvDo/GSM/WCDMA 21 | LTE/GSM/WCDMA 22 | LTE/CDMA/EvDo 23 | CDMA/EvDo auto 24 | GSM/WCDMA auto 25 | WCDMA only 26 | GSM only 27 | GSM/WCDMA preferred 28 | 29 | 30 | LTE/CDMA/EvDo/GSM/WCDMA 31 | LTE/GSM/WCDMA 32 | LTE/CDMA/EvDo 33 | CDMA/EvDo auto 34 | GSM/WCDMA auto 35 | WCDMA only 36 | GSM only 37 | GSM/WCDMA preferred 38 | 39 | 40 | "10" 41 | "9" 42 | "8" 43 | "4" 44 | "3" 45 | "2" 46 | "1" 47 | "0" 48 | 49 | 50 | -------------------------------------------------------------------------------- /overlay/vendor/cmsdk/cm/res/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 21 | true 22 | 100 23 | true 24 | 25 | 26 | 12000 27 | 28 | 41 | 43 42 | 43 | 44 | 0 45 | 46 | 47 | -------------------------------------------------------------------------------- /power/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2014 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 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | ifneq ($(TARGET_TAP_TO_WAKE_NODE),) 22 | LOCAL_CFLAGS += -DTAP_TO_WAKE_NODE=\"$(TARGET_TAP_TO_WAKE_NODE)\" 23 | endif 24 | 25 | LOCAL_MODULE_RELATIVE_PATH := hw 26 | LOCAL_SRC_FILES := power.c 27 | LOCAL_SHARED_LIBRARIES := liblog libcutils 28 | LOCAL_MODULE_TAGS := optional 29 | LOCAL_MODULE := power.bacon 30 | include $(BUILD_SHARED_LIBRARY) 31 | -------------------------------------------------------------------------------- /power/power.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 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 | 21 | #define LOG_TAG "PowerHal" 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | enum { 28 | PROFILE_POWER_SAVE, 29 | PROFILE_BALANCED, 30 | PROFILE_HIGH_PERFORMANCE, 31 | }; 32 | 33 | #define POWER_NR_OF_SUPPORTED_PROFILES 3 34 | 35 | #define POWER_PROFILE_PROPERTY "sys.perf.profile" 36 | #define POWER_SAVE_PROP "0" 37 | #define BALANCED_PROP "1" 38 | #define HIGH_PERFORMANCE_PROP "2" 39 | 40 | static int current_power_profile = PROFILE_BALANCED; 41 | 42 | static int sysfs_write(const char *path, char *s) 43 | { 44 | char buf[80]; 45 | int len; 46 | int fd = open(path, O_WRONLY); 47 | 48 | if (fd < 0) { 49 | strerror_r(errno, buf, sizeof(buf)); 50 | ALOGE("Error opening %s: %s\n", path, buf); 51 | return -1; 52 | } 53 | 54 | len = write(fd, s, strlen(s)); 55 | if (len < 0) { 56 | strerror_r(errno, buf, sizeof(buf)); 57 | ALOGE("Error writing to %s: %s\n", path, buf); 58 | return -1; 59 | } 60 | 61 | close(fd); 62 | return 0; 63 | } 64 | 65 | static void power_init(struct power_module *module __unused) 66 | { 67 | ALOGI("%s", __func__); 68 | } 69 | 70 | static void power_set_interactive(struct power_module *module __unused, 71 | int on __unused) 72 | { 73 | } 74 | 75 | static void set_power_profile(int profile) 76 | { 77 | if (profile == current_power_profile) 78 | return; 79 | 80 | switch (profile) { 81 | case PROFILE_POWER_SAVE: 82 | property_set(POWER_PROFILE_PROPERTY, POWER_SAVE_PROP); 83 | break; 84 | case PROFILE_BALANCED: 85 | property_set(POWER_PROFILE_PROPERTY, BALANCED_PROP); 86 | break; 87 | case PROFILE_HIGH_PERFORMANCE: 88 | property_set(POWER_PROFILE_PROPERTY, HIGH_PERFORMANCE_PROP); 89 | break; 90 | } 91 | 92 | current_power_profile = profile; 93 | } 94 | 95 | static void power_hint(struct power_module *module __unused, power_hint_t hint, 96 | void *data __unused) 97 | { 98 | if (hint == POWER_HINT_SET_PROFILE) 99 | set_power_profile(*(int32_t *)data); 100 | } 101 | 102 | static struct hw_module_methods_t power_module_methods = { 103 | .open = NULL, 104 | }; 105 | 106 | static void set_feature(struct power_module *module __unused, 107 | feature_t feature, int state) 108 | { 109 | #ifdef TAP_TO_WAKE_NODE 110 | char tmp_str[64]; 111 | 112 | if (feature == POWER_FEATURE_DOUBLE_TAP_TO_WAKE) { 113 | snprintf(tmp_str, 64, "%d", state); 114 | sysfs_write(TAP_TO_WAKE_NODE, tmp_str); 115 | } 116 | #endif 117 | } 118 | 119 | static int get_feature(struct power_module *module __unused, feature_t feature) 120 | { 121 | if (feature == POWER_FEATURE_SUPPORTED_PROFILES) 122 | return POWER_NR_OF_SUPPORTED_PROFILES; 123 | return -1; 124 | } 125 | 126 | struct power_module HAL_MODULE_INFO_SYM = { 127 | .common = { 128 | .tag = HARDWARE_MODULE_TAG, 129 | .module_api_version = POWER_MODULE_API_VERSION_0_3, 130 | .hal_api_version = HARDWARE_HAL_API_VERSION, 131 | .id = POWER_HARDWARE_MODULE_ID, 132 | .name = "Bacon Power HAL", 133 | .author = "The CyanogenMod Project", 134 | .methods = &power_module_methods, 135 | }, 136 | .init = power_init, 137 | .powerHint = power_hint, 138 | .setInteractive = power_set_interactive, 139 | .setFeature = set_feature, 140 | .getFeature = get_feature 141 | }; 142 | -------------------------------------------------------------------------------- /proprietary-files-qc.txt: -------------------------------------------------------------------------------- 1 | # Bluetooth 2 | bin/btnvtool 3 | bin/hci_qcomm_init 4 | vendor/lib/libbtnv.so 5 | 6 | # ADSP 7 | bin/adsprpcd 8 | vendor/lib/libadsprpc.so 9 | vendor/lib/libfastcvadsp_stub.so 10 | vendor/lib/libfastcvopt.so 11 | 12 | # Audio 13 | vendor/lib/libacdbloader.so 14 | vendor/lib/libacdbrtac.so 15 | vendor/lib/libadiertac.so 16 | vendor/lib/libaudcal.so 17 | vendor/lib/soundfx/libqcbassboost.so 18 | vendor/lib/soundfx/libqcreverb.so 19 | vendor/lib/soundfx/libqcvirt.so 20 | 21 | # DRM 22 | bin/qseecomd 23 | lib/libdrmdecrypt.so 24 | vendor/lib/libQSEEComAPI.so 25 | vendor/lib/libdrmfs.so 26 | vendor/lib/libdrmtime.so 27 | vendor/lib/librpmb.so 28 | vendor/lib/libssd.so 29 | 30 | # GPS 31 | bin/loc_launcher 32 | lib/libloc_api_v02.so 33 | lib/libloc_ds_api.so 34 | vendor/lib/hw/flp.default.so 35 | vendor/lib/libflp.so 36 | vendor/lib/libgeofence.so 37 | vendor/lib/libizat_core.so 38 | vendor/lib/liblbs_core.so 39 | 40 | # Graphics 41 | vendor/lib/egl/eglsubAndroid.so 42 | vendor/lib/egl/libEGL_adreno.so 43 | vendor/lib/egl/libGLESv1_CM_adreno.so 44 | vendor/lib/egl/libGLESv2_adreno.so 45 | vendor/lib/egl/libq3dtools_adreno.so 46 | vendor/lib/libadreno_utils.so 47 | vendor/lib/libbccQTI.so 48 | vendor/lib/libC2D2.so 49 | vendor/lib/libCB.so 50 | vendor/lib/libc2d30-a3xx.so 51 | vendor/lib/libgsl.so 52 | vendor/lib/libllvm-qcom.so 53 | vendor/lib/libOpenCL.so 54 | vendor/lib/libsc-a3xx.so 55 | vendor/lib/libRSDriver_adreno.so 56 | vendor/lib/librs_adreno.so 57 | vendor/lib/librs_adreno_sha1.so 58 | vendor/lib/libscale.so 59 | 60 | # Graphics firmware 61 | etc/firmware/a330_pfp.fw 62 | etc/firmware/a330_pm4.fw 63 | 64 | # Listen service 65 | vendor/lib/liblistenhardware.so 66 | vendor/lib/liblistenjni.so 67 | -vendor/lib/liblisten.so 68 | vendor/lib/liblistensoundmodel.so 69 | 70 | # Media 71 | vendor/lib/libDivxDrm.so 72 | vendor/lib/libI420colorconvert.so 73 | vendor/lib/libmm-color-convertor.so 74 | vendor/lib/libmmosal.so 75 | vendor/lib/libSHIMDivxDrm.so 76 | 77 | # Perf 78 | bin/mpdecision 79 | 80 | # Qualcomm framework 81 | bin/irsc_util 82 | -vendor/lib/libdiag.so 83 | vendor/lib/libdsi_netctrl.so 84 | -vendor/lib/libdsutils.so 85 | -vendor/lib/libidl.so 86 | -vendor/lib/libqcci_legacy.so 87 | vendor/lib/libqdi.so 88 | vendor/lib/libqdp.so 89 | -vendor/lib/libqmi.so 90 | vendor/lib/libqmi_cci.so 91 | vendor/lib/libqmi_client_helper.so 92 | -vendor/lib/libqmi_client_qmux.so 93 | vendor/lib/libqmi_common_so.so 94 | vendor/lib/libqmi_csi.so 95 | vendor/lib/libqmi_encdec.so 96 | -vendor/lib/libqmiservices.so 97 | vendor/lib/libsmemlog.so 98 | vendor/lib/libsystem_health_mon.so 99 | 100 | # Radio 101 | -priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk 102 | -app/shutdownlistener/shutdownlistener.apk 103 | bin/netmgrd 104 | bin/qmuxd 105 | bin/radish 106 | bin/rfs_access 107 | bin/rmt_storage 108 | etc/data/dsi_config.xml 109 | etc/data/netmgr_config.xml 110 | etc/permissions/qcnvitems.xml 111 | etc/permissions/qcrilhook.xml 112 | framework/qcnvitems.jar 113 | framework/qcrilhook.jar 114 | framework/qti-telephony-common.jar 115 | -lib/libmdmdetect.so 116 | vendor/lib/libcneapiclient.so 117 | vendor/lib/libconfigdb.so 118 | vendor/lib/liblqe.so 119 | vendor/lib/libnetmgr.so 120 | vendor/lib/libperipheral_client.so 121 | vendor/lib/libril-qc-qmi-1.so 122 | vendor/lib/libril-qcril-hook-oem.so 123 | vendor/lib/libxml.so 124 | 125 | # Sensors 126 | bin/sensors.qcom 127 | vendor/lib/hw/activity_recognition.msm8974.so 128 | vendor/lib/hw/sensors.msm8974.so 129 | vendor/lib/libsensor1.so 130 | vendor/lib/libsensor_reg.so 131 | 132 | # Thermal 133 | vendor/lib/libthermalclient.so 134 | 135 | # Time services 136 | bin/time_daemon 137 | -vendor/lib/libtime_genoff.so 138 | -vendor/lib/libTimeService.so 139 | -app/TimeService/TimeService.apk 140 | 141 | # Venus (media) firmware 142 | etc/firmware/venus.b00 143 | etc/firmware/venus.b01 144 | etc/firmware/venus.b02 145 | etc/firmware/venus.b03 146 | etc/firmware/venus.b04 147 | etc/firmware/venus.mbn 148 | etc/firmware/venus.mdt 149 | 150 | # Widevine - from kipper 151 | vendor/lib/libwvdrm_L3.so|7e77482481197997294a834bfbc817a01b6075cd 152 | vendor/lib/libWVStreamControlAPI_L3.so|61673304827483d44b735a3dd08f0783d10ce92d 153 | vendor/lib/mediadrm/libwvdrmengine.so|416e44ba482f1f97258ff8793b0a810219ac632d 154 | 155 | # WiFi 156 | -lib/libwpa_qmi_eap_proxy.so 157 | lib/libwcnss_qmi.so 158 | -------------------------------------------------------------------------------- /proprietary-files.txt: -------------------------------------------------------------------------------- 1 | # Camera 2 | bin/mm-qcamera-daemon 3 | vendor/lib/libactuator_dw9714.so 4 | vendor/lib/libactuator_dw9714_camcorder.so 5 | vendor/lib/libactuator_dw9714_camera.so 6 | vendor/lib/libjpegdhw.so 7 | vendor/lib/libjpegehw.so 8 | vendor/lib/libmmcamera2_c2d_module.so 9 | vendor/lib/libmmcamera2_cpp_module.so 10 | vendor/lib/libmmcamera2_frame_algorithm.so 11 | vendor/lib/libmmcamera2_iface_modules.so 12 | vendor/lib/libmmcamera2_imglib_modules.so 13 | vendor/lib/libmmcamera2_is.so 14 | vendor/lib/libmmcamera2_isp_modules.so 15 | vendor/lib/libmmcamera2_pproc_modules.so 16 | vendor/lib/libmmcamera2_q3a_special.so 17 | vendor/lib/libmmcamera2_sensor_modules.so 18 | vendor/lib/libmmcamera2_stats_algorithm.so 19 | vendor/lib/libmmcamera2_stats_modules.so 20 | vendor/lib/libmmcamera2_vpe_module.so 21 | vendor/lib/libmmcamera2_wnr_module.so 22 | vendor/lib/libmmcamera_faceproc.so 23 | vendor/lib/libmmcamera_hdr_gb_lib.so 24 | vendor/lib/libmmcamera_hdr_lib.so 25 | vendor/lib/libmmcamera_imglib.so 26 | vendor/lib/libmmcamera_imx214.so 27 | vendor/lib/libmmcamera_ov5648.so 28 | vendor/lib/libmmcamera_tintless_algo.so 29 | vendor/lib/libmmcamera_tintless_bg_pca_algo.so 30 | vendor/lib/libmmcamera_tuning.so 31 | vendor/lib/libmmcamera_wavelet_lib.so 32 | vendor/lib/libmmipl.so 33 | vendor/lib/libmmjpeg.so 34 | vendor/lib/libmmqjpeg_codec.so 35 | vendor/lib/liboemcamera.so 36 | vendor/lib/libqomx_jpegdec.so 37 | vendor/lib/libqomx_jpegenc.so 38 | 39 | # Camera Chromatix 40 | vendor/lib/libchromatix_imx214_common.so 41 | vendor/lib/libchromatix_imx214_default_video.so 42 | vendor/lib/libchromatix_imx214_hfr_120.so 43 | vendor/lib/libchromatix_imx214_hfr_60.so 44 | vendor/lib/libchromatix_imx214_liveshot.so 45 | vendor/lib/libchromatix_imx214_preview.so 46 | vendor/lib/libchromatix_imx214_preview_binning.so 47 | vendor/lib/libchromatix_imx214_snapshot.so 48 | vendor/lib/libchromatix_imx214_snapshot_hdr.so 49 | vendor/lib/libchromatix_imx214_video_binning.so 50 | vendor/lib/libchromatix_imx214_video_hdr.so 51 | vendor/lib/libchromatix_ov5648_common.so 52 | vendor/lib/libchromatix_ov5648_default_video.so 53 | vendor/lib/libchromatix_ov5648_preview.so 54 | vendor/lib/libchromatix_ov5648_zsl.so 55 | 56 | # Camera firmware 57 | etc/firmware/cpp_firmware_v1_1_1.fw 58 | etc/firmware/cpp_firmware_v1_1_6.fw 59 | etc/firmware/cpp_firmware_v1_2_0.fw 60 | 61 | # Modem firmware 62 | etc/firmware/adsp.b00 63 | etc/firmware/adsp.b01 64 | etc/firmware/adsp.b02 65 | etc/firmware/adsp.b03 66 | etc/firmware/adsp.b04 67 | etc/firmware/adsp.b05 68 | etc/firmware/adsp.b06 69 | etc/firmware/adsp.b07 70 | etc/firmware/adsp.b08 71 | etc/firmware/adsp.b09 72 | etc/firmware/adsp.b10 73 | etc/firmware/adsp.b11 74 | etc/firmware/adsp.b12 75 | etc/firmware/adsp.mdt 76 | etc/firmware/cmnlib.b00 77 | etc/firmware/cmnlib.b01 78 | etc/firmware/cmnlib.b02 79 | etc/firmware/cmnlib.b03 80 | etc/firmware/cmnlib.mdt 81 | etc/firmware/isdbtmm.b00 82 | etc/firmware/isdbtmm.b01 83 | etc/firmware/isdbtmm.b02 84 | etc/firmware/isdbtmm.b03 85 | etc/firmware/isdbtmm.mdt 86 | etc/firmware/keymaste.b00 87 | etc/firmware/keymaste.b01 88 | etc/firmware/keymaste.b02 89 | etc/firmware/keymaste.b03 90 | etc/firmware/keymaste.mdt 91 | etc/firmware/mc_v2.b00 92 | etc/firmware/mc_v2.b01 93 | etc/firmware/mc_v2.b02 94 | etc/firmware/mc_v2.b03 95 | etc/firmware/mc_v2.mdt 96 | etc/firmware/playread.b00 97 | etc/firmware/playread.b01 98 | etc/firmware/playread.b02 99 | etc/firmware/playread.b03 100 | etc/firmware/playread.mdt 101 | etc/firmware/tqs.b00 102 | etc/firmware/tqs.b01 103 | etc/firmware/tqs.b02 104 | etc/firmware/tqs.b03 105 | etc/firmware/tqs.mdt 106 | etc/firmware/wcnss.b00 107 | etc/firmware/wcnss.b01 108 | etc/firmware/wcnss.b02 109 | etc/firmware/wcnss.b04 110 | etc/firmware/wcnss.b06 111 | etc/firmware/wcnss.b07 112 | etc/firmware/wcnss.b08 113 | etc/firmware/wcnss.b09 114 | etc/firmware/wcnss.mdt 115 | etc/firmware/widevine.b00 116 | etc/firmware/widevine.b01 117 | etc/firmware/widevine.b02 118 | etc/firmware/widevine.b03 119 | etc/firmware/widevine.mdt 120 | 121 | # NFC 122 | vendor/firmware/libpn547_fw.so 123 | 124 | # Sensors 125 | etc/sensor_def_qcomdev.conf 126 | vendor/lib/libAKM8963.so|741eb7ee64bffd54d53ff6a7ed17c4baf0d2c7b8 127 | -------------------------------------------------------------------------------- /recovery/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_C_INCLUDES := $(call project-path-for,recovery) 5 | LOCAL_SRC_FILES := recovery_updater.cpp 6 | LOCAL_MODULE := librecovery_updater_bacon 7 | LOCAL_MODULE_TAGS := eng 8 | include $(BUILD_STATIC_LIBRARY) 9 | -------------------------------------------------------------------------------- /releasetools.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 The Android Open Source Project 2 | # Copyright (c) 2011, The Linux Foundation. All rights reserved. 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 | import hashlib 17 | import common 18 | import re 19 | 20 | def FullOTA_Assertions(info): 21 | AddTrustZoneAssertion(info) 22 | return 23 | 24 | def IncrementalOTA_Assertions(info): 25 | AddTrustZoneAssertion(info) 26 | return 27 | 28 | def AddTrustZoneAssertion(info): 29 | android_info = info.input_zip.read("OTA/android-info.txt") 30 | m = re.search(r'require\s+version-trustzone\s*=\s*(\S+)', android_info) 31 | if m: 32 | versions = m.group(1).split('|') 33 | if len(versions) and '*' not in versions: 34 | cmd = 'assert(bacon.verify_trustzone(' + ','.join(['"%s"' % tz for tz in versions]) + ') == "1");' 35 | info.script.AppendExtra(cmd) 36 | cmd = 'assert(bacon.verify_fs_type() == "1");' 37 | info.script.AppendExtra(cmd) 38 | return 39 | -------------------------------------------------------------------------------- /rootdir/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # QCOM config scripts 5 | 6 | include $(CLEAR_VARS) 7 | LOCAL_MODULE := init.qcom.bt.sh 8 | LOCAL_MODULE_TAGS := optional 9 | LOCAL_MODULE_CLASS := ETC 10 | LOCAL_SRC_FILES := etc/init.qcom.bt.sh 11 | include $(BUILD_PREBUILT) 12 | 13 | # Device init files 14 | 15 | include $(CLEAR_VARS) 16 | LOCAL_MODULE := fstab.bacon 17 | LOCAL_MODULE_TAGS := optional eng 18 | LOCAL_MODULE_CLASS := ETC 19 | LOCAL_SRC_FILES := etc/fstab.bacon 20 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 21 | include $(BUILD_PREBUILT) 22 | 23 | include $(CLEAR_VARS) 24 | LOCAL_MODULE := init.bacon.rc 25 | LOCAL_MODULE_TAGS := optional eng 26 | LOCAL_MODULE_CLASS := ETC 27 | LOCAL_SRC_FILES := etc/init.bacon.rc 28 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 29 | include $(BUILD_PREBUILT) 30 | 31 | include $(CLEAR_VARS) 32 | LOCAL_MODULE := init.qcom.power.rc 33 | LOCAL_MODULE_TAGS := optional 34 | LOCAL_MODULE_CLASS := ETC 35 | LOCAL_SRC_FILES := etc/init.qcom.power.rc 36 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 37 | include $(BUILD_PREBUILT) 38 | 39 | include $(CLEAR_VARS) 40 | LOCAL_MODULE := init.qcom.usb.rc 41 | LOCAL_MODULE_TAGS := optional eng 42 | LOCAL_MODULE_CLASS := ETC 43 | LOCAL_SRC_FILES := etc/init.qcom.usb.rc 44 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 45 | include $(BUILD_PREBUILT) 46 | 47 | include $(CLEAR_VARS) 48 | LOCAL_MODULE := init.recovery.bacon.rc 49 | LOCAL_MODULE_TAGS := optional 50 | LOCAL_MODULE_CLASS := ETC 51 | LOCAL_SRC_FILES := etc/init.qcom.power.rc 52 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 53 | include $(BUILD_PREBUILT) 54 | 55 | include $(CLEAR_VARS) 56 | LOCAL_MODULE := ueventd.bacon.rc 57 | LOCAL_MODULE_TAGS := optional 58 | LOCAL_MODULE_CLASS := ETC 59 | LOCAL_SRC_FILES := etc/ueventd.qcom.rc 60 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 61 | include $(BUILD_PREBUILT) 62 | -------------------------------------------------------------------------------- /rootdir/etc/fstab.bacon: -------------------------------------------------------------------------------- 1 | # Android fstab file. 2 | # 3 | # The filesystem that contains the filesystem checker binary (typically /system) cannot 4 | # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK 5 | 6 | /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait 7 | /dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,errors=panic wait,check,formattable,encryptable=/dev/block/platform/msm_sdcc.1/by-name/reserve4 8 | /dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,errors=panic wait,check,formattable 9 | /dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait,check 10 | /dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults 11 | /dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults 12 | /dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults 13 | /dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait 14 | 15 | /devices/platform/xhci-hcd* auto auto defaults voldmanaged=usbdisk:auto 16 | -------------------------------------------------------------------------------- /rootdir/etc/init.qcom.bt.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are 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 copyright 9 | # notice, this list of conditions and the following disclaimer in the 10 | # documentation and/or other materials provided with the distribution. 11 | # * Neither the name of The Linux Foundation nor 12 | # the names of its contributors may be used to endorse or promote 13 | # products derived from this software without specific prior written 14 | # permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | LOG_TAG="qcom-bluetooth" 30 | LOG_NAME="${0}:" 31 | 32 | loge () 33 | { 34 | /system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@" 35 | } 36 | 37 | logi () 38 | { 39 | /system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@" 40 | } 41 | 42 | failed () 43 | { 44 | loge "$1: exit code $2" 45 | exit $2 46 | } 47 | 48 | POWER_CLASS=`getprop qcom.bt.dev_power_class` 49 | LE_POWER_CLASS=`getprop qcom.bt.le_dev_pwr_class` 50 | 51 | setprop bluetooth.status off 52 | 53 | case $POWER_CLASS in 54 | 1) PWR_CLASS="-p 0" ; 55 | logi "Power Class: 1";; 56 | 2) PWR_CLASS="-p 1" ; 57 | logi "Power Class: 2";; 58 | 3) PWR_CLASS="-p 2" ; 59 | logi "Power Class: CUSTOM";; 60 | *) PWR_CLASS=""; 61 | logi "Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)"; 62 | logi "Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3>";; 63 | esac 64 | 65 | case $LE_POWER_CLASS in 66 | 1) LE_PWR_CLASS="-P 0" ; 67 | logi "LE Power Class: 1";; 68 | 2) LE_PWR_CLASS="-P 1" ; 69 | logi "LE Power Class: 2";; 70 | 3) LE_PWR_CLASS="-P 2" ; 71 | logi "LE Power Class: CUSTOM";; 72 | *) LE_PWR_CLASS="-P 1"; 73 | logi "LE Power Class: Ignored. Default(2) used (1-CLASS1/2-CLASS2/3-CUSTOM)"; 74 | logi "LE Power Class: To override, Before turning BT ON; setprop qcom.bt.le_dev_pwr_class <1 or 2 or 3>";; 75 | esac 76 | 77 | eval $(/system/bin/hci_qcomm_init -e $PWR_CLASS $LE_PWR_CLASS && echo "exit_code_hci_qcomm_init=0" || echo "exit_code_hci_qcomm_init=1") 78 | 79 | case $exit_code_hci_qcomm_init in 80 | 0) logi "Bluetooth QSoC firmware download succeeded, $BTS_DEVICE $BTS_TYPE $BTS_BAUD $BTS_ADDRESS";; 81 | *) failed "Bluetooth QSoC firmware download failed" $exit_code_hci_qcomm_init; 82 | setprop bluetooth.status off 83 | exit $exit_code_hci_qcomm_init;; 84 | esac 85 | 86 | setprop bluetooth.status on 87 | exit 0 88 | -------------------------------------------------------------------------------- /sepolicy/camera.te: -------------------------------------------------------------------------------- 1 | # Older qcamera service sockets 2 | allow mm-qcamerad system_data_file:dir { write remove_name add_name }; 3 | 4 | # Face detection cache in the old location 5 | allow mm-qcamerad camera_data_file:file create_file_perms; 6 | -------------------------------------------------------------------------------- /sepolicy/cameraserver.te: -------------------------------------------------------------------------------- 1 | # For text relocations in /system/vendor/lib/libmmjpeg.so 2 | allow cameraserver system_file:file execmod; 3 | -------------------------------------------------------------------------------- /sepolicy/device.te: -------------------------------------------------------------------------------- 1 | type nvbackup_block_device, dev_type; 2 | type reserve4_block_device, dev_type; 3 | -------------------------------------------------------------------------------- /sepolicy/file.te: -------------------------------------------------------------------------------- 1 | type proc_touchpanel, fs_type; 2 | -------------------------------------------------------------------------------- /sepolicy/file_contexts: -------------------------------------------------------------------------------- 1 | # NV backup partitions 2 | /dev/block/platform/msm_sdcc\.1/by-name/oppodycnvbk u:object_r:nvbackup_block_device:s0 3 | /dev/block/platform/msm_sdcc\.1/by-name/oppostanvbk u:object_r:nvbackup_block_device:s0 4 | 5 | # Persist filesystem 6 | /dev/block/platform/msm_sdcc\.1/by-name/persist u:object_r:persist_block_device:s0 7 | 8 | # Reserve4 filesystem for encryption 9 | /dev/block/platform/msm_sdcc\.1/by-name/reserve4 u:object_r:reserve4_block_device:s0 10 | 11 | # Old camera socket 12 | /data/cam_socket1 u:object_r:camera_socket:s0 13 | /data/cam_socket2 u:object_r:camera_socket:s0 14 | -------------------------------------------------------------------------------- /sepolicy/fsck.te: -------------------------------------------------------------------------------- 1 | allow fsck persist_block_device:blk_file rw_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/genfs_contexts: -------------------------------------------------------------------------------- 1 | genfscon proc /touchpanel u:object_r:proc_touchpanel:s0 2 | -------------------------------------------------------------------------------- /sepolicy/healthd.te: -------------------------------------------------------------------------------- 1 | allow healthd device:dir r_dir_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/location.te: -------------------------------------------------------------------------------- 1 | # Cleanup sockets 2 | allow location location_data_file:sock_file unlink; 3 | -------------------------------------------------------------------------------- /sepolicy/mediaserver.te: -------------------------------------------------------------------------------- 1 | binder_call(mediaserver, audiod) 2 | 3 | allow mediaserver camera_data_file:dir search; 4 | -------------------------------------------------------------------------------- /sepolicy/mm-qcamerad.te: -------------------------------------------------------------------------------- 1 | # For text relocations in /system/vendor/lib/libmmcamera_faceproc.so 2 | allow mm-qcamerad system_file:file execmod; 3 | -------------------------------------------------------------------------------- /sepolicy/rmt_storage.te: -------------------------------------------------------------------------------- 1 | # Allow rmt_storage to backup/restore NV contents 2 | allow rmt_storage nvbackup_block_device:blk_file rw_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/shell.te: -------------------------------------------------------------------------------- 1 | # address denials with some CTS cases 2 | allow shell persist_file:dir r_dir_perms; 3 | allow shell sysfs_battery_supply:dir r_dir_perms; 4 | allow shell sysfs_usb_supply:dir r_dir_perms; 5 | -------------------------------------------------------------------------------- /sepolicy/system_app.te: -------------------------------------------------------------------------------- 1 | allow system_app proc_touchpanel:dir search; 2 | allow system_app proc_touchpanel:file rw_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/system_server.te: -------------------------------------------------------------------------------- 1 | # for CMHardwareService access to TapToWake 2 | allow system_server proc_touchpanel:file rw_file_perms; 3 | allow system_server proc_touchpanel:dir { search }; 4 | 5 | # examine battery state 6 | r_dir_file(system_server, sysfs_usb_supply); 7 | -------------------------------------------------------------------------------- /sepolicy/tee.te: -------------------------------------------------------------------------------- 1 | allow tee vfat:dir search; 2 | allow tee vfat:file { getattr open read }; 3 | -------------------------------------------------------------------------------- /sepolicy/ueventd.te: -------------------------------------------------------------------------------- 1 | allow ueventd vfat:dir search; 2 | allow ueventd vfat:file { getattr open read }; 3 | -------------------------------------------------------------------------------- /sepolicy/vold.te: -------------------------------------------------------------------------------- 1 | allow vold persist_file:dir r_file_perms; 2 | 3 | # Encryption 4 | allow vold reserve4_block_device:blk_file rw_file_perms; 5 | allow vold firmware_file:dir search; 6 | allow vold firmware_file:file r_file_perms; 7 | -------------------------------------------------------------------------------- /setup-makefiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2016 The CyanogenMod 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 | set -e 19 | 20 | export INITIAL_COPYRIGHT_YEAR=2014 21 | 22 | # Required! 23 | DEVICE=bacon 24 | VENDOR=oneplus 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 | CM_ROOT="$MY_DIR"/../../.. 31 | 32 | HELPER="$CM_ROOT"/vendor/cm/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" "$CM_ROOT" 41 | 42 | # Copyright headers and guards 43 | write_headers 44 | 45 | # The standard blobs 46 | write_makefiles "$MY_DIR"/proprietary-files.txt 47 | 48 | # Qualcomm BSP blobs - we put a conditional around here 49 | # in case the BSP is actually being built 50 | printf '\n%s\n' "ifeq (\$(QCPATH),)" >> "$PRODUCTMK" 51 | printf '\n%s\n' "ifeq (\$(QCPATH),)" >> "$ANDROIDMK" 52 | 53 | write_makefiles "$MY_DIR"/proprietary-files-qc.txt 54 | 55 | printf '%s\n' "endif" >> "$PRODUCTMK" 56 | printf '%s\n' "endif" >> "$ANDROIDMK" 57 | 58 | # We are done! 59 | write_footers 60 | 61 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # 2 | # system.prop for one+ 3 | # 4 | 5 | # Bluetooth 6 | bluetooth.hfp.client=1 7 | qcom.bluetooth.soc=smd 8 | ro.bluetooth.hfp.ver=1.7 9 | ro.qualcomm.bt.hci_transport=smd 10 | 11 | ro.bluetooth.dun=false 12 | ro.bluetooth.sap=false 13 | 14 | # CABL 15 | ro.qualcomm.cabl=0 16 | 17 | # Camera 18 | camera2.portability.force_api=1 19 | 20 | # Display 21 | ro.sf.lcd_density=480 22 | persist.hwc.mdpcomp.enable=true 23 | persist.sys.strictmode.disable=true 24 | ro.opengles.version=196608 25 | 26 | # GPS 27 | persist.gps.qc_nlp_in_use=0 28 | ro.gps.agps_provider=1 29 | 30 | # Media 31 | af.fast_track_multiplier=1 32 | audio_hal.period_size=192 33 | drm.service.enabled=true 34 | persist.audio.fluence.voicecall=true 35 | ro.qc.sdk.audio.fluencetype=fluence 36 | 37 | audio.offload.buffer.size.kb=32 38 | audio.offload.video=true 39 | audio.offload.multiple.enabled=false 40 | audio.offload.gapless.enabled=true 41 | audio.deep_buffer.media=true 42 | ro.config.vc_call_vol_steps=8 43 | ro.config.media_vol_steps=20 44 | 45 | mm.enable.smoothstreaming=true 46 | media.aac_51_output_enabled=true 47 | 48 | # Network 49 | persist.data.netmgrd.qos.enable=true 50 | persist.data.tcpackprio.enable=true 51 | ro.data.large_tcp_window_size=true 52 | 53 | # Radio 54 | rild.libpath=/system/vendor/lib/libril-qc-qmi-1.so 55 | persist.radio.add_power_save=1 56 | persist.radio.apm_sim_not_pwdn=1 57 | ro.ril.ext.ecclist=112,911,999,110,122,119,120,000,08,118 58 | 59 | ro.telephony.call_ring.multiple=0 60 | ro.telephony.default_network=9 61 | 62 | ro.use_data_netmgrd=true 63 | 64 | telephony.lteOnGsmDevice=1 65 | 66 | # Sensors 67 | ro.qc.sdk.camera.facialproc=true 68 | ro.qc.sdk.gestures.camera=false 69 | ro.qti.sdk.sensors.gestures=true 70 | ro.qti.sensors.bte=true 71 | ro.qti.sensors.gtap=true 72 | ro.qti.sensors.ir_proximity=true 73 | ro.qti.sensors.vmd=true 74 | 75 | # Time services 76 | persist.timed.enable=true 77 | 78 | # Wifi 79 | wifi.interface=wlan0 80 | -------------------------------------------------------------------------------- /voice_processing/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2013 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 | ifneq ($(filter bacon, $(TARGET_DEVICE)),) 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | LOCAL_SRC_FILES := \ 22 | voice_processing_descriptors.c 23 | 24 | LOCAL_C_INCLUDES += \ 25 | $(call include-path-for, audio-effects) 26 | 27 | LOCAL_MODULE := libqcomvoiceprocessingdescriptors 28 | 29 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx 30 | 31 | LOCAL_MODULE_TAGS := optional 32 | 33 | include $(BUILD_SHARED_LIBRARY) 34 | 35 | endif 36 | -------------------------------------------------------------------------------- /voice_processing/voice_processing_descriptors.c: -------------------------------------------------------------------------------- 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 | //------------------------------------------------------------------------------ 19 | // Effect descriptors 20 | //------------------------------------------------------------------------------ 21 | 22 | // UUIDs for effect types have been generated from http://www.itu.int/ITU-T/asn1/uuid.html 23 | // as the pre processing effects are not defined by OpenSL ES 24 | 25 | // Acoustic Echo Cancellation 29dfd020-e88b-11e5-b505-0002a5d5c51b 26 | const effect_descriptor_t qcom_product_aec_descriptor = { 27 | { 0x7b491460, 0x8d4d, 0x11e0, 0xbd61, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // type 28 | { 0x29dfd020, 0xe88b, 0x11e5, 0xb505, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // uuid 29 | EFFECT_CONTROL_API_VERSION, 30 | (EFFECT_FLAG_TYPE_PRE_PROC|EFFECT_FLAG_DEVICE_IND), 31 | 0, 32 | 0, 33 | "Acoustic Echo Canceler", 34 | "Qualcomm Fluence for Bacon" 35 | }; 36 | 37 | // Noise suppression e4eb6b40-e88b-11e5-b6ad-0002a5d5c51b 38 | const effect_descriptor_t qcom_product_ns_descriptor = { 39 | { 0x58b4b260, 0x8e06, 0x11e0, 0xaa8e, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // type 40 | { 0xe4eb6b40, 0xe88b, 0x11e5, 0xb6ad, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // uuid 41 | EFFECT_CONTROL_API_VERSION, 42 | (EFFECT_FLAG_TYPE_PRE_PROC|EFFECT_FLAG_DEVICE_IND), 43 | 0, 44 | 0, 45 | "Noise Suppression", 46 | "Qualcomm Fluence for Bacon" 47 | }; 48 | 49 | //ENABLE_AGC 50 | // Automatic Gain Control e6cdbac0-4a7c-11e4-a018-0002a5d5c51b 51 | //const effect_descriptor_t qcom_product_agc_descriptor = { 52 | // { 0x0a8abfe0, 0x654c, 0x11e0, 0xba26, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // type 53 | // { 0xe6cdbac0, 0x4a7c, 0x11e4, 0xa018, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // uuid 54 | // EFFECT_CONTROL_API_VERSION, 55 | // (EFFECT_FLAG_TYPE_PRE_PROC|EFFECT_FLAG_DEVICE_IND), 56 | // 0, 57 | // 0, 58 | // "Automatic Gain Control", 59 | // "Qualcomm Fluence for Bacon" 60 | //}; 61 | 62 | -------------------------------------------------------------------------------- /wifi/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | #---------------------------------------------------------------------- 4 | # Copy additional target-specific files 5 | #---------------------------------------------------------------------- 6 | 7 | include $(CLEAR_VARS) 8 | LOCAL_MODULE := wpa_supplicant_overlay.conf 9 | LOCAL_MODULE_TAGS := optional 10 | LOCAL_MODULE_CLASS := ETC 11 | LOCAL_SRC_FILES := $(LOCAL_MODULE) 12 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/wifi 13 | include $(BUILD_PREBUILT) 14 | 15 | include $(CLEAR_VARS) 16 | LOCAL_MODULE := p2p_supplicant_overlay.conf 17 | LOCAL_MODULE_TAGS := optional 18 | LOCAL_MODULE_CLASS := ETC 19 | LOCAL_SRC_FILES := $(LOCAL_MODULE) 20 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/wifi 21 | include $(BUILD_PREBUILT) 22 | 23 | include $(CLEAR_VARS) 24 | LOCAL_MODULE := hostapd_default.conf 25 | LOCAL_MODULE_TAGS := optional 26 | LOCAL_MODULE_CLASS := ETC 27 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/hostapd 28 | LOCAL_SRC_FILES := hostapd.conf 29 | include $(BUILD_PREBUILT) 30 | 31 | include $(CLEAR_VARS) 32 | LOCAL_MODULE := hostapd.accept 33 | LOCAL_MODULE_TAGS := optional 34 | LOCAL_MODULE_CLASS := ETC 35 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/hostapd 36 | LOCAL_SRC_FILES := hostapd.accept 37 | include $(BUILD_PREBUILT) 38 | 39 | include $(CLEAR_VARS) 40 | LOCAL_MODULE := hostapd.deny 41 | LOCAL_MODULE_TAGS := optional 42 | LOCAL_MODULE_CLASS := ETC 43 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/hostapd 44 | LOCAL_SRC_FILES := hostapd.deny 45 | include $(BUILD_PREBUILT) 46 | -------------------------------------------------------------------------------- /wifi/WCNSS_cfg.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/wifi/WCNSS_cfg.dat -------------------------------------------------------------------------------- /wifi/WCNSS_qcom_wlan_nv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerneltoast/android_device_oneplus_bacon/8390b409714a3fe60976db7120440e1b8d933921/wifi/WCNSS_qcom_wlan_nv.bin -------------------------------------------------------------------------------- /wifi/hostapd.accept: -------------------------------------------------------------------------------- 1 | # List of MAC addresses that are allowed to authenticate (IEEE 802.11) 2 | # with the AP. Optional VLAN ID can be assigned for clients based on the 3 | # MAC address if dynamic VLANs (hostapd.conf dynamic_vlan option) are used. 4 | -------------------------------------------------------------------------------- /wifi/hostapd.deny: -------------------------------------------------------------------------------- 1 | # List of MAC addresses that are not allowed to authenticate (IEEE 802.11) 2 | # with the AP. 3 | -------------------------------------------------------------------------------- /wifi/p2p_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | p2p_search_delay=100 3 | -------------------------------------------------------------------------------- /wifi/wpa_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | wowlan_triggers=any 3 | p2p_disabled=1 4 | filter_rssi=-75 5 | no_ctrl_interface= 6 | --------------------------------------------------------------------------------