diff options
323 files changed, 5848 insertions, 8068 deletions
diff --git a/.gitupstream b/.gitupstream new file mode 100644 index 00000000..f3791a07 --- /dev/null +++ b/.gitupstream @@ -0,0 +1 @@ +https://android.googlesource.com/device/google/redbull diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 239aa7ce..00000000 --- a/Android.mk +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,default-permissions.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,libnfc-nci.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,fstab.postinstall,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,ueventd.rc,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,wpa_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,hals.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,media_profiles_V1_0.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,media_codecs_performance.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,device_state_configuration.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,task_profiles.json,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,p2p_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,wpa_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) -$(eval $(call declare-copy-files-license-metadata,device/google/redbull,wpa_supplicant_overlay.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,)) - -$(eval $(call declare-1p-copy-files,device/google/redbull,audio_policy_configuration.xml)) - -ifeq ($(USES_DEVICE_GOOGLE_REDBULL),true) - subdir_makefiles=$(call first-makefiles-under,$(LOCAL_PATH)) - $(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk))) -endif diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index 17dc8520..5fe10c75 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -36,7 +36,6 @@ TARGET_2ND_CPU_VARIANT := generic TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a76 endif -BUILD_BROKEN_DUP_RULES := true BOARD_KERNEL_CMDLINE += console=ttyMSM0,115200n8 androidboot.console=ttyMSM0 printk.devkmsg=on BOARD_KERNEL_CMDLINE += msm_rtb.filter=0x237 BOARD_KERNEL_CMDLINE += ehci-hcd.park=3 @@ -125,7 +124,6 @@ BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4 # userdata.img TARGET_USERIMAGES_USE_F2FS := true BOARD_USERDATAIMAGE_PARTITION_SIZE := 10737418240 -BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs # persist.img BOARD_PERSISTIMAGE_PARTITION_SIZE := 33554432 @@ -181,7 +179,6 @@ BOOT_KERNEL_MODULES := \ subsystem_notif.ko \ ramdump.ko \ msm_memshare.ko \ - msm_bus_dbg_rpmh.ko \ msm_bus_rpmh.ko \ rpmh-regulator.ko \ qcom-geni-se.ko \ @@ -196,7 +193,6 @@ BOOT_KERNEL_MODULES := \ spi-geni-qcom.ko \ i2c-qcom-geni.ko \ ion-alloc.ko \ - msm_rtb.ko \ pinctrl-spmi-gpio.ko \ pinctrl-spmi-mpp.ko \ pwm-qti-lpg.ko \ @@ -344,7 +340,6 @@ BOOT_KERNEL_MODULES := \ leds-qpnp-flash-common.ko \ leds-qpnp-flash-v2.ko \ of_slimbus.ko \ - tz_log.ko \ google_wlan_mac.ko \ msm_ext_display.ko \ msm_qmp.ko \ @@ -380,7 +375,7 @@ BOARD_FLASH_BLOCK_SIZE := 131072 BOARD_ROOT_EXTRA_SYMLINKS := /vendor/lib/dsp:/dsp BOARD_ROOT_EXTRA_SYMLINKS += /mnt/vendor/persist:/persist -include device/google/redbull-sepolicy/redbull-sepolicy.mk +include device/google/redbull/sepolicy/redbull-sepolicy.mk QCOM_BOARD_PLATFORMS += lito QC_PROP_ROOT := vendor/qcom/sm7250/proprietary @@ -507,8 +502,6 @@ BOARD_GOOGLE_DYNAMIC_PARTITIONS_SIZE := 6438256640 # Set error limit to BOARD_SUPER_PARTITON_SIZE - 500MB BOARD_SUPER_PARTITION_ERROR_LIMIT := 9231663104 -BUILD_BROKEN_USES_BUILD_COPY_HEADERS := true - -include device/google/redbull/soong/pixel_soong_config.mk # List of modules that should not load automatically @@ -520,120 +513,13 @@ PRODUCT_COPY_FILES += \ # We can't use a variable as the prefix to an include statement # because it makes it too difficult to convert to starlark TARGET_BOARD_NAME_DIR := device/google/$(TARGET_BOOTLOADER_BOARD_NAME) --include device/google/$(TARGET_BOOTLOADER_BOARD_NAME)-sepolicy/$(TARGET_BOOTLOADER_BOARD_NAME)-sepolicy.mk +-include device/google/$(TARGET_BOOTLOADER_BOARD_NAME)/sepolicy/$(TARGET_BOOTLOADER_BOARD_NAME)-sepolicy.mk TARGET_BOARD_INFO_FILE := $(TARGET_BOARD_NAME_DIR)/board-info.txt TARGET_BOARD_COMMON_PATH := $(TARGET_BOARD_NAME_DIR)/sm7250 -# Common kernel file handling -ifneq (,$(filter $(TARGET_DEVICE),bramble redfin barbet)) - TARGET_KERNEL_DIR := device/google/redbull-kernel -else - TARGET_KERNEL_DIR := $(TARGET_BOARD_NAME_DIR)-kernel -endif - -# DTBO partition definitions -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) - BOARD_PREBUILT_DTBOIMAGE := $(TARGET_KERNEL_DIR)/dtbo.img -else - BOARD_PREBUILT_DTBOIMAGE := $(TARGET_KERNEL_DIR)/vintf/dtbo.img -endif TARGET_FS_CONFIG_GEN := $(TARGET_BOARD_NAME_DIR)/config.fs -# Kernel modules -ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kasan, $(TARGET_PRODUCT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/kasan -else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kernel_debug_memory, $(TARGET_PRODUCT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_memory -else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kernel_debug_memory_accounting, $(TARGET_PRODUCT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_memory_accounting -BOARD_KERNEL_CMDLINE += page_owner=on -else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kernel_debug_locking, $(TARGET_PRODUCT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_locking -else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kernel_debug_hang, $(TARGET_PRODUCT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_hang -else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kernel_debug_api, $(TARGET_PRODUCT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_api -else - ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR) - else - KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/vintf - endif -endif - -# Copy kheaders.ko to vendor/lib/modules for VTS test -BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULE_DIR)/kheaders.ko - -KERNEL_MODULES := $(wildcard $(KERNEL_MODULE_DIR)/*.ko) -KERNEL_MODULES_LOAD := $(strip $(shell cat $(firstword $(wildcard \ - $(KERNEL_MODULE_DIR)/modules.load \ - $(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)), \ - $(TARGET_KERNEL_DIR)/vintf/modules.load,) \ - $(TARGET_KERNEL_DIR)/modules.load)))) - -# DTB -BOARD_PREBUILT_DTBIMAGE_DIR := $(KERNEL_MODULE_DIR) - -ifeq (,$(BOOT_KERNEL_MODULES)) - BOARD_VENDOR_RAMDISK_KERNEL_MODULES := $(KERNEL_MODULES) - BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD := $(KERNEL_MODULES_LOAD) -else - # - # BEWARE: This is a tuning exercise to get right, splitting between - # boot essential drivers, fastboot/recovery drivers, and the remainder - # used by Android, but not the blocklist (device specific drivers not - # common between platforms or drivers that must not be autoloaded) which - # are loaded later. - # - # BOOT_KERNEL_MODULES - Modules loaded in first stage init. - # RECOVERY_KERNEL_MODULES - Additional modules loaded in recovery/fastbootd - # or in second stage init. - # file: modules.blocklist - Not autoloaded. loaded on demand product or HAL. - # Remainder - In second stage init, but after recovery set; - # minus the blocklist. - # - BOOT_KERNEL_MODULES_FILTER := $(foreach m,$(BOOT_KERNEL_MODULES),%/$(m)) - ifneq (,$(RECOVERY_KERNEL_MODULES)) - RECOVERY_KERNEL_MODULES_FILTER := \ - $(foreach m,$(RECOVERY_KERNEL_MODULES),%/$(m)) - endif - BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \ - $(filter $(BOOT_KERNEL_MODULES_FILTER) \ - $(RECOVERY_KERNEL_MODULES_FILTER),$(KERNEL_MODULES)) - - # ALL modules land in /vendor/lib/modules so they could be rmmod/insmod'd, - # and modules.list actually limits us to the ones we intend to load. - BOARD_VENDOR_KERNEL_MODULES := $(KERNEL_MODULES) - # To limit /vendor/lib/modules to just the ones loaded, use: - # - # BOARD_VENDOR_KERNEL_MODULES := $(filter-out \ - # $(BOOT_KERNEL_MODULES_FILTER),$(KERNEL_MODULES)) - - # Group set of /vendor/lib/modules loading order to recovery modules first, - # then remainder, subtracting both recovery and boot modules. - BOARD_VENDOR_KERNEL_MODULES_LOAD := \ - $(filter-out $(BOOT_KERNEL_MODULES_FILTER), \ - $(filter $(RECOVERY_KERNEL_MODULES_FILTER),$(KERNEL_MODULES_LOAD))) - BOARD_VENDOR_KERNEL_MODULES_LOAD += \ - $(filter-out $(BOOT_KERNEL_MODULES_FILTER) \ - $(RECOVERY_KERNEL_MODULES_FILTER),$(KERNEL_MODULES_LOAD)) - - # NB: Load order governed by modules.load and not by $(BOOT_KERNEL_MODULES) - BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD := \ - $(filter $(BOOT_KERNEL_MODULES_FILTER),$(KERNEL_MODULES_LOAD)) - - ifneq (,$(RECOVERY_KERNEL_MODULES_FILTER)) - # Group set of /vendor/lib/modules loading order to boot modules first, - # then remainder of recovery modules. - BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD := \ - $(filter $(BOOT_KERNEL_MODULES_FILTER),$(KERNEL_MODULES_LOAD)) - BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD += \ - $(filter-out $(BOOT_KERNEL_MODULES_FILTER), \ - $(filter $(RECOVERY_KERNEL_MODULES_FILTER),$(KERNEL_MODULES_LOAD))) - endif -endif - BOARD_BUILD_VENDOR_RAMDISK_IMAGE := true # Testing related defines diff --git a/BoardConfigLineage.mk b/BoardConfigLineage.mk new file mode 100644 index 00000000..7d4900d9 --- /dev/null +++ b/BoardConfigLineage.mk @@ -0,0 +1,50 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Kernel +BOARD_KERNEL_IMAGE_NAME := Image.lz4 +TARGET_COMPILE_WITH_MSM_KERNEL := true +TARGET_KERNEL_CONFIG := redbull_defconfig +TARGET_KERNEL_SOURCE := kernel/google/redbull +TARGET_NEEDS_DTBOIMAGE := true +TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-gnu- + +# Kernel modules +BOOT_KERNEL_MODULES += \ + heatmap.ko \ + touch_offload.ko + +KERNEL_MODULES_LOAD_RAW := $(strip $(shell cat device/google/redbull/modules.load)) +KERNEL_MODULES_LOAD := $(foreach m,$(KERNEL_MODULES_LOAD_RAW),$(notdir $(m))) +BOARD_VENDOR_KERNEL_MODULES_LOAD := $(filter-out $(BOOT_KERNEL_MODULES), $(KERNEL_MODULES_LOAD)) +BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD := $(filter $(BOOT_KERNEL_MODULES), $(KERNEL_MODULES_LOAD)) + +# Lineage Health +TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE := true +TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE := false + +# Manifests +DEVICE_MANIFEST_FILE += device/google/redbull/lineage_manifest.xml +DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE += vendor/lineage/config/device_framework_matrix.xml + +# Needed for camera +TARGET_GRALLOC_HANDLE_HAS_RESERVED_SIZE := true + +# Partitions +AB_OTA_PARTITIONS += \ + vendor + +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 + +# Reserve space for gapps install +-include vendor/lineage/config/BoardConfigReservedSize.mk + +# SELinux +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy-lineage/dynamic +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy-lineage/vendor + +# Verified Boot +BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3 diff --git a/allowlist_com.google.android.as.xml b/allowlist_com.google.android.as.xml new file mode 100644 index 00000000..11e6e8d2 --- /dev/null +++ b/allowlist_com.google.android.as.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2022 The LineageOS Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<config> + <!-- Specify the explicit set of other applications that AI services are allowed to + interact with, including the providers that back the implementation of the APIs + provided by the package. --> + <allow-association target="com.google.android.as" allowed="com.android.bluetooth" /> + <allow-association target="com.google.android.as" allowed="com.android.bluetooth.services" /> + <allow-association target="com.google.android.as" allowed="com.android.providers.contacts" /> + <allow-association target="com.google.android.as" allowed="com.android.providers.media" /> + <allow-association target="com.google.android.as" allowed="com.android.providers.telephony" /> + <allow-association target="com.google.android.as" allowed="com.android.systemui" /> + <!-- AI services can bind to its open-source network component. --> + <allow-association target="com.google.android.as" allowed="com.google.android.as.oss" /> + + <!-- AI services open-source network component can only bind back to the core package. --> + <allow-association target="com.google.android.as.oss" allowed="com.google.android.as" /> +</config> diff --git a/device-common.mk b/device-common.mk index d78adb0c..e46c4cbd 100644 --- a/device-common.mk +++ b/device-common.mk @@ -23,8 +23,6 @@ PRODUCT_VENDOR_MOVE_ENABLED := true TARGET_BOARD_PLATFORM := lito PRODUCT_SOONG_NAMESPACES += \ - hardware/google/av \ - hardware/google/camera \ hardware/google/interfaces \ hardware/google/pixel \ device/google/redbull \ @@ -91,12 +89,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PACKAGES += \ messaging \ -# ramdump_app -PRODUCT_PACKAGES_DEBUG += RamdumpUploader - -# ssr_detector_app -PRODUCT_PACKAGES += SSRestartDetector - TARGET_PRODUCT_PROP := $(LOCAL_PATH)/product.prop $(call inherit-product, $(LOCAL_PATH)/utils.mk) @@ -111,7 +103,6 @@ BOARD_SHIPPING_API_LEVEL := 30 DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay PRODUCT_COPY_FILES += \ - $(LOCAL_KERNEL):kernel \ $(LOCAL_PATH)/fstab.hardware:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/first_stage_ramdisk/fstab.$(PRODUCT_PLATFORM) \ $(LOCAL_PATH)/fstab.hardware:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.$(PRODUCT_PLATFORM) \ $(LOCAL_PATH)/fstab.persist:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.persist \ @@ -129,7 +120,7 @@ PRODUCT_COPY_FILES += \ MSM_VIDC_TARGET_LIST := lito # Get the color format from kernel headers MASTER_SIDE_CP_TARGET_LIST := lito # ION specific settings -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.hardware.mpssrfs.rc.userdebug:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.$(PRODUCT_PLATFORM).mpssrfs.rc PRODUCT_COPY_FILES += \ @@ -201,7 +192,7 @@ PRODUCT_PACKAGES += \ android.hardware.contexthub-service.generic # CHRE tools -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PACKAGES += \ chre_power_test_client \ chre_test_client @@ -290,26 +281,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.audio.monitorRotation=true -# Iaxxx streming and factory binary -PRODUCT_PACKAGES += \ - libtunnel \ - libodsp \ - adnc_strm.primary.default \ - sound_trigger.primary.lito - -# Add Oslo test for debug rom -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) -PRODUCT_PACKAGES += \ - tunneling_hal_test \ - sensor_param_test \ - oslo_config_test \ - odsp_api_test \ - crash_event_logger \ - dump_debug_info \ - get_pwr_stats \ - crash_trigger_test -endif - # graphics PRODUCT_PROPERTY_OVERRIDES += \ ro.opengles.version=196610 @@ -401,21 +372,6 @@ PRODUCT_PACKAGES += \ android.hardware.memtrack@1.0-impl \ android.hardware.memtrack@1.0-service -# Bluetooth HAL -PRODUCT_PACKAGES += \ - android.hardware.bluetooth@1.0-impl-qti \ - android.hardware.bluetooth@1.0-service-qti - -#Bluetooth SAR HAL -PRODUCT_PACKAGES += \ - hardware.google.bluetooth.sar@1.0-impl -PRODUCT_PACKAGES_DEBUG += \ - bluetooth_sar_test - -#Bluetooth AFH HAL -PRODUCT_PACKAGES += \ - hardware.google.bluetooth.bt_channel_avoidance@1.0-impl - # Bluetooth SoC PRODUCT_PROPERTY_OVERRIDES += \ vendor.qcom.bluetooth.soc=cherokee @@ -434,8 +390,7 @@ PRODUCT_SOONG_NAMESPACES += vendor/qcom/proprietary/bluetooth/hidl_client # DRM HAL PRODUCT_PACKAGES += \ - android.hardware.drm-service.clearkey \ - android.hardware.drm-service.widevine-v17 + android.hardware.drm-service.clearkey # NFC and Secure Element packages PRODUCT_PACKAGES += \ @@ -463,22 +418,9 @@ PRODUCT_PACKAGES += \ libOmxCore \ libstagefrighthw \ libOmxVdec \ - libOmxVdecHevc \ libOmxVenc \ libc2dcolorconvert -# Enable Codec 2.0 -PRODUCT_PACKAGES += \ - libqcodec2_base \ - libqcodec2_utils \ - libqcodec2_platform \ - libqcodec2_core \ - libqcodec2_basecodec \ - libqcodec2_v4l2codec \ - vendor.qti.media.c2@1.0-service \ - codec2.vendor.ext-arm64.policy \ - codec2.vendor.base-arm64.policy - PRODUCT_PROPERTY_OVERRIDES += \ debug.stagefright.omx_default_rank=512 @@ -504,21 +446,12 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.ims.mm_minqp=1 -PRODUCT_PACKAGES += \ - android.hardware.camera.provider@2.7-impl-google \ - android.hardware.camera.provider@2.7-service-google \ - camera.lito \ - lib_multicam_dualfov_capture_session \ - libgooglecamerahwl_impl \ - libqomx_core \ - libmmjpeg_interface \ - libmmcamera_interface \ - libcameradepthcalibrator - # Google Camera HAL test libraries in debug builds +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PACKAGES_DEBUG += \ libgoogle_camera_hal_proprietary_tests \ libgoogle_camera_hal_tests +endif PRODUCT_PACKAGES += \ fs_config_dirs \ @@ -546,17 +479,16 @@ ENABLE_VENDOR_RIL_SERVICE := true USE_QCRIL_OEMHOOK := true HOSTAPD := hostapd -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) HOSTAPD += hostapd_cli endif PRODUCT_PACKAGES += $(HOSTAPD) WPA := wpa_supplicant.conf -WPA += wpa_supplicant_wcn.conf WPA += wpa_supplicant PRODUCT_PACKAGES += $(WPA) -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PACKAGES += wpa_cli endif @@ -578,18 +510,7 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/wifi_concurrency_cfg.txt:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wifi_concurrency_cfg.txt \ $(LOCAL_PATH)/WCNSS_qcom_cfg.ini:$(TARGET_COPY_OUT_VENDOR)/firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini \ -LIB_NL := libnl_2 -PRODUCT_PACKAGES += $(LIB_NL) - -# Audio effects -PRODUCT_PACKAGES += \ - libvolumelistener \ - libqcomvisualizer \ - libqcomvoiceprocessing \ - libqcompostprocbundle - PRODUCT_PACKAGES += \ - audio.primary.lito \ audio.usb.default \ audio.r_submix.default \ libaudio-resampler \ @@ -602,18 +523,7 @@ PRODUCT_PACKAGES += \ android.hardware.bluetooth.audio@2.0-impl \ android.hardware.audio.service -# Modules for Audio HAL -PRODUCT_PACKAGES += \ - libcirrusspkrprot \ - libsndmonitor \ - liba2dpoffload \ - btaudio_offload_if \ - libthermallistener \ - libmaxxaudio \ - libaudiozoom \ - libdevicestatelistener - -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PACKAGES += \ tinyplay \ tinycap \ @@ -675,7 +585,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ vendor.audio.snd_card.open.retries=50 -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) # Subsystem ramdump PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.sys.ssr.enable_ramdumps=1 @@ -685,7 +595,7 @@ endif PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.sys.ssr.restart_level=modem,adsp -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) # Sensor debug flag PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.debug.ash.logger=0 \ @@ -699,7 +609,7 @@ $(call inherit-product, frameworks/native/build/phone-xhdpi-6144-dalvik-heap.mk) PRODUCT_PACKAGES += \ charger_res_images -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) # b/36703476: Set default log size to 1M PRODUCT_PROPERTY_OVERRIDES += \ ro.logd.size=1M @@ -713,11 +623,6 @@ endif PRODUCT_PROPERTY_OVERRIDES += \ ro.frp.pst=/dev/block/bootdevice/by-name/frp -ifeq ($(KEEP_VNDK),true) -PRODUCT_PACKAGES += \ - vndk-sp -endif - # Override heap growth limit due to high display density on device PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapgrowthlimit?=256m @@ -726,10 +631,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.dex2oat64.enabled=true -PRODUCT_PACKAGES += \ - ipacm \ - IPACM_cfg.xml - #Set default CDMA subscription to RUIM PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.default_cdma_sub=0 @@ -754,7 +655,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ ro.vendor.radio.log_prefix="modem_log_" # Enable modem logging for debug -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.sys.modem.diag.mdlog=true else @@ -764,8 +665,8 @@ endif PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.sys.modem.diag.mdlog_br_num=5 -# Enable tcpdump_logger on userdebug and eng -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +# Enable tcpdump_logger on eng +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.tcpdump.log.alwayson=false \ persist.vendor.tcpdump.log.br_num=5 @@ -786,7 +687,7 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.gadgethal.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.gadgethal.sh # default usb oem functions -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.usb.usbradio.config=diag endif @@ -855,7 +756,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ endif # Enable iwlan service logging for debug -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PROPERTY_OVERRIDES += persist.vendor.iwlan.logging.logcat=true endif @@ -865,9 +766,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json -# Set Vendor SPL to match platform -VENDOR_SECURITY_PATCH = $(PLATFORM_SECURITY_PATCH) - PRODUCT_PROPERTY_OVERRIDES += vendor.audio.adm.buffering.ms=2 PRODUCT_PROPERTY_OVERRIDES += vendor.audio_hal.period_multiplier=2 PRODUCT_PROPERTY_OVERRIDES += af.fast_track_multiplier=1 @@ -953,7 +851,7 @@ PRODUCT_PRODUCT_PROPERTIES += \ ro.thermal_warmreset = true \ # Vendor verbose logging default property -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.verbose_logging_enabled=true else @@ -961,8 +859,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.verbose_logging_enabled=false endif -# Disable Rescue Party on userdebug & eng build -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +# Disable Rescue Party on eng build +ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PRODUCT_PROPERTIES += \ persist.sys.disable_rescue=true endif diff --git a/device-lineage.mk b/device-lineage.mk new file mode 100644 index 00000000..6787ece5 --- /dev/null +++ b/device-lineage.mk @@ -0,0 +1,89 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Overlays +DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay-lineage + +# Soong namespaces +PRODUCT_SOONG_NAMESPACES += \ + vendor/qcom/opensource/commonsys-intf/display \ + vendor/qcom/opensource/display + +# Add common definitions for Qualcomm +$(call inherit-product, hardware/qcom-caf/common/common.mk) + +# AiAi Config +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/allowlist_com.google.android.as.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/sysconfig/allowlist_com.google.android.as.xml + +# Camera +PRODUCT_PRODUCT_PROPERTIES += \ + ro.vendor.camera.extensions.package=com.google.android.apps.camera.services \ + ro.vendor.camera.extensions.service=com.google.android.apps.camera.services.extensions.service.PixelExtensions + +# EUICC +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.telephony.euicc.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/android.hardware.telephony.euicc.xml + +# Google Assistant +PRODUCT_PRODUCT_PROPERTIES += ro.opa.eligible_device=true + +# LiveDisplay +PRODUCT_PACKAGES += \ + vendor.lineage.livedisplay@2.0-service-sdm + +# Parts +PRODUCT_PACKAGES += \ + GoogleParts + +# RCS +PRODUCT_PACKAGES += \ + PresencePolling \ + RcsService + +# Touch +include hardware/google/pixel/touch/device.mk + +# Build necessary packages for vendor + +# CHRE +PRODUCT_PACKAGES += \ + chre + +# GNSS +PRODUCT_PACKAGES += \ + flp.conf + +# Identity credential +PRODUCT_PACKAGES += \ + android.hardware.identity_credential.xml + +# Sensors +PRODUCT_PACKAGES += \ + android.hardware.sensors@2.0-service.multihal + +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \ + frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \ + frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \ + frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \ + frameworks/native/data/etc/android.hardware.sensor.hifi_sensors.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.hifi_sensors.xml \ + frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \ + frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \ + frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepcounter.xml \ + frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepdetector.xml + +# VNDK FWK detect +PRODUCT_PACKAGES += \ + libvndfwk_detect_jni.qti.vendor + +# Wi-Fi +PRODUCT_PACKAGES += \ + libwifi-hal-ctrl:64 \ + libwifi-hal-qcom + +# Properties +TARGET_VENDOR_PROP := $(LOCAL_PATH)/vendor.prop diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml index 19ea0383..2fcdb238 100644 --- a/device_framework_matrix_product.xml +++ b/device_framework_matrix_product.xml @@ -222,7 +222,7 @@ </hal> <hal format="aidl" optional="true"> <name>vendor.google.wifi_ext</name> - <version>2-3</version> + <version>1-3</version> <interface> <name>IWifiExt</name> <instance>default</instance> @@ -1,10 +1,3 @@ -#Version check for XTRA -#DISABLE = 0 -#AUTO = 1 -#XTRA2 = 2 -#XTRA3 = 3 -XTRA_VERSION_CHECK=0 - # Error Estimate # _SET = 1 # _CLEAR = 0 @@ -24,13 +17,6 @@ DEBUG_LEVEL = 2 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=0 -# Below bit mask configures how GPS functionalities -# should be locked when user turns off GPS on Settings -# Set bit 0x1 if MO GPS functionalities are to be locked -# Set bit 0x2 if NI GPS functionalities are to be locked -# default – both MO and NI locked for maximal privacy -#GPS_LOCK = 3 - # supl version 1.0 #SUPL_VER=0x10000 @@ -88,10 +74,12 @@ CAPABILITIES=0x17 #################################### # LTE Positioning Profile Settings #################################### +# LPP_PROFILE is a bit mask # 0: Enable RRLP on LTE(Default) -# 1: Enable LPP_User_Plane on LTE -# 2: Enable LPP_Control_Plane -# 3: Enable both LPP_User_Plane and LPP_Control_Plane +# 0x1: LPP User Plane +# 0x2: LPP Control Plane +# 0x4: LPP User Plane for NR5G +# 0x8: LPP Control Plane for NR5G #LPP_PROFILE = 2 #################################### @@ -106,6 +94,49 @@ DATUM_TYPE = 0 ################################ # NMEA provider (1=Modem Processor, 0=Application Processor) NMEA_PROVIDER=0 + +################################ +# NMEA TAG BLOCK GROUPING +################################ +# NMEA tag block grouping is only applicable to GSA +# Default is disabled +# 0 - disabled +# 1 - enabled +NMEA_TAG_BLOCK_GROUPING_ENABLED = 0 + +# Customized NMEA GGA fix quality that can be used to tell +# whether SENSOR contributed to the fix. +# +# When this configuration item is not enabled (set to any value that is not 1), +# GGA fix quality conforms to NMEA standard spec as below: +# PPP/DGNSS/SBAS correction fix w/ or w/o sensor: 2 +# RTK fixed fix w/ or w/o sensor: 4 +# RTK float fix w/ or w/o sensor: 5 +# SPE fix w/ or w/o sensor: 1 +# Sensor dead reckoning fix: 6 +# +# When this configuration is enabled (set to 1), GGA fix quality +# will be output as below: +# PPP fix w/o sensor: 59, w/ sensor: 69 +# DGNSS/SBAS correction fix w/o sensor: 2, w/ sensor: 62 +# RTK fixed fix w/o sensor: 4, w/ sensor: 64 +# RTK float fix w/o sensor: 5, w/ sensor: 65, +# SPE fix w/o sensor: 1, and w/ sensor: 61 +# Sensor dead reckoning fix: 6 +# +# any value that is not 1 - disabled +# 1 - enabled +CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0 + +################################ +# NMEA Reporting Rate Config, valid only when NMEA_PROVIDER is set to "0" +################################ +# NMEA Reporting Rate +# Set it to "1HZ" for 1Hz NMEA Reporting +# Set it to "NHZ" for NHz NMEA Reporting +#Default : NHZ (overridden by position update rate if set to lower rates) +NMEA_REPORT_RATE=NHZ + # Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE) SGLTE_TARGET=0 @@ -166,16 +197,6 @@ AGPS_CONFIG_INJECT = 1 # is able to acquire better timing information AP_TIMESTAMP_UNCERTAINTY = 10 -################################################## -# QDR engine availability status -################################################## -# 0 : NO QDR (default) -# 1 : QDR enabled -# This settings enables QDR Configuration for -# automotive use case, if enabled then -# DR_AP_Service needs to be enabled in izat.conf -#EXTERNAL_DR_ENABLED = 0 - ##################################### # DR_SYNC Pulse Availability ##################################### @@ -300,7 +321,71 @@ CP_MTLR_ES=1 ################################################## # 0 : Enable QTI GNSS (default) # 1 : Enable QCSR SS5 -# This setting use to select between QTI GNSS -# and QCSR SS5 hardware receiver. +# 2 : Enable PDS API +# This setting use to select between QTI GNSS, +# QCSR SS5 hardware receiver, and PDS API. # By default QTI GNSS receiver is enabled. # GNSS_DEPLOYMENT = 0 + +################################################## +## LOG BUFFER CONFIGURATION +################################################## +#LOG_BUFFER_ENABLED, 1=enable, 0=disable +#*_LEVEL_TIME_DEPTH, maximum time depth of level * +#in log buffer, unit is second +#*_LEVEL_MAX_CAPACITY, maximum numbers of level * +#log print sentences in log buffer +LOG_BUFFER_ENABLED = 0 +E_LEVEL_TIME_DEPTH = 600 +E_LEVEL_MAX_CAPACITY = 50 +W_LEVEL_TIME_DEPTH = 500 +W_LEVEL_MAX_CAPACITY = 100 +I_LEVEL_TIME_DEPTH = 400 +I_LEVEL_MAX_CAPACITY = 200 +D_LEVEL_TIME_DEPTH = 30 +D_LEVEL_MAX_CAPACITY = 300 +V_LEVEL_TIME_DEPTH = 200 +V_LEVEL_MAX_CAPACITY = 400 + +################################################## +# Allow buffer diag log packets when diag memory allocation +# fails during boot up time. +################################################## +BUFFER_DIAG_LOGGING = 1 + +####################################### +# NTRIP CLIENT LIBRARY NAME +####################################### +# NTRIP_CLIENT_LIB_NAME = + +################################################## +# Correction Data Framework settings +# Default values: +# CDFW_SOURCE_PRIORITY_1 = INTERNAL_1 RTCM +# CDFW_INJECT_DATA_INTERVAL = 600000 //10 mins +# CDFW_RTCM_MESSAGE_INTERVAL = 1000 //1 second +# +# If multiple sources coexist on a PL, +# the prorioty sequence can be set by the integer number. +# PRIORITY_1 is higher than PRIORITY_2, for example, +# CDFW_SOURCE_PRIORITY_1 = INTERNAL_1 RTCM +# CDFW_SOURCE_PRIORITY_2 = CV2X RTCM +################################################## + +################################################## +# RF LOSS +# The loss in 0.1 dbHz from the C/N0 at the antenna port +# These values must be configured by OEM if not +# supported in QMI LOC message +# There is one entry for each signal type +################################################## +RF_LOSS_GPS = 0 +RF_LOSS_GPS_L5 = 0 +RF_LOSS_GLO_LEFT = 0 +RF_LOSS_GLO_CENTER = 0 +RF_LOSS_GLO_RIGHT = 0 +RF_LOSS_BDS = 0 +RF_LOSS_BDS_B2A = 0 +RF_LOSS_GAL = 0 +RF_LOSS_GAL_E5 = 0 +RF_LOSS_NAVIC = 0 diff --git a/gpt-utils/gpt-utils.cpp b/gpt-utils/gpt-utils.cpp index c83ecc81..f80bfb3c 100644 --- a/gpt-utils/gpt-utils.cpp +++ b/gpt-utils/gpt-utils.cpp @@ -32,7 +32,6 @@ /****************************************************************************** * INCLUDE SECTION ******************************************************************************/ -#include <stdio.h> #include <fcntl.h> #include <string.h> #include <errno.h> @@ -46,7 +45,6 @@ #include <dirent.h> #include <inttypes.h> #include <linux/kernel.h> -#include <asm/byteorder.h> #include <map> #include <vector> #include <string> diff --git a/init.hardware.rc b/init.hardware.rc index 888e31ce..636f143c 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -413,6 +413,9 @@ on early-boot # FG cycle count read from dumpstate + backup restore from health HAL (and pixelstats) chown system system /sys/class/power_supply/maxfg/cycle_counts_bins + # Adaptive charge + chown system system /sys/class/power_supply/battery/charge_deadline + # Battery Defender chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level @@ -753,6 +756,9 @@ service loc_launcher /vendor/bin/loc_launcher user gps group gps +on property:persist.sys.xtra-daemon.enabled=* + restart loc_launcher + # Allow access to touch on property:vendor.all.modules.ready=1 chown system input /dev/touch_offload diff --git a/init.qcom.usb.sh b/init.qcom.usb.sh index 081a1250..b74e9db0 100644 --- a/init.qcom.usb.sh +++ b/init.qcom.usb.sh @@ -157,13 +157,6 @@ esac # check configfs is mounted or not if [ -d /config/usb_gadget ]; then - # Chip-serial is used for unique MSM identification in Product string - msm_serial=`cat /sys/devices/soc0/serial_number`; - msm_serial_hex=`printf %08X $msm_serial` - machine_type=`cat /sys/devices/soc0/machine` - product_string="$machine_type-$soc_hwplatform _SN:$msm_serial_hex" - echo "$product_string" > /config/usb_gadget/g1/strings/0x409/product - # ADB requires valid iSerialNumber; if ro.serialno is missing, use dummy serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber` 2> /dev/null if [ "$serialnumber" == "" ]; then diff --git a/json-c/AUTHORS b/json-c/AUTHORS deleted file mode 100644 index b389989c..00000000 --- a/json-c/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Michael Clark <michael@metaparadigm.com> -Jehiah Czebotar <jehiah@gmail.com> -Eric Haszlakiewicz <hawicz+json-c@gmail.com> -C. Watford (christopher.watford@gmail.com) - diff --git a/json-c/Android.configure.mk b/json-c/Android.configure.mk deleted file mode 100644 index a6265ada..00000000 --- a/json-c/Android.configure.mk +++ /dev/null @@ -1,39 +0,0 @@ -# This file is the top android makefile for all sub-modules. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -json_c_TOP := $(LOCAL_PATH) - -JSON_C_BUILT_SOURCES := Android.mk - -JSON_C_BUILT_SOURCES := $(patsubst %, $(abspath $(json_c_TOP))/%, $(JSON_C_BUILT_SOURCES)) - -.PHONY: json-c-configure json-c-configure-real -json-c-configure-real: - echo $(JSON_C_BUILT_SOURCES) - cd $(json_c_TOP) ; \ - $(abspath $(json_c_TOP))/autogen.sh && \ - CC="$(CONFIGURE_CC)" \ - CFLAGS="$(CONFIGURE_CFLAGS)" \ - LD=$(TARGET_LD) \ - LDFLAGS="$(CONFIGURE_LDFLAGS)" \ - CPP=$(CONFIGURE_CPP) \ - CPPFLAGS="$(CONFIGURE_CPPFLAGS)" \ - PKG_CONFIG_LIBDIR=$(CONFIGURE_PKG_CONFIG_LIBDIR) \ - PKG_CONFIG_TOP_BUILD_DIR=/ \ - ac_cv_func_malloc_0_nonnull=yes \ - ac_cv_func_realloc_0_nonnull=yes \ - $(abspath $(json_c_TOP))/$(CONFIGURE) --host=$(CONFIGURE_HOST) \ - --prefix=/system \ - && \ - for file in $(JSON_C_BUILT_SOURCES); do \ - rm -f $$file && \ - make -C $$(dirname $$file) $$(basename $$file) ; \ - done - -json-c-configure: json-c-configure-real - -PA_CONFIGURE_TARGETS += json-c-configure - --include $(json_c_TOP)/Android.mk diff --git a/json-c/Android.mk b/json-c/Android.mk deleted file mode 100644 index 6202a538..00000000 --- a/json-c/Android.mk +++ /dev/null @@ -1,38 +0,0 @@ -LIBJSON_ROOT := $(call my-dir) -include $(CLEAR_VARS) -LOCAL_MODULE := libjson -LOCAL_LICENSE_KINDS := SPDX-license-identifier-MIT legacy_unencumbered -LOCAL_LICENSE_CONDITIONS := notice unencumbered -LOCAL_PATH := $(LIBJSON_ROOT) -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/COPYING -LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include -LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr -LOCAL_COPY_HEADERS_TO := libjson/inc -LOCAL_COPY_HEADERS := bits.h \ - config.h \ - debug.h \ - linkhash.h \ - arraylist.h \ - json.h \ - json_config.h \ - json_inttypes.h \ - json_util.h \ - json_object.h \ - json_tokener.h \ - json_object_iterator.h \ - json_c_version.h -LOCAL_SRC_FILES := arraylist.c \ - debug.c \ - json_c_version.c \ - json_object.c \ - json_object_iterator.c \ - json_tokener.c \ - json_util.c \ - libjson.c \ - linkhash.c \ - printbuf.c \ - random_seed.c -LOCAL_SHARED_LIBRARIES := libcutils libutils -LOCAL_MODULE_TAG := optional -LOCAL_VENDOR_MODULE := true -include $(BUILD_SHARED_LIBRARY) diff --git a/json-c/COPYING b/json-c/COPYING deleted file mode 100644 index 740d1258..00000000 --- a/json-c/COPYING +++ /dev/null @@ -1,42 +0,0 @@ - -Copyright (c) 2009-2012 Eric Haszlakiewicz - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ----------------------------------------------------------------- - -Copyright (c) 2004, 2005 Metaparadigm Pte Ltd - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/json-c/ChangeLog b/json-c/ChangeLog deleted file mode 100644 index 584ed1fd..00000000 --- a/json-c/ChangeLog +++ /dev/null @@ -1,218 +0,0 @@ - -NEXT.VERSION - - ...nothing yet... - -0.12 - - * Address security issues: - * CVE-2013-6371: hash collision denial of service - * CVE-2013-6370: buffer overflow if size_t is larger than int - - * Avoid potential overflow in json_object_get_double - - * Eliminate the mc_abort() function and MC_ABORT macro. - - * Make the json_tokener_errors array local. It has been deprecated for - a while, and json_tokener_error_desc() should be used instead. - - * change the floating point output format to %.17g so values with - more than 6 digits show up in the output. - - * Remove the old libjson.so name compatibility support. The library is - only created as libjson-c.so now and headers are only installed - into the ${prefix}/json-c directory. - - * When supported by the linker, add the -Bsymbolic-functions flag. - - * Various changes to fix the build on MSVC. - - * Make strict mode more strict: - * number must not start with 0 - * no single-quote strings - * no comments - * trailing char not allowed - * only allow lowercase literals - - * Added a json_object_new_double_s() convenience function to allow - an exact string representation of a double to be specified when - creating the object and use it in json_tokener_parse_ex() so - a re-serialized object more exactly matches the input. - - * Add support NaN and Infinity - - -0.11 - - * IMPORTANT: the name of the library has changed to libjson-c.so and - the header files are now in include/json-c. - The pkgconfig name has also changed from json to json-c. - You should change your build to use appropriate -I and -l options. - A compatibility shim is in place so builds using the old name will - continue to work, but that will be removed in the next release. - * Maximum recursion depth is now a runtime option. - json_tokener_new() is provided for compatibility. - json_tokener_new_ex(depth) - * Include json_object_iterator.h in the installed headers. - * Add support for building on Android. - * Rewrite json_object_object_add to replace just the value if the key already exists so keys remain valid. - * Make it safe to delete keys while iterating with the json_object_object_foreach macro. - * Add a json_set_serializer() function to allow the string output of a json_object to be customized. - * Make float parsing locale independent. - * Add a json_tokener_set_flags() function and a JSON_TOKENER_STRICT flag. - * Enable -Werror when building. - * speed improvements to parsing 64-bit integers on systems with working sscanf - * Add a json_object_object_length function. - * Fix a bug (buffer overrun) when expanding arrays to more than 64 entries. - -0.10 - - * Add a json_object_to_json_string_ext() function to allow output to be - formatted in a more human readable form. - * Add json_object_object_get_ex(), a NULL-safe get object method, to be able - to distinguish between a key not present and the value being NULL. - * Add an alternative iterator implementation, see json_object_iterator.h - * Make json_object_iter public to enable external use of the - json_object_object_foreachC macro. - * Add a printbuf_memset() function to provide an effecient way to set and - append things like whitespace indentation. - * Adjust json_object_is_type and json_object_get_type so they return - json_type_null for NULL objects and handle NULL passed to - json_objct_object_get(). - * Rename boolean type to json_bool. - * Fix various compile issues for Visual Studio and MinGW. - * Allow json_tokener_parse_ex() to be re-used to parse multiple object. - Also, fix some parsing issues with capitalized hexadecimal numbers and - number in E notation. - * Add json_tokener_get_error() and json_tokener_error_desc() to better - encapsulate the process of retrieving errors while parsing. - * Various improvements to the documentation of many functions. - * Add new json_object_array_sort() function. - * Fix a bug in json_object_get_int(), which would incorrectly return 0 - when called on a string type object. - Eric Haszlakiewicz - * Add a json_type_to_name() function. - Eric Haszlakiewicz - * Add a json_tokener_parse_verbose() function. - Jehiah Czebotar - * Improve support for null bytes within JSON strings. - Jehiah Czebotar - * Fix file descriptor leak if memory allocation fails in json_util - Zachary Blair, zack_blair at hotmail dot com - * Add int64 support. Two new functions json_object_net_int64 and - json_object_get_int64. Binary compatibility preserved. - Eric Haszlakiewicz, EHASZLA at transunion com - Rui Miguel Silva Seabra, rms at 1407 dot org - * Fix subtle bug in linkhash where lookup could hang after all slots - were filled then successively freed. - Spotted by Jean-Marc Naud, j dash m at newtraxtech dot com - * Make json_object_from_file take const char *filename - Spotted by Vikram Raj V, vsagar at attinteractive dot com - * Add handling of surrogate pairs (json_tokener.c, test4.c, Makefile.am) - Brent Miller, bdmiller at yahoo dash inc dot com - * Correction to comment describing printbuf_memappend in printbuf.h - Brent Miller, bdmiller at yahoo dash inc dot com - -0.9 - * Add README.html README-WIN32.html config.h.win32 to Makefile.am - Michael Clark, <michael@metaparadigm.com> - * Add const qualifier to the json_tokener_parse functions - Eric Haszlakiewicz, EHASZLA at transunion dot com - * Rename min and max so we can never clash with C or C++ std library - Ian Atha, thatha at yahoo dash inc dot com - * Fix any noticeable spelling or grammar errors. - * Make sure every va_start has a va_end. - * Check all pointers for validity. - Erik Hovland, erik at hovland dot org - * Fix json_object_get_boolean to return false for empty string - Spotted by Vitaly Kruglikov, Vitaly dot Kruglikov at palm dot com - * optimizations to json_tokener_parse_ex(), printbuf_memappend() - Brent Miller, bdmiller at yahoo dash inc dot com - * Disable REFCOUNT_DEBUG by default in json_object.c - * Don't use this as a variable, so we can compile with a C++ compiler - * Add casts from void* to type of assignment when using malloc - * Add #ifdef __cplusplus guards to all of the headers - * Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table - Michael Clark, <michael@metaparadigm.com> - * Null pointer dereference fix. Fix json_object_get_boolean strlen test - to not return TRUE for zero length string. Remove redundant includes. - Erik Hovland, erik at hovland dot org - * Fixed warning reported by adding -Wstrict-prototypes - -Wold-style-definition to the compilatin flags. - Dotan Barak, dotanba at gmail dot com - * Add const correctness to public interfaces - Gerard Krol, g dot c dot krol at student dot tudelft dot nl - -0.8 - * Add va_end for every va_start - Dotan Barak, dotanba at gmail dot com - * Add macros to enable compiling out debug code - Geoffrey Young, geoff at modperlcookbook dot org - * Fix bug with use of capital E in numbers with exponents - Mateusz Loskot, mateusz at loskot dot net - * Add stddef.h include - * Patch allows for json-c compile with -Werror and not fail due to - -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations - Geoffrey Young, geoff at modperlcookbook dot org - -0.7 - * Add escaping of backslash to json output - * Add escaping of foward slash on tokenizing and output - * Changes to internal tokenizer from using recursion to - using a depth state structure to allow incremental parsing - -0.6 - * Fix bug in escaping of control characters - Johan Björklund, johbjo09 at kth dot se - * Remove include "config.h" from headers (should only - be included from .c files) - Michael Clark <michael@metaparadigm.com> - -0.5 - * Make headers C++ compatible by change *this to *obj - * Add ifdef C++ extern "C" to headers - * Use simpler definition of min and max in bits.h - Larry Lansing, llansing at fuzzynerd dot com - - * Remove automake 1.6 requirement - * Move autogen commands into autogen.sh. Update README - * Remove error pointer special case for Windows - * Change license from LGPL to MIT - Michael Clark <michael@metaparadigm.com> - -0.4 - * Fix additional error case in object parsing - * Add back sign reversal in nested object parse as error pointer - value is negative, while error value is positive. - Michael Clark <michael@metaparadigm.com> - -0.3 - * fix pointer arithmetic bug for error pointer check in is_error() macro - * fix type passed to printbuf_memappend in json_tokener - * update autotools bootstrap instructions in README - Michael Clark <michael@metaparadigm.com> - -0.2 - * printbuf.c - C. Watford (christopher.watford@gmail.com) - Added a Win32/Win64 compliant implementation of vasprintf - * debug.c - C. Watford (christopher.watford@gmail.com) - Removed usage of vsyslog on Win32/Win64 systems, needs to be handled - by a configure script - * json_object.c - C. Watford (christopher.watford@gmail.com) - Added scope operator to wrap usage of json_object_object_foreach, this - needs to be rethought to be more ANSI C friendly - * json_object.h - C. Watford (christopher.watford@gmail.com) - Added Microsoft C friendly version of json_object_object_foreach - * json_tokener.c - C. Watford (christopher.watford@gmail.com) - Added a Win32/Win64 compliant implementation of strndup - * json_util.c - C. Watford (christopher.watford@gmail.com) - Added cast and mask to suffice size_t v. unsigned int conversion - correctness - * json_tokener.c - sign reversal issue on error info for nested object parse - spotted by Johan Björklund (johbjo09 at kth.se) - * json_object.c - escape " in json_escape_str - * Change to automake and libtool to build shared and static library - Michael Clark <michael@metaparadigm.com> - -0.1 - * initial release diff --git a/json-c/Doxyfile b/json-c/Doxyfile deleted file mode 100644 index da39aca2..00000000 --- a/json-c/Doxyfile +++ /dev/null @@ -1,1153 +0,0 @@ -# Doxyfile 1.3.8 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = json-c - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 0.12.99 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of source -# files, where putting all generated files in the same directory would otherwise -# cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is used -# as the annotated text. Otherwise, the brief description is used as-is. If left -# blank, the following values are used ("$name" is automatically replaced with the -# name of the entity): "The $name class" "The $name widget" "The $name file" -# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = NO - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -FILE_PATTERNS = *.h - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superseded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes that -# lay further from the root node will be omitted. Note that setting this option to -# 1 or 2 may greatly reduce the computation time needed for large code bases. Also -# note that a graph may be further truncated if the graph's image dimensions are -# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). -# If 0 is used for the depth value (the default), the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/json-c/Makefile.am b/json-c/Makefile.am deleted file mode 100644 index 26ced270..00000000 --- a/json-c/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -include Makefile.am.inc - -EXTRA_DIST = README.html README-WIN32.html config.h.win32 doc json-c.vcproj -SUBDIRS = . tests - -lib_LTLIBRARIES = libjson-c.la - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = json-c.pc - -libjson_cincludedir = $(includedir)/json-c -libjson_cinclude_HEADERS = \ - arraylist.h \ - bits.h \ - debug.h \ - json.h \ - json_config.h \ - json_c_version.h \ - json_inttypes.h \ - json_object.h \ - json_object_iterator.h \ - json_object_private.h \ - json_tokener.h \ - json_util.h \ - linkhash.h \ - printbuf.h \ - random_seed.h - -#libjsonx_includedir = $(libdir)/json-c-@VERSION@ -# -#libjsonx_include_HEADERS = \ -# json_config.h - -libjson_c_la_LDFLAGS = -version-info 2:0:0 -no-undefined @JSON_BSYMBOLIC_LDFLAGS@ - -libjson_c_la_SOURCES = \ - arraylist.c \ - debug.c \ - json_c_version.c \ - json_object.c \ - json_object_iterator.c \ - json_tokener.c \ - json_util.c \ - linkhash.c \ - printbuf.c \ - random_seed.c - - -distclean-local: - -rm -rf $(testsubdir) - -rm -rf config.h.in~ Makefile.in aclocal.m4 autom4te.cache/ config.guess config.sub depcomp install-sh ltmain.sh missing - -rm -f INSTALL test-driver tests/Makefile.in compile - -maintainer-clean-local: - -rm -rf configure - -uninstall-local: - rm -rf "$(DESTDIR)@includedir@/json-c" - rm -f "$(DESTDIR)@includedir@/json" - -ANDROID_CFLAGS = -I$(top_srcdir) -DHAVE_CONFIG_H - -Android.mk: Makefile.am - androgenizer -:PROJECT json-c \ - -:SHARED libjson-c \ - -:TAGS eng debug \ - -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ - -:SOURCES $(libjson_c_la_SOURCES) $(nodist_libjson_c_la_SOURCES) \ - -:CFLAGS $(DEFS) $(ANDROID_CFLAGS) $(libjson_c_la_CFLAGS) \ - -:LDFLAGS $(libjson_c_la_LDFLAGS) $(libjson_c_la_LIBADD) \ - -:HEADER_TARGET json-c \ - -:HEADERS $(libjson_cinclude_HEADERS) \ - -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ - > $@ diff --git a/json-c/Makefile.am.inc b/json-c/Makefile.am.inc deleted file mode 100644 index fec591b6..00000000 --- a/json-c/Makefile.am.inc +++ /dev/null @@ -1,2 +0,0 @@ -AM_CFLAGS = -Wall -Werror -Wno-error=deprecated-declarations -Wextra -Wwrite-strings -Wno-unused-parameter -std=gnu99 -D_GNU_SOURCE -D_REENTRANT - diff --git a/json-c/README b/json-c/README deleted file mode 100644 index e69de29b..00000000 --- a/json-c/README +++ /dev/null diff --git a/json-c/README-WIN32.html b/json-c/README-WIN32.html deleted file mode 100644 index abdb39e7..00000000 --- a/json-c/README-WIN32.html +++ /dev/null @@ -1,50 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>JSON-C - A JSON implementation in C - Win32 specific notes</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- </head>
- <body>
- <h2>Windows specific notes for JSON-C</h2>
- <p>Please send Win32 bug reports to <a href="mailto:christopher.watford@gmail.com">christopher.watford@gmail.com</a></p>
- <p><b>Win32 Specific Changes:</b></p>
- <ul>
- <li>
- Various functions have been redefined to their Win32 version (i.e. <tt>open</tt>
- on win32 is <tt>_open</tt>)</li>
- <li>
- Implemented missing functions from MS's libc (i.e. <tt>vasprintf</tt>)</li>
- <li>
- Added code to allow Win64 support without integer resizing issues, this
- probably makes it much nicer on 64bit machines everywhere (i.e. using <tt>ptrdiff_t</tt>
- for pointer math)</li>
- </ul>
- <p><b>Porting Changelog:</b></p>
- <dl>
- <dt><tt>printbuf.c</tt> - C. Watford (christopher.watford@gmail.com)</dt>
- <dd>
- Added a Win32/Win64 compliant implementation of <tt>vasprintf</tt></dd>
- <dt><tt>debug.c</tt> - C. Watford (christopher.watford@gmail.com)</dt>
- <dd>
- Removed usage of <tt>vsyslog</tt> on Win32/Win64 systems, needs to be handled
- by a configure script</dd>
- <dt><tt>json_object.c</tt> - C. Watford (christopher.watford@gmail.com)</dt>
- <dd>
- Added scope operator to wrap usage of <tt>json_object_object_foreach</tt>, this needs to be
- rethought to be more ANSI C friendly</dd>
- <dt><tt>json_object.h</tt> - C. Watford (christopher.watford@gmail.com)</dt>
- <dd>
- Added Microsoft C friendly version of <tt>json_object_object_foreach</tt></dd>
- <dt><tt>json_tokener.c</tt> - C. Watford (christopher.watford@gmail.com)</dt>
- <dd>
- Added a Win32/Win64 compliant implementation of <tt>strndup</tt></dd>
- <dt><tt>json_util.c</tt> - C. Watford (christopher.watford@gmail.com)</dt>
- <dd>
- Added cast and mask to suffice <tt>size_t</tt> v. <tt>unsigned int</tt>
- conversion correctness</dd>
- </dl>
- <p>This program is free software; you can redistribute it and/or modify it under
- the terms of the MIT License. See COPYING for details.</p>
- <hr />
- </body>
-</html>
diff --git a/json-c/README.html b/json-c/README.html deleted file mode 100644 index dc696af3..00000000 --- a/json-c/README.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>JSON-C - A JSON implementation in C</title> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - </head> - <body> - <h2>JSON-C - A JSON implementation in C</h2> - - <h3>Overview</h3> - <p>JSON-C implements a reference counting object model that allows you to easily - construct JSON objects in C, output them as JSON formatted strings and parse - JSON formatted strings back into the C representation of JSON objects.</p> - - <h3>Building</h3> - <p>To setup JSON-C to build on your system please run <tt>configure</tt> and <tt>make</tt>.</p> - <p>If you are on Win32 and are not using the VS project file, be sure - to rename <tt>config.h.win32</tt> to <tt>config.h</tt> before building.</p> - - <h3>Documentation</h3> - <P>Doxygen generated documentation exists <a href="doc/html/json__object_8h.html">here</a> - and Win32 specific notes can be found <a href="README-WIN32.html">here</a>.</P> - - <h3><a href="https://github.com/json-c/json-c">GIT Reposository</a></h3> - <p><strong><code>git clone https://github.com/json-c/json-c.git</code></strong></p> - - <h3><a href="http://groups.google.com/group/json-c">Mailing List</a></h3> - <pi>Send email to <strong><code>json-c <i><at></i> googlegroups <i><dot></i> com</code></strong></p> - - <h3><a href="COPYING">License</a></h3> - <p>This program is free software; you can redistribute it and/or modify it under the terms of the MIT License..</p> - <hr/> - </body> -</html> diff --git a/json-c/README.md b/json-c/README.md deleted file mode 100644 index bf4d2e4f..00000000 --- a/json-c/README.md +++ /dev/null @@ -1,63 +0,0 @@ -`json-c` -======== - -Building on Unix with `git`, `gcc` and `autotools` --------------------------------------------------- - -Home page for json-c: https://github.com/json-c/json-c/wiki - -Caution: do **NOT** use sources from svn.metaparadigm.com, -they are old. - -Prerequisites: - - - `gcc`, `clang`, or another C compiler - - `libtool` - -If you're not using a release tarball, you'll also need: - - - `autoconf` (`autoreconf`) - - `automake` - -Make sure you have a complete `libtool` install, including `libtoolize`. - -`json-c` GitHub repo: https://github.com/json-c/json-c - -```bash -$ git clone https://github.com/json-c/json-c.git -$ cd json-c -$ sh autogen.sh -``` - -followed by - -```bash -$ ./configure -$ make -$ make install -``` - -To build and run the test programs: - -```bash -$ make check -``` - -Linking to `libjson-c` ----------------------- - -If your system has `pkgconfig`, -then you can just add this to your `makefile`: - -```make -CFLAGS += $(shell pkg-config --cflags json-c) -LDFLAGS += $(shell pkg-config --libs json-c) -``` - -Without `pkgconfig`, you would do something like this: - -```make -JSON_C_DIR=/path/to/json_c/install -CFLAGS += -I$(JSON_C_DIR)/include/json-c -LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c -``` diff --git a/json-c/RELEASE_CHECKLIST.txt b/json-c/RELEASE_CHECKLIST.txt deleted file mode 100644 index 47132582..00000000 --- a/json-c/RELEASE_CHECKLIST.txt +++ /dev/null @@ -1,132 +0,0 @@ - -Release checklist: - -release=0.12 -git clone https://github.com/json-c/json-c json-c-${release} -cd json-c-${release} - -Check that the compile works on Linux -Check that the compile works on NetBSD -Check that the compile works on Windows -Check ChangeLog to see if anything should be added. -Make any fixes/changes *before* branching. - - git branch json-c-${release} - git checkout json-c-${release} - ------------- - -Update the version in json_c_version.h -Update the version in Doxyfile -Update the version in configure.ac - Use ${release}. - -Update the libjson_la_LDFLAGS line in Makefile.am to the new version. - Generally, unless we're doing a major release, change: - -version-info x:y:z - to - -version-info x:y+1:z - ------------- - -Generate the configure script and other files: - sh autogen.sh - git add -f Makefile.in aclocal.m4 config.guess \ - config.sub configure depcomp install-sh \ - ltmain.sh missing tests/Makefile.in \ - INSTALL - - # check for anything else to be added: - git status --ignored - git commit - ------------- - -Generate the doxygen documentation: - doxygen - git add -f doc - git commit doc - ------------- - -cd .. -echo .git > excludes -echo autom4te.cache >> excludes -tar -czf json-c-${release}.tar.gz -X excludes json-c-${release} - -echo doc >> excludes -tar -czf json-c-${release}-nodoc.tar.gz -X excludes json-c-${release} - ------------- - -Tag the branch: -cd json-c-${release} -git tag -a json-c-${release}-$(date +%Y%m%d) -m "Release json-c-${release}" - -git push origin json-c-${release} -git push --tags - ------------- - -Go to Amazon S3 service at: - https://console.aws.amazon.com/s3/ - -Upload the two tarballs in the json-c_releases folder. - When uploading, use "Reduced Redundancy", and make the uploaded files publicly accessible. - -Logout of Amazon S3, and verify that the files are visible. - https://s3.amazonaws.com/json-c_releases/releases/index.html - -=================================== - -Post-release checklist: - -git checkout master -Add new section to ChangeLog -Update the version in json_c_version.h -Update the version in Doxyfile -Update the version in configure.ac - Use ${release}.99 to indicate a version "newer" than anything on the branch. - -Leave the libjson_la_LDFLAGS line in Makefile.am alone. - For more details see: - http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html - ------------- - -Update the gh-pages branch with new docs: - -cd json-c-${release} -git checkout json-c-${release} -cd .. - -git clone -b gh-pages https://github.com/json-c/json-c json-c-pages -cd json-c-pages -mkdir json-c-${release} -cp -R ../json-c-${release}/doc json-c-${release}/. -cp ../json-c-${release}/README-WIN32.html json-c-${release}/. -git add json-c-${release} -git commit - -vi index.html - Add/change links to current release. - -git commit index.html - -git push - ------------- - -Update checksums on wiki page. - -cd .. -openssl sha -sha256 json-c*gz -openssl md5 json-c*gz - -Copy and paste this output into the wiki page at: - https://github.com/json-c/json-c/wiki - ------------- - -Send an email to the mailing list. - diff --git a/json-c/arraylist.c b/json-c/arraylist.c deleted file mode 100644 index 1d899fa9..00000000 --- a/json-c/arraylist.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * $Id: arraylist.c,v 1.4 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#include "config.h" - -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <string.h> -#endif /* STDC_HEADERS */ - -#if defined(HAVE_STRINGS_H) && !defined(_STRING_H) && !defined(__USE_BSD) -# include <strings.h> -#endif /* HAVE_STRINGS_H */ - -#include "arraylist.h" - -struct array_list* -array_list_new(array_list_free_fn *free_fn) -{ - struct array_list *arr; - - arr = (struct array_list*)calloc(1, sizeof(struct array_list)); - if(!arr) return NULL; - arr->size = ARRAY_LIST_DEFAULT_SIZE; - arr->length = 0; - arr->free_fn = free_fn; - if(!(arr->array = (void**)calloc(sizeof(void*), arr->size))) { - free(arr); - return NULL; - } - return arr; -} - -extern void -array_list_free(struct array_list *arr) -{ - int i; - for(i = 0; i < arr->length; i++) - if(arr->array[i]) arr->free_fn(arr->array[i]); - free(arr->array); - free(arr); -} - -void* -array_list_get_idx(struct array_list *arr, int i) -{ - if(i >= arr->length) return NULL; - return arr->array[i]; -} - -static int array_list_expand_internal(struct array_list *arr, int max) -{ - void *t; - int new_size; - - if(max < arr->size) return 0; - new_size = arr->size << 1; - if (new_size < max) - new_size = max; - if(!(t = realloc(arr->array, new_size*sizeof(void*)))) return -1; - arr->array = (void**)t; - (void)memset(arr->array + arr->size, 0, (new_size-arr->size)*sizeof(void*)); - arr->size = new_size; - return 0; -} - -int -array_list_put_idx(struct array_list *arr, int idx, void *data) -{ - if(array_list_expand_internal(arr, idx+1)) return -1; - if(arr->array[idx]) arr->free_fn(arr->array[idx]); - arr->array[idx] = data; - if(arr->length <= idx) arr->length = idx + 1; - return 0; -} - -int -array_list_add(struct array_list *arr, void *data) -{ - return array_list_put_idx(arr, arr->length, data); -} - -void -array_list_sort(struct array_list *arr, int(*sort_fn)(const void *, const void *)) -{ - qsort(arr->array, arr->length, sizeof(arr->array[0]), - (int (*)(const void *, const void *))sort_fn); -} - -int -array_list_length(struct array_list *arr) -{ - return arr->length; -} diff --git a/json-c/arraylist.h b/json-c/arraylist.h deleted file mode 100644 index 4f3113c0..00000000 --- a/json-c/arraylist.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _arraylist_h_ -#define _arraylist_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define ARRAY_LIST_DEFAULT_SIZE 32 - -typedef void (array_list_free_fn) (void *data); - -struct array_list -{ - void **array; - int length; - int size; - array_list_free_fn *free_fn; -}; - -extern struct array_list* -array_list_new(array_list_free_fn *free_fn); - -extern void -array_list_free(struct array_list *al); - -extern void* -array_list_get_idx(struct array_list *al, int i); - -extern int -array_list_put_idx(struct array_list *al, int i, void *data); - -extern int -array_list_add(struct array_list *al, void *data); - -extern int -array_list_length(struct array_list *al); - -extern void -array_list_sort(struct array_list *arr, int(*compar)(const void *, const void *)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/autogen.sh b/json-c/autogen.sh deleted file mode 100755 index 69e765a6..00000000 --- a/json-c/autogen.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -autoreconf -v --install || exit 1 - -# If there are any options, assume the user wants to run configure. -# To run configure w/o any options, use ./autogen.sh --configure -if [ $# -gt 0 ] ; then - case "$1" in - --conf*) - shift 1 - ;; - esac - exec ./configure "$@" -fi diff --git a/json-c/bits.h b/json-c/bits.h deleted file mode 100644 index d14a1db0..00000000 --- a/json-c/bits.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file - * @deprecated Use json_util.h instead. - * - * $Id: bits.h,v 1.10 2006/01/30 23:07:57 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _bits_h_ -#define _bits_h_ - -/** - * @deprecated - */ -#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9) -/** - * @deprecated - */ -#define error_ptr(error) ((void*)error) -/** - * @deprecated - */ -#define error_description(error) (json_tokener_get_error(error)) -/** - * @deprecated - */ -#define is_error(ptr) (ptr == NULL) - -#endif diff --git a/json-c/check.log b/json-c/check.log deleted file mode 100644 index 3c73d2ae..00000000 --- a/json-c/check.log +++ /dev/null @@ -1,2 +0,0 @@ -HEAD is now at 6442a2f... json-c: Add libjson to the vendor image -HEAD is now at 6442a2f... json-c: Add libjson to the vendor image diff --git a/json-c/config.h b/json-c/config.h deleted file mode 100644 index f958d440..00000000 --- a/json-c/config.h +++ /dev/null @@ -1,178 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Enable RDRANR Hardware RNG Hash Seed */ -/* #undef ENABLE_RDRAND */ - -/* Define if .gnu.warning accepts long strings. */ -/* #undef HAS_GNU_WARNING_LONG */ - -/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you - don't. */ -#define HAVE_DECL_INFINITY 1 - -/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. - */ -#define HAVE_DECL_ISINF 1 - -/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. - */ -#define HAVE_DECL_ISNAN 1 - -/* Define to 1 if you have the declaration of `nan', and to 0 if you don't. */ -#define HAVE_DECL_NAN 1 - -/* Define to 1 if you have the declaration of `_finite', and to 0 if you - don't. */ -#define HAVE_DECL__FINITE 0 - -/* Define to 1 if you have the declaration of `_isnan', and to 0 if you don't. - */ -#define HAVE_DECL__ISNAN 0 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -/* #undef HAVE_DOPRNT */ - -/* Define to 1 if you have the <endian.h> header file. */ -#define HAVE_ENDIAN_H 1 - -/* Define to 1 if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the <locale.h> header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `open' function. */ -#define HAVE_OPEN 1 - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#define HAVE_REALLOC 1 - -/* Define to 1 if you have the `setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define to 1 if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strncasecmp' function. */ -#define HAVE_STRNCASECMP 1 - -/* Define to 1 if you have the <syslog.h> header file. */ -#define HAVE_SYSLOG_H 1 - -/* Define to 1 if you have the <sys/cdefs.h> header file. */ -#define HAVE_SYS_CDEFS_H 1 - -/* Define to 1 if you have the <sys/param.h> header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `vasprintf' function. */ -#define HAVE_VASPRINTF 1 - -/* Define to 1 if you have the `vprintf' function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Define to 1 if you have the `vsyslog' function. */ -#define HAVE_VSYSLOG 1 - -/* Public define for json_inttypes.h */ -#define JSON_C_HAVE_INTTYPES_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* Name of package */ -#define PACKAGE "json-c" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "json-c@googlegroups.com" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "json-c" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "json-c 0.12.99" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "json-c" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.12.99" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.12.99" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to rpl_realloc if the replacement function should be used. */ -/* #undef realloc */ - -/* Define to `unsigned int' if <sys/types.h> does not define. */ -/* #undef size_t */ diff --git a/json-c/config.h.in b/json-c/config.h.in deleted file mode 100644 index af2e5fc2..00000000 --- a/json-c/config.h.in +++ /dev/null @@ -1,177 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Enable RDRANR Hardware RNG Hash Seed */ -#undef ENABLE_RDRAND - -/* Define if .gnu.warning accepts long strings. */ -#undef HAS_GNU_WARNING_LONG - -/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you - don't. */ -#undef HAVE_DECL_INFINITY - -/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. - */ -#undef HAVE_DECL_ISINF - -/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. - */ -#undef HAVE_DECL_ISNAN - -/* Define to 1 if you have the declaration of `nan', and to 0 if you don't. */ -#undef HAVE_DECL_NAN - -/* Define to 1 if you have the declaration of `_finite', and to 0 if you - don't. */ -#undef HAVE_DECL__FINITE - -/* Define to 1 if you have the declaration of `_isnan', and to 0 if you don't. - */ -#undef HAVE_DECL__ISNAN - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the <endian.h> header file. */ -#undef HAVE_ENDIAN_H - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the <locale.h> header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `open' function. */ -#undef HAVE_OPEN - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the <stdarg.h> header file. */ -#undef HAVE_STDARG_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strcasecmp' function. */ -#undef HAVE_STRCASECMP - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strncasecmp' function. */ -#undef HAVE_STRNCASECMP - -/* Define to 1 if you have the <syslog.h> header file. */ -#undef HAVE_SYSLOG_H - -/* Define to 1 if you have the <sys/cdefs.h> header file. */ -#undef HAVE_SYS_CDEFS_H - -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF - -/* Define to 1 if you have the `vsyslog' function. */ -#undef HAVE_VSYSLOG - -/* Public define for json_inttypes.h */ -#undef JSON_C_HAVE_INTTYPES_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - -/* Define to `unsigned int' if <sys/types.h> does not define. */ -#undef size_t diff --git a/json-c/configure.ac b/json-c/configure.ac deleted file mode 100644 index c50f81bd..00000000 --- a/json-c/configure.ac +++ /dev/null @@ -1,107 +0,0 @@ -AC_PREREQ(2.52) - -# Process this file with autoconf to produce a configure script. -AC_INIT([json-c], 0.12.99, [json-c@googlegroups.com]) - -AM_INIT_AUTOMAKE - -AC_PROG_MAKE_SET - -AC_ARG_ENABLE(rdrand, - AS_HELP_STRING([--enable-rdrand], - [Enable RDRAND Hardware RNG Hash Seed generation on supported x86/x64 platforms.]), -[if test x$enableval = xyes; then - enable_rdrand=yes - AC_DEFINE(ENABLE_RDRAND, 1, [Enable RDRANR Hardware RNG Hash Seed]) -fi]) - -if test "x$enable_rdrand" = "xyes"; then - AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed enabled on supported x86/x64 platforms]) -else - AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed disabled. Use --enable-rdrand to enable]) -fi - -# Checks for programs. - -# Checks for libraries. - -# Checks for header files. -AM_PROG_CC_C_O -AC_CONFIG_HEADER(config.h) -AC_CONFIG_HEADER(json_config.h) -AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h endian.h) -AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T - -# Checks for library functions. -AC_FUNC_VPRINTF -AC_FUNC_MEMCMP -AC_FUNC_MALLOC -AC_FUNC_REALLOC -AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale) -AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]]) -AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]]) -AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]]) -AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]]) -AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]]) -AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]]) - -#check if .section.gnu.warning accepts long strings (for __warn_references) -AC_LANG_PUSH([C]) - -AC_MSG_CHECKING([if .gnu.warning accepts long strings]) -AC_LINK_IFELSE([AC_LANG_SOURCE([[ -extern void json_object_get(); -__asm__(".section .gnu.json_object_get,\n\t.ascii \"Please link against libjson-c instead of libjson\"\n\t.text"); - -int main(int c,char* v) {return 0;} -]])], [ - AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.]) - AC_MSG_RESULT(yes) -], [ - AC_MSG_RESULT(no) -]) - -AC_LANG_POP([C]) - -AM_PROG_LIBTOOL - -# Check for the -Bsymbolic-functions linker flag -AC_ARG_ENABLE([Bsymbolic], - [AS_HELP_STRING([--disable-Bsymbolic], [Avoid linking with -Bsymbolic-function])], - [], - [enable_Bsymbolic=check]) - -AS_IF([test "x$enable_Bsymbolic" = "xcheck"], - [ - saved_LDFLAGS="${LDFLAGS}" - AC_MSG_CHECKING([for -Bsymbolic-functions linker flag]) - LDFLAGS=-Wl,-Bsymbolic-functions - AC_TRY_LINK([], [int main (void) { return 0; }], - [ - AC_MSG_RESULT([yes]) - enable_Bsymbolic=yes - ], - [ - AC_MSG_RESULT([no]) - enable_Bsymbolic=no - ]) - LDFLAGS="${saved_LDFLAGS}" - ]) - -AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions]) -AC_SUBST(JSON_BSYMBOLIC_LDFLAGS) - -AC_CONFIG_FILES([ -Makefile -json-c.pc -tests/Makefile -json-c-uninstalled.pc -]) - -AC_OUTPUT - diff --git a/json-c/debug.c b/json-c/debug.c deleted file mode 100644 index 3b64b590..00000000 --- a/json-c/debug.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: debug.c,v 1.5 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> - -#if HAVE_SYSLOG_H -# include <syslog.h> -#endif /* HAVE_SYSLOG_H */ - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif /* HAVE_UNISTD_H */ - -#if HAVE_SYS_PARAM_H -#include <sys/param.h> -#endif /* HAVE_SYS_PARAM_H */ - -#include "debug.h" - -static int _syslog = 0; -static int _debug = 0; - -void mc_set_debug(int debug) { _debug = debug; } -int mc_get_debug(void) { return _debug; } - -extern void mc_set_syslog(int syslog) -{ - _syslog = syslog; -} - -void mc_debug(const char *msg, ...) -{ - va_list ap; - if(_debug) { - va_start(ap, msg); -#if HAVE_VSYSLOG - if(_syslog) { - vsyslog(LOG_DEBUG, msg, ap); - } else -#endif - vprintf(msg, ap); - va_end(ap); - } -} - -void mc_error(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); -#if HAVE_VSYSLOG - if(_syslog) { - vsyslog(LOG_ERR, msg, ap); - } else -#endif - vfprintf(stderr, msg, ap); - va_end(ap); -} - -void mc_info(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); -#if HAVE_VSYSLOG - if(_syslog) { - vsyslog(LOG_INFO, msg, ap); - } else -#endif - vfprintf(stderr, msg, ap); - va_end(ap); -} diff --git a/json-c/debug.h b/json-c/debug.h deleted file mode 100644 index 80ca3e43..00000000 --- a/json-c/debug.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _DEBUG_H_ -#define _DEBUG_H_ - -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern void mc_set_debug(int debug); -extern int mc_get_debug(void); - -extern void mc_set_syslog(int syslog); - -extern void mc_debug(const char *msg, ...); -extern void mc_error(const char *msg, ...); -extern void mc_info(const char *msg, ...); - -#ifndef __STRING -#define __STRING(x) #x -#endif - -#ifndef PARSER_BROKEN_FIXED - -#define JASSERT(cond) do {} while(0) - -#else - -#define JASSERT(cond) do { \ - if (!(cond)) { \ - mc_error("cjson assert failure %s:%d : cond \"" __STRING(cond) "failed\n", __FILE__, __LINE__); \ - *(int *)0 = 1;\ - abort(); \ - }\ - } while(0) - -#endif - -#define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__) - -#ifdef MC_MAINTAINER_MODE -#define MC_SET_DEBUG(x) mc_set_debug(x) -#define MC_GET_DEBUG() mc_get_debug() -#define MC_SET_SYSLOG(x) mc_set_syslog(x) -#define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__) -#define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__) -#else -#define MC_SET_DEBUG(x) if (0) mc_set_debug(x) -#define MC_GET_DEBUG() (0) -#define MC_SET_SYSLOG(x) if (0) mc_set_syslog(x) -#define MC_DEBUG(x, ...) if (0) mc_debug(x, ##__VA_ARGS__) -#define MC_INFO(x, ...) if (0) mc_info(x, ##__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/json-c-uninstalled.pc.in b/json-c/json-c-uninstalled.pc.in deleted file mode 100644 index dab2bab5..00000000 --- a/json-c/json-c-uninstalled.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix= -exec_prefix= -libdir=@abs_top_builddir@ -includedir=@abs_top_srcdir@ - -Name: json -Description: JSON implementation in C -Version: @VERSION@ -Requires: -Libs: -L@abs_top_builddir@ -ljson-c -Cflags: -I@abs_top_srcdir@ diff --git a/json-c/json-c.pc.in b/json-c/json-c.pc.in deleted file mode 100644 index 037739d2..00000000 --- a/json-c/json-c.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: json-c -Description: JSON implementation in C -Version: @VERSION@ -Requires: -Libs: -L${libdir} -ljson-c -Cflags: -I${includedir}/json-c diff --git a/json-c/json.h b/json-c/json.h deleted file mode 100644 index e198f5da..00000000 --- a/json-c/json.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _json_h_ -#define _json_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "debug.h" -#include "linkhash.h" -#include "arraylist.h" -#include "json_util.h" -#include "json_object.h" -#include "json_tokener.h" -#include "json_object_iterator.h" -#include "json_c_version.h" - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/json_c_version.c b/json-c/json_c_version.c deleted file mode 100644 index 13eb1885..00000000 --- a/json-c/json_c_version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2012 Eric Haszlakiewicz - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - */ -#include "config.h" - -#include "json_c_version.h" - -const char *json_c_version(void) -{ - return JSON_C_VERSION; -} - -int json_c_version_num(void) -{ - return JSON_C_VERSION_NUM; -} - diff --git a/json-c/json_c_version.h b/json-c/json_c_version.h deleted file mode 100644 index d77f1a74..00000000 --- a/json-c/json_c_version.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2012 Eric Haszlakiewicz - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - */ - -#ifndef _json_c_version_h_ -#define _json_c_version_h_ - -#define JSON_C_MAJOR_VERSION 0 -#define JSON_C_MINOR_VERSION 12 -#define JSON_C_MICRO_VERSION 99 -#define JSON_C_VERSION_NUM ((JSON_C_MAJOR_VERSION << 16) | \ - (JSON_C_MINOR_VERSION << 8) | \ - JSON_C_MICRO_VERSION) -#define JSON_C_VERSION "0.12.99" - -const char *json_c_version(void); /* Returns JSON_C_VERSION */ -int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */ - -#endif diff --git a/json-c/json_config.h b/json-c/json_config.h deleted file mode 100644 index 965ff1c3..00000000 --- a/json-c/json_config.h +++ /dev/null @@ -1,4 +0,0 @@ -/* json_config.h. Generated from json_config.h.in by configure. */ - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define JSON_C_HAVE_INTTYPES_H 1 diff --git a/json-c/json_config.h.in b/json-c/json_config.h.in deleted file mode 100644 index 7888e021..00000000 --- a/json-c/json_config.h.in +++ /dev/null @@ -1,3 +0,0 @@ - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef JSON_C_HAVE_INTTYPES_H diff --git a/json-c/json_inttypes.h b/json-c/json_inttypes.h deleted file mode 100644 index 9de8d246..00000000 --- a/json-c/json_inttypes.h +++ /dev/null @@ -1,28 +0,0 @@ - -#ifndef _json_inttypes_h_ -#define _json_inttypes_h_ - -#include "json_config.h" - -#if defined(_MSC_VER) && _MSC_VER <= 1700 - -/* Anything less than Visual Studio C++ 10 is missing stdint.h and inttypes.h */ -typedef __int32 int32_t; -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX ((int32_t)_I32_MAX) -typedef __int64 int64_t; -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX ((int64_t)_I64_MAX) -#define PRId64 "I64d" -#define SCNd64 "I64d" - -#else - -#ifdef JSON_C_HAVE_INTTYPES_H -#include <inttypes.h> -#endif -/* inttypes.h includes stdint.h */ - -#endif - -#endif diff --git a/json-c/json_object.c b/json-c/json_object.c deleted file mode 100644 index 8ed02398..00000000 --- a/json-c/json_object.c +++ /dev/null @@ -1,913 +0,0 @@ -/* - * $Id: json_object.c,v 1.17 2006/07/25 03:24:50 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <math.h> -#include <errno.h> - -#include "debug.h" -#include "printbuf.h" -#include "linkhash.h" -#include "arraylist.h" -#include "json_inttypes.h" -#include "json_object.h" -#include "json_object_private.h" -#include "json_util.h" -#include "math_compat.h" - -#if !defined(HAVE_STRDUP) && defined(_MSC_VER) - /* MSC has the version as _strdup */ -# define strdup _strdup -#elif !defined(HAVE_STRDUP) -# error You do not have strdup on your system. -#endif /* HAVE_STRDUP */ - -#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER) - /* MSC has the version as _snprintf */ -# define snprintf _snprintf -#elif !defined(HAVE_SNPRINTF) -# error You do not have snprintf on your system. -#endif /* HAVE_SNPRINTF */ - -// Don't define this. It's not thread-safe. -/* #define REFCOUNT_DEBUG 1 */ - -const char *json_number_chars = "0123456789.+-eE"; -const char *json_hex_chars = "0123456789abcdefABCDEF"; - -static void json_object_generic_delete(struct json_object* jso); -static struct json_object* json_object_new(enum json_type o_type); - -static json_object_to_json_string_fn json_object_object_to_json_string; -static json_object_to_json_string_fn json_object_boolean_to_json_string; -static json_object_to_json_string_fn json_object_int_to_json_string; -static json_object_to_json_string_fn json_object_double_to_json_string; -static json_object_to_json_string_fn json_object_string_to_json_string; -static json_object_to_json_string_fn json_object_array_to_json_string; - - -/* ref count debugging */ - -#ifdef REFCOUNT_DEBUG - -static struct lh_table *json_object_table; - -static void json_object_init(void) __attribute__ ((constructor)); -static void json_object_init(void) { - MC_DEBUG("json_object_init: creating object table\n"); - json_object_table = lh_kptr_table_new(128, "json_object_table", NULL); -} - -static void json_object_fini(void) __attribute__ ((destructor)); -static void json_object_fini(void) -{ - struct lh_entry *ent; - if (MC_GET_DEBUG()) - { - if (json_object_table->count) - { - MC_DEBUG("json_object_fini: %d referenced objects at exit\n", - json_object_table->count); - lh_foreach(json_object_table, ent) - { - struct json_object* obj = (struct json_object*)ent->v; - MC_DEBUG("\t%s:%p\n", json_type_to_name(obj->o_type), obj); - } - } - } - MC_DEBUG("json_object_fini: freeing object table\n"); - lh_table_free(json_object_table); -} -#endif /* REFCOUNT_DEBUG */ - - -/* string escaping */ - -static int json_escape_str(struct printbuf *pb, char *str, int len) -{ - int pos = 0, start_offset = 0; - unsigned char c; - while (len--) - { - c = str[pos]; - switch(c) - { - case '\b': - case '\n': - case '\r': - case '\t': - case '\f': - case '"': - case '\\': - case '/': - if(pos - start_offset > 0) - printbuf_memappend(pb, str + start_offset, pos - start_offset); - - if(c == '\b') printbuf_memappend(pb, "\\b", 2); - else if(c == '\n') printbuf_memappend(pb, "\\n", 2); - else if(c == '\r') printbuf_memappend(pb, "\\r", 2); - else if(c == '\t') printbuf_memappend(pb, "\\t", 2); - else if(c == '\f') printbuf_memappend(pb, "\\f", 2); - else if(c == '"') printbuf_memappend(pb, "\\\"", 2); - else if(c == '\\') printbuf_memappend(pb, "\\\\", 2); - else if(c == '/') printbuf_memappend(pb, "\\/", 2); - - start_offset = ++pos; - break; - default: - if(c < ' ') - { - if(pos - start_offset > 0) - printbuf_memappend(pb, str + start_offset, pos - start_offset); - sprintbuf(pb, "\\u00%c%c", - json_hex_chars[c >> 4], - json_hex_chars[c & 0xf]); - start_offset = ++pos; - } else - pos++; - } - } - if (pos - start_offset > 0) - printbuf_memappend(pb, str + start_offset, pos - start_offset); - return 0; -} - - -/* reference counting */ - -extern struct json_object* json_object_get(struct json_object *jso) -{ - if (jso) - jso->_ref_count++; - return jso; -} - -int json_object_put(struct json_object *jso) -{ - if(jso) - { - jso->_ref_count--; - if(!jso->_ref_count) - { - if (jso->_user_delete) - jso->_user_delete(jso, jso->_userdata); - jso->_delete(jso); - return 1; - } - } - return 0; -} - - -/* generic object construction and destruction parts */ - -static void json_object_generic_delete(struct json_object* jso) -{ -#ifdef REFCOUNT_DEBUG - MC_DEBUG("json_object_delete_%s: %p\n", - json_type_to_name(jso->o_type), jso); - lh_table_delete(json_object_table, jso); -#endif /* REFCOUNT_DEBUG */ - printbuf_free(jso->_pb); - free(jso); -} - -static struct json_object* json_object_new(enum json_type o_type) -{ - struct json_object *jso; - - jso = (struct json_object*)calloc(sizeof(struct json_object), 1); - if (!jso) - return NULL; - jso->o_type = o_type; - jso->_ref_count = 1; - jso->_delete = &json_object_generic_delete; -#ifdef REFCOUNT_DEBUG - lh_table_insert(json_object_table, jso, jso); - MC_DEBUG("json_object_new_%s: %p\n", json_type_to_name(jso->o_type), jso); -#endif /* REFCOUNT_DEBUG */ - return jso; -} - - -/* type checking functions */ - -int json_object_is_type(struct json_object *jso, enum json_type type) -{ - if (!jso) - return (type == json_type_null); - return (jso->o_type == type); -} - -enum json_type json_object_get_type(struct json_object *jso) -{ - if (!jso) - return json_type_null; - return jso->o_type; -} - -/* set a custom conversion to string */ - -void json_object_set_serializer(json_object *jso, - json_object_to_json_string_fn to_string_func, - void *userdata, - json_object_delete_fn *user_delete) -{ - // First, clean up any previously existing user info - if (jso->_user_delete) - { - jso->_user_delete(jso, jso->_userdata); - } - jso->_userdata = NULL; - jso->_user_delete = NULL; - - if (to_string_func == NULL) - { - // Reset to the standard serialization function - switch(jso->o_type) - { - case json_type_null: - jso->_to_json_string = NULL; - break; - case json_type_boolean: - jso->_to_json_string = &json_object_boolean_to_json_string; - break; - case json_type_double: - jso->_to_json_string = &json_object_double_to_json_string; - break; - case json_type_int: - jso->_to_json_string = &json_object_int_to_json_string; - break; - case json_type_object: - jso->_to_json_string = &json_object_object_to_json_string; - break; - case json_type_array: - jso->_to_json_string = &json_object_array_to_json_string; - break; - case json_type_string: - jso->_to_json_string = &json_object_string_to_json_string; - break; - } - return; - } - - jso->_to_json_string = to_string_func; - jso->_userdata = userdata; - jso->_user_delete = user_delete; -} - - -/* extended conversion to string */ - -const char* json_object_to_json_string_ext(struct json_object *jso, int flags) -{ - if (!jso) - return "null"; - - if ((!jso->_pb) && !(jso->_pb = printbuf_new())) - return NULL; - - printbuf_reset(jso->_pb); - - if(jso->_to_json_string(jso, jso->_pb, 0, flags) < 0) - return NULL; - - return jso->_pb->buf; -} - -/* backwards-compatible conversion to string */ - -const char* json_object_to_json_string(struct json_object *jso) -{ - return json_object_to_json_string_ext(jso, JSON_C_TO_STRING_SPACED); -} - -static void indent(struct printbuf *pb, int level, int flags) -{ - if (flags & JSON_C_TO_STRING_PRETTY) - { - printbuf_memset(pb, -1, ' ', level * 2); - } -} - -/* json_object_object */ - -static int json_object_object_to_json_string(struct json_object* jso, - struct printbuf *pb, - int level, - int flags) -{ - int had_children = 0; - struct json_object_iter iter; - - sprintbuf(pb, "{" /*}*/); - if (flags & JSON_C_TO_STRING_PRETTY) - sprintbuf(pb, "\n"); - json_object_object_foreachC(jso, iter) - { - if (had_children) - { - sprintbuf(pb, ","); - if (flags & JSON_C_TO_STRING_PRETTY) - sprintbuf(pb, "\n"); - } - had_children = 1; - if (flags & JSON_C_TO_STRING_SPACED) - sprintbuf(pb, " "); - indent(pb, level+1, flags); - sprintbuf(pb, "\""); - json_escape_str(pb, iter.key, strlen(iter.key)); - if (flags & JSON_C_TO_STRING_SPACED) - sprintbuf(pb, "\": "); - else - sprintbuf(pb, "\":"); - if(iter.val == NULL) - sprintbuf(pb, "null"); - else - iter.val->_to_json_string(iter.val, pb, level+1,flags); - } - if (flags & JSON_C_TO_STRING_PRETTY) - { - if (had_children) - sprintbuf(pb, "\n"); - indent(pb,level,flags); - } - if (flags & JSON_C_TO_STRING_SPACED) - return sprintbuf(pb, /*{*/ " }"); - else - return sprintbuf(pb, /*{*/ "}"); -} - - -static void json_object_lh_entry_free(struct lh_entry *ent) -{ - free(ent->k); - json_object_put((struct json_object*)ent->v); -} - -static void json_object_object_delete(struct json_object* jso) -{ - lh_table_free(jso->o.c_object); - json_object_generic_delete(jso); -} - -struct json_object* json_object_new_object(void) -{ - struct json_object *jso = json_object_new(json_type_object); - if (!jso) - return NULL; - jso->_delete = &json_object_object_delete; - jso->_to_json_string = &json_object_object_to_json_string; - jso->o.c_object = lh_kchar_table_new(JSON_OBJECT_DEF_HASH_ENTRIES, - NULL, &json_object_lh_entry_free); - if (!jso->o.c_object) - { - json_object_generic_delete(jso); - errno = ENOMEM; - return NULL; - } - return jso; -} - -struct lh_table* json_object_get_object(struct json_object *jso) -{ - if (!jso) - return NULL; - switch(jso->o_type) - { - case json_type_object: - return jso->o.c_object; - default: - return NULL; - } -} - -void json_object_object_add(struct json_object* jso, const char *key, - struct json_object *val) -{ - // We lookup the entry and replace the value, rather than just deleting - // and re-adding it, so the existing key remains valid. - json_object *existing_value = NULL; - struct lh_entry *existing_entry; - existing_entry = lh_table_lookup_entry(jso->o.c_object, (void*)key); - if (!existing_entry) - { - lh_table_insert(jso->o.c_object, strdup(key), val); - return; - } - existing_value = (void *)existing_entry->v; - if (existing_value) - json_object_put(existing_value); - existing_entry->v = val; -} - -int json_object_object_length(struct json_object *jso) -{ - return lh_table_length(jso->o.c_object); -} - -struct json_object* json_object_object_get(struct json_object* jso, const char *key) -{ - struct json_object *result = NULL; - json_object_object_get_ex(jso, key, &result); - return result; -} - -json_bool json_object_object_get_ex(struct json_object* jso, const char *key, struct json_object **value) -{ - if (value != NULL) - *value = NULL; - - if (NULL == jso) - return FALSE; - - switch(jso->o_type) - { - case json_type_object: - return lh_table_lookup_ex(jso->o.c_object, (void*)key, (void**)value); - default: - if (value != NULL) - *value = NULL; - return FALSE; - } -} - -void json_object_object_del(struct json_object* jso, const char *key) -{ - lh_table_delete(jso->o.c_object, key); -} - - -/* json_object_boolean */ - -static int json_object_boolean_to_json_string(struct json_object* jso, - struct printbuf *pb, - int level, - int flags) -{ - if (jso->o.c_boolean) - return sprintbuf(pb, "true"); - else - return sprintbuf(pb, "false"); -} - -struct json_object* json_object_new_boolean(json_bool b) -{ - struct json_object *jso = json_object_new(json_type_boolean); - if (!jso) - return NULL; - jso->_to_json_string = &json_object_boolean_to_json_string; - jso->o.c_boolean = b; - return jso; -} - -json_bool json_object_get_boolean(struct json_object *jso) -{ - if (!jso) - return FALSE; - switch(jso->o_type) - { - case json_type_boolean: - return jso->o.c_boolean; - case json_type_int: - return (jso->o.c_int64 != 0); - case json_type_double: - return (jso->o.c_double != 0); - case json_type_string: - return (jso->o.c_string.len != 0); - default: - return FALSE; - } -} - - -/* json_object_int */ - -static int json_object_int_to_json_string(struct json_object* jso, - struct printbuf *pb, - int level, - int flags) -{ - return sprintbuf(pb, "%"PRId64, jso->o.c_int64); -} - -struct json_object* json_object_new_int(int32_t i) -{ - struct json_object *jso = json_object_new(json_type_int); - if (!jso) - return NULL; - jso->_to_json_string = &json_object_int_to_json_string; - jso->o.c_int64 = i; - return jso; -} - -int32_t json_object_get_int(struct json_object *jso) -{ - int64_t cint64; - enum json_type o_type; - - if(!jso) return 0; - - o_type = jso->o_type; - cint64 = jso->o.c_int64; - - if (o_type == json_type_string) - { - /* - * Parse strings into 64-bit numbers, then use the - * 64-to-32-bit number handling below. - */ - if (json_parse_int64(jso->o.c_string.str, &cint64) != 0) - return 0; /* whoops, it didn't work. */ - o_type = json_type_int; - } - - switch(o_type) { - case json_type_int: - /* Make sure we return the correct values for out of range numbers. */ - if (cint64 <= INT32_MIN) - return INT32_MIN; - else if (cint64 >= INT32_MAX) - return INT32_MAX; - else - return (int32_t)cint64; - case json_type_double: - return (int32_t)jso->o.c_double; - case json_type_boolean: - return jso->o.c_boolean; - default: - return 0; - } -} - -struct json_object* json_object_new_int64(int64_t i) -{ - struct json_object *jso = json_object_new(json_type_int); - if (!jso) - return NULL; - jso->_to_json_string = &json_object_int_to_json_string; - jso->o.c_int64 = i; - return jso; -} - -int64_t json_object_get_int64(struct json_object *jso) -{ - int64_t cint; - - if (!jso) - return 0; - switch(jso->o_type) - { - case json_type_int: - return jso->o.c_int64; - case json_type_double: - return (int64_t)jso->o.c_double; - case json_type_boolean: - return jso->o.c_boolean; - case json_type_string: - if (json_parse_int64(jso->o.c_string.str, &cint) == 0) - return cint; - default: - return 0; - } -} - - -/* json_object_double */ - -static int json_object_double_to_json_string(struct json_object* jso, - struct printbuf *pb, - int level, - int flags) -{ - char buf[128], *p, *q; - int size; - /* Although JSON RFC does not support - NaN or Infinity as numeric values - ECMA 262 section 9.8.1 defines - how to handle these cases as strings */ - if(isnan(jso->o.c_double)) - size = snprintf(buf, sizeof(buf), "NaN"); - else if(isinf(jso->o.c_double)) - if(jso->o.c_double > 0) - size = snprintf(buf, sizeof(buf), "Infinity"); - else - size = snprintf(buf, sizeof(buf), "-Infinity"); - else - size = snprintf(buf, sizeof(buf), "%.17g", jso->o.c_double); - - p = strchr(buf, ','); - if (p) { - *p = '.'; - } else { - p = strchr(buf, '.'); - } - if (p && (flags & JSON_C_TO_STRING_NOZERO)) { - /* last useful digit, always keep 1 zero */ - p++; - for (q=p ; *q ; q++) { - if (*q!='0') p=q; - } - /* drop trailing zeroes */ - *(++p) = 0; - size = p-buf; - } - printbuf_memappend(pb, buf, size); - return size; -} - -struct json_object* json_object_new_double(double d) -{ - struct json_object *jso = json_object_new(json_type_double); - if (!jso) - return NULL; - jso->_to_json_string = &json_object_double_to_json_string; - jso->o.c_double = d; - return jso; -} - -struct json_object* json_object_new_double_s(double d, const char *ds) -{ - struct json_object *jso = json_object_new_double(d); - if (!jso) - return NULL; - - char *new_ds = strdup(ds); - if (!new_ds) - { - json_object_generic_delete(jso); - errno = ENOMEM; - return NULL; - } - json_object_set_serializer(jso, json_object_userdata_to_json_string, - new_ds, json_object_free_userdata); - return jso; -} - -int json_object_userdata_to_json_string(struct json_object *jso, - struct printbuf *pb, int level, int flags) -{ - int userdata_len = strlen(jso->_userdata); - printbuf_memappend(pb, jso->_userdata, userdata_len); - return userdata_len; -} - -void json_object_free_userdata(struct json_object *jso, void *userdata) -{ - free(userdata); -} - -double json_object_get_double(struct json_object *jso) -{ - double cdouble; - char *errPtr = NULL; - - if(!jso) return 0.0; - switch(jso->o_type) { - case json_type_double: - return jso->o.c_double; - case json_type_int: - return jso->o.c_int64; - case json_type_boolean: - return jso->o.c_boolean; - case json_type_string: - errno = 0; - cdouble = strtod(jso->o.c_string.str,&errPtr); - - /* if conversion stopped at the first character, return 0.0 */ - if (errPtr == jso->o.c_string.str) - return 0.0; - - /* - * Check that the conversion terminated on something sensible - * - * For example, { "pay" : 123AB } would parse as 123. - */ - if (*errPtr != '\0') - return 0.0; - - /* - * If strtod encounters a string which would exceed the - * capacity of a double, it returns +/- HUGE_VAL and sets - * errno to ERANGE. But +/- HUGE_VAL is also a valid result - * from a conversion, so we need to check errno. - * - * Underflow also sets errno to ERANGE, but it returns 0 in - * that case, which is what we will return anyway. - * - * See CERT guideline ERR30-C - */ - if ((HUGE_VAL == cdouble || -HUGE_VAL == cdouble) && - (ERANGE == errno)) - cdouble = 0.0; - return cdouble; - default: - return 0.0; - } -} - - -/* json_object_string */ - -static int json_object_string_to_json_string(struct json_object* jso, - struct printbuf *pb, - int level, - int flags) -{ - sprintbuf(pb, "\""); - json_escape_str(pb, jso->o.c_string.str, jso->o.c_string.len); - sprintbuf(pb, "\""); - return 0; -} - -static void json_object_string_delete(struct json_object* jso) -{ - free(jso->o.c_string.str); - json_object_generic_delete(jso); -} - -struct json_object* json_object_new_string(const char *s) -{ - struct json_object *jso = json_object_new(json_type_string); - if (!jso) - return NULL; - jso->_delete = &json_object_string_delete; - jso->_to_json_string = &json_object_string_to_json_string; - jso->o.c_string.str = strdup(s); - if (!jso->o.c_string.str) - { - json_object_generic_delete(jso); - errno = ENOMEM; - return NULL; - } - jso->o.c_string.len = strlen(s); - return jso; -} - -struct json_object* json_object_new_string_len(const char *s, int len) -{ - struct json_object *jso = json_object_new(json_type_string); - if (!jso) - return NULL; - jso->_delete = &json_object_string_delete; - jso->_to_json_string = &json_object_string_to_json_string; - jso->o.c_string.str = (char*)malloc(len + 1); - if (!jso->o.c_string.str) - { - json_object_generic_delete(jso); - errno = ENOMEM; - return NULL; - } - memcpy(jso->o.c_string.str, (void *)s, len); - jso->o.c_string.str[len] = '\0'; - jso->o.c_string.len = len; - return jso; -} - -const char* json_object_get_string(struct json_object *jso) -{ - if (!jso) - return NULL; - switch(jso->o_type) - { - case json_type_string: - return jso->o.c_string.str; - default: - return json_object_to_json_string(jso); - } -} - -int json_object_get_string_len(struct json_object *jso) -{ - if (!jso) - return 0; - switch(jso->o_type) - { - case json_type_string: - return jso->o.c_string.len; - default: - return 0; - } -} - - -/* json_object_array */ - -static int json_object_array_to_json_string(struct json_object* jso, - struct printbuf *pb, - int level, - int flags) -{ - int had_children = 0; - int ii; - sprintbuf(pb, "["); - if (flags & JSON_C_TO_STRING_PRETTY) - sprintbuf(pb, "\n"); - for(ii=0; ii < json_object_array_length(jso); ii++) - { - struct json_object *val; - if (had_children) - { - sprintbuf(pb, ","); - if (flags & JSON_C_TO_STRING_PRETTY) - sprintbuf(pb, "\n"); - } - had_children = 1; - if (flags & JSON_C_TO_STRING_SPACED) - sprintbuf(pb, " "); - indent(pb, level + 1, flags); - val = json_object_array_get_idx(jso, ii); - if(val == NULL) - sprintbuf(pb, "null"); - else - val->_to_json_string(val, pb, level+1, flags); - } - if (flags & JSON_C_TO_STRING_PRETTY) - { - if (had_children) - sprintbuf(pb, "\n"); - indent(pb,level,flags); - } - - if (flags & JSON_C_TO_STRING_SPACED) - return sprintbuf(pb, " ]"); - else - return sprintbuf(pb, "]"); -} - -static void json_object_array_entry_free(void *data) -{ - json_object_put((struct json_object*)data); -} - -static void json_object_array_delete(struct json_object* jso) -{ - array_list_free(jso->o.c_array); - json_object_generic_delete(jso); -} - -struct json_object* json_object_new_array(void) -{ - struct json_object *jso = json_object_new(json_type_array); - if (!jso) - return NULL; - jso->_delete = &json_object_array_delete; - jso->_to_json_string = &json_object_array_to_json_string; - jso->o.c_array = array_list_new(&json_object_array_entry_free); - return jso; -} - -struct array_list* json_object_get_array(struct json_object *jso) -{ - if (!jso) - return NULL; - switch(jso->o_type) - { - case json_type_array: - return jso->o.c_array; - default: - return NULL; - } -} - -void json_object_array_sort(struct json_object *jso, int(*sort_fn)(const void *, const void *)) -{ - array_list_sort(jso->o.c_array, sort_fn); -} - -int json_object_array_length(struct json_object *jso) -{ - return array_list_length(jso->o.c_array); -} - -int json_object_array_add(struct json_object *jso,struct json_object *val) -{ - return array_list_add(jso->o.c_array, val); -} - -int json_object_array_put_idx(struct json_object *jso, int idx, - struct json_object *val) -{ - return array_list_put_idx(jso->o.c_array, idx, val); -} - -struct json_object* json_object_array_get_idx(struct json_object *jso, - int idx) -{ - return (struct json_object*)array_list_get_idx(jso->o.c_array, idx); -} - diff --git a/json-c/json_object.h b/json-c/json_object.h deleted file mode 100644 index 0dca0b1e..00000000 --- a/json-c/json_object.h +++ /dev/null @@ -1,617 +0,0 @@ -/* - * $Id: json_object.h,v 1.12 2006/01/30 23:07:57 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _json_object_h_ -#define _json_object_h_ - -#ifdef __GNUC__ -#define THIS_FUNCTION_IS_DEPRECATED(func) func __attribute__ ((deprecated)) -#elif defined(_MSC_VER) -#define THIS_FUNCTION_IS_DEPRECATED(func) __declspec(deprecated) func -#else -#define THIS_FUNCTION_IS_DEPRECATED(func) func -#endif - -#include "json_inttypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define JSON_OBJECT_DEF_HASH_ENTRIES 16 - -/** - * A flag for the json_object_to_json_string_ext() and - * json_object_to_file_ext() functions which causes the output - * to have no extra whitespace or formatting applied. - */ -#define JSON_C_TO_STRING_PLAIN 0 -/** - * A flag for the json_object_to_json_string_ext() and - * json_object_to_file_ext() functions which causes the output to have - * minimal whitespace inserted to make things slightly more readable. - */ -#define JSON_C_TO_STRING_SPACED (1<<0) -/** - * A flag for the json_object_to_json_string_ext() and - * json_object_to_file_ext() functions which causes - * the output to be formatted. - * - * See the "Two Space Tab" option at http://jsonformatter.curiousconcept.com/ - * for an example of the format. - */ -#define JSON_C_TO_STRING_PRETTY (1<<1) -/** - * A flag to drop trailing zero for float values - */ -#define JSON_C_TO_STRING_NOZERO (1<<2) - -#undef FALSE -#define FALSE ((json_bool)0) - -#undef TRUE -#define TRUE ((json_bool)1) - -extern const char *json_number_chars; -extern const char *json_hex_chars; - -/* CAW: added for ANSI C iteration correctness */ -struct json_object_iter -{ - char *key; - struct json_object *val; - struct lh_entry *entry; -}; - -/* forward structure definitions */ - -typedef int json_bool; -typedef struct printbuf printbuf; -typedef struct lh_table lh_table; -typedef struct array_list array_list; -typedef struct json_object json_object; -typedef struct json_object_iter json_object_iter; -typedef struct json_tokener json_tokener; - -/** - * Type of custom user delete functions. See json_object_set_serializer. - */ -typedef void (json_object_delete_fn)(struct json_object *jso, void *userdata); - -/** - * Type of a custom serialization function. See json_object_set_serializer. - */ -typedef int (json_object_to_json_string_fn)(struct json_object *jso, - struct printbuf *pb, - int level, - int flags); - -/* supported object types */ - -typedef enum json_type { - /* If you change this, be sure to update json_type_to_name() too */ - json_type_null, - json_type_boolean, - json_type_double, - json_type_int, - json_type_object, - json_type_array, - json_type_string -} json_type; - -/* reference counting functions */ - -/** - * Increment the reference count of json_object, thereby grabbing shared - * ownership of obj. - * - * @param obj the json_object instance - */ -extern struct json_object* json_object_get(struct json_object *obj); - -/** - * Decrement the reference count of json_object and free if it reaches zero. - * You must have ownership of obj prior to doing this or you will cause an - * imbalance in the reference count. - * - * @param obj the json_object instance - * @returns 1 if the object was freed. - */ -int json_object_put(struct json_object *obj); - -/** - * Check if the json_object is of a given type - * @param obj the json_object instance - * @param type one of: - json_type_null (i.e. obj == NULL), - json_type_boolean, - json_type_double, - json_type_int, - json_type_object, - json_type_array, - json_type_string - */ -extern int json_object_is_type(struct json_object *obj, enum json_type type); - -/** - * Get the type of the json_object. See also json_type_to_name() to turn this - * into a string suitable, for instance, for logging. - * - * @param obj the json_object instance - * @returns type being one of: - json_type_null (i.e. obj == NULL), - json_type_boolean, - json_type_double, - json_type_int, - json_type_object, - json_type_array, - json_type_string - */ -extern enum json_type json_object_get_type(struct json_object *obj); - - -/** Stringify object to json format. - * Equivalent to json_object_to_json_string_ext(obj, JSON_C_TO_STRING_SPACED) - * The pointer you get is an internal of your json object. You don't - * have to free it, later use of json_object_put() should be sufficient. - * If you can not ensure there's no concurrent access to *obj use - * strdup(). - * @param obj the json_object instance - * @returns a string in JSON format - */ -extern const char* json_object_to_json_string(struct json_object *obj); - -/** Stringify object to json format - * @see json_object_to_json_string() for details on how to free string. - * @param obj the json_object instance - * @param flags formatting options, see JSON_C_TO_STRING_PRETTY and other constants - * @returns a string in JSON format - */ -extern const char* json_object_to_json_string_ext(struct json_object *obj, int -flags); - -/** - * Set a custom serialization function to be used when this particular object - * is converted to a string by json_object_to_json_string. - * - * If a custom serializer is already set on this object, any existing - * user_delete function is called before the new one is set. - * - * If to_string_func is NULL, the other parameters are ignored - * and the default behaviour is reset. - * - * The userdata parameter is optional and may be passed as NULL. If provided, - * it is passed to to_string_func as-is. This parameter may be NULL even - * if user_delete is non-NULL. - * - * The user_delete parameter is optional and may be passed as NULL, even if - * the userdata parameter is non-NULL. It will be called just before the - * json_object is deleted, after it's reference count goes to zero - * (see json_object_put()). - * If this is not provided, it is up to the caller to free the userdata at - * an appropriate time. (i.e. after the json_object is deleted) - * - * @param jso the object to customize - * @param to_string_func the custom serialization function - * @param userdata an optional opaque cookie - * @param user_delete an optional function from freeing userdata - */ -extern void json_object_set_serializer(json_object *jso, - json_object_to_json_string_fn to_string_func, - void *userdata, - json_object_delete_fn *user_delete); - -/** - * Simply call free on the userdata pointer. - * Can be used with json_object_set_serializer(). - * - * @param jso unused - * @param userdata the pointer that is passed to free(). - */ -json_object_delete_fn json_object_free_userdata; - -/** - * Copy the jso->_userdata string over to pb as-is. - * Can be used with json_object_set_serializer(). - * - * @param jso The object whose _userdata is used. - * @param pb The destination buffer. - * @param level Ignored. - * @param flags Ignored. - */ -json_object_to_json_string_fn json_object_userdata_to_json_string; - - -/* object type methods */ - -/** Create a new empty object with a reference count of 1. The caller of - * this object initially has sole ownership. Remember, when using - * json_object_object_add or json_object_array_put_idx, ownership will - * transfer to the object/array. Call json_object_get if you want to maintain - * shared ownership or also add this object as a child of multiple objects or - * arrays. Any ownerships you acquired but did not transfer must be released - * through json_object_put. - * - * @returns a json_object of type json_type_object - */ -extern struct json_object* json_object_new_object(void); - -/** Get the hashtable of a json_object of type json_type_object - * @param obj the json_object instance - * @returns a linkhash - */ -extern struct lh_table* json_object_get_object(struct json_object *obj); - -/** Get the size of an object in terms of the number of fields it has. - * @param obj the json_object whose length to return - */ -extern int json_object_object_length(struct json_object* obj); - -/** Add an object field to a json_object of type json_type_object - * - * The reference count will *not* be incremented. This is to make adding - * fields to objects in code more compact. If you want to retain a reference - * to an added object, independent of the lifetime of obj, you must wrap the - * passed object with json_object_get. - * - * Upon calling this, the ownership of val transfers to obj. Thus you must - * make sure that you do in fact have ownership over this object. For instance, - * json_object_new_object will give you ownership until you transfer it, - * whereas json_object_object_get does not. - * - * @param obj the json_object instance - * @param key the object field name (a private copy will be duplicated) - * @param val a json_object or NULL member to associate with the given field - */ -extern void json_object_object_add(struct json_object* obj, const char *key, - struct json_object *val); - -/** Get the json_object associate with a given object field - * - * *No* reference counts will be changed. There is no need to manually adjust - * reference counts through the json_object_put/json_object_get methods unless - * you need to have the child (value) reference maintain a different lifetime - * than the owning parent (obj). Ownership of the returned value is retained - * by obj (do not do json_object_put unless you have done a json_object_get). - * If you delete the value from obj (json_object_object_del) and wish to access - * the returned reference afterwards, make sure you have first gotten shared - * ownership through json_object_get (& don't forget to do a json_object_put - * or transfer ownership to prevent a memory leak). - * - * @param obj the json_object instance - * @param key the object field name - * @returns the json_object associated with the given field name - * @deprecated Please use json_object_object_get_ex - */ -THIS_FUNCTION_IS_DEPRECATED(extern struct json_object* json_object_object_get(struct json_object* obj, - const char *key)); - -/** Get the json_object associated with a given object field. - * - * This returns true if the key is found, false in all other cases (including - * if obj isn't a json_type_object). - * - * *No* reference counts will be changed. There is no need to manually adjust - * reference counts through the json_object_put/json_object_get methods unless - * you need to have the child (value) reference maintain a different lifetime - * than the owning parent (obj). Ownership of value is retained by obj. - * - * @param obj the json_object instance - * @param key the object field name - * @param value a pointer where to store a reference to the json_object - * associated with the given field name. - * - * It is safe to pass a NULL value. - * @returns whether or not the key exists - */ -extern json_bool json_object_object_get_ex(struct json_object* obj, - const char *key, - struct json_object **value); - -/** Delete the given json_object field - * - * The reference count will be decremented for the deleted object. If there - * are no more owners of the value represented by this key, then the value is - * freed. Otherwise, the reference to the value will remain in memory. - * - * @param obj the json_object instance - * @param key the object field name - */ -extern void json_object_object_del(struct json_object* obj, const char *key); - -/** - * Iterate through all keys and values of an object. - * - * Adding keys to the object while iterating is NOT allowed. - * - * Deleting an existing key, or replacing an existing key with a - * new value IS allowed. - * - * @param obj the json_object instance - * @param key the local name for the char* key variable defined in the body - * @param val the local name for the json_object* object variable defined in - * the body - */ -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L - -# define json_object_object_foreach(obj,key,val) \ - char *key; \ - struct json_object *val __attribute__((__unused__)); \ - for(struct lh_entry *entry ## key = json_object_get_object(obj)->head, *entry_next ## key = NULL; \ - ({ if(entry ## key) { \ - key = (char*)entry ## key->k; \ - val = (struct json_object*)entry ## key->v; \ - entry_next ## key = entry ## key->next; \ - } ; entry ## key; }); \ - entry ## key = entry_next ## key ) - -#else /* ANSI C or MSC */ - -# define json_object_object_foreach(obj,key,val) \ - char *key;\ - struct json_object *val; \ - struct lh_entry *entry ## key; \ - struct lh_entry *entry_next ## key = NULL; \ - for(entry ## key = json_object_get_object(obj)->head; \ - (entry ## key ? ( \ - key = (char*)entry ## key->k, \ - val = (struct json_object*)entry ## key->v, \ - entry_next ## key = entry ## key->next, \ - entry ## key) : 0); \ - entry ## key = entry_next ## key) - -#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L */ - -/** Iterate through all keys and values of an object (ANSI C Safe) - * @param obj the json_object instance - * @param iter the object iterator - */ -#define json_object_object_foreachC(obj,iter) \ - for(iter.entry = json_object_get_object(obj)->head; (iter.entry ? (iter.key = (char*)iter.entry->k, iter.val = (struct json_object*)iter.entry->v, iter.entry) : 0); iter.entry = iter.entry->next) - -/* Array type methods */ - -/** Create a new empty json_object of type json_type_array - * @returns a json_object of type json_type_array - */ -extern struct json_object* json_object_new_array(void); - -/** Get the arraylist of a json_object of type json_type_array - * @param obj the json_object instance - * @returns an arraylist - */ -extern struct array_list* json_object_get_array(struct json_object *obj); - -/** Get the length of a json_object of type json_type_array - * @param obj the json_object instance - * @returns an int - */ -extern int json_object_array_length(struct json_object *obj); - -/** Sorts the elements of jso of type json_type_array -* -* Pointers to the json_object pointers will be passed as the two arguments -* to @sort_fn -* -* @param obj the json_object instance -* @param sort_fn a sorting function -*/ -extern void json_object_array_sort(struct json_object *jso, int(*sort_fn)(const void *, const void *)); - -/** Add an element to the end of a json_object of type json_type_array - * - * The reference count will *not* be incremented. This is to make adding - * fields to objects in code more compact. If you want to retain a reference - * to an added object you must wrap the passed object with json_object_get - * - * @param obj the json_object instance - * @param val the json_object to be added - */ -extern int json_object_array_add(struct json_object *obj, - struct json_object *val); - -/** Insert or replace an element at a specified index in an array (a json_object of type json_type_array) - * - * The reference count will *not* be incremented. This is to make adding - * fields to objects in code more compact. If you want to retain a reference - * to an added object you must wrap the passed object with json_object_get - * - * The reference count of a replaced object will be decremented. - * - * The array size will be automatically be expanded to the size of the - * index if the index is larger than the current size. - * - * @param obj the json_object instance - * @param idx the index to insert the element at - * @param val the json_object to be added - */ -extern int json_object_array_put_idx(struct json_object *obj, int idx, - struct json_object *val); - -/** Get the element at specificed index of the array (a json_object of type json_type_array) - * @param obj the json_object instance - * @param idx the index to get the element at - * @returns the json_object at the specified index (or NULL) - */ -extern struct json_object* json_object_array_get_idx(struct json_object *obj, - int idx); - -/* json_bool type methods */ - -/** Create a new empty json_object of type json_type_boolean - * @param b a json_bool TRUE or FALSE (0 or 1) - * @returns a json_object of type json_type_boolean - */ -extern struct json_object* json_object_new_boolean(json_bool b); - -/** Get the json_bool value of a json_object - * - * The type is coerced to a json_bool if the passed object is not a json_bool. - * integer and double objects will return FALSE if there value is zero - * or TRUE otherwise. If the passed object is a string it will return - * TRUE if it has a non zero length. If any other object type is passed - * TRUE will be returned if the object is not NULL. - * - * @param obj the json_object instance - * @returns a json_bool - */ -extern json_bool json_object_get_boolean(struct json_object *obj); - - -/* int type methods */ - -/** Create a new empty json_object of type json_type_int - * Note that values are stored as 64-bit values internally. - * To ensure the full range is maintained, use json_object_new_int64 instead. - * @param i the integer - * @returns a json_object of type json_type_int - */ -extern struct json_object* json_object_new_int(int32_t i); - - -/** Create a new empty json_object of type json_type_int - * @param i the integer - * @returns a json_object of type json_type_int - */ -extern struct json_object* json_object_new_int64(int64_t i); - - -/** Get the int value of a json_object - * - * The type is coerced to a int if the passed object is not a int. - * double objects will return their integer conversion. Strings will be - * parsed as an integer. If no conversion exists then 0 is returned - * and errno is set to EINVAL. null is equivalent to 0 (no error values set) - * - * Note that integers are stored internally as 64-bit values. - * If the value of too big or too small to fit into 32-bit, INT32_MAX or - * INT32_MIN are returned, respectively. - * - * @param obj the json_object instance - * @returns an int - */ -extern int32_t json_object_get_int(struct json_object *obj); - -/** Get the int value of a json_object - * - * The type is coerced to a int64 if the passed object is not a int64. - * double objects will return their int64 conversion. Strings will be - * parsed as an int64. If no conversion exists then 0 is returned. - * - * NOTE: Set errno to 0 directly before a call to this function to determine - * whether or not conversion was successful (it does not clear the value for - * you). - * - * @param obj the json_object instance - * @returns an int64 - */ -extern int64_t json_object_get_int64(struct json_object *obj); - - -/* double type methods */ - -/** Create a new empty json_object of type json_type_double - * @param d the double - * @returns a json_object of type json_type_double - */ -extern struct json_object* json_object_new_double(double d); - -/** - * Create a new json_object of type json_type_double, using - * the exact serialized representation of the value. - * - * This allows for numbers that would otherwise get displayed - * inefficiently (e.g. 12.3 => "12.300000000000001") to be - * serialized with the more convenient form. - * - * Note: this is used by json_tokener_parse_ex() to allow for - * an exact re-serialization of a parsed object. - * - * An equivalent sequence of calls is: - * @code - * jso = json_object_new_double(d); - * json_object_set_serializer(d, json_object_userdata_to_json_string, - * strdup(ds), json_object_free_userdata) - * @endcode - * - * @param d the numeric value of the double. - * @param ds the string representation of the double. This will be copied. - */ -extern struct json_object* json_object_new_double_s(double d, const char *ds); - -/** Get the double floating point value of a json_object - * - * The type is coerced to a double if the passed object is not a double. - * integer objects will return their double conversion. Strings will be - * parsed as a double. If no conversion exists then 0.0 is returned and - * errno is set to EINVAL. null is equivalent to 0 (no error values set) - * - * If the value is too big to fit in a double, then the value is set to - * the closest infinity with errno set to ERANGE. If strings cannot be - * converted to their double value, then EINVAL is set & NaN is returned. - * - * Arrays of length 0 are interpreted as 0 (with no error flags set). - * Arrays of length 1 are effectively cast to the equivalent object and - * converted using the above rules. All other arrays set the error to - * EINVAL & return NaN. - * - * NOTE: Set errno to 0 directly before a call to this function to - * determine whether or not conversion was successful (it does not clear - * the value for you). - * - * @param obj the json_object instance - * @returns a double floating point number - */ -extern double json_object_get_double(struct json_object *obj); - - -/* string type methods */ - -/** Create a new empty json_object of type json_type_string - * - * A copy of the string is made and the memory is managed by the json_object - * - * @param s the string - * @returns a json_object of type json_type_string - */ -extern struct json_object* json_object_new_string(const char *s); - -extern struct json_object* json_object_new_string_len(const char *s, int len); - -/** Get the string value of a json_object - * - * If the passed object is not of type json_type_string then the JSON - * representation of the object is returned. - * - * The returned string memory is managed by the json_object and will - * be freed when the reference count of the json_object drops to zero. - * - * @param obj the json_object instance - * @returns a string - */ -extern const char* json_object_get_string(struct json_object *obj); - -/** Get the string length of a json_object - * - * If the passed object is not of type json_type_string then zero - * will be returned. - * - * @param obj the json_object instance - * @returns int - */ -extern int json_object_get_string_len(struct json_object *obj); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/json_object_iterator.c b/json-c/json_object_iterator.c deleted file mode 100644 index 7066649c..00000000 --- a/json-c/json_object_iterator.c +++ /dev/null @@ -1,168 +0,0 @@ -/** -******************************************************************************* -* @file json_object_iterator.c -* -* Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P. -* -* This library is free software; you can redistribute it and/or modify -* it under the terms of the MIT license. See COPYING for details. -* -* @brief json-c forces clients to use its private data -* structures for JSON Object iteration. This API -* implementation corrects that by abstracting the -* private json-c details. -* -******************************************************************************* -*/ - -#include <stddef.h> - -#include "json.h" -#include "json_object_private.h" - -#include "json_object_iterator.h" - -/** - * How It Works - * - * For each JSON Object, json-c maintains a linked list of zero - * or more lh_entry (link-hash entry) structures inside the - * Object's link-hash table (lh_table). - * - * Each lh_entry structure on the JSON Object's linked list - * represents a single name/value pair. The "next" field of the - * last lh_entry in the list is set to NULL, which terminates - * the list. - * - * We represent a valid iterator that refers to an actual - * name/value pair via a pointer to the pair's lh_entry - * structure set as the iterator's opaque_ field. - * - * We follow json-c's current pair list representation by - * representing a valid "end" iterator (one that refers past the - * last pair) with a NULL value in the iterator's opaque_ field. - * - * A JSON Object without any pairs in it will have the "head" - * field of its lh_table structure set to NULL. For such an - * object, json_object_iter_begin will return an iterator with - * the opaque_ field set to NULL, which is equivalent to the - * "end" iterator. - * - * When iterating, we simply update the iterator's opaque_ field - * to point to the next lh_entry structure in the linked list. - * opaque_ will become NULL once we iterate past the last pair - * in the list, which makes the iterator equivalent to the "end" - * iterator. - */ - -/// Our current representation of the "end" iterator; -/// -/// @note May not always be NULL -static const void* kObjectEndIterValue = NULL; - -/** - * **************************************************************************** - */ -struct json_object_iterator -json_object_iter_begin(struct json_object* obj) -{ - struct json_object_iterator iter; - struct lh_table* pTable; - - /// @note json_object_get_object will return NULL if passed NULL - /// or a non-json_type_object instance - pTable = json_object_get_object(obj); - JASSERT(NULL != pTable); - - /// @note For a pair-less Object, head is NULL, which matches our - /// definition of the "end" iterator - iter.opaque_ = pTable->head; - return iter; -} - -/** - * **************************************************************************** - */ -struct json_object_iterator -json_object_iter_end(const struct json_object* obj) -{ - struct json_object_iterator iter; - - JASSERT(NULL != obj); - JASSERT(json_object_is_type(obj, json_type_object)); - - iter.opaque_ = kObjectEndIterValue; - - return iter; -} - -/** - * **************************************************************************** - */ -void -json_object_iter_next(struct json_object_iterator* iter) -{ - JASSERT(NULL != iter); - JASSERT(kObjectEndIterValue != iter->opaque_); - - iter->opaque_ = ((struct lh_entry *)iter->opaque_)->next; -} - - -/** - * **************************************************************************** - */ -const char* -json_object_iter_peek_name(const struct json_object_iterator* iter) -{ - JASSERT(NULL != iter); - JASSERT(kObjectEndIterValue != iter->opaque_); - - return (const char*)(((struct lh_entry *)iter->opaque_)->k); -} - - -/** - * **************************************************************************** - */ -struct json_object* -json_object_iter_peek_value(const struct json_object_iterator* iter) -{ - JASSERT(NULL != iter); - JASSERT(kObjectEndIterValue != iter->opaque_); - - return (struct json_object*)(((struct lh_entry *)iter->opaque_)->v); -} - - -/** - * **************************************************************************** - */ -json_bool -json_object_iter_equal(const struct json_object_iterator* iter1, - const struct json_object_iterator* iter2) -{ - JASSERT(NULL != iter1); - JASSERT(NULL != iter2); - - return (iter1->opaque_ == iter2->opaque_); -} - - -/** - * **************************************************************************** - */ -struct json_object_iterator -json_object_iter_init_default(void) -{ - struct json_object_iterator iter; - - /** - * @note Make this a negative, invalid value, such that - * accidental access to it would likely be trapped by the - * hardware as an invalid address. - */ - iter.opaque_ = NULL; - - return iter; -} diff --git a/json-c/json_object_iterator.h b/json-c/json_object_iterator.h deleted file mode 100644 index 44c9fb25..00000000 --- a/json-c/json_object_iterator.h +++ /dev/null @@ -1,239 +0,0 @@ -/** -******************************************************************************* -* @file json_object_iterator.h -* -* Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P. -* -* This library is free software; you can redistribute it and/or modify -* it under the terms of the MIT license. See COPYING for details. -* -* @brief json-c forces clients to use its private data -* structures for JSON Object iteration. This API -* corrects that by abstracting the private json-c -* details. -* -* API attributes: <br> -* * Thread-safe: NO<br> -* * Reentrant: NO -* -******************************************************************************* -*/ - - -#ifndef JSON_OBJECT_ITERATOR_H -#define JSON_OBJECT_ITERATOR_H - -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Forward declaration for the opaque iterator information. - */ -struct json_object_iter_info_; - -/** - * The opaque iterator that references a name/value pair within - * a JSON Object instance or the "end" iterator value. - */ -struct json_object_iterator { - const void* opaque_; -}; - - -/** - * forward declaration of json-c's JSON value instance structure - */ -struct json_object; - - -/** - * Initializes an iterator structure to a "default" value that - * is convenient for initializing an iterator variable to a - * default state (e.g., initialization list in a class' - * constructor). - * - * @code - * struct json_object_iterator iter = json_object_iter_init_default(); - * MyClass() : iter_(json_object_iter_init_default()) - * @endcode - * - * @note The initialized value doesn't reference any specific - * pair, is considered an invalid iterator, and MUST NOT - * be passed to any json-c API that expects a valid - * iterator. - * - * @note User and internal code MUST NOT make any assumptions - * about and dependencies on the value of the "default" - * iterator value. - * - * @return json_object_iterator - */ -struct json_object_iterator -json_object_iter_init_default(void); - -/** Retrieves an iterator to the first pair of the JSON Object. - * - * @warning Any modification of the underlying pair invalidates all - * iterators to that pair. - * - * @param obj JSON Object instance (MUST be of type json_object) - * - * @return json_object_iterator If the JSON Object has at - * least one pair, on return, the iterator refers - * to the first pair. If the JSON Object doesn't - * have any pairs, the returned iterator is - * equivalent to the "end" iterator for the same - * JSON Object instance. - * - * @code - * struct json_object_iterator it; - * struct json_object_iterator itEnd; - * struct json_object* obj; - * - * obj = json_tokener_parse("{'first':'george', 'age':100}"); - * it = json_object_iter_begin(obj); - * itEnd = json_object_iter_end(obj); - * - * while (!json_object_iter_equal(&it, &itEnd)) { - * printf("%s\n", - * json_object_iter_peek_name(&it)); - * json_object_iter_next(&it); - * } - * - * @endcode - */ -struct json_object_iterator -json_object_iter_begin(struct json_object* obj); - -/** Retrieves the iterator that represents the position beyond the - * last pair of the given JSON Object instance. - * - * @warning Do NOT write code that assumes that the "end" - * iterator value is NULL, even if it is so in a - * particular instance of the implementation. - * - * @note The reason we do not (and MUST NOT) provide - * "json_object_iter_is_end(json_object_iterator* iter)" - * type of API is because it would limit the underlying - * representation of name/value containment (or force us - * to add additional, otherwise unnecessary, fields to - * the iterator structure). The "end" iterator and the - * equality test method, on the other hand, permit us to - * cleanly abstract pretty much any reasonable underlying - * representation without burdening the iterator - * structure with unnecessary data. - * - * @note For performance reasons, memorize the "end" iterator prior - * to any loop. - * - * @param obj JSON Object instance (MUST be of type json_object) - * - * @return json_object_iterator On return, the iterator refers - * to the "end" of the Object instance's pairs - * (i.e., NOT the last pair, but "beyond the last - * pair" value) - */ -struct json_object_iterator -json_object_iter_end(const struct json_object* obj); - -/** Returns an iterator to the next pair, if any - * - * @warning Any modification of the underlying pair - * invalidates all iterators to that pair. - * - * @param iter [IN/OUT] Pointer to iterator that references a - * name/value pair; MUST be a valid, non-end iterator. - * WARNING: bad things will happen if invalid or "end" - * iterator is passed. Upon return will contain the - * reference to the next pair if there is one; if there - * are no more pairs, will contain the "end" iterator - * value, which may be compared against the return value - * of json_object_iter_end() for the same JSON Object - * instance. - */ -void -json_object_iter_next(struct json_object_iterator* iter); - - -/** Returns a const pointer to the name of the pair referenced - * by the given iterator. - * - * @param iter pointer to iterator that references a name/value - * pair; MUST be a valid, non-end iterator. - * - * @warning bad things will happen if an invalid or - * "end" iterator is passed. - * - * @return const char* Pointer to the name of the referenced - * name/value pair. The name memory belongs to the - * name/value pair, will be freed when the pair is - * deleted or modified, and MUST NOT be modified or - * freed by the user. - */ -const char* -json_object_iter_peek_name(const struct json_object_iterator* iter); - - -/** Returns a pointer to the json-c instance representing the - * value of the referenced name/value pair, without altering - * the instance's reference count. - * - * @param iter pointer to iterator that references a name/value - * pair; MUST be a valid, non-end iterator. - * - * @warning bad things will happen if invalid or - * "end" iterator is passed. - * - * @return struct json_object* Pointer to the json-c value - * instance of the referenced name/value pair; the - * value's reference count is not changed by this - * function: if you plan to hold on to this json-c node, - * take a look at json_object_get() and - * json_object_put(). IMPORTANT: json-c API represents - * the JSON Null value as a NULL json_object instance - * pointer. - */ -struct json_object* -json_object_iter_peek_value(const struct json_object_iterator* iter); - - -/** Tests two iterators for equality. Typically used to test - * for end of iteration by comparing an iterator to the - * corresponding "end" iterator (that was derived from the same - * JSON Object instance). - * - * @note The reason we do not (and MUST NOT) provide - * "json_object_iter_is_end(json_object_iterator* iter)" - * type of API is because it would limit the underlying - * representation of name/value containment (or force us - * to add additional, otherwise unnecessary, fields to - * the iterator structure). The equality test method, on - * the other hand, permits us to cleanly abstract pretty - * much any reasonable underlying representation. - * - * @param iter1 Pointer to first valid, non-NULL iterator - * @param iter2 POinter to second valid, non-NULL iterator - * - * @warning if a NULL iterator pointer or an uninitialized - * or invalid iterator, or iterators derived from - * different JSON Object instances are passed, bad things - * will happen! - * - * @return json_bool non-zero if iterators are equal (i.e., both - * reference the same name/value pair or are both at - * "end"); zero if they are not equal. - */ -json_bool -json_object_iter_equal(const struct json_object_iterator* iter1, - const struct json_object_iterator* iter2); - - -#ifdef __cplusplus -} -#endif - - -#endif /* JSON_OBJECT_ITERATOR_H */ diff --git a/json-c/json_object_private.h b/json-c/json_object_private.h deleted file mode 100644 index 5ed791b5..00000000 --- a/json-c/json_object_private.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _json_object_private_h_ -#define _json_object_private_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (json_object_private_delete_fn)(struct json_object *o); - -struct json_object -{ - enum json_type o_type; - json_object_private_delete_fn *_delete; - json_object_to_json_string_fn *_to_json_string; - int _ref_count; - struct printbuf *_pb; - union data { - json_bool c_boolean; - double c_double; - int64_t c_int64; - struct lh_table *c_object; - struct array_list *c_array; - struct { - char *str; - int len; - } c_string; - } o; - json_object_delete_fn *_user_delete; - void *_userdata; -}; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/json_tokener.c b/json-c/json_tokener.c deleted file mode 100644 index 60e81f27..00000000 --- a/json-c/json_tokener.c +++ /dev/null @@ -1,887 +0,0 @@ -/* - * $Id: json_tokener.c,v 1.20 2006/07/25 03:24:50 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - * - * Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved. - * The copyrights to the contents of this file are licensed under the MIT License - * (http://www.opensource.org/licenses/mit-license.php) - */ - -#include "config.h" - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <ctype.h> -#include <string.h> -#include <limits.h> - -#include "debug.h" -#include "printbuf.h" -#include "arraylist.h" -#include "json_inttypes.h" -#include "json_object.h" -#include "json_tokener.h" -#include "json_util.h" - -#ifdef HAVE_LOCALE_H -#include <locale.h> -#endif /* HAVE_LOCALE_H */ - -#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9) - -#if !HAVE_STRDUP && defined(_MSC_VER) - /* MSC has the version as _strdup */ -# define strdup _strdup -#elif !HAVE_STRDUP -# error You do not have strdup on your system. -#endif /* HAVE_STRDUP */ - -#if !HAVE_STRNCASECMP && defined(_MSC_VER) - /* MSC has the version as _strnicmp */ -# define strncasecmp _strnicmp -#elif !HAVE_STRNCASECMP -# error You do not have strncasecmp on your system. -#endif /* HAVE_STRNCASECMP */ - -/* Use C99 NAN by default; if not available, nan("") should work too. */ -#ifndef NAN -#define NAN nan("") -#endif /* !NAN */ - -static const char json_null_str[] = "null"; -static const int json_null_str_len = sizeof(json_null_str) - 1; -static const char json_inf_str[] = "Infinity"; -static const int json_inf_str_len = sizeof(json_inf_str) - 1; -static const char json_nan_str[] = "NaN"; -static const int json_nan_str_len = sizeof(json_nan_str) - 1; -static const char json_true_str[] = "true"; -static const int json_true_str_len = sizeof(json_true_str) - 1; -static const char json_false_str[] = "false"; -static const int json_false_str_len = sizeof(json_false_str) - 1; - -static const char* json_tokener_errors[] = { - "success", - "continue", - "nesting too deep", - "unexpected end of data", - "unexpected character", - "null expected", - "boolean expected", - "number expected", - "array value separator ',' expected", - "quoted object property name expected", - "object property name separator ':' expected", - "object value separator ',' expected", - "invalid string sequence", - "expected comment", - "buffer size overflow" -}; - -const char *json_tokener_error_desc(enum json_tokener_error jerr) -{ - int jerr_int = (int)jerr; - if (jerr_int < 0 || jerr_int >= (int)(sizeof(json_tokener_errors) / sizeof(json_tokener_errors[0]))) - return "Unknown error, invalid json_tokener_error value passed to json_tokener_error_desc()"; - return json_tokener_errors[jerr]; -} - -enum json_tokener_error json_tokener_get_error(json_tokener *tok) -{ - return tok->err; -} - -/* Stuff for decoding unicode sequences */ -#define IS_HIGH_SURROGATE(uc) (((uc) & 0xFC00) == 0xD800) -#define IS_LOW_SURROGATE(uc) (((uc) & 0xFC00) == 0xDC00) -#define DECODE_SURROGATE_PAIR(hi,lo) ((((hi) & 0x3FF) << 10) + ((lo) & 0x3FF) + 0x10000) -static unsigned char utf8_replacement_char[3] = { 0xEF, 0xBF, 0xBD }; - -struct json_tokener* json_tokener_new_ex(int depth) -{ - struct json_tokener *tok; - - tok = (struct json_tokener*)calloc(1, sizeof(struct json_tokener)); - if (!tok) return NULL; - tok->stack = (struct json_tokener_srec *)calloc(depth, sizeof(struct json_tokener_srec)); - if (!tok->stack) { - free(tok); - return NULL; - } - tok->pb = printbuf_new(); - tok->max_depth = depth; - json_tokener_reset(tok); - return tok; -} - -struct json_tokener* json_tokener_new(void) -{ - return json_tokener_new_ex(JSON_TOKENER_DEFAULT_DEPTH); -} - -void json_tokener_free(struct json_tokener *tok) -{ - json_tokener_reset(tok); - if (tok->pb) printbuf_free(tok->pb); - if (tok->stack) free(tok->stack); - free(tok); -} - -static void json_tokener_reset_level(struct json_tokener *tok, int depth) -{ - tok->stack[depth].state = json_tokener_state_eatws; - tok->stack[depth].saved_state = json_tokener_state_start; - json_object_put(tok->stack[depth].current); - tok->stack[depth].current = NULL; - free(tok->stack[depth].obj_field_name); - tok->stack[depth].obj_field_name = NULL; -} - -void json_tokener_reset(struct json_tokener *tok) -{ - int i; - if (!tok) - return; - - for(i = tok->depth; i >= 0; i--) - json_tokener_reset_level(tok, i); - tok->depth = 0; - tok->err = json_tokener_success; -} - -struct json_object* json_tokener_parse(const char *str) -{ - enum json_tokener_error jerr_ignored; - struct json_object* obj; - obj = json_tokener_parse_verbose(str, &jerr_ignored); - return obj; -} - -struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error) -{ - struct json_tokener* tok; - struct json_object* obj; - - tok = json_tokener_new(); - if (!tok) - return NULL; - obj = json_tokener_parse_ex(tok, str, -1); - *error = tok->err; - if(tok->err != json_tokener_success) { - if (obj != NULL) - json_object_put(obj); - obj = NULL; - } - - json_tokener_free(tok); - return obj; -} - -#define state tok->stack[tok->depth].state -#define saved_state tok->stack[tok->depth].saved_state -#define current tok->stack[tok->depth].current -#define obj_field_name tok->stack[tok->depth].obj_field_name - -/* Optimization: - * json_tokener_parse_ex() consumed a lot of CPU in its main loop, - * iterating character-by character. A large performance boost is - * achieved by using tighter loops to locally handle units such as - * comments and strings. Loops that handle an entire token within - * their scope also gather entire strings and pass them to - * printbuf_memappend() in a single call, rather than calling - * printbuf_memappend() one char at a time. - * - * PEEK_CHAR() and ADVANCE_CHAR() macros are used for code that is - * common to both the main loop and the tighter loops. - */ - -/* PEEK_CHAR(dest, tok) macro: - * Peeks at the current char and stores it in dest. - * Returns 1 on success, sets tok->err and returns 0 if no more chars. - * Implicit inputs: str, len vars - */ -#define PEEK_CHAR(dest, tok) \ - (((tok)->char_offset == len) ? \ - (((tok)->depth == 0 && state == json_tokener_state_eatws && saved_state == json_tokener_state_finish) ? \ - (((tok)->err = json_tokener_success), 0) \ - : \ - (((tok)->err = json_tokener_continue), 0) \ - ) : \ - (((dest) = *str), 1) \ - ) - -/* ADVANCE_CHAR() macro: - * Incrementes str & tok->char_offset. - * For convenience of existing conditionals, returns the old value of c (0 on eof) - * Implicit inputs: c var - */ -#define ADVANCE_CHAR(str, tok) \ - ( ++(str), ((tok)->char_offset)++, c) - - -/* End optimization macro defs */ - - -struct json_object* json_tokener_parse_ex(struct json_tokener *tok, - const char *str, int len) -{ - struct json_object *obj = NULL; - char c = '\1'; -#ifdef HAVE_SETLOCALE - char *oldlocale=NULL, *tmplocale; - - tmplocale = setlocale(LC_NUMERIC, NULL); - if (tmplocale) oldlocale = strdup(tmplocale); - setlocale(LC_NUMERIC, "C"); -#endif - - tok->char_offset = 0; - tok->err = json_tokener_success; - - /* this interface is presently not 64-bit clean due to the int len argument - and the internal printbuf interface that takes 32-bit int len arguments - so the function limits the maximum string size to INT32_MAX (2GB). - If the function is called with len == -1 then strlen is called to check - the string length is less than INT32_MAX (2GB) */ - if ((len < -1) || (len == -1 && strlen(str) > INT32_MAX)) { - tok->err = json_tokener_error_size; - return NULL; - } - - while (PEEK_CHAR(c, tok)) { - - redo_char: - switch(state) { - - case json_tokener_state_eatws: - /* Advance until we change state */ - while (isspace((int)c)) { - if ((!ADVANCE_CHAR(str, tok)) || (!PEEK_CHAR(c, tok))) - goto out; - } - if(c == '/' && !(tok->flags & JSON_TOKENER_STRICT)) { - printbuf_reset(tok->pb); - printbuf_memappend_fast(tok->pb, &c, 1); - state = json_tokener_state_comment_start; - } else { - state = saved_state; - goto redo_char; - } - break; - - case json_tokener_state_start: - switch(c) { - case '{': - state = json_tokener_state_eatws; - saved_state = json_tokener_state_object_field_start; - current = json_object_new_object(); - break; - case '[': - state = json_tokener_state_eatws; - saved_state = json_tokener_state_array; - current = json_object_new_array(); - break; - case 'I': - case 'i': - state = json_tokener_state_inf; - printbuf_reset(tok->pb); - tok->st_pos = 0; - goto redo_char; - case 'N': - case 'n': - state = json_tokener_state_null; // or NaN - printbuf_reset(tok->pb); - tok->st_pos = 0; - goto redo_char; - case '\'': - if (tok->flags & JSON_TOKENER_STRICT) { - /* in STRICT mode only double-quote are allowed */ - tok->err = json_tokener_error_parse_unexpected; - goto out; - } - case '"': - state = json_tokener_state_string; - printbuf_reset(tok->pb); - tok->quote_char = c; - break; - case 'T': - case 't': - case 'F': - case 'f': - state = json_tokener_state_boolean; - printbuf_reset(tok->pb); - tok->st_pos = 0; - goto redo_char; -#if defined(__GNUC__) - case '0' ... '9': -#else - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': -#endif - case '-': - state = json_tokener_state_number; - printbuf_reset(tok->pb); - tok->is_double = 0; - goto redo_char; - default: - tok->err = json_tokener_error_parse_unexpected; - goto out; - } - break; - - case json_tokener_state_finish: - if(tok->depth == 0) goto out; - obj = json_object_get(current); - json_tokener_reset_level(tok, tok->depth); - tok->depth--; - goto redo_char; - - case json_tokener_state_inf: /* aka starts with 'i' */ - { - int size_inf; - int is_negative = 0; - - printbuf_memappend_fast(tok->pb, &c, 1); - size_inf = json_min(tok->st_pos+1, json_inf_str_len); - char *infbuf = tok->pb->buf; - if (*infbuf == '-') - { - infbuf++; - is_negative = 1; - } - if ((!(tok->flags & JSON_TOKENER_STRICT) && - strncasecmp(json_inf_str, infbuf, size_inf) == 0) || - (strncmp(json_inf_str, infbuf, size_inf) == 0) - ) - { - if (tok->st_pos == json_inf_str_len) - { - current = json_object_new_double(is_negative ? -INFINITY : INFINITY); - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - goto redo_char; - } - } else { - tok->err = json_tokener_error_parse_unexpected; - goto out; - } - tok->st_pos++; - } - break; - case json_tokener_state_null: /* aka starts with 'n' */ - { - int size; - int size_nan; - printbuf_memappend_fast(tok->pb, &c, 1); - size = json_min(tok->st_pos+1, json_null_str_len); - size_nan = json_min(tok->st_pos+1, json_nan_str_len); - if((!(tok->flags & JSON_TOKENER_STRICT) && - strncasecmp(json_null_str, tok->pb->buf, size) == 0) - || (strncmp(json_null_str, tok->pb->buf, size) == 0) - ) { - if (tok->st_pos == json_null_str_len) { - current = NULL; - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - goto redo_char; - } - } - else if ((!(tok->flags & JSON_TOKENER_STRICT) && - strncasecmp(json_nan_str, tok->pb->buf, size_nan) == 0) || - (strncmp(json_nan_str, tok->pb->buf, size_nan) == 0) - ) - { - if (tok->st_pos == json_nan_str_len) - { - current = json_object_new_double(NAN); - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - goto redo_char; - } - } else { - tok->err = json_tokener_error_parse_null; - goto out; - } - tok->st_pos++; - } - break; - - case json_tokener_state_comment_start: - if(c == '*') { - state = json_tokener_state_comment; - } else if(c == '/') { - state = json_tokener_state_comment_eol; - } else { - tok->err = json_tokener_error_parse_comment; - goto out; - } - printbuf_memappend_fast(tok->pb, &c, 1); - break; - - case json_tokener_state_comment: - { - /* Advance until we change state */ - const char *case_start = str; - while(c != '*') { - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - goto out; - } - } - printbuf_memappend_fast(tok->pb, case_start, 1+str-case_start); - state = json_tokener_state_comment_end; - } - break; - - case json_tokener_state_comment_eol: - { - /* Advance until we change state */ - const char *case_start = str; - while(c != '\n') { - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - goto out; - } - } - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - MC_DEBUG("json_tokener_comment: %s\n", tok->pb->buf); - state = json_tokener_state_eatws; - } - break; - - case json_tokener_state_comment_end: - printbuf_memappend_fast(tok->pb, &c, 1); - if(c == '/') { - MC_DEBUG("json_tokener_comment: %s\n", tok->pb->buf); - state = json_tokener_state_eatws; - } else { - state = json_tokener_state_comment; - } - break; - - case json_tokener_state_string: - { - /* Advance until we change state */ - const char *case_start = str; - while(1) { - if(c == tok->quote_char) { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - current = json_object_new_string_len(tok->pb->buf, tok->pb->bpos); - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - break; - } else if(c == '\\') { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - saved_state = json_tokener_state_string; - state = json_tokener_state_string_escape; - break; - } - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - goto out; - } - } - } - break; - - case json_tokener_state_string_escape: - switch(c) { - case '"': - case '\\': - case '/': - printbuf_memappend_fast(tok->pb, &c, 1); - state = saved_state; - break; - case 'b': - case 'n': - case 'r': - case 't': - case 'f': - if(c == 'b') printbuf_memappend_fast(tok->pb, "\b", 1); - else if(c == 'n') printbuf_memappend_fast(tok->pb, "\n", 1); - else if(c == 'r') printbuf_memappend_fast(tok->pb, "\r", 1); - else if(c == 't') printbuf_memappend_fast(tok->pb, "\t", 1); - else if(c == 'f') printbuf_memappend_fast(tok->pb, "\f", 1); - state = saved_state; - break; - case 'u': - tok->ucs_char = 0; - tok->st_pos = 0; - state = json_tokener_state_escape_unicode; - break; - default: - tok->err = json_tokener_error_parse_string; - goto out; - } - break; - - case json_tokener_state_escape_unicode: - { - unsigned int got_hi_surrogate = 0; - - /* Handle a 4-byte sequence, or two sequences if a surrogate pair */ - while(1) { - if(strchr(json_hex_chars, c)) { - tok->ucs_char += ((unsigned int)jt_hexdigit(c) << ((3-tok->st_pos++)*4)); - if(tok->st_pos == 4) { - unsigned char unescaped_utf[4]; - - if (got_hi_surrogate) { - if (IS_LOW_SURROGATE(tok->ucs_char)) { - /* Recalculate the ucs_char, then fall thru to process normally */ - tok->ucs_char = DECODE_SURROGATE_PAIR(got_hi_surrogate, tok->ucs_char); - } else { - /* Hi surrogate was not followed by a low surrogate */ - /* Replace the hi and process the rest normally */ - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - } - got_hi_surrogate = 0; - } - - if (tok->ucs_char < 0x80) { - unescaped_utf[0] = tok->ucs_char; - printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 1); - } else if (tok->ucs_char < 0x800) { - unescaped_utf[0] = 0xc0 | (tok->ucs_char >> 6); - unescaped_utf[1] = 0x80 | (tok->ucs_char & 0x3f); - printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 2); - } else if (IS_HIGH_SURROGATE(tok->ucs_char)) { - /* Got a high surrogate. Remember it and look for the - * the beginning of another sequence, which should be the - * low surrogate. - */ - got_hi_surrogate = tok->ucs_char; - /* Not at end, and the next two chars should be "\u" */ - if ((tok->char_offset+1 != len) && - (tok->char_offset+2 != len) && - (str[1] == '\\') && - (str[2] == 'u')) - { - /* Advance through the 16 bit surrogate, and move on to the - * next sequence. The next step is to process the following - * characters. - */ - if( !ADVANCE_CHAR(str, tok) || !ADVANCE_CHAR(str, tok) ) { - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - } - /* Advance to the first char of the next sequence and - * continue processing with the next sequence. - */ - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - goto out; - } - tok->ucs_char = 0; - tok->st_pos = 0; - continue; /* other json_tokener_state_escape_unicode */ - } else { - /* Got a high surrogate without another sequence following - * it. Put a replacement char in for the hi surrogate - * and pretend we finished. - */ - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - } - } else if (IS_LOW_SURROGATE(tok->ucs_char)) { - /* Got a low surrogate not preceded by a high */ - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - } else if (tok->ucs_char < 0x10000) { - unescaped_utf[0] = 0xe0 | (tok->ucs_char >> 12); - unescaped_utf[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f); - unescaped_utf[2] = 0x80 | (tok->ucs_char & 0x3f); - printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 3); - } else if (tok->ucs_char < 0x110000) { - unescaped_utf[0] = 0xf0 | ((tok->ucs_char >> 18) & 0x07); - unescaped_utf[1] = 0x80 | ((tok->ucs_char >> 12) & 0x3f); - unescaped_utf[2] = 0x80 | ((tok->ucs_char >> 6) & 0x3f); - unescaped_utf[3] = 0x80 | (tok->ucs_char & 0x3f); - printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 4); - } else { - /* Don't know what we got--insert the replacement char */ - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - } - state = saved_state; - break; - } - } else { - tok->err = json_tokener_error_parse_string; - goto out; - } - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - if (got_hi_surrogate) /* Clean up any pending chars */ - printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3); - goto out; - } - } - } - break; - - case json_tokener_state_boolean: - { - int size1, size2; - printbuf_memappend_fast(tok->pb, &c, 1); - size1 = json_min(tok->st_pos+1, json_true_str_len); - size2 = json_min(tok->st_pos+1, json_false_str_len); - if((!(tok->flags & JSON_TOKENER_STRICT) && - strncasecmp(json_true_str, tok->pb->buf, size1) == 0) - || (strncmp(json_true_str, tok->pb->buf, size1) == 0) - ) { - if(tok->st_pos == json_true_str_len) { - current = json_object_new_boolean(1); - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - goto redo_char; - } - } else if((!(tok->flags & JSON_TOKENER_STRICT) && - strncasecmp(json_false_str, tok->pb->buf, size2) == 0) - || (strncmp(json_false_str, tok->pb->buf, size2) == 0)) { - if(tok->st_pos == json_false_str_len) { - current = json_object_new_boolean(0); - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - goto redo_char; - } - } else { - tok->err = json_tokener_error_parse_boolean; - goto out; - } - tok->st_pos++; - } - break; - - case json_tokener_state_number: - { - /* Advance until we change state */ - const char *case_start = str; - int case_len=0; - while(c && strchr(json_number_chars, c)) { - ++case_len; - if(c == '.' || c == 'e' || c == 'E') - tok->is_double = 1; - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - printbuf_memappend_fast(tok->pb, case_start, case_len); - goto out; - } - } - if (case_len>0) - printbuf_memappend_fast(tok->pb, case_start, case_len); - - // Check for -Infinity - if (tok->pb->buf[0] == '-' && case_len == 1 && - (c == 'i' || c == 'I')) - { - state = json_tokener_state_inf; - goto redo_char; - } - } - { - int64_t num64; - double numd; - if (!tok->is_double && json_parse_int64(tok->pb->buf, &num64) == 0) { - if (num64 && tok->pb->buf[0]=='0' && (tok->flags & JSON_TOKENER_STRICT)) { - /* in strict mode, number must not start with 0 */ - tok->err = json_tokener_error_parse_number; - goto out; - } - current = json_object_new_int64(num64); - } - else if(tok->is_double && json_parse_double(tok->pb->buf, &numd) == 0) - { - current = json_object_new_double_s(numd, tok->pb->buf); - } else { - tok->err = json_tokener_error_parse_number; - goto out; - } - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - goto redo_char; - } - break; - - case json_tokener_state_array_after_sep: - case json_tokener_state_array: - if(c == ']') { - if (state == json_tokener_state_array_after_sep && - (tok->flags & JSON_TOKENER_STRICT)) - { - tok->err = json_tokener_error_parse_unexpected; - goto out; - } - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - } else { - if(tok->depth >= tok->max_depth-1) { - tok->err = json_tokener_error_depth; - goto out; - } - state = json_tokener_state_array_add; - tok->depth++; - json_tokener_reset_level(tok, tok->depth); - goto redo_char; - } - break; - - case json_tokener_state_array_add: - json_object_array_add(current, obj); - saved_state = json_tokener_state_array_sep; - state = json_tokener_state_eatws; - goto redo_char; - - case json_tokener_state_array_sep: - if(c == ']') { - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - } else if(c == ',') { - saved_state = json_tokener_state_array_after_sep; - state = json_tokener_state_eatws; - } else { - tok->err = json_tokener_error_parse_array; - goto out; - } - break; - - case json_tokener_state_object_field_start: - case json_tokener_state_object_field_start_after_sep: - if(c == '}') { - if (state == json_tokener_state_object_field_start_after_sep && - (tok->flags & JSON_TOKENER_STRICT)) - { - tok->err = json_tokener_error_parse_unexpected; - goto out; - } - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - } else if (c == '"' || c == '\'') { - tok->quote_char = c; - printbuf_reset(tok->pb); - state = json_tokener_state_object_field; - } else { - tok->err = json_tokener_error_parse_object_key_name; - goto out; - } - break; - - case json_tokener_state_object_field: - { - /* Advance until we change state */ - const char *case_start = str; - while(1) { - if(c == tok->quote_char) { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - obj_field_name = strdup(tok->pb->buf); - saved_state = json_tokener_state_object_field_end; - state = json_tokener_state_eatws; - break; - } else if(c == '\\') { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - saved_state = json_tokener_state_object_field; - state = json_tokener_state_string_escape; - break; - } - if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) { - printbuf_memappend_fast(tok->pb, case_start, str-case_start); - goto out; - } - } - } - break; - - case json_tokener_state_object_field_end: - if(c == ':') { - saved_state = json_tokener_state_object_value; - state = json_tokener_state_eatws; - } else { - tok->err = json_tokener_error_parse_object_key_sep; - goto out; - } - break; - - case json_tokener_state_object_value: - if(tok->depth >= tok->max_depth-1) { - tok->err = json_tokener_error_depth; - goto out; - } - state = json_tokener_state_object_value_add; - tok->depth++; - json_tokener_reset_level(tok, tok->depth); - goto redo_char; - - case json_tokener_state_object_value_add: - json_object_object_add(current, obj_field_name, obj); - free(obj_field_name); - obj_field_name = NULL; - saved_state = json_tokener_state_object_sep; - state = json_tokener_state_eatws; - goto redo_char; - - case json_tokener_state_object_sep: - if(c == '}') { - saved_state = json_tokener_state_finish; - state = json_tokener_state_eatws; - } else if(c == ',') { - saved_state = json_tokener_state_object_field_start_after_sep; - state = json_tokener_state_eatws; - } else { - tok->err = json_tokener_error_parse_object_value_sep; - goto out; - } - break; - - } - if (!ADVANCE_CHAR(str, tok)) - goto out; - } /* while(POP_CHAR) */ - - out: - if (c && - (state == json_tokener_state_finish) && - (tok->depth == 0) && - (tok->flags & JSON_TOKENER_STRICT)) { - /* unexpected char after JSON data */ - tok->err = json_tokener_error_parse_unexpected; - } - if (!c) { /* We hit an eof char (0) */ - if(state != json_tokener_state_finish && - saved_state != json_tokener_state_finish) - tok->err = json_tokener_error_parse_eof; - } - -#ifdef HAVE_SETLOCALE - setlocale(LC_NUMERIC, oldlocale); - if (oldlocale) free(oldlocale); -#endif - - if (tok->err == json_tokener_success) - { - json_object *ret = json_object_get(current); - int ii; - - /* Partially reset, so we parse additional objects on subsequent calls. */ - for(ii = tok->depth; ii >= 0; ii--) - json_tokener_reset_level(tok, ii); - return ret; - } - - MC_DEBUG("json_tokener_parse_ex: error %s at offset %d\n", - json_tokener_errors[tok->err], tok->char_offset); - return NULL; -} - -void json_tokener_set_flags(struct json_tokener *tok, int flags) -{ - tok->flags = flags; -} diff --git a/json-c/json_tokener.h b/json-c/json_tokener.h deleted file mode 100644 index a72d2bde..00000000 --- a/json-c/json_tokener.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * $Id: json_tokener.h,v 1.10 2006/07/25 03:24:50 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _json_tokener_h_ -#define _json_tokener_h_ - -#include <stddef.h> -#include "json_object.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum json_tokener_error { - json_tokener_success, - json_tokener_continue, - json_tokener_error_depth, - json_tokener_error_parse_eof, - json_tokener_error_parse_unexpected, - json_tokener_error_parse_null, - json_tokener_error_parse_boolean, - json_tokener_error_parse_number, - json_tokener_error_parse_array, - json_tokener_error_parse_object_key_name, - json_tokener_error_parse_object_key_sep, - json_tokener_error_parse_object_value_sep, - json_tokener_error_parse_string, - json_tokener_error_parse_comment, - json_tokener_error_size -}; - -enum json_tokener_state { - json_tokener_state_eatws, - json_tokener_state_start, - json_tokener_state_finish, - json_tokener_state_null, - json_tokener_state_comment_start, - json_tokener_state_comment, - json_tokener_state_comment_eol, - json_tokener_state_comment_end, - json_tokener_state_string, - json_tokener_state_string_escape, - json_tokener_state_escape_unicode, - json_tokener_state_boolean, - json_tokener_state_number, - json_tokener_state_array, - json_tokener_state_array_add, - json_tokener_state_array_sep, - json_tokener_state_object_field_start, - json_tokener_state_object_field, - json_tokener_state_object_field_end, - json_tokener_state_object_value, - json_tokener_state_object_value_add, - json_tokener_state_object_sep, - json_tokener_state_array_after_sep, - json_tokener_state_object_field_start_after_sep, - json_tokener_state_inf -}; - -struct json_tokener_srec -{ - enum json_tokener_state state, saved_state; - struct json_object *obj; - struct json_object *current; - char *obj_field_name; -}; - -#define JSON_TOKENER_DEFAULT_DEPTH 32 - -struct json_tokener -{ - char *str; - struct printbuf *pb; - int max_depth, depth, is_double, st_pos, char_offset; - enum json_tokener_error err; - unsigned int ucs_char; - char quote_char; - struct json_tokener_srec *stack; - int flags; -}; - -/** - * Be strict when parsing JSON input. Use caution with - * this flag as what is considered valid may become more - * restrictive from one release to the next, causing your - * code to fail on previously working input. - * - * This flag is not set by default. - * - * @see json_tokener_set_flags() - */ -#define JSON_TOKENER_STRICT 0x01 - -/** - * Given an error previously returned by json_tokener_get_error(), - * return a human readable description of the error. - * - * @return a generic error message is returned if an invalid error value is provided. - */ -const char *json_tokener_error_desc(enum json_tokener_error jerr); - -/** - * Retrieve the error caused by the last call to json_tokener_parse_ex(), - * or json_tokener_success if there is no error. - * - * When parsing a JSON string in pieces, if the tokener is in the middle - * of parsing this will return json_tokener_continue. - * - * See also json_tokener_error_desc(). - */ -enum json_tokener_error json_tokener_get_error(struct json_tokener *tok); - -extern struct json_tokener* json_tokener_new(void); -extern struct json_tokener* json_tokener_new_ex(int depth); -extern void json_tokener_free(struct json_tokener *tok); -extern void json_tokener_reset(struct json_tokener *tok); -extern struct json_object* json_tokener_parse(const char *str); -extern struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error); - -/** - * Set flags that control how parsing will be done. - */ -extern void json_tokener_set_flags(struct json_tokener *tok, int flags); - -/** - * Parse a string and return a non-NULL json_object if a valid JSON value - * is found. The string does not need to be a JSON object or array; - * it can also be a string, number or boolean value. - * - * A partial JSON string can be parsed. If the parsing is incomplete, - * NULL will be returned and json_tokener_get_error() will be return - * json_tokener_continue. - * json_tokener_parse_ex() can then be called with additional bytes in str - * to continue the parsing. - * - * If json_tokener_parse_ex() returns NULL and the error anything other than - * json_tokener_continue, a fatal error has occurred and parsing must be - * halted. Then tok object must not be re-used until json_tokener_reset() is - * called. - * - * When a valid JSON value is parsed, a non-NULL json_object will be - * returned. Also, json_tokener_get_error() will return json_tokener_success. - * Be sure to check the type with json_object_is_type() or - * json_object_get_type() before using the object. - * - * @b XXX this shouldn't use internal fields: - * Trailing characters after the parsed value do not automatically cause an - * error. It is up to the caller to decide whether to treat this as an - * error or to handle the additional characters, perhaps by parsing another - * json value starting from that point. - * - * Extra characters can be detected by comparing the tok->char_offset against - * the length of the last len parameter passed in. - * - * The tokener does \b not maintain an internal buffer so the caller is - * responsible for calling json_tokener_parse_ex with an appropriate str - * parameter starting with the extra characters. - * - * This interface is presently not 64-bit clean due to the int len argument - * so the function limits the maximum string size to INT32_MAX (2GB). - * If the function is called with len == -1 then strlen is called to check - * the string length is less than INT32_MAX (2GB) - * - * Example: - * @code -json_object *jobj = NULL; -const char *mystring = NULL; -int stringlen = 0; -enum json_tokener_error jerr; -do { - mystring = ... // get JSON string, e.g. read from file, etc... - stringlen = strlen(mystring); - jobj = json_tokener_parse_ex(tok, mystring, stringlen); -} while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue); -if (jerr != json_tokener_success) -{ - fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr)); - // Handle errors, as appropriate for your application. -} -if (tok->char_offset < stringlen) // XXX shouldn't access internal fields -{ - // Handle extra characters after parsed object as desired. - // e.g. issue an error, parse another object from that point, etc... -} -// Success, use jobj here. - -@endcode - * - * @param tok a json_tokener previously allocated with json_tokener_new() - * @param str an string with any valid JSON expression, or portion of. This does not need to be null terminated. - * @param len the length of str - */ -extern struct json_object* json_tokener_parse_ex(struct json_tokener *tok, - const char *str, int len); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/json_util.c b/json-c/json_util.c deleted file mode 100644 index 2a5621b0..00000000 --- a/json-c/json_util.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * $Id: json_util.c,v 1.4 2006/01/30 23:07:57 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#include "config.h" -#undef realloc - -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <limits.h> -#include <string.h> -#include <errno.h> -#include <ctype.h> - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif /* HAVE_SYS_STAT_H */ - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif /* HAVE_FCNTL_H */ - -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif /* HAVE_UNISTD_H */ - -#ifdef WIN32 -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -# include <io.h> -#endif /* defined(WIN32) */ - -#if !defined(HAVE_OPEN) && defined(WIN32) -# define open _open -#endif - -#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER) - /* MSC has the version as _snprintf */ -# define snprintf _snprintf -#elif !defined(HAVE_SNPRINTF) -# error You do not have snprintf on your system. -#endif /* HAVE_SNPRINTF */ - -#include "debug.h" -#include "printbuf.h" -#include "json_inttypes.h" -#include "json_object.h" -#include "json_tokener.h" -#include "json_util.h" - -static int sscanf_is_broken = 0; -static int sscanf_is_broken_testdone = 0; -static void sscanf_is_broken_test(void); - -struct json_object* json_object_from_file(const char *filename) -{ - struct printbuf *pb; - struct json_object *obj; - char buf[JSON_FILE_BUF_SIZE]; - int fd, ret; - - if((fd = open(filename, O_RDONLY)) < 0) { - MC_ERROR("json_object_from_file: error opening file %s: %s\n", - filename, strerror(errno)); - return NULL; - } - if(!(pb = printbuf_new())) { - close(fd); - MC_ERROR("json_object_from_file: printbuf_new failed\n"); - return NULL; - } - while((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) { - printbuf_memappend(pb, buf, ret); - } - close(fd); - if(ret < 0) { - MC_ERROR("json_object_from_file: error reading file %s: %s\n", - filename, strerror(errno)); - printbuf_free(pb); - return NULL; - } - obj = json_tokener_parse(pb->buf); - printbuf_free(pb); - return obj; -} - -/* extended "format and write to file" function */ - -int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags) -{ - const char *json_str; - int fd, ret; - unsigned int wpos, wsize; - - if(!obj) { - MC_ERROR("json_object_to_file: object is null\n"); - return -1; - } - - if((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) { - MC_ERROR("json_object_to_file: error opening file %s: %s\n", - filename, strerror(errno)); - return -1; - } - - if(!(json_str = json_object_to_json_string_ext(obj,flags))) { - close(fd); - return -1; - } - - wsize = (unsigned int)(strlen(json_str) & UINT_MAX); /* CAW: probably unnecessary, but the most 64bit safe */ - wpos = 0; - while(wpos < wsize) { - if((ret = write(fd, json_str + wpos, wsize-wpos)) < 0) { - close(fd); - MC_ERROR("json_object_to_file: error writing file %s: %s\n", - filename, strerror(errno)); - return -1; - } - - /* because of the above check for ret < 0, we can safely cast and add */ - wpos += (unsigned int)ret; - } - - close(fd); - return 0; -} - -// backwards compatible "format and write to file" function - -int json_object_to_file(const char *filename, struct json_object *obj) -{ - return json_object_to_file_ext(filename, obj, JSON_C_TO_STRING_PLAIN); -} - -int json_parse_double(const char *buf, double *retval) -{ - return (sscanf(buf, "%lf", retval)==1 ? 0 : 1); -} - -/* - * Not all implementations of sscanf actually work properly. - * Check whether the one we're currently using does, and if - * it's broken, enable the workaround code. - */ -static void sscanf_is_broken_test() -{ - int64_t num64; - int ret_errno, is_int64_min, ret_errno2, is_int64_max; - - (void)sscanf(" -01234567890123456789012345", "%" SCNd64, &num64); - ret_errno = errno; - is_int64_min = (num64 == INT64_MIN); - - (void)sscanf(" 01234567890123456789012345", "%" SCNd64, &num64); - ret_errno2 = errno; - is_int64_max = (num64 == INT64_MAX); - - if (ret_errno != ERANGE || !is_int64_min || - ret_errno2 != ERANGE || !is_int64_max) - { - MC_DEBUG("sscanf_is_broken_test failed, enabling workaround code\n"); - sscanf_is_broken = 1; - } -} - -int json_parse_int64(const char *buf, int64_t *retval) -{ - int64_t num64; - const char *buf_sig_digits; - int orig_has_neg; - int saved_errno; - - if (!sscanf_is_broken_testdone) - { - sscanf_is_broken_test(); - sscanf_is_broken_testdone = 1; - } - - // Skip leading spaces - while (isspace((int)*buf) && *buf) - buf++; - - errno = 0; // sscanf won't always set errno, so initialize - if (sscanf(buf, "%" SCNd64, &num64) != 1) - { - MC_DEBUG("Failed to parse, sscanf != 1\n"); - return 1; - } - - saved_errno = errno; - buf_sig_digits = buf; - orig_has_neg = 0; - if (*buf_sig_digits == '-') - { - buf_sig_digits++; - orig_has_neg = 1; - } - - // Not all sscanf implementations actually work - if (sscanf_is_broken && saved_errno != ERANGE) - { - char buf_cmp[100]; - char *buf_cmp_start = buf_cmp; - int recheck_has_neg = 0; - int buf_cmp_len; - - // Skip leading zeros, but keep at least one digit - while (buf_sig_digits[0] == '0' && buf_sig_digits[1] != '\0') - buf_sig_digits++; - if (num64 == 0) // assume all sscanf impl's will parse -0 to 0 - orig_has_neg = 0; // "-0" is the same as just plain "0" - - snprintf(buf_cmp_start, sizeof(buf_cmp), "%" PRId64, num64); - if (*buf_cmp_start == '-') - { - recheck_has_neg = 1; - buf_cmp_start++; - } - // No need to skip leading spaces or zeros here. - - buf_cmp_len = strlen(buf_cmp_start); - /** - * If the sign is different, or - * some of the digits are different, or - * there is another digit present in the original string - * then we have NOT successfully parsed the value. - */ - if (orig_has_neg != recheck_has_neg || - strncmp(buf_sig_digits, buf_cmp_start, strlen(buf_cmp_start)) != 0 || - ((int)strlen(buf_sig_digits) != buf_cmp_len && - isdigit((int)buf_sig_digits[buf_cmp_len]) - ) - ) - { - saved_errno = ERANGE; - } - } - - // Not all sscanf impl's set the value properly when out of range. - // Always do this, even for properly functioning implementations, - // since it shouldn't slow things down much. - if (saved_errno == ERANGE) - { - if (orig_has_neg) - num64 = INT64_MIN; - else - num64 = INT64_MAX; - } - *retval = num64; - return 0; -} - -#ifndef HAVE_REALLOC -void* rpl_realloc(void* p, size_t n) -{ - if (n == 0) - n = 1; - if (p == 0) - return malloc(n); - return realloc(p, n); -} -#endif - -#define NELEM(a) (sizeof(a) / sizeof(a[0])) -static const char* json_type_name[] = { - /* If you change this, be sure to update the enum json_type definition too */ - "null", - "boolean", - "double", - "int", - "object", - "array", - "string", -}; - -const char *json_type_to_name(enum json_type o_type) -{ - int o_type_int = (int)o_type; - if (o_type_int < 0 || o_type_int >= (int)NELEM(json_type_name)) - { - MC_ERROR("json_type_to_name: type %d is out of range [0,%d]\n", o_type, NELEM(json_type_name)); - return NULL; - } - return json_type_name[o_type]; -} - diff --git a/json-c/json_util.h b/json-c/json_util.h deleted file mode 100644 index 387dbc47..00000000 --- a/json-c/json_util.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _json_util_h_ -#define _json_util_h_ - -#include "json_object.h" - -#ifndef json_min -#define json_min(a,b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef json_max -#define json_max(a,b) ((a) > (b) ? (a) : (b)) -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - -#define JSON_FILE_BUF_SIZE 4096 - -/* utility functions */ -extern struct json_object* json_object_from_file(const char *filename); -extern int json_object_to_file(const char *filename, struct json_object *obj); -extern int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags); -extern int json_parse_int64(const char *buf, int64_t *retval); -extern int json_parse_double(const char *buf, double *retval); - - -/** - * Return a string describing the type of the object. - * e.g. "int", or "object", etc... - */ -extern const char *json_type_to_name(enum json_type o_type); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/libjson.c b/json-c/libjson.c deleted file mode 100644 index 5284fd0e..00000000 --- a/json-c/libjson.c +++ /dev/null @@ -1,26 +0,0 @@ - -/* dummy source file for compatibility purposes */ - -#if defined(HAVE_CDEFS_H) -#include <sys/cdefs.h> -#endif - -#ifndef __warn_references - -#if defined(__GNUC__) && defined (HAS_GNU_WARNING_LONG) - -#define __warn_references(sym,msg) \ - __asm__(".section .gnu" #sym ",\n\t.ascii \"" msg "\"\n\t.text"); - -#else -#define __warn_references(sym,msg) /* nothing */ -#endif - -#endif - -#include "json_object.h" - -__warn_references(json_object_get, "Warning: please link against libjson-c instead of libjson"); - -/* __asm__(".section .gnu.warning." __STRING(sym) \ - " ; .ascii \"" msg "\" ; .text") */ diff --git a/json-c/linkhash.c b/json-c/linkhash.c deleted file mode 100644 index 712c3879..00000000 --- a/json-c/linkhash.c +++ /dev/null @@ -1,602 +0,0 @@ -/* - * $Id: linkhash.c,v 1.4 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <stdarg.h> -#include <stddef.h> -#include <limits.h> - -#ifdef HAVE_ENDIAN_H -# include <endian.h> /* attempt to define endianness */ -#endif - -#include "random_seed.h" -#include "linkhash.h" - -void lh_abort(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); - vprintf(msg, ap); - va_end(ap); - exit(1); -} - -unsigned long lh_ptr_hash(const void *k) -{ - /* CAW: refactored to be 64bit nice */ - return (unsigned long)((((ptrdiff_t)k * LH_PRIME) >> 4) & ULONG_MAX); -} - -int lh_ptr_equal(const void *k1, const void *k2) -{ - return (k1 == k2); -} - -/* - * hashlittle from lookup3.c, by Bob Jenkins, May 2006, Public Domain. - * http://burtleburtle.net/bob/c/lookup3.c - * minor modifications to make functions static so no symbols are exported - * minor mofifications to compile with -Werror - */ - -/* -------------------------------------------------------------------------------- -lookup3.c, by Bob Jenkins, May 2006, Public Domain. - -These are functions for producing 32-bit hashes for hash table lookup. -hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() -are externally useful functions. Routines to test the hash are included -if SELF_TEST is defined. You can use this free for any purpose. It's in -the public domain. It has no warranty. - -You probably want to use hashlittle(). hashlittle() and hashbig() -hash byte arrays. hashlittle() is is faster than hashbig() on -little-endian machines. Intel and AMD are little-endian machines. -On second thought, you probably want hashlittle2(), which is identical to -hashlittle() except it returns two 32-bit hashes for the price of one. -You could implement hashbig2() if you wanted but I haven't bothered here. - -If you want to find a hash of, say, exactly 7 integers, do - a = i1; b = i2; c = i3; - mix(a,b,c); - a += i4; b += i5; c += i6; - mix(a,b,c); - a += i7; - final(a,b,c); -then use c as the hash value. If you have a variable length array of -4-byte integers to hash, use hashword(). If you have a byte array (like -a character string), use hashlittle(). If you have several byte arrays, or -a mix of things, see the comments above hashlittle(). - -Why is this so big? I read 12 bytes at a time into 3 4-byte integers, -then mix those integers. This is fast (you can do a lot more thorough -mixing with 12*3 instructions on 3 integers than you can with 3 instructions -on 1 byte), but shoehorning those bytes into integers efficiently is messy. -------------------------------------------------------------------------------- -*/ - -/* - * My best guess at if you are big-endian or little-endian. This may - * need adjustment. - */ -#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ - __BYTE_ORDER == __LITTLE_ENDIAN) || \ - (defined(i386) || defined(__i386__) || defined(__i486__) || \ - defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)) -# define HASH_LITTLE_ENDIAN 1 -# define HASH_BIG_ENDIAN 0 -#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ - __BYTE_ORDER == __BIG_ENDIAN) || \ - (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 -#else -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 0 -#endif - -#define hashsize(n) ((uint32_t)1<<(n)) -#define hashmask(n) (hashsize(n)-1) -#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) - -/* -------------------------------------------------------------------------------- -mix -- mix 3 32-bit values reversibly. - -This is reversible, so any information in (a,b,c) before mix() is -still in (a,b,c) after mix(). - -If four pairs of (a,b,c) inputs are run through mix(), or through -mix() in reverse, there are at least 32 bits of the output that -are sometimes the same for one pair and different for another pair. -This was tested for: -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that -satisfy this are - 4 6 8 16 19 4 - 9 15 3 18 27 15 - 14 9 3 7 17 3 -Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing -for "differ" defined as + with a one-bit base and a two-bit delta. I -used http://burtleburtle.net/bob/hash/avalanche.html to choose -the operations, constants, and arrangements of the variables. - -This does not achieve avalanche. There are input bits of (a,b,c) -that fail to affect some output bits of (a,b,c), especially of a. The -most thoroughly mixed value is c, but it doesn't really even achieve -avalanche in c. - -This allows some parallelism. Read-after-writes are good at doubling -the number of bits affected, so the goal of mixing pulls in the opposite -direction as the goal of parallelism. I did what I could. Rotates -seem to cost as much as shifts on every machine I could lay my hands -on, and rotates are much kinder to the top and bottom bits, so I used -rotates. -------------------------------------------------------------------------------- -*/ -#define mix(a,b,c) \ -{ \ - a -= c; a ^= rot(c, 4); c += b; \ - b -= a; b ^= rot(a, 6); a += c; \ - c -= b; c ^= rot(b, 8); b += a; \ - a -= c; a ^= rot(c,16); c += b; \ - b -= a; b ^= rot(a,19); a += c; \ - c -= b; c ^= rot(b, 4); b += a; \ -} - -/* -------------------------------------------------------------------------------- -final -- final mixing of 3 32-bit values (a,b,c) into c - -Pairs of (a,b,c) values differing in only a few bits will usually -produce values of c that look totally different. This was tested for -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -These constants passed: - 14 11 25 16 4 14 24 - 12 14 25 16 4 14 24 -and these came close: - 4 8 15 26 3 22 24 - 10 8 15 26 3 22 24 - 11 8 15 26 3 22 24 -------------------------------------------------------------------------------- -*/ -#define final(a,b,c) \ -{ \ - c ^= b; c -= rot(b,14); \ - a ^= c; a -= rot(c,11); \ - b ^= a; b -= rot(a,25); \ - c ^= b; c -= rot(b,16); \ - a ^= c; a -= rot(c,4); \ - b ^= a; b -= rot(a,14); \ - c ^= b; c -= rot(b,24); \ -} - - -/* -------------------------------------------------------------------------------- -hashlittle() -- hash a variable-length key into a 32-bit value - k : the key (the unaligned variable-length array of bytes) - length : the length of the key, counting by bytes - initval : can be any 4-byte value -Returns a 32-bit value. Every bit of the key affects every bit of -the return value. Two keys differing by one or two bits will have -totally different hash values. - -The best hash table sizes are powers of 2. There is no need to do -mod a prime (mod is sooo slow!). If you need less than 32 bits, -use a bitmask. For example, if you need only 10 bits, do - h = (h & hashmask(10)); -In which case, the hash table should have hashsize(10) elements. - -If you are hashing n strings (uint8_t **)k, do it like this: - for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h); - -By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this -code any way you wish, private, educational, or commercial. It's free. - -Use for hash table lookup, or anything where one collision in 2^^32 is -acceptable. Do NOT use for cryptographic purposes. -------------------------------------------------------------------------------- -*/ - -static uint32_t hashlittle( const void *key, size_t length, uint32_t initval) -{ - uint32_t a,b,c; /* internal state */ - union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; - - u.ptr = key; - if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { - const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ - - /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - /* - * "k[2]&0xffffff" actually reads beyond the end of the string, but - * then masks off the part it's not allowed to read. Because the - * string is aligned, the masked-off tail is in the same word as the - * rest of the string. Every machine with memory protection I've seen - * does it on word boundaries, so is OK with this. But VALGRIND will - * still catch it and complain. The masking trick does make the hash - * noticably faster for short strings (like English words). - */ -#ifndef VALGRIND - - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]&0xffffff; a+=k[0]; break; - case 6 : b+=k[1]&0xffff; a+=k[0]; break; - case 5 : b+=k[1]&0xff; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]&0xffffff; break; - case 2 : a+=k[0]&0xffff; break; - case 1 : a+=k[0]&0xff; break; - case 0 : return c; /* zero length strings require no mixing */ - } - -#else /* make valgrind happy */ - - const uint8_t *k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]; break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ - case 1 : a+=k8[0]; break; - case 0 : return c; - } - -#endif /* !valgrind */ - - } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { - const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ - const uint8_t *k8; - - /*--------------- all but last block: aligned reads and different mixing */ - while (length > 12) - { - a += k[0] + (((uint32_t)k[1])<<16); - b += k[2] + (((uint32_t)k[3])<<16); - c += k[4] + (((uint32_t)k[5])<<16); - mix(a,b,c); - length -= 12; - k += 6; - } - - /*----------------------------- handle the last (probably partial) block */ - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[4]+(((uint32_t)k[5])<<16); - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=k[4]; - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=k[2]; - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=k[0]; - break; - case 1 : a+=k8[0]; - break; - case 0 : return c; /* zero length requires no mixing */ - } - - } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - a += ((uint32_t)k[1])<<8; - a += ((uint32_t)k[2])<<16; - a += ((uint32_t)k[3])<<24; - b += k[4]; - b += ((uint32_t)k[5])<<8; - b += ((uint32_t)k[6])<<16; - b += ((uint32_t)k[7])<<24; - c += k[8]; - c += ((uint32_t)k[9])<<8; - c += ((uint32_t)k[10])<<16; - c += ((uint32_t)k[11])<<24; - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; - case 1 : a+=k[0]; - break; - case 0 : return c; - } - } - - final(a,b,c); - return c; -} - -unsigned long lh_char_hash(const void *k) -{ - static volatile int random_seed = -1; - - if (random_seed == -1) { - int seed; - /* we can't use -1 as it is the unitialized sentinel */ - while ((seed = json_c_get_random_seed()) == -1); -#if defined __GNUC__ - __sync_val_compare_and_swap(&random_seed, -1, seed); -#elif defined _MSC_VER - InterlockedCompareExchange(&random_seed, seed, -1); -#else -#warning "racy random seed initializtion if used by multiple threads" - random_seed = seed; /* potentially racy */ -#endif - } - - return hashlittle((const char*)k, strlen((const char*)k), random_seed); -} - -int lh_char_equal(const void *k1, const void *k2) -{ - return (strcmp((const char*)k1, (const char*)k2) == 0); -} - -struct lh_table* lh_table_new(int size, const char *name, - lh_entry_free_fn *free_fn, - lh_hash_fn *hash_fn, - lh_equal_fn *equal_fn) -{ - int i; - struct lh_table *t; - - t = (struct lh_table*)calloc(1, sizeof(struct lh_table)); - if(!t) lh_abort("lh_table_new: calloc failed\n"); - t->count = 0; - t->size = size; - t->name = name; - t->table = (struct lh_entry*)calloc(size, sizeof(struct lh_entry)); - if(!t->table) lh_abort("lh_table_new: calloc failed\n"); - t->free_fn = free_fn; - t->hash_fn = hash_fn; - t->equal_fn = equal_fn; - for(i = 0; i < size; i++) t->table[i].k = LH_EMPTY; - return t; -} - -struct lh_table* lh_kchar_table_new(int size, const char *name, - lh_entry_free_fn *free_fn) -{ - return lh_table_new(size, name, free_fn, lh_char_hash, lh_char_equal); -} - -struct lh_table* lh_kptr_table_new(int size, const char *name, - lh_entry_free_fn *free_fn) -{ - return lh_table_new(size, name, free_fn, lh_ptr_hash, lh_ptr_equal); -} - -void lh_table_resize(struct lh_table *t, int new_size) -{ - struct lh_table *new_t; - struct lh_entry *ent; - - new_t = lh_table_new(new_size, t->name, NULL, t->hash_fn, t->equal_fn); - ent = t->head; - while(ent) { - lh_table_insert(new_t, ent->k, ent->v); - ent = ent->next; - } - free(t->table); - t->table = new_t->table; - t->size = new_size; - t->head = new_t->head; - t->tail = new_t->tail; - t->resizes++; - free(new_t); -} - -void lh_table_free(struct lh_table *t) -{ - struct lh_entry *c; - for(c = t->head; c != NULL; c = c->next) { - if(t->free_fn) { - t->free_fn(c); - } - } - free(t->table); - free(t); -} - - -int lh_table_insert(struct lh_table *t, void *k, const void *v) -{ - unsigned long h, n; - - t->inserts++; - if(t->count >= t->size * LH_LOAD_FACTOR) lh_table_resize(t, t->size * 2); - - h = t->hash_fn(k); - n = h % t->size; - - while( 1 ) { - if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) break; - t->collisions++; - if ((int)++n == t->size) n = 0; - } - - t->table[n].k = k; - t->table[n].v = v; - t->count++; - - if(t->head == NULL) { - t->head = t->tail = &t->table[n]; - t->table[n].next = t->table[n].prev = NULL; - } else { - t->tail->next = &t->table[n]; - t->table[n].prev = t->tail; - t->table[n].next = NULL; - t->tail = &t->table[n]; - } - - return 0; -} - - -struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k) -{ - unsigned long h = t->hash_fn(k); - unsigned long n = h % t->size; - int count = 0; - - t->lookups++; - while( count < t->size ) { - if(t->table[n].k == LH_EMPTY) return NULL; - if(t->table[n].k != LH_FREED && - t->equal_fn(t->table[n].k, k)) return &t->table[n]; - if ((int)++n == t->size) n = 0; - count++; - } - return NULL; -} - - -const void* lh_table_lookup(struct lh_table *t, const void *k) -{ - void *result; - lh_table_lookup_ex(t, k, &result); - return result; -} - -json_bool lh_table_lookup_ex(struct lh_table* t, const void* k, void **v) -{ - struct lh_entry *e = lh_table_lookup_entry(t, k); - if (e != NULL) { - if (v != NULL) *v = (void *)e->v; - return TRUE; /* key found */ - } - if (v != NULL) *v = NULL; - return FALSE; /* key not found */ -} - -int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e) -{ - ptrdiff_t n = (ptrdiff_t)(e - t->table); /* CAW: fixed to be 64bit nice, still need the crazy negative case... */ - - /* CAW: this is bad, really bad, maybe stack goes other direction on this machine... */ - if(n < 0) { return -2; } - - if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) return -1; - t->count--; - if(t->free_fn) t->free_fn(e); - t->table[n].v = NULL; - t->table[n].k = LH_FREED; - if(t->tail == &t->table[n] && t->head == &t->table[n]) { - t->head = t->tail = NULL; - } else if (t->head == &t->table[n]) { - t->head->next->prev = NULL; - t->head = t->head->next; - } else if (t->tail == &t->table[n]) { - t->tail->prev->next = NULL; - t->tail = t->tail->prev; - } else { - t->table[n].prev->next = t->table[n].next; - t->table[n].next->prev = t->table[n].prev; - } - t->table[n].next = t->table[n].prev = NULL; - return 0; -} - - -int lh_table_delete(struct lh_table *t, const void *k) -{ - struct lh_entry *e = lh_table_lookup_entry(t, k); - if(!e) return -1; - return lh_table_delete_entry(t, e); -} - -int lh_table_length(struct lh_table *t) -{ - return t->count; -} diff --git a/json-c/linkhash.h b/json-c/linkhash.h deleted file mode 100644 index 950d09f3..00000000 --- a/json-c/linkhash.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - * $Id: linkhash.h,v 1.6 2006/01/30 23:07:57 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef _linkhash_h_ -#define _linkhash_h_ - -#include "json_object.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * golden prime used in hash functions - */ -#define LH_PRIME 0x9e370001UL - -/** - * The fraction of filled hash buckets until an insert will cause the table - * to be resized. - * This can range from just above 0 up to 1.0. - */ -#define LH_LOAD_FACTOR 0.66 - -/** - * sentinel pointer value for empty slots - */ -#define LH_EMPTY (void*)-1 - -/** - * sentinel pointer value for freed slots - */ -#define LH_FREED (void*)-2 - -struct lh_entry; - -/** - * callback function prototypes - */ -typedef void (lh_entry_free_fn) (struct lh_entry *e); -/** - * callback function prototypes - */ -typedef unsigned long (lh_hash_fn) (const void *k); -/** - * callback function prototypes - */ -typedef int (lh_equal_fn) (const void *k1, const void *k2); - -/** - * An entry in the hash table - */ -struct lh_entry { - /** - * The key. - */ - void *k; - /** - * The value. - */ - const void *v; - /** - * The next entry - */ - struct lh_entry *next; - /** - * The previous entry. - */ - struct lh_entry *prev; -}; - - -/** - * The hash table structure. - */ -struct lh_table { - /** - * Size of our hash. - */ - int size; - /** - * Numbers of entries. - */ - int count; - - /** - * Number of collisions. - */ - int collisions; - - /** - * Number of resizes. - */ - int resizes; - - /** - * Number of lookups. - */ - int lookups; - - /** - * Number of inserts. - */ - int inserts; - - /** - * Number of deletes. - */ - int deletes; - - /** - * Name of the hash table. - */ - const char *name; - - /** - * The first entry. - */ - struct lh_entry *head; - - /** - * The last entry. - */ - struct lh_entry *tail; - - struct lh_entry *table; - - /** - * A pointer onto the function responsible for freeing an entry. - */ - lh_entry_free_fn *free_fn; - lh_hash_fn *hash_fn; - lh_equal_fn *equal_fn; -}; - - -/** - * Pre-defined hash and equality functions - */ -extern unsigned long lh_ptr_hash(const void *k); -extern int lh_ptr_equal(const void *k1, const void *k2); - -extern unsigned long lh_char_hash(const void *k); -extern int lh_char_equal(const void *k1, const void *k2); - - -/** - * Convenience list iterator. - */ -#define lh_foreach(table, entry) \ -for(entry = table->head; entry; entry = entry->next) - -/** - * lh_foreach_safe allows calling of deletion routine while iterating. - */ -#define lh_foreach_safe(table, entry, tmp) \ -for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp) - - - -/** - * Create a new linkhash table. - * @param size initial table size. The table is automatically resized - * although this incurs a performance penalty. - * @param name the table name. - * @param free_fn callback function used to free memory for entries - * when lh_table_free or lh_table_delete is called. - * If NULL is provided, then memory for keys and values - * must be freed by the caller. - * @param hash_fn function used to hash keys. 2 standard ones are defined: - * lh_ptr_hash and lh_char_hash for hashing pointer values - * and C strings respectively. - * @param equal_fn comparison function to compare keys. 2 standard ones defined: - * lh_ptr_hash and lh_char_hash for comparing pointer values - * and C strings respectively. - * @return a pointer onto the linkhash table. - */ -extern struct lh_table* lh_table_new(int size, const char *name, - lh_entry_free_fn *free_fn, - lh_hash_fn *hash_fn, - lh_equal_fn *equal_fn); - -/** - * Convenience function to create a new linkhash - * table with char keys. - * @param size initial table size. - * @param name table name. - * @param free_fn callback function used to free memory for entries. - * @return a pointer onto the linkhash table. - */ -extern struct lh_table* lh_kchar_table_new(int size, const char *name, - lh_entry_free_fn *free_fn); - - -/** - * Convenience function to create a new linkhash - * table with ptr keys. - * @param size initial table size. - * @param name table name. - * @param free_fn callback function used to free memory for entries. - * @return a pointer onto the linkhash table. - */ -extern struct lh_table* lh_kptr_table_new(int size, const char *name, - lh_entry_free_fn *free_fn); - - -/** - * Free a linkhash table. - * If a callback free function is provided then it is called for all - * entries in the table. - * @param t table to free. - */ -extern void lh_table_free(struct lh_table *t); - - -/** - * Insert a record into the table. - * @param t the table to insert into. - * @param k a pointer to the key to insert. - * @param v a pointer to the value to insert. - */ -extern int lh_table_insert(struct lh_table *t, void *k, const void *v); - - -/** - * Lookup a record into the table. - * @param t the table to lookup - * @param k a pointer to the key to lookup - * @return a pointer to the record structure of the value or NULL if it does not exist. - */ -extern struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k); - -/** - * Lookup a record into the table - * @param t the table to lookup - * @param k a pointer to the key to lookup - * @return a pointer to the found value or NULL if it does not exist. - * @deprecated Use lh_table_lookup_ex instead. - */ -THIS_FUNCTION_IS_DEPRECATED(extern const void* lh_table_lookup(struct lh_table *t, const void *k)); - -/** - * Lookup a record in the table - * @param t the table to lookup - * @param k a pointer to the key to lookup - * @param v a pointer to a where to store the found value (set to NULL if it doesn't exist). - * @return whether or not the key was found - */ -extern json_bool lh_table_lookup_ex(struct lh_table *t, const void *k, void **v); - -/** - * Delete a record from the table. - * If a callback free function is provided then it is called for the - * for the item being deleted. - * @param t the table to delete from. - * @param e a pointer to the entry to delete. - * @return 0 if the item was deleted. - * @return -1 if it was not found. - */ -extern int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e); - - -/** - * Delete a record from the table. - * If a callback free function is provided then it is called for the - * for the item being deleted. - * @param t the table to delete from. - * @param k a pointer to the key to delete. - * @return 0 if the item was deleted. - * @return -1 if it was not found. - */ -extern int lh_table_delete(struct lh_table *t, const void *k); - -extern int lh_table_length(struct lh_table *t); - -void lh_abort(const char *msg, ...); -void lh_table_resize(struct lh_table *t, int new_size); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/math_compat.h b/json-c/math_compat.h deleted file mode 100644 index f40b8faf..00000000 --- a/json-c/math_compat.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __math_compat_h -#define __math_compat_h - -/* Define isnan and isinf on Windows/MSVC */ - -#ifndef HAVE_DECL_ISNAN -# ifdef HAVE_DECL__ISNAN -#include <float.h> -#define isnan(x) _isnan(x) -# endif -#endif - -#ifndef HAVE_DECL_ISINF -# ifdef HAVE_DECL__FINITE -#include <float.h> -#define isinf(x) (!_finite(x)) -# endif -#endif - -#ifndef HAVE_DECL_NAN -#error This platform does not have nan() -#endif - -#ifndef HAVE_DECL_INFINITY -#error This platform does not have INFINITY -#endif - -#endif diff --git a/json-c/printbuf.c b/json-c/printbuf.c deleted file mode 100644 index fe952b45..00000000 --- a/json-c/printbuf.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * $Id: printbuf.c,v 1.5 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - * - * Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved. - * The copyrights to the contents of this file are licensed under the MIT License - * (http://www.opensource.org/licenses/mit-license.php) - */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef HAVE_STDARG_H -# include <stdarg.h> -#else /* !HAVE_STDARG_H */ -# error Not enough var arg support! -#endif /* HAVE_STDARG_H */ - -#include "debug.h" -#include "printbuf.h" - -static int printbuf_extend(struct printbuf *p, int min_size); - -struct printbuf* printbuf_new(void) -{ - struct printbuf *p; - - p = (struct printbuf*)calloc(1, sizeof(struct printbuf)); - if(!p) return NULL; - p->size = 32; - p->bpos = 0; - if(!(p->buf = (char*)malloc(p->size))) { - free(p); - return NULL; - } - return p; -} - - -/** - * Extend the buffer p so it has a size of at least min_size. - * - * If the current size is large enough, nothing is changed. - * - * Note: this does not check the available space! The caller - * is responsible for performing those calculations. - */ -static int printbuf_extend(struct printbuf *p, int min_size) -{ - char *t; - int new_size; - - if (p->size >= min_size) - return 0; - - new_size = p->size * 2; - if (new_size < min_size + 8) - new_size = min_size + 8; -#ifdef PRINTBUF_DEBUG - MC_DEBUG("printbuf_memappend: realloc " - "bpos=%d min_size=%d old_size=%d new_size=%d\n", - p->bpos, min_size, p->size, new_size); -#endif /* PRINTBUF_DEBUG */ - if(!(t = (char*)realloc(p->buf, new_size))) - return -1; - p->size = new_size; - p->buf = t; - return 0; -} - -int printbuf_memappend(struct printbuf *p, const char *buf, int size) -{ - if (p->size <= p->bpos + size + 1) { - if (printbuf_extend(p, p->bpos + size + 1) < 0) - return -1; - } - memcpy(p->buf + p->bpos, buf, size); - p->bpos += size; - p->buf[p->bpos]= '\0'; - return size; -} - -int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len) -{ - int size_needed; - - if (offset == -1) - offset = pb->bpos; - size_needed = offset + len; - if (pb->size < size_needed) - { - if (printbuf_extend(pb, size_needed) < 0) - return -1; - } - - memset(pb->buf + offset, charvalue, len); - if (pb->bpos < size_needed) - pb->bpos = size_needed; - - return 0; -} - -#if !defined(HAVE_VSNPRINTF) && defined(_MSC_VER) -# define vsnprintf _vsnprintf -#elif !defined(HAVE_VSNPRINTF) /* !HAVE_VSNPRINTF */ -# error Need vsnprintf! -#endif /* !HAVE_VSNPRINTF && defined(WIN32) */ - -#if !defined(HAVE_VASPRINTF) -/* CAW: compliant version of vasprintf */ -static int vasprintf(char **buf, const char *fmt, va_list ap) -{ -#ifndef WIN32 - static char _T_emptybuffer = '\0'; -#endif /* !defined(WIN32) */ - int chars; - char *b; - - if(!buf) { return -1; } - -#ifdef WIN32 - chars = _vscprintf(fmt, ap)+1; -#else /* !defined(WIN32) */ - /* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite - our buffer like on some 64bit sun systems.... but hey, its time to move on */ - chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap)+1; - if(chars < 0) { chars *= -1; } /* CAW: old glibc versions have this problem */ -#endif /* defined(WIN32) */ - - b = (char*)malloc(sizeof(char)*chars); - if(!b) { return -1; } - - if((chars = vsprintf(b, fmt, ap)) < 0) - { - free(b); - } else { - *buf = b; - } - - return chars; -} -#endif /* !HAVE_VASPRINTF */ - -int sprintbuf(struct printbuf *p, const char *msg, ...) -{ - va_list ap; - char *t; - int size; - char buf[128]; - - /* user stack buffer first */ - va_start(ap, msg); - size = vsnprintf(buf, 128, msg, ap); - va_end(ap); - /* if string is greater than stack buffer, then use dynamic string - with vasprintf. Note: some implementation of vsnprintf return -1 - if output is truncated whereas some return the number of bytes that - would have been written - this code handles both cases. */ - if(size == -1 || size > 127) { - va_start(ap, msg); - if((size = vasprintf(&t, msg, ap)) < 0) { va_end(ap); return -1; } - va_end(ap); - printbuf_memappend(p, t, size); - free(t); - return size; - } else { - printbuf_memappend(p, buf, size); - return size; - } -} - -void printbuf_reset(struct printbuf *p) -{ - p->buf[0] = '\0'; - p->bpos = 0; -} - -void printbuf_free(struct printbuf *p) -{ - if(p) { - free(p->buf); - free(p); - } -} diff --git a/json-c/printbuf.h b/json-c/printbuf.h deleted file mode 100644 index b1bde7f9..00000000 --- a/json-c/printbuf.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $ - * - * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - * - * Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved. - * The copyrights to the contents of this file are licensed under the MIT License - * (http://www.opensource.org/licenses/mit-license.php) - */ - -#ifndef _printbuf_h_ -#define _printbuf_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -struct printbuf { - char *buf; - int bpos; - int size; -}; - -extern struct printbuf* -printbuf_new(void); - -/* As an optimization, printbuf_memappend_fast is defined as a macro - * that handles copying data if the buffer is large enough; otherwise - * it invokes printbuf_memappend_real() which performs the heavy - * lifting of realloc()ing the buffer and copying data. - * Your code should not use printbuf_memappend directly--use - * printbuf_memappend_fast instead. - */ -extern int -printbuf_memappend(struct printbuf *p, const char *buf, int size); - -#define printbuf_memappend_fast(p, bufptr, bufsize) \ -do { \ - if ((p->size - p->bpos) > bufsize) { \ - memcpy(p->buf + p->bpos, (bufptr), bufsize); \ - p->bpos += bufsize; \ - p->buf[p->bpos]= '\0'; \ - } else { printbuf_memappend(p, (bufptr), bufsize); } \ -} while (0) - -#define printbuf_length(p) ((p)->bpos) - -/** - * Set len bytes of the buffer to charvalue, starting at offset offset. - * Similar to calling memset(x, charvalue, len); - * - * The memory allocated for the buffer is extended as necessary. - * - * If offset is -1, this starts at the end of the current data in the buffer. - */ -extern int -printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len); - -extern int -sprintbuf(struct printbuf *p, const char *msg, ...); - -extern void -printbuf_reset(struct printbuf *p); - -extern void -printbuf_free(struct printbuf *p); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/json-c/random_seed.c b/json-c/random_seed.c deleted file mode 100644 index f6719298..00000000 --- a/json-c/random_seed.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * random_seed.c - * - * Copyright (c) 2013 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#include <stdio.h> -#include "config.h" - -#define DEBUG_SEED(s) - - -#if defined ENABLE_RDRAND - -/* cpuid */ - -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) -#define HAS_X86_CPUID 1 - -static void do_cpuid(int regs[], int h) -{ - __asm__ __volatile__( -#if defined __x86_64__ - "pushq %%rbx;\n" -#else - "pushl %%ebx;\n" -#endif - "cpuid;\n" -#if defined __x86_64__ - "popq %%rbx;\n" -#else - "popl %%ebx;\n" -#endif - : "=a"(regs[0]), [ebx] "=r"(regs[1]), "=c"(regs[2]), "=d"(regs[3]) - : "a"(h)); -} - -#elif defined _MSC_VER - -#define HAS_X86_CPUID 1 -#define do_cpuid __cpuid - -#endif - -/* has_rdrand */ - -#if HAS_X86_CPUID - -static int has_rdrand() -{ - // CPUID.01H:ECX.RDRAND[bit 30] == 1 - int regs[4]; - do_cpuid(regs, 1); - return (regs[2] & (1 << 30)) != 0; -} - -#endif - -/* get_rdrand_seed - GCC x86 and X64 */ - -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - -#define HAVE_RDRAND 1 - -static int get_rdrand_seed() -{ - DEBUG_SEED("get_rdrand_seed"); - int _eax; - // rdrand eax - __asm__ __volatile__("1: .byte 0x0F\n" - " .byte 0xC7\n" - " .byte 0xF0\n" - " jnc 1b;\n" - : "=a" (_eax)); - return _eax; -} - -#endif - -#if defined _MSC_VER - -#if _MSC_VER >= 1700 -#define HAVE_RDRAND 1 - -/* get_rdrand_seed - Visual Studio 2012 and above */ - -static int get_rdrand_seed() -{ - DEBUG_SEED("get_rdrand_seed"); - int r; - while (_rdrand32_step(&r) == 0); - return r; -} - -#elif defined _M_IX86 -#define HAVE_RDRAND 1 - -/* get_rdrand_seed - Visual Studio 2010 and below - x86 only */ - -static int get_rdrand_seed() -{ - DEBUG_SEED("get_rdrand_seed"); - int _eax; -retry: - // rdrand eax - __asm _emit 0x0F __asm _emit 0xC7 __asm _emit 0xF0 - __asm jnc retry - __asm mov _eax, eax - return _eax; -} - -#endif -#endif - -#endif /* defined ENABLE_RDRAND */ - - -/* has_dev_urandom */ - -#if defined (__APPLE__) || defined(__unix__) || defined(__linux__) - -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -#include <stdlib.h> -#include <sys/stat.h> - -#define HAVE_DEV_RANDOM 1 - -static const char *dev_random_file = "/dev/urandom"; - -static int has_dev_urandom() -{ - struct stat buf; - if (stat(dev_random_file, &buf)) { - return 0; - } - return ((buf.st_mode & S_IFCHR) != 0); -} - - -/* get_dev_random_seed */ - -static int get_dev_random_seed() -{ - DEBUG_SEED("get_dev_random_seed"); - - int fd = open(dev_random_file, O_RDONLY); - if (fd < 0) { - fprintf(stderr, "error opening %s: %s", dev_random_file, strerror(errno)); - exit(1); - } - - int r; - ssize_t nread = read(fd, &r, sizeof(r)); - if (nread != sizeof(r)) { - fprintf(stderr, "error short read %s: %s", dev_random_file, strerror(errno)); - exit(1); - } - - close(fd); - return r; -} - -#endif - - -/* get_cryptgenrandom_seed */ - -#ifdef WIN32 - -#define HAVE_CRYPTGENRANDOM 1 - -#include <windows.h> -#include <wincrypt.h> -#ifndef __GNUC__ -#pragma comment(lib, "advapi32.lib") -#endif - -static int get_cryptgenrandom_seed() -{ - DEBUG_SEED("get_cryptgenrandom_seed"); - - HCRYPTPROV hProvider = 0; - int r; - - if (!CryptAcquireContextW(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { - fprintf(stderr, "error CryptAcquireContextW"); - exit(1); - } - - if (!CryptGenRandom(hProvider, sizeof(r), (BYTE*)&r)) { - fprintf(stderr, "error CryptGenRandom"); - exit(1); - } - - CryptReleaseContext(hProvider, 0); - - return r; -} - -#endif - - -/* get_time_seed */ - -#include <time.h> - -static int get_time_seed() -{ - DEBUG_SEED("get_time_seed"); - - return (int)time(NULL) * 433494437; -} - - -/* json_c_get_random_seed */ - -int json_c_get_random_seed() -{ -#if HAVE_RDRAND - if (has_rdrand()) return get_rdrand_seed(); -#endif -#if HAVE_DEV_RANDOM - if (has_dev_urandom()) return get_dev_random_seed(); -#endif -#if HAVE_CRYPTGENRANDOM - return get_cryptgenrandom_seed(); -#endif - return get_time_seed(); -} diff --git a/json-c/random_seed.h b/json-c/random_seed.h deleted file mode 100644 index 7362d67d..00000000 --- a/json-c/random_seed.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * random_seed.h - * - * Copyright (c) 2013 Metaparadigm Pte. Ltd. - * Michael Clark <michael@metaparadigm.com> - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - * - */ - -#ifndef seed_h -#define seed_h - -#ifdef __cplusplus -extern "C" { -#endif - -extern int json_c_get_random_seed(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lineage.dependencies b/lineage.dependencies new file mode 100644 index 00000000..09f52fdf --- /dev/null +++ b/lineage.dependencies @@ -0,0 +1,10 @@ +[ + { + "repository": "android_device_google_gs-common", + "target_path": "device/google/gs-common" + }, + { + "repository": "android_kernel_google_redbull", + "target_path": "kernel/google/redbull" + } +] diff --git a/lineage_common.mk b/lineage_common.mk new file mode 100644 index 00000000..337fc02e --- /dev/null +++ b/lineage_common.mk @@ -0,0 +1,8 @@ +# +# Copyright (C) 2023 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Lineage Health +include hardware/google/pixel/lineage_health/device.mk diff --git a/lineage_manifest.xml b/lineage_manifest.xml new file mode 100644 index 00000000..35410f38 --- /dev/null +++ b/lineage_manifest.xml @@ -0,0 +1,11 @@ +<manifest version="1.0" type="device" target-level="5"> + <hal format="hidl"> + <name>vendor.lineage.livedisplay</name> + <transport>hwbinder</transport> + <version>2.0</version> + <interface> + <name>IPictureAdjustment</name> + <instance>default</instance> + </interface> + </hal> +</manifest> diff --git a/media_codecs_vendor_audio.xml b/media_codecs_vendor_audio.xml deleted file mode 100644 index dd770260..00000000 --- a/media_codecs_vendor_audio.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright (C) 2015-2018 The Linux Foundation. All rights reserved. - Not a contribution. - Copyright (C) 2012 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<Included> - <Decoders> - <!-- SimpleOMXComponet based software decoder--> - <MediaCodec name="OMX.qti.audio.decoder.flac" type="audio/flac" > - <Limit name="concurrent-instances" max="10" /> - </MediaCodec> - <MediaCodec name="OMX.qti.audio.decoder.mpegh" type="audio/mhas" > - <Limit name="concurrent-instances" max="10" /> - </MediaCodec> - </Decoders> -</Included> diff --git a/modules.load b/modules.load new file mode 100644 index 00000000..b116d1f2 --- /dev/null +++ b/modules.load @@ -0,0 +1,329 @@ +kernel/kernel/trace/msm_ipc_logging.ko +kernel/kernel/kheaders.ko +kernel/fs/incfs/incrementalfs.ko +kernel/drivers/irqchip/qcom-pdc.ko +kernel/drivers/phy/qualcomm/phy-qcom-ufs.ko +kernel/drivers/phy/qualcomm/phy-qcom-ufs-qrbtc-sdm845.ko +kernel/drivers/phy/qualcomm/phy-qcom-ufs-qmp-v4.ko +kernel/drivers/phy/qualcomm/phy-qcom-ufs-qmp-v4-lito.ko +kernel/drivers/phy/qualcomm/phy-qcom-ufs-qmp-v3-660.ko +kernel/drivers/phy/qualcomm/phy-qcom-ufs-qmp-v3.ko +kernel/drivers/pinctrl/qcom/pinctrl-msm.ko +kernel/drivers/pinctrl/qcom/pinctrl-spmi-gpio.ko +kernel/drivers/pinctrl/qcom/pinctrl-spmi-mpp.ko +kernel/drivers/pinctrl/qcom/pinctrl-lito.ko +kernel/drivers/pwm/pwm-qti-lpg.ko +kernel/drivers/video/backlight/lcd.ko +kernel/drivers/video/backlight/qcom-spmi-wled.ko +kernel/drivers/clk/qcom/clk-qcom.ko +kernel/drivers/clk/qcom/clk-aop-qmp.ko +kernel/drivers/clk/qcom/clk-rpmh.ko +kernel/drivers/clk/qcom/camcc-lito.ko +kernel/drivers/clk/qcom/debugcc-lito.ko +kernel/drivers/clk/qcom/dispcc-lito.ko +kernel/drivers/clk/qcom/gcc-lito.ko +kernel/drivers/clk/qcom/gpucc-lito.ko +kernel/drivers/clk/qcom/npucc-lito.ko +kernel/drivers/clk/qcom/videocc-lito.ko +kernel/drivers/clk/qcom/clk-spmi-pmic-div.ko +kernel/drivers/dma/qcom/gpi.ko +kernel/drivers/dma/virt-dma.ko +kernel/drivers/soc/qcom/cmd-db.ko +kernel/drivers/soc/qcom/mdt_loader.ko +kernel/drivers/soc/qcom/qmi_helpers.ko +kernel/drivers/soc/qcom/qcom_rpmh.ko +kernel/drivers/soc/qcom/smem.ko +kernel/drivers/soc/qcom/smem_state.ko +kernel/drivers/soc/qcom/smp2p.ko +kernel/drivers/soc/qcom/qcom_ipcc.ko +kernel/drivers/soc/qcom/llcc-slice.ko +kernel/drivers/soc/qcom/llcc-lito.ko +kernel/drivers/soc/qcom/llcc-orchid.ko +kernel/drivers/soc/qcom/llcc_perfmon.ko +kernel/drivers/soc/qcom/secure_buffer.ko +kernel/drivers/soc/qcom/qtee_shm_bridge.ko +kernel/drivers/soc/qcom/early_random.ko +kernel/drivers/soc/qcom/core_hang_detect.ko +kernel/drivers/soc/qcom/gladiator_hang_detect.ko +kernel/drivers/soc/qcom/msm_minidump.ko +kernel/drivers/soc/qcom/minidump_log.ko +kernel/drivers/soc/qcom/memory_dump_v2.ko +kernel/drivers/soc/qcom/dcc_v2.ko +kernel/drivers/soc/qcom/service-notifier.ko +kernel/drivers/soc/qcom/service-locator.ko +kernel/drivers/soc/qcom/subsys-pil-tz.ko +kernel/drivers/soc/qcom/memshare/heap_mem_ext_v01.ko +kernel/drivers/soc/qcom/memshare/msm_memshare.ko +kernel/drivers/soc/qcom/peripheral-loader.ko +kernel/drivers/soc/qcom/qdsp6v2/cdsp-loader.ko +kernel/drivers/soc/qcom/jtagv8.ko +kernel/drivers/soc/qcom/jtagv8-etm.ko +kernel/drivers/soc/qcom/smcinvoke.ko +kernel/drivers/soc/qcom/rq_stats.ko +kernel/drivers/soc/qcom/subsystem_notif.ko +kernel/drivers/soc/qcom/subsystem-restart.ko +kernel/drivers/soc/qcom/ramdump.ko +kernel/drivers/soc/qcom/microdump_collector.ko +kernel/drivers/soc/qcom/eud.ko +kernel/drivers/soc/qcom/qcom_socinfo.ko +kernel/drivers/soc/qcom/watchdog_v2.ko +kernel/drivers/soc/qcom/msm_bus/msm_bus.ko +kernel/drivers/soc/qcom/msm_bus/msm_bus_rpmh.ko +kernel/drivers/soc/qcom/fsa4480-i2c.ko +kernel/drivers/soc/qcom/glink_probe.ko +kernel/drivers/soc/qcom/glink_pkt.ko +kernel/drivers/soc/qcom/smp2p_sleepstate.ko +kernel/drivers/soc/qcom/system_pm.ko +kernel/drivers/soc/qcom/event_timer.ko +kernel/drivers/soc/qcom/lpm-stats.ko +kernel/drivers/soc/qcom/rpmh_master_stat.ko +kernel/drivers/soc/qcom/rpm_stats.ko +kernel/drivers/soc/qcom/ddr_stats.ko +kernel/drivers/soc/qcom/cdsprm.ko +kernel/drivers/soc/qcom/msm_icnss.ko +kernel/drivers/soc/qcom/modemsmem/modemsmem.ko +kernel/drivers/regulator/qpnp-amoled-regulator.ko +kernel/drivers/regulator/refgen.ko +kernel/drivers/regulator/rpmh-regulator.ko +kernel/drivers/regulator/slg51000-regulator.ko +kernel/drivers/regulator/tps-regulator.ko +kernel/drivers/tty/serial/msm_geni_serial.ko +kernel/drivers/char/hw_random/msm_rng.ko +kernel/drivers/char/adsprpc.ko +kernel/drivers/char/adsprpc_compat.ko +kernel/drivers/char/fastcvpd.ko +kernel/drivers/char/rdbg.ko +kernel/drivers/char/diag/diagchar.ko +kernel/drivers/iommu/msm_dma_iommu_mapping.ko +kernel/drivers/iommu/arm-smmu.ko +kernel/drivers/iommu/arm-smmu-debug.ko +kernel/drivers/iommu/iommu-logger.ko +kernel/drivers/gpu/msm/msm_adreno.ko +kernel/drivers/base/regmap/regmap-spmi.ko +kernel/drivers/misc/eeprom/at24.ko +kernel/drivers/misc/hdcp_qseecom.ko +kernel/drivers/misc/msm_hdcp.ko +kernel/drivers/misc/qseecom.ko +kernel/drivers/misc/citadel-spi.ko +kernel/drivers/mfd/qcom-i2c-pmic.ko +kernel/drivers/mfd/qcom-spmi-pmic.ko +kernel/drivers/nfc/st21nfc.ko +kernel/drivers/nfc/ese/st54j_se.ko +kernel/drivers/crypto/msm/qce50.ko +kernel/drivers/crypto/msm/qcedev-module.ko +kernel/drivers/crypto/msm/qcrypto.ko +kernel/drivers/scsi/ufs/ufs_qcom.ko +kernel/drivers/scsi/ufs/ufshcd-core.ko +kernel/drivers/scsi/ufs/ufshcd-pltfrm.ko +kernel/drivers/spi/spi-geni-qcom.ko +kernel/drivers/spmi/spmi-pmic-arb.ko +kernel/drivers/net/wireless/cnss_utils/cnss_utils.ko +kernel/drivers/net/wireless/cnss_prealloc/cnss_prealloc.ko +kernel/drivers/net/wireless/cnss_genl/cnss_nl.ko +kernel/drivers/uio/msm_sharedmem/msm_sharedmem.ko +kernel/drivers/usb/phy/phy-generic.ko +kernel/drivers/usb/phy/phy-msm-ssusb-qmp.ko +kernel/drivers/usb/phy/phy-msm-snps-hs.ko +kernel/drivers/usb/host/xhci-plat-hcd.ko +kernel/drivers/usb/gadget/function/rndis.ko +kernel/drivers/usb/gadget/function/usb_f_diag.ko +kernel/drivers/usb/gadget/function/usb_f_cdev.ko +kernel/drivers/usb/gadget/function/usb_f_ccid.ko +kernel/drivers/usb/gadget/function/usb_f_qdss.ko +kernel/drivers/usb/gadget/function/usb_f_gsi.ko +kernel/drivers/usb/gadget/function/usb_f_mtp.ko +kernel/drivers/usb/gadget/function/usb_f_ptp.ko +kernel/drivers/usb/typec/tcpm/tcpm.ko +kernel/drivers/usb/pd/qpnp_pdphy.ko +kernel/drivers/usb/dwc3/dwc3.ko +kernel/drivers/usb/dwc3/dwc3-haps.ko +kernel/drivers/usb/dwc3/dwc3-of-simple.ko +kernel/drivers/usb/dwc3/dwc3-qcom.ko +kernel/drivers/usb/dwc3/usb-dwc3-msm.ko +kernel/drivers/usb/roles/roles.ko +kernel/drivers/input/touchscreen/touch_offload.ko +kernel/drivers/input/touchscreen/touchscreen_tbn.ko +kernel/drivers/input/touchscreen/heatmap.ko +kernel/drivers/input/misc/drv2624.ko +kernel/drivers/input/misc/qpnp-power-on.ko +kernel/drivers/input/misc/vd6281/vd6281_module.ko +kernel/drivers/input/misc/fpc_fingerprint/fpc1020_platform_tee.ko +kernel/drivers/rtc/rtc-pm8xxx.ko +kernel/drivers/i2c/busses/i2c-qcom-geni.ko +kernel/drivers/media/platform/msm/npu/msm_npu.ko +kernel/drivers/power/reset/msm-poweroff.ko +kernel/drivers/power/supply/qcom/pmic-voter.ko +kernel/drivers/power/supply/qcom/qpnp-battery.ko +kernel/drivers/power/supply/qcom/qpnp-smb5-charger.ko +kernel/drivers/power/supply/qcom/qpnp-qgauge.ko +kernel/drivers/power/supply/google/google-bms.ko +kernel/drivers/power/supply/google/sm7250_bms.ko +kernel/drivers/power/supply/google/google_charger.ko +kernel/drivers/power/supply/google/google-battery.ko +kernel/drivers/power/supply/google/overheat_mitigation.ko +kernel/drivers/power/supply/google/logbuffer.ko +kernel/drivers/power/supply/google/p9221_charger.ko +kernel/drivers/thermal/qcom/adc_tm.ko +kernel/drivers/thermal/qcom/qti_qmi_sensor.ko +kernel/drivers/thermal/qcom/bcl_pmic5.ko +kernel/drivers/thermal/qcom/bcl_soc.ko +kernel/drivers/thermal/qcom/qmi_cdev.ko +kernel/drivers/thermal/qcom/msm_lmh_dcvs.ko +kernel/drivers/thermal/qcom/lmh_dbg.ko +kernel/drivers/thermal/qcom/regulator_aop_cdev.ko +kernel/drivers/thermal/qcom/cpu_isolate.ko +kernel/drivers/thermal/qcom/lmh_cpu_vdd_cdev.ko +kernel/drivers/thermal/qcom-spmi-temp-alarm.ko +kernel/drivers/thermal/thermal-tsens.ko +kernel/drivers/md/dm-user.ko +kernel/drivers/bluetooth/bluetooth_power.ko +kernel/drivers/edac/qcom_edac.ko +kernel/drivers/cpufreq/qcom-cpufreq-hw.ko +kernel/drivers/cpuidle/msm_pm.ko +kernel/drivers/leds/leds-qpnp-flash-v2.ko +kernel/drivers/leds/leds-qpnp-flash-common.ko +kernel/drivers/firmware/msm_scm.ko +kernel/drivers/of/of_slimbus.ko +kernel/drivers/of/of_batterydata.ko +kernel/drivers/staging/android/ion/ion-alloc.ko +kernel/drivers/staging/wlan_mac/google_wlan_mac.ko +kernel/drivers/platform/msm/msm_ext_display.ko +kernel/drivers/platform/msm/qpnp-revid.ko +kernel/drivers/platform/msm/sps/msm_sps.ko +kernel/drivers/platform/msm/gsi/msm_gsi.ko +kernel/drivers/platform/msm/ipa/ipa3.ko +kernel/drivers/platform/msm/qcom-geni-se.ko +kernel/drivers/mailbox/msm_qmp.ko +kernel/drivers/hwspinlock/qcom_hwspinlock.ko +kernel/drivers/devfreq/bimc-bwmon.ko +kernel/drivers/devfreq/arm-memlat-mon.ko +kernel/drivers/devfreq/governor_bw_hwmon.ko +kernel/drivers/devfreq/governor_memlat.ko +kernel/drivers/devfreq/governor_msm_adreno_tz.ko +kernel/drivers/devfreq/governor_bw_vbif.ko +kernel/drivers/devfreq/governor_gpubw_mon.ko +kernel/drivers/devfreq/governor_cdsp_l3.ko +kernel/drivers/devfreq/devfreq_qcom_fw.ko +kernel/drivers/devfreq/devfreq_devbw.ko +kernel/drivers/iio/adc/qcom-spmi-adc5.ko +kernel/drivers/iio/adc/qcom-vadc-common.ko +kernel/drivers/iio/power/pac193x.ko +kernel/drivers/perf/qcom_llcc_pmu.ko +kernel/drivers/hwtracing/google/coresight-clk-placeholder.ko +kernel/drivers/hwtracing/google/coresight-clk-amba-placeholder.ko +kernel/drivers/nvmem/nvmem_qfprom.ko +kernel/drivers/nvmem/qcom-spmi-sdam.ko +kernel/drivers/slimbus/slimbus.ko +kernel/drivers/slimbus/slim_msm_ngd.ko +kernel/drivers/rpmsg/rpmsg_core.ko +kernel/drivers/rpmsg/rpmsg_char.ko +kernel/drivers/rpmsg/qcom_glink_native.ko +kernel/drivers/rpmsg/qcom_glink_smem.ko +kernel/drivers/rpmsg/qcom_glink_spss.ko +kernel/drivers/rmnet.ko +kernel/sound/usb/usb-audio-qmi.ko +kernel/sound/soc/codecs/snd-soc-rl6231.ko +kernel/sound/soc/codecs/snd-soc-rt5514.ko +kernel/sound/soc/codecs/snd-soc-rt5514-qmi.ko +kernel/sound/soc/codecs/snd-soc-rt5514-spi.ko +kernel/sound/soc/codecs/snd-soc-wm-adsp.ko +kernel/sound/soc/codecs/snd-soc-cs35l41.ko +kernel/sound/soc/codecs/snd-soc-cs35l41-i2c.ko +kernel/sound/soc/codecs/snd-soc-codec-misc.ko +kernel/techpack/video/msm/msm-vidc.ko +kernel/techpack/display/msm/msm_drm.ko +kernel/techpack/camera/drivers/cam_req_mgr/cam_mem_mgr.ko +kernel/techpack/camera/drivers/cam_req_mgr/cam_req_mgr_late.ko +kernel/techpack/camera/drivers/cam_req_mgr/cam_req_mgr.ko +kernel/techpack/camera/drivers/cam_utils/cam_utils.ko +kernel/techpack/camera/drivers/cam_utils/cam_debug_util.ko +kernel/techpack/camera/drivers/cam_core/cam-context.ko +kernel/techpack/camera/drivers/cam_sync/cam-sync.ko +kernel/techpack/camera/drivers/cam_smmu/cam_smmu_api.ko +kernel/techpack/camera/drivers/cam_cpas/cam_cpas.ko +kernel/techpack/camera/drivers/cam_cdm/cam_cdm.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_tasklet_util.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid17x.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_lite17x.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/cam_isp_hw_mgr.ko +kernel/techpack/camera/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.ko +kernel/techpack/camera/drivers/cam_isp/cam_isp.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_res_mgr/cam_res_mgr.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_sensor_utils/cam_sensor_util.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_cci/cam_cci.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_cci/cam_cci_late.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_sensor_io/cam-sensor-io.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_csiphy/cam_csiphy.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_actuator/cam_actuator.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_sensor/cam_sensor.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_eeprom/cam_eeprom.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_ois/cam_ois.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_flash/cam_flash.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_sensor_vsync/cam_sensor_vsync_dev.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_sensor_vsync/cam_sensor_vsync_pb.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_gyro/cam_gyro_core.ko +kernel/techpack/camera/drivers/cam_sensor_module/cam_fw_update/fw-update.ko +kernel/techpack/camera/drivers/cam_icp/icp_hw/a5_hw/cam_a5.ko +kernel/techpack/camera/drivers/cam_icp/icp_hw/ipe_hw/cam_ipe.ko +kernel/techpack/camera/drivers/cam_icp/icp_hw/bps_hw/cam_bps.ko +kernel/techpack/camera/drivers/cam_icp/cam_hfi.ko +kernel/techpack/camera/drivers/cam_icp/cam_icp.ko +kernel/techpack/camera/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc.ko +kernel/techpack/camera/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma.ko +kernel/techpack/camera/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.ko +kernel/techpack/camera/drivers/cam_jpeg/cam_jpeg.ko +kernel/techpack/camera/drivers/cam_fd/fd_hw_mgr/cam-fd-hw-mgr.ko +kernel/techpack/camera/drivers/cam_fd/cam_fd.ko +kernel/techpack/camera/drivers/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw.ko +kernel/techpack/camera/drivers/cam_lrme/lrme_hw_mgr/cam_lrme_hw_mgr.ko +kernel/techpack/camera/drivers/cam_lrme/cam_lrme.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/cam_custom_sub_mod_soc.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/cam_custom_sub_mod_dev.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw1/cam_custom_sub_mod_core.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_csid/cam_custom_csid_dev.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_hw_mgr/cam_custom_hw_mgr.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_dev.ko +kernel/techpack/camera/drivers/cam_cust/cam_custom_context.ko +kernel/techpack/audio/soc/pinctrl_lpi_dlkm.ko +kernel/techpack/audio/soc/swr_dlkm.ko +kernel/techpack/audio/soc/snd_event_dlkm.ko +kernel/techpack/audio/soc/swr_ctrl_dlkm.ko +kernel/techpack/audio/dsp/codecs/native_dlkm.ko +kernel/techpack/audio/dsp/q6_dlkm.ko +kernel/techpack/audio/dsp/usf_dlkm.ko +kernel/techpack/audio/dsp/adsp_loader_dlkm.ko +kernel/techpack/audio/dsp/q6_pdr_dlkm.ko +kernel/techpack/audio/dsp/q6_notifier_dlkm.ko +kernel/techpack/audio/ipc/apr_dlkm.ko +kernel/techpack/audio/asoc/codecs/wcd937x/wcd937x_dlkm.ko +kernel/techpack/audio/asoc/codecs/wcd937x/wcd937x_slave_dlkm.ko +kernel/techpack/audio/asoc/codecs/wcd938x/wcd938x_dlkm.ko +kernel/techpack/audio/asoc/codecs/wcd938x/wcd938x_slave_dlkm.ko +kernel/techpack/audio/asoc/codecs/bolero/bolero_cdc_dlkm.ko +kernel/techpack/audio/asoc/codecs/bolero/wsa_macro_dlkm.ko +kernel/techpack/audio/asoc/codecs/bolero/va_macro_dlkm.ko +kernel/techpack/audio/asoc/codecs/bolero/tx_macro_dlkm.ko +kernel/techpack/audio/asoc/codecs/bolero/rx_macro_dlkm.ko +kernel/techpack/audio/asoc/codecs/wsa883x/wsa883x_dlkm.ko +kernel/techpack/audio/asoc/codecs/tas256x/tas256x_dlkm.ko +kernel/techpack/audio/asoc/codecs/wcd_core_dlkm.ko +kernel/techpack/audio/asoc/codecs/wcd9xxx_dlkm.ko +kernel/techpack/audio/asoc/codecs/wsa881x_dlkm.ko +kernel/techpack/audio/asoc/codecs/stub_dlkm.ko +kernel/techpack/audio/asoc/codecs/mbhc_dlkm.ko +kernel/techpack/audio/asoc/codecs/hdmi_dlkm.ko +kernel/techpack/audio/asoc/platform_dlkm.ko +kernel/techpack/audio/asoc/machine_dlkm.ko +kernel/net/bridge/netfilter/ebtables.ko +kernel/net/bridge/netfilter/ebtable_broute.ko +kernel/net/sctp/sctp.ko +kernel/net/sctp/sctp_diag.ko +kernel/net/qrtr/qrtr.ko +kernel/net/qrtr/qrtr-smd.ko +extra/ftm5.ko +extra/sec_touch.ko +extra/wlan.ko diff --git a/overlay-lineage/frameworks/base/core/res/res/values/arrays.xml b/overlay-lineage/frameworks/base/core/res/res/values/arrays.xml new file mode 100644 index 00000000..333bb324 --- /dev/null +++ b/overlay-lineage/frameworks/base/core/res/res/values/arrays.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2021, The LineageOS Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Device-specific array of SIM slot indexes which are are embedded eUICCs. + e.g. If a device has two physical slots with indexes 0, 1, and slot 1 is an + eUICC, then the value of this array should be: + <integer-array name="non_removable_euicc_slots"> + <item>1</item> + </integer-array> + If a device has three physical slots and slot 1 and 2 are eUICCs, then the value of + this array should be: + <integer-array name="non_removable_euicc_slots"> + <item>1</item> + <item>2</item> + </integer-array> + This is used to differentiate between removable eUICCs and built in eUICCs, and should + be set by OEMs for devices which use eUICCs. --> + <integer-array name="non_removable_euicc_slots"> + <item>1</item> + </integer-array> +</resources> diff --git a/overlay-lineage/frameworks/base/core/res/res/values/config.xml b/overlay-lineage/frameworks/base/core/res/res/values/config.xml new file mode 100644 index 00000000..65329a54 --- /dev/null +++ b/overlay-lineage/frameworks/base/core/res/res/values/config.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2021, The LineageOS Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- List of comma separated package names for which we the system will not show crash, ANR, + etc. dialogs. --> + <string translatable="false" name="config_appsNotReportingCrashes">com.google.android.euicc</string> + + <!-- Specify if the fingerprint hardware support gestures--> + <bool name="config_fingerprintSupportsGestures">true</bool> + + <string-array name="config_nightDisplayColorTemperatureCoefficients"> + <!-- R a-coefficient --> <item>0.0</item> + <!-- R b-coefficient --> <item>0.0</item> + <!-- R y-intercept --> <item>1.0</item> + <!-- G a-coefficient --> <item>-0.000000014365268757</item> + <!-- G b-coefficient --> <item>0.000255092801250106</item> + <!-- G y-intercept --> <item>-0.064156942434907716</item> + <!-- B a-coefficient --> <item>-0.000000000910931179</item> + <!-- B b-coefficient --> <item>0.000207598323269139</item> + <!-- B y-intercept --> <item>-0.349361641294833436</item> + </string-array> + + <!-- Flag indicating whether we should enable the adaptive sleep.--> + <bool name="config_adaptive_sleep_available">true</bool> + + <!-- The component name for the default system attention service. + This service must be trusted, as it can be activated without explicit consent of the user. + See android.attention.AttentionManagerService. + --> + <string name="config_defaultAttentionService" translatable="false">com.google.android.as/com.google.android.apps.miphone.aiai.attention.service.AiAiAttentionService</string> + + <!-- Live Captions --> + <string name="config_defaultSystemCaptionsManagerService">com.google.android.as/com.google.android.apps.miphone.aiai.captions.SystemCaptionsManagerService</string> + + <!-- Recents text and image selection for Pixel Launcher (not supported by Launcher3) --> + <string name="config_defaultContentSuggestionsService" translatable="false">com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiContentSuggestionsService</string> + + <!-- Launcher app suggestions --> + <string name="config_defaultAppPredictionService" translatable="false">com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiPredictionService</string> + + <!-- Make AiAi the default role holder for System Intelligence --> + <string name="config_systemAmbientAudioIntelligence">com.google.android.as</string> + <string name="config_systemAudioIntelligence">com.google.android.as</string> + <string name="config_systemNotificationIntelligence">com.google.android.as</string> + <string name="config_systemTextIntelligence">com.google.android.as</string> + <string name="config_systemUiIntelligence">com.google.android.as</string> + <string name="config_systemVisualIntelligence">com.google.android.as</string> + + <!-- Whether WiFi display is supported by this device. + There are many prerequisites for this feature to work correctly. + Here are a few of them: + * The WiFi radio must support WiFi P2P. + * The WiFi radio must support concurrent connections to the WiFi display and + to an access point. + * The Audio Flinger audio_policy.conf file must specify a rule for the "r_submix" + remote submix module. This module is used to record and stream system + audio output to the WiFi display encoder in the media server. + * The remote submix module "audio.r_submix.default" must be installed on the device. + * The device must be provisioned with HDCP keys (for protected content). + --> + <bool name="config_enableWifiDisplay">true</bool> +</resources> diff --git a/overlay-lineage/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay-lineage/frameworks/base/packages/SettingsProvider/res/values/defaults.xml new file mode 100644 index 00000000..65f6870f --- /dev/null +++ b/overlay-lineage/frameworks/base/packages/SettingsProvider/res/values/defaults.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright 2021, The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<resources> + <!-- Default screen brightness, from 0 to 255. 102 is 40%. --> + <integer name="def_screen_brightness">82</integer> + <!-- Set the automatic brightness mode on by default --> + <bool name="def_screen_brightness_automatic_mode">true</bool> +</resources> diff --git a/overlay-lineage/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay-lineage/frameworks/base/packages/SystemUI/res/values/config.xml new file mode 100644 index 00000000..5cc77237 --- /dev/null +++ b/overlay-lineage/frameworks/base/packages/SystemUI/res/values/config.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2021, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + + <!-- Should we vibrate on an icon animation of the shelf. This should only be active if the + vibrator is capable of subtle vibrations --> + <bool name="config_vibrateOnIconAnimation">true</bool> + + <!-- Whether to show a warning notification when device's skin temperature is high. --> + <integer name="config_showTemperatureWarning">1</integer> + + <!-- Whether to show a alarm dialog when device's usb port is overheating. --> + <integer name="config_showUsbPortAlarm">1</integer> + +</resources> diff --git a/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml new file mode 100644 index 00000000..d4faff51 --- /dev/null +++ b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2021, The LineageOS Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- Whether device has screen with higher aspect ratio --> + <bool name="config_haveHigherAspectRatioScreen">true</bool> + + <!-- Defines the actions shown in advanced reboot submenu --> + <string-array name="config_restartActionsList"> + <item>restart</item> + <item>restart_recovery</item> + <item>restart_fastboot</item> + <item>restart_bootloader</item> + </string-array> +</resources> diff --git a/overlay-lineage/packages/apps/Aperture/app/src/main/res/values/config.xml b/overlay-lineage/packages/apps/Aperture/app/src/main/res/values/config.xml new file mode 100644 index 00000000..58a9ef46 --- /dev/null +++ b/overlay-lineage/packages/apps/Aperture/app/src/main/res/values/config.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + SPDX-FileCopyrightText: 2022 The LineageOS Project + SPDX-License-Identifier: Apache-2.0 +--> +<resources> + <!-- An array of triplets made of (camera ID, approximate zoom ratio, exact zoom ratio). + These values will be added to the lens selector if one or more cameras uses the + multi-camera API to let the user select which lens to use. + It's highly recommended to leave config_enableAuxCameras to false, since with + multi-camera API you only use a single camera device for all sensors. + You may enable it if you need auxiliary camera devices for a set of cameras on one + of the device's side (e.g. logical main back camera but multiple physical camera + devices on front), in that case if a main device side's lens is referenced here + all the auxiliary camera devices of that side will be ignored. + You may be able to get the exact zoom ratio needed to trigger the lens switch from + your stock camera app and observing the zoom ratio it sets with the following command: + adb shell dumpsys media.camera | grep 'android.control.zoomRatio' -1 + Example for Google Pixel 7 Pro's back camera configuration: + <string-array name="config_logicalZoomRatios"> + <item>0</item> <item>0.5</item> <item>0.55632502</item> + <item>0</item> <item>2.0</item> <item>2.0</item> + <item>0</item> <item>5.0</item> <item>5.0</item> + </string-array> + --> + <string-array name="config_logicalZoomRatios"> + <item>0</item> <item>0.6</item> <item>0.61500001</item> + <item>0</item> <item>2.0</item> <item>2.0</item> + </string-array> +</resources> diff --git a/overlay-lineage/packages/apps/Dialer/java/com/android/dialer/callrecord/res/values/config.xml b/overlay-lineage/packages/apps/Dialer/java/com/android/dialer/callrecord/res/values/config.xml new file mode 100644 index 00000000..4cacde56 --- /dev/null +++ b/overlay-lineage/packages/apps/Dialer/java/com/android/dialer/callrecord/res/values/config.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2021 The LineageOS Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <bool name="call_recording_enabled">true</bool> + <integer name="call_recording_audio_source">4</integer> +</resources> diff --git a/overlay-lineage/packages/apps/Settings/res/values/config.xml b/overlay-lineage/packages/apps/Settings/res/values/config.xml new file mode 100644 index 00000000..61850280 --- /dev/null +++ b/overlay-lineage/packages/apps/Settings/res/values/config.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2021, The LineageOS Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- Whether to show the Preference for Adaptive connectivity --> + <bool name="config_show_adaptive_connectivity">true</bool> + +</resources> diff --git a/overlay-lineage/packages/apps/Settings/res/values/lineage_config.xml b/overlay-lineage/packages/apps/Settings/res/values/lineage_config.xml new file mode 100644 index 00000000..d212f663 --- /dev/null +++ b/overlay-lineage/packages/apps/Settings/res/values/lineage_config.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2020-2024 The LineageOS Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <!-- Show battery cycle count --> + <bool name="config_show_battery_cycle_count" translatable="false">true</bool> +</resources> diff --git a/overlay-lineage/packages/apps/SimpleDeviceConfig/res/values/config.xml b/overlay-lineage/packages/apps/SimpleDeviceConfig/res/values/config.xml new file mode 100644 index 00000000..b5c0ad3a --- /dev/null +++ b/overlay-lineage/packages/apps/SimpleDeviceConfig/res/values/config.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2020 The Proton AOSP Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <string-array name="configs_device"> + <!-- Live Captions (Pixel 2017 + OEM) --> + <item>device_personalization_services/Captions__allow_box_x_axis_movement=true</item> + <item>device_personalization_services/Captions__available_for_download=en-US;fr-FR;fr-BE;fr-CH;it-IT;it-CH;de-DE;de-AT;de-BE;de-CH;es-US</item> + <item>device_personalization_services/Captions__disable_prod=false</item> + <!-- <item>device_personalization_services/Captions__enable=false</item> --> + <item>device_personalization_services/Captions__enable_adaptive_box_width=true</item> + <item>device_personalization_services/Captions__enable_augmented_modality=true</item> + <item>device_personalization_services/Captions__enable_augmented_modality_input=true</item> + <item>device_personalization_services/Captions__enable_augmented_modality_language_detection=true</item> + <item>device_personalization_services/Captions__enable_augmented_music=true</item> + <!-- <item>device_personalization_services/Captions__enable_clearcut_logging=true</item> --> + <item>device_personalization_services/Captions__enable_language_detection=true</item> + <item>device_personalization_services/Captions__enable_multilang=true</item> + <item>device_personalization_services/Captions__enable_punctuations=true</item> + <item>device_personalization_services/Captions__enable_setting_page=false</item> + <item>device_personalization_services/Captions__enable_text_transform=false</item> + <item>device_personalization_services/Captions__enable_westworld_logging=false</item> + <item>device_personalization_services/Captions__enable_zero_day=false</item> + <item>device_personalization_services/Captions__manifest_url_template=https://storage.googleapis.com/captions/%{NAMESPACE}_%{VERSION}_manifest.json</item> + <item>device_personalization_services/Captions__model_version_v1=20190613</item> + <item>device_personalization_services/Captions__model_version_v1_2=20200112</item> + <item>device_personalization_services/Captions__new_model_version=20230731</item> + <item>device_personalization_services/Captions__speech_threshold=0.2</item> + <item>device_personalization_services/Captions__supported_languages=en-US;fr-FR;it-IT;de-DE</item> + <item>device_personalization_services/Captions__supported_languages_beta_quality=fr-FR;it-IT;de-DE</item> + <item>device_personalization_services/Captions__surface_sound_events=true</item> + <item>device_personalization_services/Captions__text_transform_augmented_input=true</item> + <item>device_personalization_services/Captions__visibility_playing_duration_millis=5000</item> + <item>device_personalization_services/Captions__visibility_stopped_duration_millis=1500</item> + + <!-- Now Playing (Pixel 2017) --> + <item>device_personalization_services/NowPlaying__ambient_music_apk_music_detector_min_score=0.45</item> + <item>device_personalization_services/NowPlaying__ambient_music_get_model_state_cooldown_seconds_cloud_search=9</item> + <item>device_personalization_services/NowPlaying__ambient_music_index_manifest_17_09_02=3071:https://storage.googleapis.com/music-iq-db/updatable_db_v3/20231217-030102/manifest.json</item> + <item>device_personalization_services/NowPlaying__ambient_music_matcher_match_threshold_17_09_02=1.0E-6</item> + <item>device_personalization_services/NowPlaying__ambient_music_on_demand_enabled=true</item> + <item>device_personalization_services/NowPlaying__ambient_music_on_demand_music_confidence=0.48</item> + <item>device_personalization_services/NowPlaying__cloud_api_allowed=true</item> + <item>device_personalization_services/NowPlaying__dsp_model_checksum_enabled=false</item> + <!-- <item>device_personalization_services/NowPlaying__enable_usage_fa=true</item> --> + <item>device_personalization_services/NowPlaying__favorites_enabled=true</item> + <item>device_personalization_services/NowPlaying__feature_users_count_enabled=true</item> + <!-- <item>device_personalization_services/NowPlaying__federated_analytics_allowed=true</item> --> + <item>device_personalization_services/NowPlaying__handle_ambient_music_results_with_history=true</item> + <item>device_personalization_services/NowPlaying__min_training_interval_millis=86400000</item> + <item>device_personalization_services/NowPlaying__nnfp_v3_model_enabled=true</item> + <item>device_personalization_services/NowPlaying__on_demand_enable_eager_prompt=true</item> + <item>device_personalization_services/NowPlaying__on_demand_fingerprinter_being_setup_warning=true</item> + <item>device_personalization_services/NowPlaying__on_demand_hide_if_fingerprinter_install_not_confirmed=true</item> + <item>device_personalization_services/NowPlaying__on_demand_min_supported_aga_version=12.35.17</item> + <item>device_personalization_services/NowPlaying__on_demand_retry_fingerprinter_install=true</item> + <item>device_personalization_services/NowPlaying__youtube_export_enabled=true</item> + + <!-- Adaptive Sound (Pixel 2020) --> + <item>device_personalization_services/AdaptiveAudio__enable_adaptive_audio=true</item> + <item>device_personalization_services/AdaptiveAudio__show_promo_notification=false</item> + <item>device_personalization_services/AdaptiveAudio__use_silence_detector_state_bug_fix=true</item> + + <!-- Screen attention (Pixel 2019) --> + <item>device_personalization_services/Attention__accel_sensor_enabled=false</item> + <item>device_personalization_services/Attention__accel_sensor_threshold_mss=0.2</item> + <item>device_personalization_services/Attention__enabled=true</item> + <item>device_personalization_services/Attention__margin_horizontal_px=1000</item> + <item>device_personalization_services/Attention__margin_vertical_px=1000</item> + <item>device_personalization_services/Attention__proximity_sensor_enabled=false</item> + + <!-- Recents text selection (for Pixel Launcher users) --> + <item>device_personalization_services/Overview__enable_barcode_detection=false</item> + <item>device_personalization_services/Overview__enable_image_search=false</item> + <item>device_personalization_services/Overview__enable_image_selection=true</item> + <item>device_personalization_services/Overview__enable_japanese_ocr=true</item> + <item>device_personalization_services/Overview__enable_lens_r_overview_long_press=true</item> + <item>device_personalization_services/Overview__enable_lens_r_overview_select_mode=true</item> + <item>device_personalization_services/Overview__enable_lens_r_overview_translate_action=false</item> + <item>device_personalization_services/Overview__enable_overview=true</item> + <item>device_personalization_services/Overview__enable_pir_clearcut_logging=true</item> + <item>device_personalization_services/Overview__enable_pir_westworld_logging=true</item> + <item>device_personalization_services/Overview__enable_proactive_hints=false</item> + <item>device_personalization_services/Overview__enable_superpacks_pir_protocol=true</item> + <item>device_personalization_services/Overview__min_lens_agsa_app_version=301084649</item> + <!-- Disable federated learning --> + <item>device_personalization_services/OverviewFederatedAnalytics__enable_fa=false</item> + <item>device_personalization_services/OverviewFederatedAnalytics__enable_min_training_interval=false</item> + <item>device_personalization_services/OverviewFederatedAnalytics__enable_non_synthetic_logs=false</item> + + <!-- Disable unused AiAi features --> + <item>device_personalization_services/Autofill__enable=false</item> + <item>device_personalization_services/Autofill__enable_fa=false</item> + <item>device_personalization_services/Fedex__enable_fedex=false</item> + <item>device_personalization_services/Logging__enable_aiai_clearcut_logging=false</item> + <item>device_personalization_services/NotificationAssistant__enable_service=false</item> + <item>device_personalization_services/VisualCortex__enable=false</item> + </string-array> +</resources> diff --git a/overlay-lineage/packages/services/Telephony/res/values/config.xml b/overlay-lineage/packages/services/Telephony/res/values/config.xml new file mode 100644 index 00000000..98ff60f3 --- /dev/null +++ b/overlay-lineage/packages/services/Telephony/res/values/config.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021, The LineageOS Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- Phone app resources that may need to be customized + for different hardware or product builds. --> +<resources> + <!-- The package name for the platform carrier config app, bundled with system image. --> + <string name="platform_carrier_config_package" translatable="false">com.google.android.carrier</string> + + <!-- The package names which can request thermal mitigation. --> + <string-array name="thermal_mitigation_allowlisted_packages" translatable="false"> + <item>com.google.android.connectivitythermalpowermanager</item> + </string-array> +</resources> diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index b0747c0d..e413a213 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -65,6 +65,7 @@ <integer-array name="config_availableColorModes"> <item>0</item> <!-- COLOR_MODE_NATURAL --> <item>1</item> <!-- COLOR_MODE_BOOSTED --> + <item>2</item> <!-- COLOR_MODE_SATURATED --> <item>3</item> <!-- COLOR_MODE_AUTOMATIC --> </integer-array> @@ -108,9 +109,6 @@ <!-- If device supports pickup/lift gesture --> <bool name="config_dozePulsePickup">true</bool> - <!-- Set to true to add links to Cell Broadcast app from Settings and MMS app. --> - <bool name="config_cellBroadcastAppLinks">true</bool> - <!-- reference volume index for music stream to limit headphone volume and display warning --> <integer name="config_safe_media_volume_index">7</integer> @@ -276,7 +274,7 @@ <item>"/system/framework/framework.jar"</item> <item>"/system/framework/services.jar"</item> <item>"/system/bin/surfaceflinger"</item> - <item>"/system_ext/priv-app/SystemUIGoogle/SystemUIGoogle.apk"</item> + <item>"/system_ext/priv-app/SystemUI/SystemUI.apk"</item> <item>"/vendor/lib64/lib_aion_buffer.so"</item> <item>"/vendor/lib64/libcamxexternalformatutils.so"</item> <item>"/vendor/lib64/libipebpsstriping.so"</item> @@ -284,9 +282,6 @@ <item>"/vendor/lib64/libgsl.so"</item> </string-array> - <!-- Should the pinner service pin the Camera application? --> - <bool name="config_pinnerCameraApp">true</bool> - <!-- Bytes that the PinnerService will pin for Home app --> <integer name="config_pinnerHomePinBytes">6291456</integer> diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml index c2ac3b4f..d8c7f6dc 100755 --- a/overlay/packages/apps/Settings/res/values/config.xml +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -15,9 +15,22 @@ --> <resources> - <!-- Whether or not the device is capable of multiple levels of vibration intensity. - Note that this is different from whether it can control the vibration amplitude as some - devices will be able to vary their amplitude but do not possess enough dynamic range to - have distinct intensity levels --> - <bool name="config_vibration_supports_multiple_intensities">true</bool> + <!-- The number of vibration intensity levels supported by the device. + + Note that this should correspond to the ability to vary the vibration amplitude, with + enough dynamic range to have at least as many distinct intensity levels as defined here. + + Supported values are 1, 2, 3. If '1', the settings app will use a toggle for the settings, + otherwise a slider. If '3', the settings app maps intensities directly to the levels + supported by the Vibrator HAL APIs. If '2', then the levels will be mapped to + VIBRATION_INTENSITY_LOW and VIBRATION_INTENSITY_HIGH, which gives the most range for + scaling vibrations. The medium intensity will be skipped. + + The default intensity values are configured at + frameworks/base/core/res/res/values/config.xml's config_default[type]VibrationIntensity. + Make sure that each default intensity value is consistent with the supported levels set + here. If this settings supports only 2 levels, for example, then the default intensity + should be either LOW (1) or HIGH (3). + --> + <integer name="config_vibration_supported_intensity_levels">2</integer> </resources> diff --git a/parts/Android.bp b/parts/Android.bp new file mode 100644 index 00000000..594360b4 --- /dev/null +++ b/parts/Android.bp @@ -0,0 +1,23 @@ +// +// Copyright (C) 2021 The LineageOS Project +// +// SPDX-License-Identifier: Apache-2.0 +// + +android_app { + name: "GoogleParts", + + srcs: ["src/**/*.java"], + certificate: "platform", + platform_apis: true, + privileged: true, + system_ext_specific: true, + + static_libs: [ + "org.lineageos.settings.resources", + ], + + optimize: { + proguard_flags_files: ["proguard.flags"], + }, +} diff --git a/parts/AndroidManifest.xml b/parts/AndroidManifest.xml new file mode 100644 index 00000000..b5c79ae8 --- /dev/null +++ b/parts/AndroidManifest.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 The LineageOS Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="org.lineageos.settings" + android:versionCode="1" + android:versionName="1.0" + android:sharedUserId="android.uid.system"> + + <queries> + <package android:name="com.google.android.gms" /> + <package android:name="com.google.android.gsf" /> + <package android:name="com.google.android.euicc" /> + <package android:name="com.google.euiccpixel" /> + </queries> + + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + + <uses-sdk + android:minSdkVersion="30" + android:targetSdkVersion="30"/> + + <application + android:label="@string/device_settings_app_name" + android:persistent="true"> + + <receiver android:name=".BootCompletedReceiver"> + <intent-filter> + <action android:name="android.intent.action.BOOT_COMPLETED" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </receiver> + + </application> +</manifest> diff --git a/parts/proguard.flags b/parts/proguard.flags new file mode 100644 index 00000000..3dbac7bc --- /dev/null +++ b/parts/proguard.flags @@ -0,0 +1,3 @@ +-keep class org.lineageos.settings.* { + *; +} diff --git a/parts/src/org/lineageos/settings/BootCompletedReceiver.java b/parts/src/org/lineageos/settings/BootCompletedReceiver.java new file mode 100644 index 00000000..3b56b2d5 --- /dev/null +++ b/parts/src/org/lineageos/settings/BootCompletedReceiver.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.lineageos.settings; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class BootCompletedReceiver extends BroadcastReceiver { + private static final String TAG = "GoogleParts"; + + @Override + public void onReceive(final Context context, Intent intent) { + Log.d(TAG, "Received boot completed intent"); + EuiccDisabler.enableOrDisableEuicc(context); + } +} diff --git a/parts/src/org/lineageos/settings/EuiccDisabler.java b/parts/src/org/lineageos/settings/EuiccDisabler.java new file mode 100644 index 00000000..a102841c --- /dev/null +++ b/parts/src/org/lineageos/settings/EuiccDisabler.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.lineageos.settings; + +import android.content.Context; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.util.Log; + +class EuiccDisabler { + private static final String TAG = "GoogleParts"; + private static final String[] EUICC_DEPENDENCIES = new String[]{ + "com.google.android.gms", + "com.google.android.gsf" + }; + private static final String[] EUICC_PACKAGES = new String[]{ + "com.google.android.euicc", + "com.google.euiccpixel" + }; + + private static boolean isInstalledAndEnabled(PackageManager pm, String pkgName) { + try { + PackageInfo info = pm.getPackageInfo(pkgName, 0); + Log.d(TAG, "package " + pkgName + " installed, " + + "enabled = " + info.applicationInfo.enabled); + return info.applicationInfo.enabled; + } catch (PackageManager.NameNotFoundException e) { + Log.d(TAG, "package " + pkgName + " is not installed"); + return false; + } + } + + private static boolean shouldDisable(PackageManager pm) { + for (String dep : EUICC_DEPENDENCIES) { + if (!isInstalledAndEnabled(pm, dep)) { + // Disable if any of the dependencies are disabled + return true; + } + } + return false; + } + + public static void enableOrDisableEuicc(Context context) { + PackageManager pm = context.getPackageManager(); + boolean disable = shouldDisable(pm); + int flag = disable + ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED + : PackageManager.COMPONENT_ENABLED_STATE_ENABLED; + for (String pkg : EUICC_PACKAGES) { + try { + pm.setApplicationEnabledSetting(pkg, flag, 0); + } catch (IllegalArgumentException e) { + Log.d(TAG, "package " + pkg + " is not present"); + } + } + } +} diff --git a/sepolicy-lineage/dynamic/hal_lineage_livedisplay_qti.te b/sepolicy-lineage/dynamic/hal_lineage_livedisplay_qti.te new file mode 100644 index 00000000..76c79ba9 --- /dev/null +++ b/sepolicy-lineage/dynamic/hal_lineage_livedisplay_qti.te @@ -0,0 +1,7 @@ +# Do not use add_service() as hal_graphics_composer_default may be the provider as well +allow hal_lineage_livedisplay_qti qdisplay_service:service_manager find; + +binder_call(hal_lineage_livedisplay_qti, hal_graphics_composer_default) + +# Allow LiveDisplay to access vendor display property +get_prop(hal_lineage_livedisplay_qti, vendor_display_prop) diff --git a/sepolicy-lineage/vendor/file_contexts b/sepolicy-lineage/vendor/file_contexts new file mode 100644 index 00000000..88151924 --- /dev/null +++ b/sepolicy-lineage/vendor/file_contexts @@ -0,0 +1,2 @@ +# LiveDisplay HAL +/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.0-service-sdm u:object_r:hal_lineage_livedisplay_qti_exec:s0 diff --git a/sepolicy-lineage/vendor/hal_lineage_livedisplay.te b/sepolicy-lineage/vendor/hal_lineage_livedisplay.te new file mode 100644 index 00000000..83cfd263 --- /dev/null +++ b/sepolicy-lineage/vendor/hal_lineage_livedisplay.te @@ -0,0 +1,12 @@ +type hal_lineage_livedisplay_qti, domain; +hal_server_domain(hal_lineage_livedisplay_qti, hal_lineage_livedisplay) + +type hal_lineage_livedisplay_qti_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_lineage_livedisplay_qti) + +# Allow LiveDisplay HAL's default implementation to use vendor-binder service +vndbinder_use(hal_lineage_livedisplay_qti) + +# Allow LiveDisplay to store files under /data/vendor/display and access them +allow hal_lineage_livedisplay_qti display_vendor_data_file:dir rw_dir_perms; +allow hal_lineage_livedisplay_qti display_vendor_data_file:file create_file_perms; diff --git a/sepolicy/.gitupstream b/sepolicy/.gitupstream new file mode 100644 index 00000000..8b9ed448 --- /dev/null +++ b/sepolicy/.gitupstream @@ -0,0 +1 @@ +https://android.googlesource.com/device/google/redbull-sepolicy diff --git a/sepolicy/OWNERS b/sepolicy/OWNERS new file mode 100644 index 00000000..791abb4a --- /dev/null +++ b/sepolicy/OWNERS @@ -0,0 +1,3 @@ +include platform/system/sepolicy:/OWNERS + +rurumihong@google.com diff --git a/sepolicy/PREUPLOAD.cfg b/sepolicy/PREUPLOAD.cfg new file mode 100644 index 00000000..6544d629 --- /dev/null +++ b/sepolicy/PREUPLOAD.cfg @@ -0,0 +1,2 @@ +[Hook Scripts] +aosp_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "." diff --git a/sepolicy/private/certs/wfcactivation.x509.pem b/sepolicy/private/certs/wfcactivation.x509.pem new file mode 100644 index 00000000..b331e2ef --- /dev/null +++ b/sepolicy/private/certs/wfcactivation.x509.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDxzCCAq+gAwIBAgIVALNdsIWw8RAlQd7BIdldf+kv/v+BMA0GCSqGSIb3DQEB +CwUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH +Ew1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMH +QW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0xODAyMjEwMDU0MjBaFw00ODAy +MjEwMDU0MjBaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYw +FAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4G +A1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAMC2qqWTcN7MfX8ILMKG6q8SDJIIlE+zXz67V7N3jZKh +XpPzIMAv9nDrR6tmDye7S7qxp3UniErpTBCrVCAQUksniJ/4d9Ie6r99UeDq6YzJ +Y9mcQtfvzD+ZELKgkNfBoUMNRMCx5v+srchcDVjnTuU3FxNhQMYpDhP7PCynJW9/ +YeNznLdAbYaHBVhTYueUxlwryf+1bBa3E54hqu0xoHrP0FjKiX1ifhuTBcQfmKnF +JfC/I6r0x2vi+hAgBDXX/4WAUAtCFSeOKw5Qp4osqrMlguuotcgdznRI4Qqs2YDF +TVeeagu/3x242sUJzSqn4rrU+kNt1Az+G2SEQsbK1akCAwEAAaNQME4wDAYDVR0T +BAUwAwEB/zAdBgNVHQ4EFgQUOyhe5x68/4unqcqy4QAqn22NXPYwHwYDVR0jBBgw +FoAUOyhe5x68/4unqcqy4QAqn22NXPYwDQYJKoZIhvcNAQELBQADggEBAGzl8klj ++pOfYj91U5Xi5C9unsOWSx4uTufn62c5TvL/AvkCq5adzYlF2u320S+kfvYlAOR6 +MhN5tlFaKBDGCi+6zHnLTO2QLaZxYGJb5SdwaAF14shFg+7ZNMLb1X8GuKrLIGw1 +P2A5EWFSIwNaGQLz7Mwr66db7efBNWVvcMRdM67cip4LMeXGxuW+aKoJ2X7/x3Lc +FKsKQ7Jx1RxoylUMNBS+0kPCqoUnMqgD9U8Drbp0NcQgkqe0Vks9I/j5bxMeXgES +dkvy6CwcTB01ROO+VLwmWbculJy59K10HtqmeBrzb3DLnxBgAqgbFvIqKVXp8yp2 +l7kN8tGn0HIj4+0= +-----END CERTIFICATE----- diff --git a/sepolicy/private/compat/30.0/30.0.cil b/sepolicy/private/compat/30.0/30.0.cil new file mode 100644 index 00000000..b8deabff --- /dev/null +++ b/sepolicy/private/compat/30.0/30.0.cil @@ -0,0 +1,6 @@ +(typeattributeset dataservice_app_30_0 (dataservice_app)) +(expandtypeattribute (dataservice_app_30_0) true) +(typeattribute dataservice_app_30_0) +(typeattributeset google_camera_app_30_0 (google_camera_app)) +(expandtypeattribute (google_camera_app_30_0) true) +(typeattribute google_camera_app_30_0) diff --git a/sepolicy/private/compat/31.0/31.0.cil b/sepolicy/private/compat/31.0/31.0.cil new file mode 100644 index 00000000..1c8f7634 --- /dev/null +++ b/sepolicy/private/compat/31.0/31.0.cil @@ -0,0 +1,7 @@ +(typeattributeset dataservice_app_31_0 (dataservice_app)) +(expandtypeattribute (dataservice_app_31_0) true) +(typeattribute dataservice_app_31_0) +(typeattributeset google_camera_app_31_0 (google_camera_app)) +(expandtypeattribute (google_camera_app_31_0) true) +(typeattribute google_camera_app_31_0) + diff --git a/sepolicy/private/dumpstate.te b/sepolicy/private/dumpstate.te new file mode 100644 index 00000000..a5522fd8 --- /dev/null +++ b/sepolicy/private/dumpstate.te @@ -0,0 +1,2 @@ +# b/192197221 +dontaudit dumpstate artd:binder call; diff --git a/sepolicy/private/genfs_contexts b/sepolicy/private/genfs_contexts new file mode 100644 index 00000000..0baaf386 --- /dev/null +++ b/sepolicy/private/genfs_contexts @@ -0,0 +1,9 @@ +####### Coresight ETM ############### +genfscon sysfs /devices/platform/soc/7040000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7140000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7240000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7340000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7440000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7540000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7640000.etm u:object_r:sysfs_devices_cs_etm:s0 +genfscon sysfs /devices/platform/soc/7740000.etm u:object_r:sysfs_devices_cs_etm:s0 diff --git a/sepolicy/private/google_camera_app.te b/sepolicy/private/google_camera_app.te new file mode 100644 index 00000000..411bbcb3 --- /dev/null +++ b/sepolicy/private/google_camera_app.te @@ -0,0 +1,22 @@ +## Custom security policy for Google Camera App, the default camera application on Pixel devices. +## +## Google Camera App is a standard app for the most part, but on Pixel devices +## it has access to hardware accelerators such as Hexagon. +## +## This policy defines the extra rules necessary for that access, +## that reference private core sepolicy + +# Duplicate all access that normal untrusted_app has, except for untrusted_app_domain +app_domain(google_camera_app) +net_domain(google_camera_app) +bluetooth_domain(google_camera_app) + +# Write app-specific trace data to the Perfetto traced damon. This requires +# connecting to its producer socket and obtaining a (per-process) tmpfs fd. +allow google_camera_app traced:fd use; +allow google_camera_app traced_tmpfs:file { read write getattr map }; +unix_socket_connect(google_camera_app, traced_producer, traced) + +# Allow heap profiling if the app opts in by being marked +# profileable/debuggable. +can_profile_heap(google_camera_app) diff --git a/sepolicy/private/keys.conf b/sepolicy/private/keys.conf new file mode 100644 index 00000000..22198c56 --- /dev/null +++ b/sepolicy/private/keys.conf @@ -0,0 +1,2 @@ +[@WFCACTIVATION] +ALL : device/google/redbull/sepolicy/private/certs/wfcactivation.x509.pem diff --git a/sepolicy/private/mac_permissions.xml b/sepolicy/private/mac_permissions.xml new file mode 100644 index 00000000..636d5794 --- /dev/null +++ b/sepolicy/private/mac_permissions.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<policy> + +<!-- + + * A signature is a hex encoded X.509 certificate or a tag defined in + keys.conf and is required for each signer tag. + * A signer tag may contain a seinfo tag and multiple package stanzas. + * A default tag is allowed that can contain policy for all apps not signed with a + previously listed cert. It may not contain any inner package stanzas. + * Each signer/default/package tag is allowed to contain one seinfo tag. This tag + represents additional info that each app can use in setting a SELinux security + context on the eventual process. + * When a package is installed the following logic is used to determine what seinfo + value, if any, is assigned. + - All signatures used to sign the app are checked first. + - If a signer stanza has inner package stanzas, those stanza will be checked + to try and match the package name of the app. If the package name matches + then that seinfo tag is used. If no inner package matches then the outer + seinfo tag is assigned. + - The default tag is consulted last if needed. +--> + <signer signature="@WFCACTIVATION" > + <seinfo value="wfcactivation" /> + </signer> +</policy> diff --git a/sepolicy/private/radio.te b/sepolicy/private/radio.te new file mode 100644 index 00000000..eb5b3441 --- /dev/null +++ b/sepolicy/private/radio.te @@ -0,0 +1,2 @@ +add_service(radio, qchook_service) +add_service(radio, uce_service) diff --git a/sepolicy/private/seapp_contexts b/sepolicy/private/seapp_contexts new file mode 100644 index 00000000..bbdc26bb --- /dev/null +++ b/sepolicy/private/seapp_contexts @@ -0,0 +1,20 @@ +# Domain for WfcActivation app +user=_app seinfo=wfcactivation name=com.google.android.wfcactivation domain=wfc_activation_app levelFrom=all + +#Domain for Sprint Hidden Menu +user=_app isPrivApp=true seinfo=platform name=com.google.android.hiddenmenu domain=sprint_hidden_menu type=app_data_file levelFrom=all + +# Domain for vzw omadm trigger +user=_app isPrivApp=true seinfo=platform name=com.google.omadm.trigger domain=vzw_omadm_trigger type=app_data_file levelFrom=all + +# Domain for vzw omadm connmo +user=_app isPrivApp=true seinfo=platform name=com.android.sdm.plugins.connmo domain=vzw_omadm_connmo type=app_data_file levelFrom=all + +# Domain for vzw omadm dcmo +user=_app isPrivApp=true seinfo=platform name=com.android.sdm.plugins.dcmo domain=vzw_omadm_dcmo type=app_data_file levelFrom=all + +# Domain for vzw omadm diagmon +user=_app isPrivApp=true seinfo=platform name=com.android.sdm.plugins.diagmon domain=vzw_omadm_diagmon type=app_data_file levelFrom=all + +# Domain for uscc omadm +user=_app isPrivApp=true seinfo=platform name=com.android.sdm.plugins.usccdm domain=uscc_omadm type=app_data_file levelFrom=all diff --git a/sepolicy/private/service.te b/sepolicy/private/service.te new file mode 100644 index 00000000..2cc37a23 --- /dev/null +++ b/sepolicy/private/service.te @@ -0,0 +1 @@ +type qchook_service, service_manager_type; diff --git a/sepolicy/private/service_contexts b/sepolicy/private/service_contexts new file mode 100644 index 00000000..db3e3d14 --- /dev/null +++ b/sepolicy/private/service_contexts @@ -0,0 +1 @@ +qchook u:object_r:qchook_service:s0
\ No newline at end of file diff --git a/sepolicy/private/sprint_hidden_menu.te b/sepolicy/private/sprint_hidden_menu.te new file mode 100644 index 00000000..9c01004c --- /dev/null +++ b/sepolicy/private/sprint_hidden_menu.te @@ -0,0 +1,8 @@ +type sprint_hidden_menu, domain, coredomain; + +app_domain(sprint_hidden_menu) +net_domain(sprint_hidden_menu) + +allow sprint_hidden_menu app_api_service:service_manager find; +allow sprint_hidden_menu qchook_service:service_manager find; +allow sprint_hidden_menu radio_service:service_manager find; diff --git a/sepolicy/private/toolbox.te b/sepolicy/private/toolbox.te new file mode 100644 index 00000000..e2676e95 --- /dev/null +++ b/sepolicy/private/toolbox.te @@ -0,0 +1,6 @@ +# b/192506182 +dontaudit toolbox toolbox:capability dac_read_search ; +dontaudit toolbox toolbox:capability dac_override ; +dontaudit toolbox virtualizationservice_data_file:dir setattr; +# b/192985881 +dontaudit toolbox toolbox:capability fowner; diff --git a/sepolicy/private/uscc_omadm.te b/sepolicy/private/uscc_omadm.te new file mode 100644 index 00000000..b53d66c3 --- /dev/null +++ b/sepolicy/private/uscc_omadm.te @@ -0,0 +1,9 @@ +type uscc_omadm, domain, coredomain; + +app_domain(uscc_omadm) +net_domain(uscc_omadm) + +# Services +allow uscc_omadm app_api_service:service_manager find; +allow uscc_omadm qchook_service:service_manager find; +allow uscc_omadm radio_service:service_manager find;
\ No newline at end of file diff --git a/sepolicy/private/vzw_omadm_connmo.te b/sepolicy/private/vzw_omadm_connmo.te new file mode 100644 index 00000000..dda0dc85 --- /dev/null +++ b/sepolicy/private/vzw_omadm_connmo.te @@ -0,0 +1,9 @@ +type vzw_omadm_connmo, domain, coredomain; + +app_domain(vzw_omadm_connmo) +net_domain(vzw_omadm_connmo) + +# Services +allow vzw_omadm_connmo app_api_service:service_manager find; +allow vzw_omadm_connmo qchook_service:service_manager find; +allow vzw_omadm_connmo radio_service:service_manager find;
\ No newline at end of file diff --git a/sepolicy/private/vzw_omadm_dcmo.te b/sepolicy/private/vzw_omadm_dcmo.te new file mode 100644 index 00000000..8a27ef36 --- /dev/null +++ b/sepolicy/private/vzw_omadm_dcmo.te @@ -0,0 +1,9 @@ +type vzw_omadm_dcmo, domain, coredomain; + +app_domain(vzw_omadm_dcmo) +net_domain(vzw_omadm_dcmo) + +# Services +allow vzw_omadm_dcmo app_api_service:service_manager find; +allow vzw_omadm_dcmo qchook_service:service_manager find; +allow vzw_omadm_dcmo radio_service:service_manager find;
\ No newline at end of file diff --git a/sepolicy/private/vzw_omadm_diagmon.te b/sepolicy/private/vzw_omadm_diagmon.te new file mode 100644 index 00000000..5c2bb4b0 --- /dev/null +++ b/sepolicy/private/vzw_omadm_diagmon.te @@ -0,0 +1,9 @@ +type vzw_omadm_diagmon, domain, coredomain; + +app_domain(vzw_omadm_diagmon) +net_domain(vzw_omadm_diagmon) + +# Services +allow vzw_omadm_diagmon app_api_service:service_manager find; +allow vzw_omadm_diagmon qchook_service:service_manager find; +allow vzw_omadm_diagmon radio_service:service_manager find;
\ No newline at end of file diff --git a/sepolicy/private/vzw_omadm_trigger.te b/sepolicy/private/vzw_omadm_trigger.te new file mode 100644 index 00000000..aea7a93a --- /dev/null +++ b/sepolicy/private/vzw_omadm_trigger.te @@ -0,0 +1,9 @@ +type vzw_omadm_trigger, domain, coredomain; + +app_domain(vzw_omadm_trigger) +net_domain(vzw_omadm_trigger) + +# Services +allow vzw_omadm_trigger app_api_service:service_manager find; +allow vzw_omadm_trigger qchook_service:service_manager find; +allow vzw_omadm_trigger radio_service:service_manager find;
\ No newline at end of file diff --git a/sepolicy/private/wfc_activation_app.te b/sepolicy/private/wfc_activation_app.te new file mode 100644 index 00000000..cd32efc4 --- /dev/null +++ b/sepolicy/private/wfc_activation_app.te @@ -0,0 +1,9 @@ +type wfc_activation_app, domain, coredomain; + +app_domain(wfc_activation_app) +net_domain(wfc_activation_app) + +# Services +allow wfc_activation_app app_api_service:service_manager find; +allow wfc_activation_app qchook_service:service_manager find; +allow wfc_activation_app radio_service:service_manager find; diff --git a/sepolicy/public/dataservice_app.te b/sepolicy/public/dataservice_app.te new file mode 100644 index 00000000..426416c4 --- /dev/null +++ b/sepolicy/public/dataservice_app.te @@ -0,0 +1 @@ +type dataservice_app, domain; diff --git a/sepolicy/public/google_camera_app.te b/sepolicy/public/google_camera_app.te new file mode 100644 index 00000000..656be514 --- /dev/null +++ b/sepolicy/public/google_camera_app.te @@ -0,0 +1 @@ +type google_camera_app, domain, coredomain; diff --git a/sepolicy/redbull-sepolicy.mk b/sepolicy/redbull-sepolicy.mk new file mode 100644 index 00000000..a28d29b1 --- /dev/null +++ b/sepolicy/redbull-sepolicy.mk @@ -0,0 +1,29 @@ +PRODUCT_PUBLIC_SEPOLICY_DIRS += device/google/redbull/sepolicy/public +PRODUCT_PRIVATE_SEPOLICY_DIRS += device/google/redbull/sepolicy/private + +# confirmationui +BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/confirmationui_hal + +# ramdump +BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/ramdump + +# twoshay +BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/input + +# google_battery service +BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/googlebattery + +# vendors +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy/vendor/google +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy/vendor/qcom/common +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy/vendor/qcom/sm7250 +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy/tracking_denials +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy/vendor/st +BOARD_SEPOLICY_DIRS += device/google/redbull/sepolicy/vendor/verizon + +# Pixel-wide sepolicy +BOARD_VENDOR_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/powerstats +BOARD_VENDOR_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/ramdump/common + +# system_ext +SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/google/redbull/sepolicy/system_ext/private diff --git a/sepolicy/system_ext/private/platform_app.te b/sepolicy/system_ext/private/platform_app.te new file mode 100644 index 00000000..10d6bba9 --- /dev/null +++ b/sepolicy/system_ext/private/platform_app.te @@ -0,0 +1,2 @@ +# allow systemui to set boot animation colors +set_prop(platform_app, bootanim_system_prop); diff --git a/sepolicy/system_ext/private/seapp_contexts b/sepolicy/system_ext/private/seapp_contexts new file mode 100644 index 00000000..934937fe --- /dev/null +++ b/sepolicy/system_ext/private/seapp_contexts @@ -0,0 +1,24 @@ +# Use a custom domain for GoogleCamera, to allow for Hexagon DSP access +user=_app seinfo=google name=com.google.android.GoogleCamera domain=google_camera_app type=app_data_file levelFrom=all + +# Also allow GoogleCameraNext, the dogfood beta version, the same access as GoogleCamera +user=_app seinfo=googlepulse name=com.google.android.apps.googlecamera.fishfood domain=google_camera_app type=app_data_file levelFrom=all + +# Domain for DeviceDropMonitor service +user=_app seinfo=platform name=com.google.android.devicedropmonitor domain=device_drop_monitor type=app_data_file levelFrom=all + +# Domain for Display +user=_app seinfo=platform name=com.android.hbmsvmanager domain=hbmsvmanager_app type=app_data_file levelFrom=all + +# Domain for IpHealthMonitor service +user=_app seinfo=platform name=com.google.android.iphealthmonitor domain=ip_health_monitor type=app_data_file levelFrom=all + +# Domain for UvExposureReporter service +user=_app isPrivApp=true name=com.google.android.uvexposurereporter domain=uv_exposure_reporter type=app_data_file levelFrom=all + +# Domain for connectivity monitor +user=_app isPrivApp=true seinfo=platform name=com.google.android.connectivitymonitor domain=con_monitor_app type=app_data_file levelFrom=all + +# Verizon for OBDM tool +user=_app seinfo=verizon name=com.verizon.obdm domain=obdm_app type=app_data_file levelFrom=all +user=_app seinfo=verizon name=com.verizon.obdm:background domain=obdm_app type=app_data_file levelFrom=all diff --git a/sepolicy/tracking_denials/bug_map b/sepolicy/tracking_denials/bug_map new file mode 100644 index 00000000..016afc63 --- /dev/null +++ b/sepolicy/tracking_denials/bug_map @@ -0,0 +1,3 @@ +hal_drm_widevine default_prop file b/238263416 +hal_googlebattery dumpstate fd b/238263849 +shell qemu_sf_lcd_density_prop file b/238953936 diff --git a/sepolicy/tracking_denials/dumpstate.te b/sepolicy/tracking_denials/dumpstate.te new file mode 100644 index 00000000..c415668c --- /dev/null +++ b/sepolicy/tracking_denials/dumpstate.te @@ -0,0 +1,2 @@ +# b/233569257 +dontaudit dumpstate app_zygote:process { signal }; diff --git a/sepolicy/tracking_denials/hal_dumpstate_impl.te b/sepolicy/tracking_denials/hal_dumpstate_impl.te new file mode 100644 index 00000000..92def335 --- /dev/null +++ b/sepolicy/tracking_denials/hal_dumpstate_impl.te @@ -0,0 +1,2 @@ +# b/193472671 +dontaudit hal_dumpstate_impl sysfs:file getattr; diff --git a/sepolicy/tracking_denials/hal_health_default.te b/sepolicy/tracking_denials/hal_health_default.te new file mode 100644 index 00000000..b4832d67 --- /dev/null +++ b/sepolicy/tracking_denials/hal_health_default.te @@ -0,0 +1,3 @@ +# b/174535059 +dontaudit hal_health_default unlabeled:file read; +dontaudit hal_health_default unlabeled:file write; diff --git a/sepolicy/tracking_denials/hal_power_default.te b/sepolicy/tracking_denials/hal_power_default.te new file mode 100644 index 00000000..2f7782bf --- /dev/null +++ b/sepolicy/tracking_denials/hal_power_default.te @@ -0,0 +1,5 @@ +# b/177780314 +dontaudit hal_power_default hal_power_default:capability dac_read_search ; +# b/178755882 +dontaudit hal_power_default hal_power_default:capability dac_override ; +dontaudit hal_power_default hal_power_default:capability dac_override ; diff --git a/sepolicy/tracking_denials/hal_sensors_default.te b/sepolicy/tracking_denials/hal_sensors_default.te new file mode 100644 index 00000000..781bec74 --- /dev/null +++ b/sepolicy/tracking_denials/hal_sensors_default.te @@ -0,0 +1,3 @@ +# b/181834278 +dontaudit hal_sensors_default servicemanager:binder call; +dontaudit hal_sensors_default boot_status_prop:file read; diff --git a/sepolicy/tracking_denials/hal_tetheroffload_default.te b/sepolicy/tracking_denials/hal_tetheroffload_default.te new file mode 100644 index 00000000..7c11ff73 --- /dev/null +++ b/sepolicy/tracking_denials/hal_tetheroffload_default.te @@ -0,0 +1,2 @@ +# b/155252695 +dontaudit hal_tetheroffload_default unlabeled:dir search; diff --git a/sepolicy/tracking_denials/pixelstats_vendor.te b/sepolicy/tracking_denials/pixelstats_vendor.te new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sepolicy/tracking_denials/pixelstats_vendor.te @@ -0,0 +1 @@ + diff --git a/sepolicy/tracking_denials/platform_app.te b/sepolicy/tracking_denials/platform_app.te new file mode 100644 index 00000000..d3f45227 --- /dev/null +++ b/sepolicy/tracking_denials/platform_app.te @@ -0,0 +1,2 @@ +# b/194892738 +dontaudit platform_app hal_power_stats_hwservice:hwservice_manager find; diff --git a/sepolicy/tracking_denials/ssgtzd.te b/sepolicy/tracking_denials/ssgtzd.te new file mode 100644 index 00000000..148c6d23 --- /dev/null +++ b/sepolicy/tracking_denials/ssgtzd.te @@ -0,0 +1,3 @@ +# b/159393396 +dontaudit ssgtzd self:qipcrtr_socket create; +dontaudit ssgtzd vendor_data_file:dir setattr; diff --git a/sepolicy/tracking_denials/surfaceflinger.te b/sepolicy/tracking_denials/surfaceflinger.te new file mode 100644 index 00000000..c364a38a --- /dev/null +++ b/sepolicy/tracking_denials/surfaceflinger.te @@ -0,0 +1,3 @@ +# b/177780269 +dontaudit surfaceflinger hal_graphics_composer_default:dir search ; +dontaudit surfaceflinger hal_graphics_composer_default:dir search ; diff --git a/sepolicy/vendor/google/bug_map b/sepolicy/vendor/google/bug_map new file mode 100644 index 00000000..8dba124d --- /dev/null +++ b/sepolicy/vendor/google/bug_map @@ -0,0 +1,6 @@ +google_camera_app selinuxfs file b/175910397 +hal_health_default unlabeled file b/156200409 +hvdcp unlabeled file b/161101902 +shell debugfs file b/175106535 +shell device_config_runtime_native_boot_prop file b/175106535 +shell sysfs file b/175106535 diff --git a/sepolicy/vendor/google/cbrs_setup.te b/sepolicy/vendor/google/cbrs_setup.te new file mode 100644 index 00000000..93d62a33 --- /dev/null +++ b/sepolicy/vendor/google/cbrs_setup.te @@ -0,0 +1,14 @@ +# GoogleCBRS app +type cbrs_setup_app, domain; + +userdebug_or_eng(` + app_domain(cbrs_setup_app) + net_domain(cbrs_setup_app) + + allow cbrs_setup_app app_api_service:service_manager find; + allow cbrs_setup_app cameraserver_service:service_manager find; + allow cbrs_setup_app radio_service:service_manager find; + allow cbrs_setup_app surfaceflinger_service:service_manager find; + set_prop(cbrs_setup_app, radio_prop) + set_prop(cbrs_setup_app, vendor_radio_prop) +') diff --git a/sepolicy/vendor/google/certs/EuiccSupportPixel.x509.pem b/sepolicy/vendor/google/certs/EuiccSupportPixel.x509.pem new file mode 100644 index 00000000..956c9590 --- /dev/null +++ b/sepolicy/vendor/google/certs/EuiccSupportPixel.x509.pem @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFxjCCA66gAwIBAgIURH+ESClecwsP2Et2gQ1RAHxabWcwDQYJKoZIhvcNAQEL +BQAwdDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcT +DU1vdW50YWluIFZpZXcxFDASBgNVBAoTC0dvb2dsZSBJbmMuMRAwDgYDVQQLEwdB +bmRyb2lkMRAwDgYDVQQDEwdBbmRyb2lkMB4XDTE5MDIyODE5MjIxNloXDTQ5MDIy +ODE5MjIxNlowdDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAU +BgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC0dvb2dsZSBJbmMuMRAwDgYD +VQQLEwdBbmRyb2lkMRAwDgYDVQQDEwdBbmRyb2lkMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA5AVOe4SKiCOnR4DQ2V3sIo5LNpGtmdzZ54MnHIrsSX8n +43xtCTpfQWDWnDZFCIHSmR8KAOQ0BNxL8ajtr66gU6tFzD5Vlistwl9P9uUlYWgG +aeyEoOUqtiN2HtsJDpcCLYKOz6oH2c5NeruDp5n/Z49xpXXXLgoOTlsoS65tsTcW +FrcSuuOE40UyFJ+Rwhh1EiXGPvT99gaXNnDq5WIsPNNe39jV7f01lZs/g5iUn4dV +A/DxLMam/CQh7qQkh6qWkDL8koQ21N9xEZYTR8qvGvgz3Zd1yfT0P1HsgJaPXK5F +qb2vLV1NP8KoYIlB2KqadCn+HJjIgH8UIbB+R8o6KuWCYzLb5vPs87HkXG5/Y+GB +7HrCIC+6a8BJ4UUyjUkg/HtBd7GlEixZKLtbcJ3erdfL7uigjCJEqAYDXr2Zes31 +898ePcl3YQO5/rHobB7f4w3iF/TwIAAyRRlOceoskCEa/vCbmb7I8HQIJthSNedW +cBiKUneohCtfLT3qS0JUVZewiFRMOVD8mwcZFr4o/UfVslEe8DpBp0WXs/83OeEJ +dtfRc861jdOJ7EIyfDmBX91iWgLCBgv6aXtMvP7CwgZV7y+C+WbbsjYTYSjsNVSA +1uexVPozsSkIjxote0aAiu6+b8LAq9bq2c6Yc6MoldgBqlfcwvFzlKqlm966q6UC +AwEAAaNQME4wDAYDVR0TBAUwAwEB/zAdBgNVHQ4EFgQUuH5K2ov/9L++x+8UhrCD +hNdJm6EwHwYDVR0jBBgwFoAUuH5K2ov/9L++x+8UhrCDhNdJm6EwDQYJKoZIhvcN +AQELBQADggIBAIV1Wx+iwchzxx+ggbWlmJx+oPya2axvj8cgbLGujxI+nmtY2b7U +vzazggubioxJJW7rzemLMDwfKPlfiZkIeQmBe2YJhHiwIPaRAB2juZTfQARsEkd4 +qYvcIDui6PbbgitLWOh3lYNDcVe/c8+EwbJuNNSqjPwIZvj2lodTQNI7uUy1ff5h +ytHsznObr/rh+MeJlKKY56JL6VEzsD694iVFxJ7f4FXK5Y0pjqYmGj1krcfMFoxH +PAmj57yf3VVzeGKx5re+5WIMe5K0RZB9IWxfvx1DsxXvzVeaHYW/c6VF7TVT/RUV ++iLtst+1A1RJbeXDu3uLHxPAC44WUb3FQOUKPRP2cIul70ifJSbvu+qLuyfgwltX +yYIeQMSrUw4WK6NMNYaIPgEq1BX4rLUlKxlH4xaNwT5ZCWLTRdWozYP5FFSMdQhh +Ob1Ki81wKmr1f9EkXoW9eGRZBj3tAg90k0qltel30eLpW6gmnNg+la84nyaXfBF3 +vQAbaAuW5D3TAMWR/Wl6nHoPItdrXHkyMRvQkzx2ezKz61ZP3uDfEZvMLXR0lle8 +s6pTZB3GLS4mY9LFQdDwPlc1xk8yEcdnUAZs+9U6zZF1+FKSgb3UNy81g2DHUMp0 +FCBXTy+kLm0LQVYU91kLd+fTkmgkWl4xSyXeV5g3FFuiv9ahl7//vvCG +-----END CERTIFICATE----- diff --git a/sepolicy/vendor/google/certs/app.x509.pem b/sepolicy/vendor/google/certs/app.x509.pem new file mode 100644 index 00000000..1ccaade6 --- /dev/null +++ b/sepolicy/vendor/google/certs/app.x509.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNV +BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBW +aWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4G +A1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQx +CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3Vu +dGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9p +ZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgC +ggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JO +Rland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/ +8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfY +wXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LW +uT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0z +OHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Yl +mn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14al +oXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE +BxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsT +B0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTAD +AQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4 +rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCE +yj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh +5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTb +Qe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZM +cUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK +-----END CERTIFICATE----- diff --git a/sepolicy/vendor/google/certs/com_google_mds.x509.pem b/sepolicy/vendor/google/certs/com_google_mds.x509.pem new file mode 100644 index 00000000..640c6fb9 --- /dev/null +++ b/sepolicy/vendor/google/certs/com_google_mds.x509.pem @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE-----
+MIIF1TCCA72gAwIBAgIVAPZ4KZV2jpxRBCoVAidCu62l3cDqMA0GCSqGSIb3DQEBCwUAMHsxCzAJ
+BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw
+EgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEXMBUGA1UEAwwOY29tX2dvb2ds
+ZV9tZHMwHhcNMTkwNDIyMTQ1NzA1WhcNNDkwNDIyMTQ1NzA1WjB7MQswCQYDVQQGEwJVUzETMBEG
+A1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xl
+IEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxFzAVBgNVBAMMDmNvbV9nb29nbGVfbWRzMIICIjANBgkq
+hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqgNC0hhI3NzaPUllJfe01hCTuEpl35D02+DKJ5prPFxv
+6KGTk6skjZOwV87Zf2pyj/cbnv28ioDjwvqMBe4ntFdKtH9gl2tTAVl69HMKXF4Iny/wnrt2mxzh
+WxFUd5PuW+mWug+UQw/NGUuaf5d/yys/RrchHKM1+zBV6aOzH6BXiwDoOF2i43d5GlNQ/tFuMySW
+LJftJN0QULFelxNDFFJZhw2P3c4opxjmF2yCoIiDfBEIhTZFKUbHX6YDLXmtUpXl35q+cxK4TCxP
+URyzwdfiyheF3TTxagfzhvXNg/ifrY67S4qCGfzoEMPxrTz02gS0u3D6r/2+hl9vAJChLKDNdIs6
+TqIw+YnABrELiZLLFnaABnjQ7xC3xv1s3W6dWxaxnoVMtC1YvdgwhC5gSpJ4A+AGcCLv96hoeB1I
+IoGV9Yt0Z97MFpXeHFpAxFZ1F9feBqwOCDbu50dmdKZvqGHZ4Ts3uy7ukDQ08dquHpT+NmqkmmW5
+GGhkuyZS3HHpU/QeVsZiyJCJBbDe5lz6NGXK56ruuF9ILeGHtldjQm40oYRc01ESScyVjSU0kpMO
+C7hn1B7rKAm8xxG7eH04ieQrNnbbee7atOO4C3157W5CqujfLMeo6OCRVtcYkYIuSi8hIPNySu/q
+OaEtEP4owVNZR0H6mCHy5pANsyBofMkCAwEAAaNQME4wDAYDVR0TBAUwAwEB/zAdBgNVHQ4EFgQU
+gk8pmLx8yP3RILwR5am1G10PBEowHwYDVR0jBBgwFoAUgk8pmLx8yP3RILwR5am1G10PBEowDQYJ
+KoZIhvcNAQELBQADggIBAC9iQ1huo6CzjcsB1IIw3WYPYVfHtvG7fiB49QO6cjth8fxM36YOxnMz
+K9Zh89cnFx7BeXG4MdbR3lAWO+wTbEpM/5azAQfqHB/ZEEAo1THtqS58C1bTwJ5zxkA+wL/x1ucT
+EV0QZtPHC1K5nIV5FuICiJjui5FHfj2HYu2A5a5729rdZ7sL8Vgx6TUFKpEPs5iCrlx5X/E+/wJa
+DM5iIjVvrGJJq0VWHHeDJEE+Sw1CDxWYRzvu1WvCvhk149hf4LlfrR0A5t8QJRGx0WwF10DLGgJx
+7epMBpzhMIXc529FTIx4Rx2PcufjTZC9EN7PkLgVfYahWEkt/YIfV/0F6U6viLxdNC5O0pimSV57
+vT6HIthX1OC34eZca0cPqH1kOuhRDKOhbP4yIgdYX6knpvw8aXsYcyTfAmDyrt0EWffeBPedaxMo
+xfijdlsBQUymviUQ8qBbfl1Ew9VoC+VEsiobK7Ubog0IK+82LQ7FOLMoNYnhk5wJ63i1kVvBVAgH
+64PMME2KG//BwYFfKK6jUXibabyNke72+1Jr0xpw1BHJPxNJ8Q8yCBLF0wmXmFJSM+9lSDd10Bni
+FJeMFMQ0T1Sf8GUSIxYYbMK5pDguRs+JOYkUID02ylJ3L6GAnxXCjGWzpdxw29/WWJc+qsYFEIbP
+kKzTUNQHaaLHmcLK22Ht
+-----END CERTIFICATE-----
diff --git a/sepolicy/vendor/google/certs/pulse-release.x509.pem b/sepolicy/vendor/google/certs/pulse-release.x509.pem new file mode 100644 index 00000000..fb11572f --- /dev/null +++ b/sepolicy/vendor/google/certs/pulse-release.x509.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICUjCCAbsCBEk0mH4wDQYJKoZIhvcNAQEEBQAwcDELMAkGA1UEBhMCVVMxCzAJ +BgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29n +bGUsIEluYzEUMBIGA1UECxMLR29vZ2xlLCBJbmMxEDAOBgNVBAMTB1Vua25vd24w +HhcNMDgxMjAyMDIwNzU4WhcNMzYwNDE5MDIwNzU4WjBwMQswCQYDVQQGEwJVUzEL +MAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC0dv +b2dsZSwgSW5jMRQwEgYDVQQLEwtHb29nbGUsIEluYzEQMA4GA1UEAxMHVW5rbm93 +bjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAn0gDGZD5sUcmOE4EU9GPjAu/ +jcd7JQSksSB8TGxEurwArcZhD6a2qy2oDjPy7vFrJqP2uFua+sqQn/u+s/TJT36B +IqeY4OunXO090in6c2X0FRZBWqnBYX3Vg84Zuuigu9iF/BeptL0mQIBRIarbk3fe +tAATOBQYiC7FIoL8WA0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQBAhmae1jHaQ4Td +0GHSJuBzuYzEuZ34teS+njy+l1Aeg98cb6lZwM5gXE/SrG0chM7eIEdsurGb6PIg +Ov93F61lLY/MiQcI0SFtqERXWSZJ4OnTxLtM9Y2hnbHU/EG8uVhPZOZfQQ0FKf1b +aIOMFB0Km9HbEZHLKg33kOoMsS2zpA== +-----END CERTIFICATE----- diff --git a/sepolicy/vendor/google/citadeld.te b/sepolicy/vendor/google/citadeld.te new file mode 100644 index 00000000..e0425188 --- /dev/null +++ b/sepolicy/vendor/google/citadeld.te @@ -0,0 +1 @@ +allow citadeld debugfs_ipc:dir search; diff --git a/sepolicy/vendor/google/color_init.te b/sepolicy/vendor/google/color_init.te new file mode 100644 index 00000000..46c3ebc0 --- /dev/null +++ b/sepolicy/vendor/google/color_init.te @@ -0,0 +1,3 @@ +type color_init, domain; +type color_init_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(color_init)
\ No newline at end of file diff --git a/sepolicy/vendor/google/device.te b/sepolicy/vendor/google/device.te new file mode 100644 index 00000000..11d2fc35 --- /dev/null +++ b/sepolicy/vendor/google/device.te @@ -0,0 +1,7 @@ +type ramoops_device, dev_type; +type rls_device, dev_type; +type dp_block_device, dev_type; +type qg_device, dev_type; +type logbuffer_device, dev_type; +type smcinvoke_device, dev_type; +type battery_history_device, dev_type; diff --git a/sepolicy/vendor/google/device_drop_monitor.te b/sepolicy/vendor/google/device_drop_monitor.te new file mode 100644 index 00000000..8c0c0b77 --- /dev/null +++ b/sepolicy/vendor/google/device_drop_monitor.te @@ -0,0 +1,15 @@ +type device_drop_monitor, domain, coredomain; + +userdebug_or_eng(` + app_domain(device_drop_monitor) + + allow device_drop_monitor app_api_service:service_manager find; + allow device_drop_monitor fwk_stats_hwservice:hwservice_manager find; + allow device_drop_monitor sysfs_msm_subsys:dir search; + allow device_drop_monitor sysfs_msm_subsys:file r_file_perms; + allow device_drop_monitor fwk_stats_service:service_manager find; + binder_call(device_drop_monitor, gpuservice); + binder_call(device_drop_monitor, stats_service_server); + binder_use(device_drop_monitor) +') + diff --git a/sepolicy/vendor/google/dumpstate.te b/sepolicy/vendor/google/dumpstate.te new file mode 100644 index 00000000..c69e8745 --- /dev/null +++ b/sepolicy/vendor/google/dumpstate.te @@ -0,0 +1,24 @@ +dump_hal(hal_telephony) +dump_hal(hal_graphics_composer) + +userdebug_or_eng(` + allow dumpstate debugfs_dma_buf:file r_file_perms; + allow dumpstate media_rw_data_file:file append; + dontaudit dumpstate su:process sigkill; +') + +# For collecting bugreports. +allow dumpstate sysfs_scsi_devices_0000:file r_file_perms; + +allow dumpstate persist_file:dir r_dir_perms; +allow dumpstate firmware_file:dir r_dir_perms; +allow dumpstate firmware_file:filesystem getattr; + +dontaudit dumpstate debugfs_dma_buf:file r_file_perms; +dontaudit dumpstate incidentd:process sigkill; + +# dumpstate may trigger a screen capture using /system/bin/screencap. In this +# case, the gralloc implementation will attempt to retrieve information about +# the GPU using /sys/class/kgsl/**/gpu_model. +allow dumpstate sysfs_msm_subsys:dir search; +allow dumpstate sysfs_msm_subsys:file rw_file_perms; diff --git a/sepolicy/vendor/google/e2fs.te b/sepolicy/vendor/google/e2fs.te new file mode 100644 index 00000000..4d2b596c --- /dev/null +++ b/sepolicy/vendor/google/e2fs.te @@ -0,0 +1,2 @@ +allow e2fs sysfs_scsi_devices_0000:dir r_dir_perms; +allow e2fs sysfs_scsi_devices_0000:file r_file_perms; diff --git a/sepolicy/vendor/google/euiccpixel_app.te b/sepolicy/vendor/google/euiccpixel_app.te new file mode 100644 index 00000000..bef7b07b --- /dev/null +++ b/sepolicy/vendor/google/euiccpixel_app.te @@ -0,0 +1,9 @@ +type euiccpixel_app, domain; +app_domain(euiccpixel_app) + +allow euiccpixel_app app_api_service:service_manager find; +allow euiccpixel_app radio_service:service_manager find; +allow euiccpixel_app nfc_service:service_manager find; + +set_prop(euiccpixel_app, vendor_secure_element_prop) +set_prop(euiccpixel_app, vendor_modem_prop) diff --git a/sepolicy/vendor/google/fastbootd.te b/sepolicy/vendor/google/fastbootd.te new file mode 100644 index 00000000..9b542501 --- /dev/null +++ b/sepolicy/vendor/google/fastbootd.te @@ -0,0 +1,10 @@ +recovery_only(` + allow fastbootd boot_block_device:blk_file r_file_perms; + allow fastbootd custom_ab_block_device:blk_file { w_file_perms ioctl getattr }; + allow fastbootd dp_block_device:blk_file r_file_perms; + allow fastbootd gpt_block_device:blk_file rw_file_perms; + allow fastbootd modem_block_device:blk_file getattr; + allow fastbootd sysfs_scsi_devices_0000:dir r_dir_perms; + allow fastbootd sg_device:chr_file rw_file_perms; + allow fastbootd citadel_device:chr_file rw_file_perms; +') diff --git a/sepolicy/vendor/google/file.te b/sepolicy/vendor/google/file.te new file mode 100644 index 00000000..53a5f889 --- /dev/null +++ b/sepolicy/vendor/google/file.te @@ -0,0 +1,53 @@ +type persist_battery_file, file_type, vendor_persist_type; +type persist_haptics_file, file_type, vendor_persist_type; +type modem_stat_data_file, file_type, data_file_type; +type modem_dump_file, file_type, data_file_type; +type tcpdump_vendor_data_file, file_type, data_file_type, mlstrustedobject; +type ramoops_vendor_data_file, file_type, data_file_type, mlstrustedobject; +type proc_touch, proc_type, fs_type, mlstrustedobject; +type debugfs_batteryinfo, debugfs_type, fs_type; +type sysfs_chargelevel, sysfs_type, fs_type; +type sysfs_display, sysfs_type, fs_type; +type sysfs_touch, sysfs_type, fs_type; +type sysfs_power_stats_ignore, sysfs_type, fs_type; +type sysfs_camera, sysfs_type, fs_type; +type sysfs_pixelstats, fs_type, sysfs_type; +type sysfs_pstore, sysfs_type, fs_type; +type debugfs_f2fs, debugfs_type, fs_type; +type proc_f2fs, proc_type, fs_type; +type sysfs_esim, sysfs_type, fs_type; +type sysfs_imei, sysfs_type, fs_type; +type debugfs_usb, debugfs_type, fs_type; +type mediadrm_vendor_data_file, file_type, data_file_type; +type diag_socket, file_type, mlstrustedobject; +type debugfs_dma_buf, debugfs_type, fs_type; +type debugfs_clk, debugfs_type, fs_type; +type debugfs_pmic, debugfs_type, fs_type; +type sysfs_contaminant, sysfs_type, fs_type; +type sysfs_fingerprint, sysfs_type, fs_type; +type sysfs_typec_info, sysfs_type, fs_type; +type per_boot_file, file_type, data_file_type, core_data_file_type; +type proc_scsi, proc_type, fs_type; +type sysfs_call_state, sysfs_type, fs_type; +type proc_sched_lib_mask_cpuinfo, proc_type, fs_type; + +# Dumpstates bootloader logs +type proc_bldrlog, fs_type, proc_type; + +# Dumpstats IPA statistics +type debugfs_ipa, debugfs_type, fs_type; + +# IPA Data Stall Detection +type debugfs_ipa_data_stall_detection, debugfs_type, fs_type; + +# Incremental file system driver +type vendor_incremental_module, vendor_file_type, file_type; + +# All files under /data/vendor/firmware/wifi +type updated_wifi_firmware_data_file, file_type, data_file_type; + +# Firmware mount +type firmware_file, file_type, contextmount_type, vendor_file_type; +allow firmware_file self:filesystem associate; + +type sysfs_wlc, sysfs_type, fs_type; diff --git a/sepolicy/vendor/google/file_contexts b/sepolicy/vendor/google/file_contexts new file mode 100644 index 00000000..5a0e30c2 --- /dev/null +++ b/sepolicy/vendor/google/file_contexts @@ -0,0 +1,71 @@ +# dev nodes +/dev/access-metadata u:object_r:ramoops_device:s0 +/dev/access-ramoops u:object_r:ramoops_device:s0 +/dev/block/zram0 u:object_r:swap_block_device:s0 +/dev/vd6281 u:object_r:rls_device:s0 +/dev/sensor_tunnel u:object_r:rls_device:s0 +/dev/qg u:object_r:qg_device:s0 +/dev/qg_battery u:object_r:qg_device:s0 +/dev/battery_history u:object_r:battery_history_device:s0 +/dev/logbuffer_tcpm u:object_r:logbuffer_device:s0 +/dev/logbuffer_usbpd u:object_r:logbuffer_device:s0 +/dev/logbuffer_pps u:object_r:logbuffer_device:s0 +/dev/logbuffer_ssoc u:object_r:logbuffer_device:s0 +/dev/logbuffer_smblib u:object_r:logbuffer_device:s0 +/dev/logbuffer_ttf u:object_r:logbuffer_device:s0 +/dev/logbuffer_wireless u:object_r:logbuffer_device:s0 +/dev/logbuffer_rtx u:object_r:logbuffer_device:s0 + +# vendor binaries +/vendor/bin/hw/android\.hardware\.camera\.provider@2\.7-service-google u:object_r:hal_camera_default_exec:s0 +/vendor/bin/hw/android\.hardware\.contexthub@1\.2-service\.generic u:object_r:hal_contexthub_default_exec:s0 +/vendor/bin/hw/android\.hardware\.neuralnetworks@1\.2-service-noronha u:object_r:hal_neuralnetworks_darwinn_exec:s0 +/vendor/bin/hw/android\.hardware\.power\.stats@1\.0-service\.pixel u:object_r:hal_power_stats_default_exec:s0 +/vendor/bin/hw/hardware\.google\.light@1\.1-service u:object_r:hal_light_default_exec:s0 +/vendor/bin/hw/vendor\.google\.radioext@1\.0-service u:object_r:hal_radioext_default_exec:s0 +/vendor/bin/color_init u:object_r:color_init_exec:s0 +/vendor/bin/init\.ramoops\.sh u:object_r:ramoops_exec:s0 +/vendor/bin/modem_svc u:object_r:modem_svc_exec:s0 +/vendor/bin/ramoops u:object_r:ramoops_exec:s0 +/vendor/bin/rlsservice u:object_r:rlsservice_exec:s0 +/vendor/bin/init\.radio\.sh u:object_r:init_radio_exec:s0 +/vendor/bin/hw/vendor\.google\.wifi_ext@1\.0-service-vendor u:object_r:hal_wifi_ext_exec:s0 +/vendor/bin/hw/vendor\.google\.wifi_ext@1\.0-service-vendor-lazy u:object_r:hal_wifi_ext_exec:s0 +/vendor/bin/hw/vendor\.google\.wifi_ext-service-vendor u:object_r:hal_wifi_ext_exec:s0 +/vendor/bin/hw/vendor\.google\.wifi_ext-service-vendor-lazy u:object_r:hal_wifi_ext_exec:s0 +/vendor/bin/tcpdump_logger u:object_r:tcpdump_logger_exec:s0 +/vendor/bin/hw/vendor\.google\.wireless_charger@1\.3-service-vendor u:object_r:hal_wlc_exec:s0 +/vendor/bin/hw/vendor.qti.hardware.display.composer-service u:object_r:hal_graphics_composer_default_exec:s0 +/vendor/bin/hw/init_dp u:object_r:init_dp_exec:s0 +/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.2-service\.fpc u:object_r:hal_fingerprint_default_exec:s0 +/vendor/bin/init\.qti\.chg_policy\.sh u:object_r:init_qti_chg_policy_exec:s0 +/vendor/bin/init\.modem\.sh u:object_r:init_modem_exec:s0 +/vendor/bin/init\.gadgethal\.sh u:object_r:init_gadgethal_exec:s0 +/vendor/bin/init\.twoshay\.sh u:object_r:init_twoshay_exec:s0 +/vendor/bin/init\.insmod\.sh u:object_r:init-insmod-sh_exec:s0 +/vendor/bin/hw/android\.hardware\.contexthub-service\.generic u:object_r:hal_contexthub_default_exec:s0 +/vendor/bin/hw/android\.hardware\.contexthub@1\.[0-9]-service\.generic u:object_r:hal_contexthub_default_exec:s0 +/vendor/bin/hw/vendor\.google\.wireless_charger@1\.[0-9]-service-vendor u:object_r:hal_wlc_exec:s0 + +# Vendor firmware +/vendor/firmware_mnt(/.*)? u:object_r:firmware_file:s0 + +/mnt/vendor/persist/battery(/.*)? u:object_r:persist_battery_file:s0 +/mnt/vendor/persist/haptics(/.*)? u:object_r:persist_haptics_file:s0 + +# Incremental file system driver +/vendor/lib/modules/incrementalfs\.ko u:object_r:vendor_incremental_module:s0 + +# data files +/data/vendor/modem_stat/debug\.txt u:object_r:modem_stat_data_file:s0 +/data/vendor/modem_dump(/.*)? u:object_r:modem_dump_file:s0 +/data/vendor/tcpdump_logger(/.*)? u:object_r:tcpdump_vendor_data_file:s0 +/data/vendor_ce/[0-9]+/ramoops(/.*)? u:object_r:ramoops_vendor_data_file:s0 +/data/per_boot(/.*)? u:object_r:per_boot_file:s0 +/data/vendor/firmware/wifi(/.*)? u:object_r:updated_wifi_firmware_data_file:s0 + +# dev socket node +/dev/socket/diag_router u:object_r:diag_socket:s0 + +#vendor_kernel_modules +/vendor/lib/modules/.*\.ko u:object_r:vendor_kernel_modules:s0 diff --git a/sepolicy/vendor/google/fsck.te b/sepolicy/vendor/google/fsck.te new file mode 100644 index 00000000..7d94ea1f --- /dev/null +++ b/sepolicy/vendor/google/fsck.te @@ -0,0 +1,3 @@ +allow fsck persist_block_device:blk_file rw_file_perms; +allow fsck sysfs_scsi_devices_0000:dir r_dir_perms; +allow fsck sysfs_scsi_devices_0000:file r_file_perms; diff --git a/sepolicy/vendor/google/genfs_contexts b/sepolicy/vendor/google/genfs_contexts new file mode 100644 index 00000000..01141f4d --- /dev/null +++ b/sepolicy/vendor/google/genfs_contexts @@ -0,0 +1,280 @@ +genfscon debugfs /f2fs u:object_r:debugfs_f2fs:s0 +genfscon sysfs /devices/soc0 u:object_r:sysfs_soc:s0 +genfscon sysfs /devices/soc0/serial_number u:object_r:sysfs_soc_sensitive:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/slowio_read_cnt u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/slowio_write_cnt u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/slowio_unmap_cnt u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/slowio_sync_cnt u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/manual_gc u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/io_stats u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/req_stats u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/err_stats u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/device_descriptor u:object_r:sysfs_scsi_devices_0000:s0 +genfscon proc /sys/vm/swappiness u:object_r:proc_swappiness:s0 +genfscon proc /fs/f2fs u:object_r:proc_f2fs:s0 +genfscon proc /irq u:object_r:proc_irq:s0 +genfscon proc /scsi u:object_r:proc_scsi:s0 + +# Touch +genfscon sysfs /devices/platform/soc/880000.spi/spi_master/spi0/spi0.0 u:object_r:sysfs_touch:s0 +genfscon proc /fts/driver_test u:object_r:proc_touch:s0 +genfscon sysfs /devices/virtual/sec/tsp u:object_r:sysfs_touch:s0 + +# PowerHal +genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,cpu-cpu-llcc-bw/devfreq u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,cpu-llcc-ddr-bw/devfreq u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/18321000.qcom,devfreq-l3/18321000.qcom,devfreq-l3:qcom,cpu0-cpu-l3-lat/devfreq u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/18321000.qcom,devfreq-l3/18321000.qcom,devfreq-l3:qcom,cpu6-cpu-l3-lat/devfreq u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/18321000.qcom,devfreq-l3/18321000.qcom,devfreq-l3:qcom,cpu7-cpu-l3-lat/devfreq u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/clkgate_enable u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/hibern8_on_idle_enable u:object_r:sysfs_scsi_devices_0000:s0 +genfscon debugfs /sched_features u:object_r:debugfs_sched_features:s0 +genfscon proc /sys/kernel/sched_lib_name u:object_r:proc_sched_lib_mask_cpuinfo:s0 +genfscon proc /sys/kernel/sched_lib_mask_force u:object_r:proc_sched_lib_mask_cpuinfo:s0 + +# PowerStatsHal +genfscon sysfs /power/system_sleep/stats u:object_r:sysfs_power_stats:s0 +genfscon sysfs /power/rpmh_stats/master_stats u:object_r:sysfs_power_stats:s0 +genfscon sysfs /kernel/wifi/power_stats u:object_r:sysfs_power_stats:s0 +genfscon sysfs /devices/platform/soc/soc:abc-sm/state_stats +u:object_r:sysfs_power_stats:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-0010/iio:device3 +u:object_r:sysfs_power_stats:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-0018/iio:device4 +u:object_r:sysfs_power_stats:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-001f/iio:device5 +u:object_r:sysfs_power_stats:s0 +genfscon sysfs /devices/platform/soc/984000.i2c/i2c-0/0-0008/power_stats u:object_r:sysfs_power_stats:s0 + +# Not used by PowerStatsHal +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm8150@0:vadc@3100/iio:device0 +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8150b@2:vadc@3100/iio:device1 +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-04/c440000.qcom,spmi:qcom,pm8150l@4:vadc@3100/iio:device2 +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-00/c440000.qcom,spmi:qcom,pm8150@0:vadc@3100/iio:device0 +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm8150b@2:vadc@3100/iio:device1 +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-04/c440000.qcom,spmi:qcom,pm8150l@4:vadc@3100/iio:device2 +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:vadc@3100/iio:device1/name +u:object_r:sysfs_power_stats_ignore:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-04/c440000.qcom,spmi:qcom,pm8150l@4:vadc@3100/iio:device2/name +u:object_r:sysfs_power_stats_ignore:s0 + +# Display +genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/backlight u:object_r:sysfs_leds:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/panel_info u:object_r:sysfs_display:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/gamma u:object_r:sysfs_display:s0 + +# PMIC +genfscon debugfs /regmap/spmi0-05/address u:object_r:debugfs_pmic:s0 +genfscon debugfs /regmap/spmi0-05/count u:object_r:debugfs_pmic:s0 +genfscon debugfs /regmap/spmi0-05/data u:object_r:debugfs_pmic:s0 + +# Vibrator +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-005a u:object_r:sysfs_vibrator:s0 + +# Camera +genfscon sysfs /devices/platform/soc/ac4a000.qcom,cci u:object_r:sysfs_camera:s0 +genfscon sysfs /devices/platform/soc/ac4b000.qcom,cci u:object_r:sysfs_camera:s0 + +# eSIM status +genfscon sysfs /firmware/devicetree/base/chosen/cdt/cdb2/esim u:object_r:sysfs_esim:s0 + +# Thermal +genfscon sysfs /devices/platform/soc/18323000.qcom,cpufreq-hw u:object_r:sysfs_thermal:s0 + +# Battery +genfscon sysfs /devices/platform/soc/soc:google,battery/power_supply/battery u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/charge_disable u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qpnp,qg/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:google,bms/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qpnp,qg/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:google,bms/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-0050/ u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-003b/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/health_descriptor u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /devices/platform/soc/1d84000.ufshc/host0/target0:0:0/0:0:0: u:object_r:sysfs_scsi_devices_0000:s0 +genfscon sysfs /class/qcom-battery u:object_r:sysfs_batteryinfo:s0 +genfscon debugfs /logbuffer/ssoc u:object_r:debugfs_batteryinfo:s0 +genfscon debugfs /logbuffer/ttf u:object_r:debugfs_batteryinfo:s0 +genfscon debugfs /logbuffer/wireless u:object_r:debugfs_batteryinfo:s0 +genfscon debugfs /logbuffer/rtx u:object_r:debugfs_batteryinfo:s0 +genfscon debugfs /google_charger u:object_r:debugfs_batteryinfo:s0 +genfscon debugfs /google_battery u:object_r:debugfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/charge_start_level u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/charge_stop_level u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_drainto_soc u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_recharge_soc u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_recharge_voltage u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_resume_abs_temp u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_resume_soc u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_resume_temp u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_resume_time u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_trigger_temp u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_trigger_time u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_trigger_voltage u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_temp_enable u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_temp_dry_run u:object_r:sysfs_chargelevel:s0 +genfscon sysfs /devices/platform/soc/soc:google,charger/bd_clear u:object_r:sysfs_chargelevel:s0 + + +# Pixelstats +genfscon sysfs /devices/platform/codec_detect/resistance_left_right u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/soc/soc:google,overheat_mitigation u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/codec_detect/codec_state u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/codec_detect/wdsp_stat u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/codec_detect/headset_codec_state u:object_r:sysfs_pixelstats:s0 + + +# Audio Dsp for HardwareInfo +genfscon sysfs /devices/platform/codec_detect/hwinfo_part_number u:object_r:sysfs_audio:s0 +genfscon sysfs /devices/platform/soc/984000.i2c/i2c-0/0-0057/i2c_reset u:object_r:sysfs_audio:s0 + +# USB +genfscon debugfs /usb/tcpm-usbpd0 u:object_r:debugfs_usb:s0 +genfscon debugfs /logbuffer/usbpd u:object_r:debugfs_usb:s0 +genfscon debugfs /logbuffer/smblib u:object_r:debugfs_usb:s0 +genfscon debugfs /logbuffer/pps u:object_r:debugfs_usb:s0 +genfscon sysfs /class/typec u:object_r:sysfs_typec_info:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/typec u:object_r:sysfs_typec_info:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/usb_limit_sink_current u:object_r:sysfs_typec_info:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/usb_limit_sink_enable u:object_r:sysfs_typec_info:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/usb_limit_source_enable u:object_r:sysfs_typec_info:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/typec u:object_r:sysfs_typec_info:s0 + +# Dumpstate hal +genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_buf:s0 +genfscon debugfs /dma_buf/dmaprocs u:object_r:debugfs_dma_buf:s0 + +# Power +genfscon debugfs /clk/debug_suspend u:object_r:debugfs_clk:s0 + +# ramoops +genfscon sysfs /devices/virtual/ramoops/pstore/aes_key u:object_r:sysfs_pstore:s0 +genfscon sysfs /devices/virtual/ramoops/pstore/aes_key_iv u:object_r:sysfs_pstore:s0 +genfscon sysfs /devices/virtual/ramoops/pstore/aes_key_tag u:object_r:sysfs_pstore:s0 +genfscon sysfs /devices/virtual/ramoops/pstore/use_alt u:object_r:sysfs_pstore:s0 + +# pmic +genfscon debugfs /pmic-votable u:object_r:debugfs_pmic:s0 + +# USB contaminant detection +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb/moisture_detected u:object_r:sysfs_contaminant:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb/moisture_detection_enabled u:object_r:sysfs_contaminant:s0 + +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb/moisture_detected u:object_r:sysfs_contaminant:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb/moisture_detection_enabled u:object_r:sysfs_contaminant:s0 + +# Bootloader +genfscon proc /bldrlog u:object_r:proc_bldrlog:s0 + +# Fingerprint +genfscon sysfs /devices/platform/soc/soc:fp_fpc1020 u:object_r:sysfs_fingerprint:s0 + +# Dumpstats IPA statistics +genfscon debugfs /ipa/ipa_statistics_msg u:object_r:debugfs_ipa:s0 + +# IPA Data Stall Detection +genfscon debugfs /ipawwan/debug u:object_r:debugfs_ipa_data_stall_detection:s0 + +# IMEI/MEID +genfscon sysfs /firmware/devicetree/base/chosen/cdt/cdb2/imei1 u:object_r:sysfs_imei:s0 +genfscon sysfs /firmware/devicetree/base/chosen/cdt/cdb2/imei2 u:object_r:sysfs_imei:s0 +genfscon sysfs /firmware/devicetree/base/chosen/cdt/cdb2/meid1 u:object_r:sysfs_imei:s0 +genfscon sysfs /firmware/devicetree/base/chosen/cdt/cdb2/meid2 u:object_r:sysfs_imei:s0 + +# Sensor ALSP feature +genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/te2_table u:object_r:sysfs_leds:s0 + +# Call state +genfscon sysfs /devices/platform/soc/soc:qcom,msm-audio-apr/soc:qcom,msm-audio-apr:qcom,q6core-audio/soc:qcom,msm-audio-apr:qcom,q6core-audio:sound/call_state u:object_r:sysfs_call_state:s0 + +# Extcon +genfscon sysfs /devices/platform/soc/soc:qcom,msm-ext-disp/extcon u:object_r:sysfs_extcon:s0 +genfscon sysfs /devices/platform/soc/88e0000.qcom,msm-eud/extcon u:object_r:sysfs_extcon:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/extcon u:object_r:sysfs_extcon:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/extcon u:object_r:sysfs_extcon:s0 + +# Wakeup stats (new) +# https://lkml.org/lkml/2019/8/6/1275 +genfscon sysfs /devices/platform/soc/18800000.qcom,icnss/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/1e00000.qcom,ipa/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/880000.spi/spi_master/spi0/spi0.0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/888000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/88e0000.qcom,msm-eud/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/890000.spi/spi_master/spi1/spi1.0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/894000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/984000.i2c/i2c-0/0-0008/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/984000.i2c/i2c-0/0-0057/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-003b/power_supply/wireless/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/98c000.i2c/i2c-1/1-003b/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/a600000.ssusb/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/rtc/rtc0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,power-on@800/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:google,bms/power_supply/sm7250_bms/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,power-on@800/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/dc/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/main/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/pc_port/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/power_supply/tcpm-source-psy-usbpd0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qpnp,qg/power_supply/bms/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-04/c440000.qcom,spmi:qcom,pm8150l@4:qcom,power-on@800/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/rtc/rtc0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,power-on@800/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:google,bms/power_supply/sm7250_bms/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,power-on@800/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/dc/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/main/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/pc_port/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/power_supply/tcpm-source-psy-usbpd0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-02/c440000.qcom,spmi:qcom,pm7250b@2:qpnp,qg/power_supply/bms/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-04/c440000.qcom,spmi:qcom,pm8150l@4:qcom,power-on@800/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:google,battery/power_supply/battery/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:gpio_keys/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:keydebug/keycombo.0.auto/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,msm-audio-apr/soc:qcom,msm-audio-apr:qcom,q6core-audio/soc:qcom,msm-audio-apr:qcom,q6core-audio:bolero-cdc/rx-macro/rx_swr_ctrl/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,msm-audio-apr/soc:qcom,msm-audio-apr:qcom,q6core-audio/soc:qcom,msm-audio-apr:qcom,q6core-audio:bolero-cdc/tx-macro/tx_swr_ctrl/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,smp2p-adsp/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,smp2p-cdsp/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,smp2p-mpss/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,smp2p-npu/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,smp2p_sleepstate/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/diag/diag/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_aac/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_alac/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_amrnb/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_amrwb/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_amrwbplus/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_ape/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_evrc/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_g711alaw/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_g711mlaw/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_mp3/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_multi_aac/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_qcelp/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_wma/wakeup u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/virtual/misc/msm_wmapro/wakeup u:object_r:sysfs_wakeup:s0 diff --git a/sepolicy/vendor/google/google_camera_app.te b/sepolicy/vendor/google/google_camera_app.te new file mode 100644 index 00000000..2b4af1ac --- /dev/null +++ b/sepolicy/vendor/google/google_camera_app.te @@ -0,0 +1,80 @@ +## Custom security policy for Google Camera App, the default camera application on Pixel devices. +## +## Google Camera App is a standard app for the most part, but on Pixel devices +## it has access to hardware accelerators such as Hexagon and Airbrush. +## +## This policy defines the extra rules necessary for that access. + +## Untrusted_app_domain disallows access to new HW services, and since +## GCA needs to talk to airbrush, this doesn't work. So the following +## rules duplicate untrusted_app_domain to the extent needed by GCA, +## by copying from core/sepolicy/private/untrusted_app_all.te and +## other .te files that refer to untrusted_app_all. + +# Some apps ship with shared libraries and binaries that they write out +# to their sandbox directory and then execute. +allow google_camera_app privapp_data_file:file { r_file_perms execute }; +allow google_camera_app app_data_file:file { r_file_perms execute }; +auditallow google_camera_app app_data_file:file execute; + +# Allow handling of less common filesystem objects +allow google_camera_app app_data_file:{ lnk_file sock_file fifo_file } create_file_perms; + +# Read and write system app data files passed over Binder. +# Motivating case was /data/data/com.android.settings/cache/*.jpg for +# cropping or taking user photos. +allow google_camera_app system_app_data_file:file { read write getattr }; + +allow google_camera_app app_api_service:service_manager find; +allow google_camera_app audioserver_service:service_manager find; +allow google_camera_app cameraserver_service:service_manager find; +allow google_camera_app drmserver_service:service_manager find; +allow google_camera_app mediaserver_service:service_manager find; +allow google_camera_app mediaextractor_service:service_manager find; +allow google_camera_app mediametrics_service:service_manager find; +allow google_camera_app mediadrmserver_service:service_manager find; +allow google_camera_app nfc_service:service_manager find; +allow google_camera_app radio_service:service_manager find; + +# gdbserver for ndk-gdb ptrace attaches to app process. +allow google_camera_app self:process ptrace; + +# Android Studio Instant Run has the application connect to a +# runas_app socket listening in the abstract namespace. +# https://developer.android.com/studio/run/ +allow google_camera_app runas_app:unix_stream_socket connectto; + +# Untrusted apps need to be able to send a SIGCHLD to runas_app +# when running under a debugger +allow google_camera_app runas_app:process sigchld; + +# allow untrusted apps to use UDP sockets provided by the system server but not +# modify them other than to connect +allow google_camera_app system_server:udp_socket { + connect getattr read recvfrom sendto write getopt setopt }; + +# Allow lldb/ndk-gdb/simpleperf to ptrace attach to debuggable app processes. +allow runas_app google_camera_app:process { ptrace signal sigstop }; +allow runas_app google_camera_app:unix_stream_socket connectto; + +# simpleperf_app_runner switches to the app security context. +allow simpleperf_app_runner google_camera_app:process dyntransition; # setcon + +## Extra capabilities for Google Camera App + +## Access to Hexagon DSP kernel device +allow google_camera_app qdsp_device:chr_file r_file_perms; + +# Read adsp files, for Hexagon access +allow google_camera_app adsprpcd_file:lnk_file r_file_perms; + +# Allow read camera prop +get_prop(google_camera_app, vendor_camera_prop) +get_prop(google_camera_app, vendor_camera_ro_prop) + +# Allow read vendor display prop +get_prop(google_camera_app, vendor_display_prop) + +# Allow read sysfs soc +allow google_camera_app sysfs_soc:dir search; +allow google_camera_app sysfs_soc:file r_file_perms; diff --git a/sepolicy/vendor/google/grilservice_app.te b/sepolicy/vendor/google/grilservice_app.te new file mode 100644 index 00000000..4188d8f3 --- /dev/null +++ b/sepolicy/vendor/google/grilservice_app.te @@ -0,0 +1,18 @@ +type grilservice_app, domain; + +app_domain(grilservice_app) + +allow grilservice_app hal_bluetooth_coexistence_hwservice:hwservice_manager find; +allow grilservice_app hal_radioext_hwservice:hwservice_manager find; +allow grilservice_app hal_wifi_ext_hwservice:hwservice_manager find; +allow grilservice_app hal_wifi_ext_service:service_manager find; +allow grilservice_app app_api_service:service_manager find; +binder_call(grilservice_app, hal_bluetooth_default) +binder_call(grilservice_app, hal_radioext_default) +binder_call(grilservice_app, hal_wifi_ext) + +# this denial on grilservice_app since this AudioMetric functionality is not used in legacy device. +dontaudit grilservice_app hal_audiometricext_hwservice:hwservice_manager find; +# this denial on grilservice_app since ODPM isn't accessed / available on legacy devices. +dontaudit grilservice_app hal_power_stats_service:service_manager find; + diff --git a/sepolicy/vendor/google/hal_camera_default.te b/sepolicy/vendor/google/hal_camera_default.te new file mode 100644 index 00000000..e90e7c7f --- /dev/null +++ b/sepolicy/vendor/google/hal_camera_default.te @@ -0,0 +1,62 @@ +vndbinder_use(hal_camera_default); +allow hal_camera_default sysfs_soc:dir search; +allow hal_camera_default sysfs_soc:file r_file_perms; +allow hal_camera_default sysfs_ssr:file r_file_perms; +allow hal_camera_default gpu_device:chr_file rw_file_perms; + +# For camera hal to use factory calibration data +allow hal_camera_default mnt_vendor_file:dir search; +allow hal_camera_default persist_file:lnk_file read; +allow hal_camera_default persist_file:dir search; +allow hal_camera_default persist_camera_file:dir search; +allow hal_camera_default persist_camera_file:file r_file_perms; + +# For camera hal to use system property +get_prop(hal_camera_default, vendor_display_prop) +set_prop(hal_camera_default, vendor_camera_prop) +get_prop(hal_camera_default, vendor_camera_ro_prop) + +# For camera hal to talk with rlsservice +allow hal_camera_default rls_service:service_manager find; +binder_call(hal_camera_default, rlsservice) + +# For camera hal to talk with gralloc +hal_client_domain(hal_camera_default, hal_graphics_allocator) +hal_client_domain(hal_camera_default, hal_graphics_composer) +allow hal_camera_default hal_graphics_mapper_hwservice:hwservice_manager find; + +# QSPM hal service for accessing camera info +hal_client_domain(hal_camera_default, hal_qspmhal) + +#For camera hal to talk with ECOService. +allow hal_camera_default eco_service:service_manager find; +binder_call(hal_camera_default, mediacodec) + +# For camera hal to communicate with with power HAL +hal_client_domain(hal_camera_default, hal_power) + +# For camera hal to communicate with the thermal HAL. +hal_client_domain(hal_camera_default, hal_thermal) + +# For camera hal to control priority of current process +hal_client_domain(hal_camera_default, hal_configstore) +allow hal_camera_default self:capability sys_nice; +allow hal_camera_default self:qipcrtr_socket create_socket_perms_no_ioctl; + +# For camera hal to talk with system server (for sensor access) +binder_call(hal_camera_default, sensor_service_server) + +# For camera hal to talk with GPU and dontaudit unnecessary files in /sys +dontaudit hal_camera_default sysfs_msm_subsys:dir search; + +# For camera hal to talk with NNAPI service +hal_client_domain(hal_camera_default, hal_neuralnetworks) + +# For camera hal to set kernel driver scheduler policy +allow hal_camera_default kernel:process setsched; + +# For camera debugging +userdebug_or_eng(` + allow hal_camera_default camera_vendor_data_file:dir create_dir_perms; + allow hal_camera_default camera_vendor_data_file:file create_file_perms; +') diff --git a/sepolicy/vendor/google/hal_confirmationui.te b/sepolicy/vendor/google/hal_confirmationui.te new file mode 100644 index 00000000..97609fd7 --- /dev/null +++ b/sepolicy/vendor/google/hal_confirmationui.te @@ -0,0 +1,3 @@ +binder_call(hal_confirmationui_server, hal_tui_comm_qti) +binder_call(hal_confirmationui_server, citadeld) +allow hal_confirmationui_server citadeld_service:service_manager find; diff --git a/sepolicy/vendor/google/hal_contexthub.te b/sepolicy/vendor/google/hal_contexthub.te new file mode 100644 index 00000000..10c5d53d --- /dev/null +++ b/sepolicy/vendor/google/hal_contexthub.te @@ -0,0 +1,3 @@ +# Allow context hub HAL to communicate with daemon via socket +allow hal_contexthub_default chre:unix_stream_socket connectto; +allow hal_contexthub_default chre_socket:sock_file write; diff --git a/sepolicy/vendor/google/hal_dumpstate_impl.te b/sepolicy/vendor/google/hal_dumpstate_impl.te new file mode 100644 index 00000000..fa75a28e --- /dev/null +++ b/sepolicy/vendor/google/hal_dumpstate_impl.te @@ -0,0 +1,180 @@ +type hal_dumpstate_impl, domain; +type hal_dumpstate_impl_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_dumpstate_impl) +hal_server_domain(hal_dumpstate_impl, hal_dumpstate) + +# Allow to write dumpstate_board.txt +allow hal_dumpstate_impl shell_data_file:file getattr; + +# Execute dump scripts from vendor partition +allow hal_dumpstate_impl vendor_shell_exec:file rx_file_perms; +allow hal_dumpstate_impl vendor_toolbox_exec:file rx_file_perms; + +userdebug_or_eng(` + allow hal_dumpstate_impl proc_bldrlog:file r_file_perms; +') + +dontaudit hal_dumpstate_impl proc_bldrlog:file r_file_perms; + +# Touch sysfs interface +allow hal_dumpstate_impl sysfs_touch:dir r_dir_perms; +allow hal_dumpstate_impl sysfs_touch:file rw_file_perms; +allow hal_dumpstate_impl proc_touch:file rw_file_perms; + +# For dma_buf/ion dump +allow hal_dumpstate_impl debugfs_dma_buf:file r_file_perms; +r_dir_file(hal_dumpstate_impl, debugfs_ion) + +# Access /dev/block/mapper/ +allow hal_dumpstate_impl block_device:dir r_dir_perms; + +# dump Battery/Charger/Guage +allow hal_dumpstate_impl debugfs_pmic:dir r_dir_perms; +allow hal_dumpstate_impl debugfs_pmic:file r_file_perms; +userdebug_or_eng(` + allow hal_dumpstate_impl debugfs_batteryinfo:dir r_dir_perms; + allow hal_dumpstate_impl debugfs_batteryinfo:file r_file_perms; + allow hal_dumpstate_impl debugfs_pmic:file rw_file_perms; +') +dontaudit hal_dumpstate_impl debugfs_batteryinfo:dir r_dir_perms; +dontaudit hal_dumpstate_impl debugfs_batteryinfo:file r_file_perms; +allow hal_dumpstate_impl sysfs_chargelevel:file r_file_perms; +allow hal_dumpstate_impl sysfs_batteryinfo:file r_file_perms; + +# dump usb files +allow hal_dumpstate_impl debugfs_usb:file r_file_perms; + +# dump power supply stats +allow hal_dumpstate_impl sysfs_batteryinfo:dir r_dir_perms; +allow hal_dumpstate_impl sysfs_batteryinfo:file r_file_perms; + +# Dumpstats IPA statistics +userdebug_or_eng(` + allow hal_dumpstate_impl debugfs_ipa:file r_file_perms; +') + +# Allow to read pixel-trace trace file +allow hal_dumpstate_impl debugfs_tracing_instances:dir search; +allow hal_dumpstate_impl debugfs_tracing_instances:file r_file_perms; + +# Access to modem files +userdebug_or_eng(` + allow hal_dumpstate_impl tcpdump_vendor_data_file:dir create_dir_perms; + allow hal_dumpstate_impl tcpdump_vendor_data_file:file create_file_perms; + allow hal_dumpstate_impl ssr_log_file:dir search; + allow hal_dumpstate_impl ssr_log_file:file r_file_perms; + allow hal_dumpstate_impl mpss_rfs_data_file:dir r_dir_perms; + allow hal_dumpstate_impl mpss_rfs_data_file:file r_file_perms; + allow hal_dumpstate_impl netmgrd_data_file:dir r_dir_perms; + allow hal_dumpstate_impl netmgrd_data_file:file r_file_perms; + + set_prop(hal_dumpstate_impl, vendor_tcpdump_log_prop) +') +dontaudit hal_dumpstate_impl debugfs_ipa:file r_file_perms; + +allow hal_dumpstate_impl debugfs_tzdbg:file r_file_perms; +allow hal_dumpstate_impl debugfs_tzdbg:dir r_dir_perms; + +# dump ipc files +allow hal_dumpstate_impl debugfs_ipc:dir r_dir_perms; +allow hal_dumpstate_impl debugfs_ipc:file r_file_perms; + +# Access to modem dump and radio data files +allow hal_dumpstate_impl modem_dump_file:dir create_dir_perms; +allow hal_dumpstate_impl modem_dump_file:file create_file_perms; +allow hal_dumpstate_impl vendor_radio_data_file:dir r_dir_perms; +allow hal_dumpstate_impl vendor_radio_data_file:file r_file_perms; + +# Access to modem stat +domain_auto_trans(hal_dumpstate_impl, modem_svc_exec, modem_svc) +allow hal_dumpstate_impl modem_stat_data_file:file r_file_perms; + +set_prop(hal_dumpstate_impl, vendor_modem_diag_prop) +get_prop(hal_dumpstate_impl, vendor_radio_prop) + +# Access to Citadel is via citadeld +vndbinder_use(hal_dumpstate_impl) +binder_call(hal_dumpstate_impl, citadeld) +allow hal_dumpstate_impl citadeld_service:service_manager find; +allow hal_dumpstate_impl citadel_updater_exec:file execute_no_trans; + +# Access to UFS/F2FS info +allow hal_dumpstate_impl debugfs_f2fs:dir r_dir_perms; +allow hal_dumpstate_impl debugfs_f2fs:file r_file_perms; +allow hal_dumpstate_impl proc_f2fs:dir r_dir_perms; +allow hal_dumpstate_impl proc_f2fs:file r_file_perms; +allow hal_dumpstate_impl sysfs_scsi_devices_0000:dir r_dir_perms; +allow hal_dumpstate_impl sysfs_scsi_devices_0000:file r_file_perms; +allow hal_dumpstate_impl proc_scsi:dir r_dir_perms; +allow hal_dumpstate_impl proc_scsi:file r_file_perms; + +# Access to prop +get_prop(hal_dumpstate_impl, boottime_public_prop) + +# Access to files for dumping +allow hal_dumpstate_impl sysfs:dir r_dir_perms; + +# Access /dev/logbuffer* +allow hal_dumpstate_impl logbuffer_device:chr_file r_file_perms; + +dontaudit hal_dumpstate_impl tcpdump_vendor_data_file:dir create_dir_perms; +dontaudit hal_dumpstate_impl tcpdump_vendor_data_file:file create_file_perms; +dontaudit hal_dumpstate_impl vendor_tcpdump_log_prop:file r_file_perms; +dontaudit hal_dumpstate_impl netmgrd_data_file:dir r_dir_perms; +dontaudit hal_dumpstate_impl netmgrd_data_file:file r_file_perms; + +# Access to vendor logging property +set_prop(hal_dumpstate_impl, vendor_logging_prop) + +# Access /d/icnss/stats +allow hal_dumpstate_impl debugfs_icnss:dir r_dir_perms; +allow hal_dumpstate_impl debugfs_icnss:file r_file_perms; + +# Allow to access wlan debug info by dumpstate +allow hal_dumpstate_impl debugfs_wlan:dir r_dir_perms; +allow hal_dumpstate_impl debugfs_wlan:file r_file_perms; +allow hal_dumpstate_impl sysfs_msm_wlan:dir r_dir_perms; +allow hal_dumpstate_impl sysfs_power_stats:file r_file_perms; + +# Allow to dump page_owner +userdebug_or_eng(` + allow hal_dumpstate_impl debugfs_page_owner:file r_file_perms; +') + +#Dumpstats fastrpc buffer +allow hal_dumpstate_impl sysfs_fastrpc:file r_file_perms; + +# Allow to access eSIM status +allow hal_dumpstate_impl sysfs_esim:file r_file_perms; + +# Allow to access panel info +allow hal_dumpstate_impl sysfs_display:dir r_dir_perms; +allow hal_dumpstate_impl sysfs_display:file r_file_perms; + +#dump sensors log +userdebug_or_eng(` + allow hal_dumpstate_impl sensors_vendor_data_file:dir r_dir_perms; + allow hal_dumpstate_impl sensors_vendor_data_file:file r_file_perms; +') + +# Allow to dump datastall log +userdebug_or_eng(` + allow hal_dumpstate_impl vendor_radio_data_file:file create_file_perms; + allow hal_dumpstate_impl vendor_radio_data_file:dir rw_dir_perms; +') + +# Allow reading and writing camera profiler +userdebug_or_eng(` + allow hal_dumpstate_impl camera_vendor_data_file:dir r_dir_perms; + allow hal_dumpstate_impl camera_vendor_data_file:file r_file_perms; +') +dontaudit hal_dumpstate_impl camera_vendor_data_file:dir r_dir_perms; +dontaudit hal_dumpstate_impl camera_vendor_data_file:file r_file_perms; + +dontaudit hal_dumpstate_impl sensors_vendor_data_file:dir r_dir_perms; +dontaudit hal_dumpstate_impl sensors_vendor_data_file:file r_file_perms; + +# Access to thermal debug data +r_dir_file(hal_dumpstate_impl, sysfs_thermal) + +dontaudit hal_dumpstate_impl rootfs:dir rw_dir_perms; diff --git a/sepolicy/vendor/google/hal_fingerprint.te b/sepolicy/vendor/google/hal_fingerprint.te new file mode 100644 index 00000000..7de66923 --- /dev/null +++ b/sepolicy/vendor/google/hal_fingerprint.te @@ -0,0 +1,15 @@ +allow hal_fingerprint sysfs_fingerprint:dir r_dir_perms; +allow hal_fingerprint sysfs_fingerprint:file rw_file_perms; +allow hal_fingerprint sysfs_msm_subsys:dir search; +allow hal_fingerprint sysfs_msm_subsys:file r_file_perms; +allow hal_fingerprint tee_device:chr_file rw_file_perms; +allow hal_fingerprint uhid_device:chr_file rw_file_perms; +allow hal_fingerprint fwk_stats_hwservice:hwservice_manager find; +binder_call(hal_fingerprint_default, statsd); + +dontaudit hal_fingerprint_default sysfs_camera:dir search; +dontaudit hal_fingerprint_default sysfs_camera:file r_file_perms; +dontaudit hal_fingerprint_default sysfs_rmtfs:dir search; +dontaudit hal_fingerprint_default sysfs_rmtfs:file r_file_perms; +dontaudit hal_fingerprint_default sysfs_thermal:dir search; +dontaudit hal_fingerprint_default sysfs_thermal:file r_file_perms; diff --git a/sepolicy/vendor/google/hal_health_default.te b/sepolicy/vendor/google/hal_health_default.te new file mode 100644 index 00000000..c9e6a0b5 --- /dev/null +++ b/sepolicy/vendor/google/hal_health_default.te @@ -0,0 +1,18 @@ +r_dir_file(hal_health_default, sysfs_scsi_devices_0000) +set_prop(hal_health_default, vendor_shutdown_prop) +set_prop(hal_health_default, vendor_battery_defender_prop) + +allow hal_health_default fwk_stats_hwservice:hwservice_manager find; +allow hal_health_default fwk_stats_service:service_manager find; +binder_use(hal_health_default) + +allow hal_health_default sysfs_thermal:dir r_dir_perms; +allow hal_health_default sysfs_thermal:file rw_file_perms; +allow hal_health_default persist_file:dir search; +allow hal_health_default persist_battery_file:file create_file_perms; +allow hal_health_default persist_battery_file:dir rw_dir_perms; +allow hal_health_default mnt_vendor_file:dir search; +allow hal_health_default sysfs_chargelevel:file rw_file_perms; +allow hal_health_default sysfs_batteryinfo:file w_file_perms; + +r_dir_file(hal_health_default, sysfs_typec_info) diff --git a/sepolicy/vendor/google/hal_health_storage_default.te b/sepolicy/vendor/google/hal_health_storage_default.te new file mode 100644 index 00000000..436297ac --- /dev/null +++ b/sepolicy/vendor/google/hal_health_storage_default.te @@ -0,0 +1,4 @@ +# idle-maint +get_prop(hal_health_storage_default, vendor_hw_plat_prop) +allow hal_health_storage_default metadata_file:dir r_dir_perms; +allow hal_health_storage_default sysfs_scsi_devices_0000:file rw_file_perms; diff --git a/sepolicy/vendor/google/hal_neuralnetworks_darwinn.te b/sepolicy/vendor/google/hal_neuralnetworks_darwinn.te new file mode 100644 index 00000000..204b6f00 --- /dev/null +++ b/sepolicy/vendor/google/hal_neuralnetworks_darwinn.te @@ -0,0 +1,3 @@ +type hal_neuralnetworks_darwinn, domain; +type hal_neuralnetworks_darwinn_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_neuralnetworks_darwinn)
\ No newline at end of file diff --git a/sepolicy/vendor/google/hal_power_default.te b/sepolicy/vendor/google/hal_power_default.te new file mode 100644 index 00000000..1da3393e --- /dev/null +++ b/sepolicy/vendor/google/hal_power_default.te @@ -0,0 +1,7 @@ +allow hal_power_default sysfs_msm_subsys:dir search; +allow hal_power_default sysfs_msm_subsys:file rw_file_perms; +allow hal_power_default sysfs_thermal:dir r_dir_perms; +allow hal_power_default sysfs_thermal:file rw_file_perms; +allow hal_power_default sysfs_scsi_devices_0000:file rw_file_perms; +allow hal_power_default sysfs_fs_f2fs:dir r_dir_perms; +allow hal_power_default sysfs_fs_f2fs:file rw_file_perms; diff --git a/sepolicy/vendor/google/hal_power_stats_default.te b/sepolicy/vendor/google/hal_power_stats_default.te new file mode 100644 index 00000000..fac8cda9 --- /dev/null +++ b/sepolicy/vendor/google/hal_power_stats_default.te @@ -0,0 +1,11 @@ +allow hal_power_stats_default sysfs_msm_wlan:dir search; # Needed to traverse to wlan stats file +get_prop(hal_power_stats_default, wifi_hal_prop) # Needed to detect wifi on/off +r_dir_file(hal_power_stats_default, sysfs_power_stats) # Needed to traverse platform low power stats +r_dir_file(hal_power_stats_default, sysfs_iio_devices) # Needed to traverse odpm files +r_dir_file(hal_power_stats_default, sysfs_msm_subsys) # Needed to traverse subsystem low power stats +r_dir_file(hal_power_stats_default, sysfs_leds) # Needed to track display stats + +binder_call(hal_power_stats, citadeld) + +dontaudit hal_power_stats_default sysfs_power_stats_ignore:file r_file_perms; +dontaudit hal_power_stats_default sysfs_power_stats_ignore:dir r_dir_perms; diff --git a/sepolicy/vendor/google/hal_radioext_default.te b/sepolicy/vendor/google/hal_radioext_default.te new file mode 100644 index 00000000..1a6ac358 --- /dev/null +++ b/sepolicy/vendor/google/hal_radioext_default.te @@ -0,0 +1,35 @@ +type hal_radioext_default, domain; +type hal_radioext_default_exec, exec_type, vendor_file_type, file_type; +hal_server_domain(hal_radioext_default, hal_telephony) +init_daemon_domain(hal_radioext_default) + +hwbinder_use(hal_radioext_default) +get_prop(hal_radioext_default, hwservicemanager_prop) +add_hwservice(hal_radioext_default, hal_radioext_hwservice) +binder_call(hal_radioext_default, grilservice_app) + +r_dir_file(hal_radioext_default, sysfs_msm_subsys) + +allow hal_radioext_default self:socket create_socket_perms; +allow hal_radioext_default qmuxd_socket:dir w_dir_perms; +allow hal_radioext_default qmuxd_socket:sock_file create_file_perms; +allow hal_radioext_default sysfs_soc:dir search; +allow hal_radioext_default sysfs_soc:file r_file_perms; +allow hal_radioext_default self:qipcrtr_socket create_socket_perms_no_ioctl; +allowxperm hal_radioext_default self:socket ioctl msm_sock_ipc_ioctls; + +allow hal_radioext_default hal_wifi_ext_hwservice:hwservice_manager find; +allow hal_radioext_default hal_wifi_ext_service:service_manager find; +allow hal_radioext_default hal_wifi_ext:binder call; + +allow hal_radioext_default hal_bluetooth_coexistence_hwservice:hwservice_manager find; +allow hal_radioext_default hal_bluetooth_default:binder call; + +userdebug_or_eng(` + allow hal_radioext_default vendor_radio_data_file:dir create_dir_perms; + allow hal_radioext_default vendor_radio_data_file:file create_file_perms; +') + +allow hal_radioext_default modem_stat_data_file:file create_file_perms; + +dontaudit hal_radioext_default kernel:system module_request; diff --git a/sepolicy/vendor/google/hal_sensors_default.te b/sepolicy/vendor/google/hal_sensors_default.te new file mode 100644 index 00000000..4a9adc8b --- /dev/null +++ b/sepolicy/vendor/google/hal_sensors_default.te @@ -0,0 +1,13 @@ +get_prop(hal_sensors_default, vendor_display_prop) + +allow hal_sensors_default sysfs_leds:dir search; +allow hal_sensors_default sysfs_leds:file rw_file_perms; + +# Allow Suez nanoapp clients to connect to CHRE. +allow hal_sensors_default chre_socket:sock_file write; +allow hal_sensors_default chre:unix_stream_socket connectto; + +# Allow SensorSuez to connect AIDL stats. +binder_use(hal_sensors_default); +get_prop(hal_sensors_default, boot_status_prop); +allow hal_sensors_default fwk_stats_service:service_manager find; diff --git a/sepolicy/vendor/google/hal_usb_impl.te b/sepolicy/vendor/google/hal_usb_impl.te new file mode 100644 index 00000000..12160ca3 --- /dev/null +++ b/sepolicy/vendor/google/hal_usb_impl.te @@ -0,0 +1,15 @@ +type hal_usb_impl, domain; +hal_server_domain(hal_usb_impl, hal_usb) +hal_server_domain(hal_usb_impl, hal_usb_gadget) + +type hal_usb_impl_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_usb_impl) + +set_prop(hal_usb_impl, vendor_usb_prop) + +allow hal_usb_impl sysfs_typec_info:dir r_dir_perms; +allow hal_usb_impl sysfs_typec_info:file rw_file_perms; +allow hal_usb_impl sysfs_batteryinfo:dir search; +allow hal_usb_impl sysfs_batteryinfo:file r_file_perms; +allow hal_usb_impl sysfs_contaminant:file rw_file_perms; +allow hal_usb_impl sysfs_extcon:dir search; diff --git a/sepolicy/vendor/google/hal_vibrator_default.te b/sepolicy/vendor/google/hal_vibrator_default.te new file mode 100644 index 00000000..0ba33f27 --- /dev/null +++ b/sepolicy/vendor/google/hal_vibrator_default.te @@ -0,0 +1,12 @@ +allow hal_vibrator_default sysfs_leds:dir search; + +allow hal_vibrator_default mnt_vendor_file:dir search; +allow hal_vibrator_default persist_file:dir search; +r_dir_file(hal_vibrator_default, persist_haptics_file) +allow hal_vibrator_default sysfs_thermal:dir r_dir_perms; +allow hal_vibrator_default sysfs_thermal:file r_file_perms; + +get_prop(hal_vibrator_default, vendor_vibrator_prop); +binder_call(hal_vibrator_default, system_server) +allow hal_vibrator_default fwk_sensor_hwservice:hwservice_manager find; +allow hal_vibrator_default fwk_sensor_service:service_manager find; diff --git a/sepolicy/vendor/google/hal_wifi_ext.te b/sepolicy/vendor/google/hal_wifi_ext.te new file mode 100644 index 00000000..32aa39c6 --- /dev/null +++ b/sepolicy/vendor/google/hal_wifi_ext.te @@ -0,0 +1,46 @@ +type hal_wifi_ext, domain; +hal_server_domain(hal_wifi_ext, hal_wifi) + +type hal_wifi_ext_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_wifi_ext) + +# Allow to start the IWifi:wifi_ext service +add_hwservice(hal_wifi_ext, hal_wifi_ext_hwservice); +add_service(hal_wifi_ext, hal_wifi_ext_service) + +# Allow wifi hal access to LOWI +allow hal_wifi_ext location:unix_stream_socket connectto; +allow hal_wifi_ext location:unix_dgram_socket sendto; +allow hal_wifi_ext wifihal_socket:dir rw_dir_perms; +allow hal_wifi_ext wifihal_socket:sock_file create_file_perms; + +# write to files owned by location daemon +allow hal_wifi_ext location_socket:dir search; +allow hal_wifi_ext location_socket:sock_file write; + +# Write wlan driver/fw version into property +set_prop(hal_wifi_ext, vendor_wifi_version) + +# allow hal_wifi to write into /proc/debugdriver/driverdump +r_dir_file(hal_wifi_ext, proc_wifi_dbg) + +# Allow wifi_ext to report callbacks to gril-service app +binder_call(hal_wifi_ext, grilservice_app) + +# Allow hal_wifi to write into /dev/wlan +allow hal_wifi_ext wlan_device:chr_file rw_file_perms; + +# Allow wifi_ext to read and write /data/vendor/firmware/wifi +allow hal_wifi_ext updated_wifi_firmware_data_file:dir rw_dir_perms; +allow hal_wifi_ext updated_wifi_firmware_data_file:file create_file_perms; + +# Allow wifi_ext to read the updated firmware files from app +allow hal_wifi_ext priv_app:fd use; +allow hal_wifi_ext privapp_data_file:file { read map }; + +userdebug_or_eng(` +# debugfs entries are only needed in user-debug or eng builds + +# Allow wifi hal to access wlan debugfs directories +allow hal_wifi_ext debugfs_wlan:dir r_dir_perms; +') diff --git a/sepolicy/vendor/google/hal_wireless_charger.te b/sepolicy/vendor/google/hal_wireless_charger.te new file mode 100644 index 00000000..f2e0b3ab --- /dev/null +++ b/sepolicy/vendor/google/hal_wireless_charger.te @@ -0,0 +1,8 @@ +type hal_wireless_charger, domain; +type hal_wireless_charger_exec, exec_type, vendor_file_type, file_type; + +# QCOM device only +allow hal_wireless_charger sysfs_chargelevel:file rw_file_perms; + +allow hal_wlc sysfs_wlc:dir r_dir_perms; +allow hal_wlc sysfs_wlc:file rw_file_perms; diff --git a/sepolicy/vendor/google/hal_wlc.te b/sepolicy/vendor/google/hal_wlc.te new file mode 100644 index 00000000..0339bbe8 --- /dev/null +++ b/sepolicy/vendor/google/hal_wlc.te @@ -0,0 +1,13 @@ +type hal_wlc, domain; +type hal_wlc_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(hal_wlc) + +hwbinder_use(hal_wlc) +add_hwservice(hal_wlc, hal_wlc_hwservice) +get_prop(hal_wlc, hwservicemanager_prop) + +# Allow access to /sys/class/power_supply/wireless +r_dir_file(hal_wlc, sysfs_batteryinfo) + +allow hal_wlc self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; diff --git a/sepolicy/vendor/google/hardware_info_app.te b/sepolicy/vendor/google/hardware_info_app.te new file mode 100644 index 00000000..557ed506 --- /dev/null +++ b/sepolicy/vendor/google/hardware_info_app.te @@ -0,0 +1,31 @@ +type hardware_info_app, domain; + +app_domain(hardware_info_app) + +## +## Sepolicy requseted by libhwinfo.jar and HardwareInfoService +## +allow hardware_info_app app_api_service:service_manager find; + +# putStorageHealthInfo +dontaudit hardware_info_app sysfs:file r_file_perms; + +# Batteryinfo +allow hardware_info_app sysfs_batteryinfo:dir search; +allow hardware_info_app sysfs_batteryinfo:file r_file_perms; + +# Storage +allow hardware_info_app sysfs_scsi_devices_0000:dir search; +allow hardware_info_app sysfs_scsi_devices_0000:file r_file_perms; + +# putApplicationProcessor +dontaudit hardware_info_app sysfs_soc:dir search; +dontaudit hardware_info_app sysfs_soc:file { getattr open read }; + +# Display +allow hardware_info_app sysfs_display:dir search; +allow hardware_info_app sysfs_display:file r_file_perms; + +# SysFS audio +allow hardware_info_app sysfs_audio:dir search; +allow hardware_info_app sysfs_audio:file r_file_perms; diff --git a/sepolicy/vendor/google/hbmsvmanager_app.te b/sepolicy/vendor/google/hbmsvmanager_app.te new file mode 100644 index 00000000..d33136f5 --- /dev/null +++ b/sepolicy/vendor/google/hbmsvmanager_app.te @@ -0,0 +1,13 @@ +type hbmsvmanager_app, domain, coredomain; + +app_domain(hbmsvmanager_app); +hal_client_domain(hbmsvmanager_app, hal_light) +hal_client_domain(hbmsvmanager_app, hal_qspmhal) + +allow hbmsvmanager_app hal_pixel_display_service:service_manager find; +binder_call(hbmsvmanager_app, hal_graphics_composer_default) + +# Standard system services +allow hbmsvmanager_app app_api_service:service_manager find; + +allow hbmsvmanager_app cameraserver_service:service_manager find; diff --git a/sepolicy/vendor/google/hwservice.te b/sepolicy/vendor/google/hwservice.te new file mode 100644 index 00000000..7ba9a7a1 --- /dev/null +++ b/sepolicy/vendor/google/hwservice.te @@ -0,0 +1,6 @@ +type hal_pixelstats_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_radioext_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_wifi_ext_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_wlc_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_bluetooth_coexistence_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_audiometricext_hwservice, hwservice_manager_type; diff --git a/sepolicy/vendor/google/hwservice_contexts b/sepolicy/vendor/google/hwservice_contexts new file mode 100644 index 00000000..51e5a317 --- /dev/null +++ b/sepolicy/vendor/google/hwservice_contexts @@ -0,0 +1,11 @@ +hardware.google.pixelstats::IPixelStats u:object_r:hal_pixelstats_hwservice:s0 +hardware.google.light::ILight u:object_r:hal_light_hwservice:s0 +hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance u:object_r:hal_bluetooth_coexistence_hwservice:s0 +hardware.google.bluetooth.sar::IBluetoothSar u:object_r:hal_bluetooth_coexistence_hwservice:s0 +vendor.google.radioext::IRadioExt u:object_r:hal_radioext_hwservice:s0 +vendor.google.wifi_ext::IWifiExt u:object_r:hal_wifi_ext_hwservice:s0 +vendor.google.wireless_charger::IWirelessCharger u:object_r:hal_wlc_hwservice:s0 +com.fingerprints.extension::IFingerprintEngineering u:object_r:hal_fingerprint_hwservice:s0 +com.fingerprints.extension::IFingerprintSensorTest u:object_r:hal_fingerprint_hwservice:s0 +com.fingerprints.extension::IFingerprintNavigation u:object_r:hal_fingerprint_hwservice:s0 +vendor.google.audiometricext::IAudioMetricExt u:object_r:hal_audiometricext_hwservice:s0 diff --git a/sepolicy/vendor/google/init-insmod-sh.te b/sepolicy/vendor/google/init-insmod-sh.te new file mode 100644 index 00000000..67530dc3 --- /dev/null +++ b/sepolicy/vendor/google/init-insmod-sh.te @@ -0,0 +1,23 @@ +# Allow insmod +type init-insmod-sh, domain; +type init-insmod-sh_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init-insmod-sh) + +allow init-insmod-sh kernel:process setsched; +allow init-insmod-sh self:capability { sys_module sys_nice }; +allow init-insmod-sh vendor_kernel_modules:system module_load; +allow init-insmod-sh vendor_toolbox_exec:file execute_no_trans; +allow init-insmod-sh sysfs_msm_boot:file w_file_perms; + +userdebug_or_eng(` + allow init-insmod-sh debugfs_ipc:dir search; + allow init-insmod-sh debugfs_wlan:dir search; +') + +set_prop(init-insmod-sh, vendor_device_prop) + +dontaudit init-insmod-sh debugfs_ipc:dir search; +dontaudit init-insmod-sh debugfs_wlan:dir search; +dontaudit init-insmod-sh debugfs_bootreceiver_tracing:dir search; +dontaudit init-insmod-sh proc_cmdline:file r_file_perms; diff --git a/sepolicy/vendor/google/init.te b/sepolicy/vendor/google/init.te new file mode 100644 index 00000000..42e1dd3f --- /dev/null +++ b/sepolicy/vendor/google/init.te @@ -0,0 +1,17 @@ +# Allow init to mount firmware +allow init firmware_file:dir mounton; +allow init firmware_file:filesystem { getattr mount relabelfrom }; + +allow init custom_ab_block_device:lnk_file relabelto; + +# This is needed for chaining a boot partition vbmeta +# descriptor, where init will probe the boot partition +# to read the chained vbmeta in the first-stage, then +# relabel /dev/block/by-name/boot_[a|b] to block_device +# after loading sepolicy in the second stage. +allow init boot_block_device:lnk_file relabelto; + +allow init sysfs_scsi_devices_0000:file w_file_perms; + +allow init per_boot_file:file ioctl; +allowxperm init per_boot_file:file ioctl { F2FS_IOC_SET_PIN_FILE }; diff --git a/sepolicy/vendor/google/init_dp.te b/sepolicy/vendor/google/init_dp.te new file mode 100644 index 00000000..cb5ffffc --- /dev/null +++ b/sepolicy/vendor/google/init_dp.te @@ -0,0 +1,14 @@ +type init_dp, domain; +type init_dp_exec, exec_type, vendor_file_type, file_type; + +userdebug_or_eng(` +# Shell script exec (toolbox) +allow init_dp vendor_toolbox_exec:file rx_file_perms; +allow init_dp proc_cmdline:file r_file_perms; + +# Find and write block device +allow init_dp block_device:dir search; +allow init_dp dp_block_device:blk_file rw_file_perms; + +init_daemon_domain(init_dp) +') diff --git a/sepolicy/vendor/google/init_gadgethal.te b/sepolicy/vendor/google/init_gadgethal.te new file mode 100644 index 00000000..b59e17a3 --- /dev/null +++ b/sepolicy/vendor/google/init_gadgethal.te @@ -0,0 +1,11 @@ +type init_gadgethal, domain; +type init_gadgethal_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init_gadgethal) + +allow init_gadgethal vendor_toolbox_exec:file execute_no_trans; + +allow init_gadgethal configfs:dir create_dir_perms; +allow init_gadgethal configfs:file { read setattr getattr }; +allow init_gadgethal configfs:lnk_file { read setattr getattr }; +allow init_gadgethal self:capability chown; diff --git a/sepolicy/vendor/google/init_modem.te b/sepolicy/vendor/google/init_modem.te new file mode 100644 index 00000000..ebfe13d0 --- /dev/null +++ b/sepolicy/vendor/google/init_modem.te @@ -0,0 +1,9 @@ +type init_modem, domain; +type init_modem_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(init_modem) + +set_prop(init_modem, vendor_modem_prop) + +allow init_modem sysfs_imei:file r_file_perms; + +allow init_modem vendor_toolbox_exec:file execute_no_trans; diff --git a/sepolicy/vendor/google/init_qti_chg_policy.te b/sepolicy/vendor/google/init_qti_chg_policy.te new file mode 100644 index 00000000..924d3d16 --- /dev/null +++ b/sepolicy/vendor/google/init_qti_chg_policy.te @@ -0,0 +1,18 @@ +type init_qti_chg_policy, domain; +type init_qti_chg_policy_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(init_qti_chg_policy) + +allow init_qti_chg_policy self:capability chown; +allow init_qti_chg_policy vendor_toolbox_exec:file rx_file_perms; +allow init_qti_chg_policy sysfs_batteryinfo:file create_file_perms; +allow init_qti_chg_policy sysfs_batteryinfo:dir r_dir_perms; +allow init_qti_chg_policy sysfs_contaminant:file create_file_perms; +allow init_qti_chg_policy sysfs_wakeup:dir r_dir_perms; +allow init_qti_chg_policy sysfs_wakeup:file getattr; +allow init_qti_chg_policy sysfs_iio_devices:dir search; +allow init_qti_chg_policy sysfs_power_stats_ignore:dir search; +allow init_qti_chg_policy sysfs_power_stats_ignore:file r_file_perms; +allow init_qti_chg_policy sysfs_power_stats:dir search; +allow init_qti_chg_policy sysfs_power_stats:file r_file_perms; + +set_prop(init_qti_chg_policy, vendor_hvdcp_opti_prop) diff --git a/sepolicy/vendor/google/init_radio.te b/sepolicy/vendor/google/init_radio.te new file mode 100644 index 00000000..26664d75 --- /dev/null +++ b/sepolicy/vendor/google/init_radio.te @@ -0,0 +1,8 @@ +type init_radio, domain; +type init_radio_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(init_radio) + +allow init_radio vendor_radio_data_file:dir create_dir_perms; +allow init_radio vendor_radio_data_file:file create_file_perms; + +allow init_radio vendor_toolbox_exec:file execute_no_trans; diff --git a/sepolicy/vendor/google/init_twoshay.te b/sepolicy/vendor/google/init_twoshay.te new file mode 100644 index 00000000..82b6971c --- /dev/null +++ b/sepolicy/vendor/google/init_twoshay.te @@ -0,0 +1,10 @@ +type init_twoshay, domain; +type init_twoshay_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(init_twoshay) + +allow init_twoshay vendor_toolbox_exec:file execute_no_trans; + +allow init_twoshay sysfs_display:dir search; +allow init_twoshay sysfs_display:file r_file_perms; + +set_prop(init_twoshay, vendor_twoshay_prop) diff --git a/sepolicy/vendor/google/ip_health_monitor.te b/sepolicy/vendor/google/ip_health_monitor.te new file mode 100644 index 00000000..352d7c14 --- /dev/null +++ b/sepolicy/vendor/google/ip_health_monitor.te @@ -0,0 +1,11 @@ +type ip_health_monitor, domain, coredomain; + +app_domain(ip_health_monitor) + +allow ip_health_monitor app_api_service:service_manager find; +allow ip_health_monitor fwk_stats_hwservice:hwservice_manager find; +allow ip_health_monitor fwk_stats_service:service_manager find; +allow ip_health_monitor sysfs_msm_subsys:dir search; +allow ip_health_monitor sysfs_msm_subsys:file r_file_perms; +binder_call(ip_health_monitor, stats_service_server); +binder_use(ip_health_monitor) diff --git a/sepolicy/vendor/google/kernel.te b/sepolicy/vendor/google/kernel.te new file mode 100644 index 00000000..53ec7cfa --- /dev/null +++ b/sepolicy/vendor/google/kernel.te @@ -0,0 +1,6 @@ +userdebug_or_eng(` + allow kernel debugfs_batteryinfo:dir search; +') +dontaudit kernel debugfs_batteryinfo:dir search; + +allow kernel per_boot_file:file r_file_perms; diff --git a/sepolicy/vendor/google/keys.conf b/sepolicy/vendor/google/keys.conf new file mode 100644 index 00000000..9151503b --- /dev/null +++ b/sepolicy/vendor/google/keys.conf @@ -0,0 +1,12 @@ +[@GOOGLE] +ALL : device/google/redbull/sepolicy/vendor/google/certs/app.x509.pem + +[@GOOGLEPULSE] +ALL : device/google/redbull/sepolicy/vendor/google/certs/pulse-release.x509.pem + +[@MDS] +ALL : device/google/redbull/sepolicy/vendor/google/certs/com_google_mds.x509.pem + +[@EUICCSUPPORTPIXEL] +ALL : device/google/redbull/sepolicy/vendor/google/certs/EuiccSupportPixel.x509.pem + diff --git a/sepolicy/vendor/google/logger_app.te b/sepolicy/vendor/google/logger_app.te new file mode 100644 index 00000000..caa22f34 --- /dev/null +++ b/sepolicy/vendor/google/logger_app.te @@ -0,0 +1,23 @@ +userdebug_or_eng(` + allow logger_app vendor_radio_data_file:file create_file_perms; + allow logger_app vendor_radio_data_file:dir create_dir_perms; + + allow logger_app tcpdump_vendor_data_file:dir create_dir_perms; + allow logger_app tcpdump_vendor_data_file:file create_file_perms; + + allow logger_app cnss_vendor_data_file:dir create_dir_perms; + allow logger_app cnss_vendor_data_file:file create_file_perms; + + get_prop(logger_app, radio_prop) + set_prop(logger_app, vendor_ramdump_prop) + set_prop(logger_app, logpersistd_logging_prop) + set_prop(logger_app, logd_prop) + set_prop(logger_app, vendor_ssr_prop) + set_prop(logger_app, vendor_cnss_diag_prop) + set_prop(logger_app, vendor_tcpdump_log_prop) + set_prop(logger_app, vendor_modem_diag_prop) + set_prop(logger_app, vendor_wifi_sniffer_prop) + set_prop(logger_app, vendor_usb_prop) + set_prop(logger_app, vendor_logging_prop) + set_prop(logger_app, vendor_logger_prop) +') diff --git a/sepolicy/vendor/google/mac_permissions.xml b/sepolicy/vendor/google/mac_permissions.xml new file mode 100644 index 00000000..070982fc --- /dev/null +++ b/sepolicy/vendor/google/mac_permissions.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<policy> + +<!-- + + * A signature is a hex encoded X.509 certificate or a tag defined in + keys.conf and is required for each signer tag. + * A signer tag may contain a seinfo tag and multiple package stanzas. + * A default tag is allowed that can contain policy for all apps not signed with a + previously listed cert. It may not contain any inner package stanzas. + * Each signer/default/package tag is allowed to contain one seinfo tag. This tag + represents additional info that each app can use in setting a SELinux security + context on the eventual process. + * When a package is installed the following logic is used to determine what seinfo + value, if any, is assigned. + - All signatures used to sign the app are checked first. + - If a signer stanza has inner package stanzas, those stanza will be checked + to try and match the package name of the app. If the package name matches + then that seinfo tag is used. If no inner package matches then the outer + seinfo tag is assigned. + - The default tag is consulted last if needed. +--> + <!-- google apps key --> + <signer signature="@GOOGLE" > + <seinfo value="google" /> + </signer> + <signer signature="@GOOGLEPULSE" > + <seinfo value="googlepulse" /> + </signer> + <signer signature="@MDS" > + <seinfo value="mds" /> + </signer> + <signer signature="@EUICCSUPPORTPIXEL" > + <seinfo value="EuiccSupportPixel" /> + </signer> +</policy> diff --git a/sepolicy/vendor/google/modem_diagnostics.te b/sepolicy/vendor/google/modem_diagnostics.te new file mode 100644 index 00000000..c481738b --- /dev/null +++ b/sepolicy/vendor/google/modem_diagnostics.te @@ -0,0 +1,24 @@ +type modem_diagnostic_app, domain; + +app_domain(modem_diagnostic_app) +net_domain(modem_diagnostic_app) + +allow modem_diagnostic_app app_api_service:service_manager find; +allow modem_diagnostic_app radio_service:service_manager find; + +userdebug_or_eng(` + allow modem_diagnostic_app diag_device:chr_file rw_file_perms; + allow modem_diagnostic_app sysfs_esim:file r_file_perms; + + allow modem_diagnostic_app ssr_log_file:dir r_dir_perms; + allow modem_diagnostic_app ssr_log_file:file r_file_perms; + + unix_socket_connect(modem_diagnostic_app, diag, qlogd); + + set_prop(modem_diagnostic_app, vendor_modem_diag_prop) + set_prop(modem_diagnostic_app, radio_control_prop) + set_prop(modem_diagnostic_app, vendor_radio_prop) + + allow modem_diagnostic_app sysfs_batteryinfo:file r_file_perms; + allow modem_diagnostic_app sysfs_batteryinfo:dir search; +') diff --git a/sepolicy/vendor/google/modem_svc.te b/sepolicy/vendor/google/modem_svc.te new file mode 100644 index 00000000..0197ba49 --- /dev/null +++ b/sepolicy/vendor/google/modem_svc.te @@ -0,0 +1,20 @@ +type modem_svc, domain; +type modem_svc_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(modem_svc) + +allow modem_svc self:capability net_bind_service; +allow modem_svc self:qipcrtr_socket create_socket_perms_no_ioctl; + +# For property service +set_prop(modem_svc, vendor_modem_diag_prop) +set_prop(modem_svc, vendor_modem_prop) +get_prop(modem_svc, radio_control_prop) +get_prop(modem_svc, vendor_build_type_prop) + +# For bugreport collection +allow modem_svc hal_dumpstate_impl:fd use; +allow modem_svc dumpstate:fd use; +allow modem_svc shell_data_file:file write; + +dontaudit modem_svc sysfs_msm_subsys:dir r_dir_perms; +dontaudit modem_svc sysfs_ssr:file r_file_perms; diff --git a/sepolicy/vendor/google/pixelstats_vendor.te b/sepolicy/vendor/google/pixelstats_vendor.te new file mode 100644 index 00000000..bb4a9d44 --- /dev/null +++ b/sepolicy/vendor/google/pixelstats_vendor.te @@ -0,0 +1,4 @@ +allow pixelstats_vendor sysfs_typec_info:dir search; +allow pixelstats_vendor sysfs_typec_info:file r_file_perms; +allow pixelstats_vendor battery_history_device:chr_file r_file_perms; +allow pixelstats_vendor fwk_stats_hwservice:hwservice_manager find; diff --git a/sepolicy/vendor/google/platform_app.te b/sepolicy/vendor/google/platform_app.te new file mode 100644 index 00000000..03004b31 --- /dev/null +++ b/sepolicy/vendor/google/platform_app.te @@ -0,0 +1,13 @@ +# To find and bind hal_wlc +allow platform_app hal_wlc_hwservice:hwservice_manager find; +binder_call(platform_app, hal_wlc) +binder_call(hal_wlc, platform_app) + +allow platform_app fwk_stats_hwservice:hwservice_manager find; +allow platform_app nfc_service:service_manager find; + +allow platform_app fwk_stats_service:service_manager find; +binder_use(platform_app) + +allow platform_app hal_wireless_charger_service:service_manager find; +binder_call(platform_app, hal_wireless_charger) diff --git a/sepolicy/vendor/google/property.te b/sepolicy/vendor/google/property.te new file mode 100644 index 00000000..5dea67ad --- /dev/null +++ b/sepolicy/vendor/google/property.te @@ -0,0 +1,22 @@ +vendor_internal_prop(vendor_battery_defender_prop) +vendor_internal_prop(vendor_build_type_prop) +vendor_internal_prop(vendor_ecoservice_prop) +vendor_internal_prop(vendor_modem_prop) +vendor_internal_prop(vendor_ramoops_prop) +vendor_internal_prop(vendor_sensor_prop) +vendor_internal_prop(vendor_shutdown_prop) +vendor_internal_prop(vendor_tcpdump_log_prop) +vendor_internal_prop(vendor_vibrator_prop) +vendor_internal_prop(vendor_twoshay_prop) +vendor_internal_prop(vendor_device_prop) +vendor_internal_prop(vendor_battery_profile_prop) + +# vendor verbose logging property +vendor_internal_prop(vendor_logging_prop) + +vendor_restricted_prop(vendor_camera_ro_prop) + +vendor_public_prop(vendor_hw_plat_prop) + +# Logger +vendor_internal_prop(vendor_logger_prop) diff --git a/sepolicy/vendor/google/property_contexts b/sepolicy/vendor/google/property_contexts new file mode 100644 index 00000000..119d9829 --- /dev/null +++ b/sepolicy/vendor/google/property_contexts @@ -0,0 +1,82 @@ +persist.vendor.radio.RATE_ADAPT_ENABLE u:object_r:vendor_radio_prop:s0 +persist.vendor.radio.ROTATION_ENABLE u:object_r:vendor_radio_prop:s0 +persist.vendor.radio.VT_ENABLE u:object_r:vendor_radio_prop:s0 +persist.vendor.radio.VT_HYBRID_ENABLE u:object_r:vendor_radio_prop:s0 +persist.vendor.radio.videopause.mode u:object_r:vendor_radio_prop:s0 +persist.vendor.radio.smlog_switch u:object_r:vendor_radio_prop:s0 + +ro.vendor.radio.log_loc u:object_r:vendor_radio_prop:s0 +ro.vendor.radio.log_prefix u:object_r:vendor_radio_prop:s0 + +persist.vendor.audio.fluence.voicecomm u:object_r:vendor_audio_prop:s0 + +ro.boot.usbcontroller u:object_r:vendor_usb_prop:s0 + +ro.boot.hardware.platform u:object_r:vendor_hw_plat_prop:s0 + +vendor.display.primary_red u:object_r:vendor_display_prop:s0 +vendor.display.primary_green u:object_r:vendor_display_prop:s0 +vendor.display.primary_blue u:object_r:vendor_display_prop:s0 +vendor.display.primary_white u:object_r:vendor_display_prop:s0 +vendor.display.native_display_primaries_ready u:object_r:vendor_display_prop:s0 + +# battery +vendor.battery.defender. u:object_r:vendor_battery_defender_prop:s0 + +# test battery profile +persist.vendor.testing_battery_profile u:object_r:vendor_battery_profile_prop:s0 + +# Tcpdump_logger +persist.vendor.tcpdump.log.alwayson u:object_r:vendor_tcpdump_log_prop:s0 +vendor.tcpdump.log.ondemand u:object_r:vendor_tcpdump_log_prop:s0 +vendor.tcpdump.log.alwayson u:object_r:vendor_tcpdump_log_prop:s0 +vendor.tcpdump.output.dir u:object_r:vendor_tcpdump_log_prop:s0 + +persist.vendor.shutdown. u:object_r:vendor_shutdown_prop:s0 + +# Google camera hal read only props +ro.vendor.camera. u:object_r:vendor_camera_ro_prop:s0 +ro.vendor.camera.res.fmq.size u:object_r:vendor_camera_ro_prop:s0 +ro.vendor.camera.req.fmq.size u:object_r:vendor_camera_ro_prop:s0 + +ro.vendor.build.type u:object_r:vendor_build_type_prop:s0 + + +persist.vendor.modem. u:object_r:vendor_modem_prop:s0 +persist.vendor.mdm. u:object_r:vendor_modem_prop:s0 +vendor.modem. u:object_r:vendor_modem_prop:s0 + +# ramoops +vendor.ramoops. u:object_r:vendor_ramoops_prop:s0 + +# FP HAL kpi +vendor.fpc_kpi u:object_r:vendor_default_prop:s0 + +# Vendor verbose logging prop +persist.vendor.verbose_logging_enabled u:object_r:vendor_logging_prop:s0 + +# Haptics HAL +ro.vendor.vibrator.hal.closeloop.threshold u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.config.dynamic u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.click.duration u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.tick.duration u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.heavyclick.duration u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.short.voltage u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.long.voltage u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.long.frequency.shift u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.effect.shape u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.steady.shape u:object_r:vendor_vibrator_prop:s0 +ro.vendor.vibrator.hal.lptrigger u:object_r:vendor_vibrator_prop:s0 + +# Sensor +vendor.sensor. u:object_r:vendor_sensor_prop:s0 + +# twoshay +vendor.twoshay.study_group u:object_r:vendor_twoshay_prop:s0 exact bool + +vendor.all.modules.ready u:object_r:vendor_device_prop:s0 +vendor.all.devices.ready u:object_r:vendor_device_prop:s0 + +# Logger app +vendor.pixellogger. u:object_r:vendor_logger_prop:s0 +persist.vendor.pixellogger. u:object_r:vendor_logger_prop:s0 diff --git a/sepolicy/vendor/google/ramdump_app.te b/sepolicy/vendor/google/ramdump_app.te new file mode 100644 index 00000000..fa4f9eb0 --- /dev/null +++ b/sepolicy/vendor/google/ramdump_app.te @@ -0,0 +1,18 @@ +type ramdump_app, domain; + +userdebug_or_eng(` + app_domain(ramdump_app) + + allow ramdump_app app_api_service:service_manager find; + + allow ramdump_app ramdump_vendor_data_file:file create_file_perms; + allow ramdump_app ramdump_vendor_data_file:dir create_dir_perms; + + set_prop(ramdump_app, vendor_ramdump_prop) + get_prop(ramdump_app, system_boot_reason_prop) + + # To access ramdumpfs. + allow ramdump_app mnt_vendor_file:dir search; + allow ramdump_app ramdump_vendor_mnt_file:dir create_dir_perms; + allow ramdump_app ramdump_vendor_mnt_file:file create_file_perms; +') diff --git a/sepolicy/vendor/google/ramoops.te b/sepolicy/vendor/google/ramoops.te new file mode 100644 index 00000000..9dc2bdc3 --- /dev/null +++ b/sepolicy/vendor/google/ramoops.te @@ -0,0 +1,12 @@ +type ramoops, domain; +type ramoops_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(ramoops); + +allow ramoops ramoops_exec:file rx_file_perms; +allow ramoops vendor_toolbox_exec:file rx_file_perms; +allow ramoops sysfs_pstore:file rw_file_perms; +allow ramoops ramoops_device:chr_file rw_file_perms; +allow ramoops ramoops_vendor_data_file:file create_file_perms; +allow ramoops ramoops_vendor_data_file:dir rw_dir_perms; + +set_prop(ramoops, vendor_ramoops_prop); diff --git a/sepolicy/vendor/google/recovery.te b/sepolicy/vendor/google/recovery.te new file mode 100644 index 00000000..39cb5575 --- /dev/null +++ b/sepolicy/vendor/google/recovery.te @@ -0,0 +1,4 @@ +recovery_only(` + allow recovery sg_device:chr_file rw_file_perms; + allow recovery sysfs_scsi_devices_0000:dir r_dir_perms; +') diff --git a/sepolicy/vendor/google/rlsservice.te b/sepolicy/vendor/google/rlsservice.te new file mode 100644 index 00000000..de0913e5 --- /dev/null +++ b/sepolicy/vendor/google/rlsservice.te @@ -0,0 +1,31 @@ +type rlsservice, domain; +type rlsservice_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(rlsservice) +vndbinder_use(rlsservice) +add_service(rlsservice, rls_service) + +# access vd6281 rainbow sensor files +allow rlsservice rls_device:chr_file rw_file_perms; + +# For rlsservice to use factory calibration data +allow rlsservice mnt_vendor_file:dir search; +allow rlsservice persist_file:dir search; +allow rlsservice persist_camera_file:dir search; +allow rlsservice persist_camera_file:file r_file_perms; + +allow rlsservice hal_camera_default:binder call; + +# For rlsservice to access display related sys file nodes +allow rlsservice sysfs_msm_subsys:dir search; +allow rlsservice sysfs_msm_subsys:file r_file_perms; +allow rlsservice sysfs_leds:dir search; +allow rlsservice sysfs_leds:file r_file_perms; + +# For rlsservice to access audio +allow rlsservice audio_device:dir search; +allow rlsservice audio_device:chr_file rw_file_perms; +allow rlsservice proc_asound:dir search; +allow rlsservice proc_asound:file r_file_perms; + +# For rlsservice to access sensor +binder_call(rlsservice, hal_sensors_default) diff --git a/sepolicy/vendor/google/seapp_contexts b/sepolicy/vendor/google/seapp_contexts new file mode 100644 index 00000000..71f4cb57 --- /dev/null +++ b/sepolicy/vendor/google/seapp_contexts @@ -0,0 +1,17 @@ +# Domain for Ramdump +user=system seinfo=platform name=com.google.SSRestartDetector domain=ssr_detector_app type=system_app_data_file levelFrom=user +user=_app seinfo=platform name=com.android.ramdump domain=ramdump_app type=app_data_file levelFrom=all + +# Domain for grilservice +user=_app isPrivApp=true name=com.google.android.grilservice domain=grilservice_app levelFrom=all + +# Domain for Modem Diagnostic System +user=_app seinfo=mds name=com.google.mds domain=modem_diagnostic_app type=app_data_file levelFrom=user +user=_app seinfo=platform name=com.google.mds domain=modem_diagnostic_app type=app_data_file levelFrom=user + +# Domain for GoogleCBRS app +user=_app seinfo=platform name=com.google.googlecbrs domain=cbrs_setup_app type=app_data_file levelFrom=user + +# Domain for EuiccSupportPixel +user=_app isPrivApp=true seinfo=EuiccSupportPixel name=com.google.euiccpixel domain=euiccpixel_app type=app_data_file levelFrom=all + diff --git a/sepolicy/vendor/google/sensor_service_server.te b/sepolicy/vendor/google/sensor_service_server.te new file mode 100644 index 00000000..71c13efc --- /dev/null +++ b/sepolicy/vendor/google/sensor_service_server.te @@ -0,0 +1,2 @@ +binder_call(sensor_service_server, hal_camera_default) +binder_call(sensor_service_server, hal_graphics_composer_default) diff --git a/sepolicy/vendor/google/service.te b/sepolicy/vendor/google/service.te new file mode 100644 index 00000000..27abf848 --- /dev/null +++ b/sepolicy/vendor/google/service.te @@ -0,0 +1,5 @@ +type hal_pixel_display_service, service_manager_type, hal_service_type; +type hal_wifi_ext_service, service_manager_type, hal_service_type; + +type hal_wireless_charger_service, hal_service_type, protected_service, service_manager_type; +type eco_service, service_manager_type; diff --git a/sepolicy/vendor/google/service_contexts b/sepolicy/vendor/google/service_contexts new file mode 100644 index 00000000..40989edf --- /dev/null +++ b/sepolicy/vendor/google/service_contexts @@ -0,0 +1,7 @@ +android.hardware.drm.IDrmFactory/widevine u:object_r:hal_drm_service:s0 +com.google.hardware.pixel.display.IDisplay/default u:object_r:hal_pixel_display_service:s0 +vendor.google.wifi_ext.IWifiExt/default u:object_r:hal_wifi_ext_service:s0 + +vendor.google.wireless_charger.IWirelessCharger/default u:object_r:hal_wireless_charger_service:s0 + +media.ecoservice u:object_r:eco_service:s0 diff --git a/sepolicy/vendor/google/shell.te b/sepolicy/vendor/google/shell.te new file mode 100644 index 00000000..eba9c9ef --- /dev/null +++ b/sepolicy/vendor/google/shell.te @@ -0,0 +1,2 @@ +get_prop(shell, vendor_hvdcp_opti_prop) +get_prop(shell, vendor_hw_plat_prop) diff --git a/sepolicy/vendor/google/ssr_detector.te b/sepolicy/vendor/google/ssr_detector.te new file mode 100644 index 00000000..3a44e9a1 --- /dev/null +++ b/sepolicy/vendor/google/ssr_detector.te @@ -0,0 +1,29 @@ +# SSRestartDetector app +type ssr_detector_app, domain; + +app_domain(ssr_detector_app) + +allow ssr_detector_app app_api_service:service_manager find; +allow ssr_detector_app radio_service:service_manager find; + +userdebug_or_eng(` + allow ssr_detector_app ramdump_vendor_data_file:dir r_dir_perms; + allow ssr_detector_app ramdump_vendor_data_file:file r_file_perms; + get_prop(ssr_detector_app, vendor_ssr_prop) +') + +get_prop(ssr_detector_app, vendor_wifi_version) +get_prop(ssr_detector_app, vendor_adsp_version_prop) + +# ssr_detector app's data type is system_app_data_file. +allow ssr_detector_app system_app_data_file:dir create_dir_perms; +allow ssr_detector_app system_app_data_file:file create_file_perms; + +allow ssr_detector_app cgroup:file w_file_perms; + +allow ssr_detector_app sysfs:lnk_file r_file_perms; +r_dir_file(ssr_detector_app, sysfs_msm_subsys) +r_dir_file(ssr_detector_app, sysfs_ssr) + +allow ssr_detector_app sysfs_ssr_writable:file getattr; + diff --git a/sepolicy/vendor/google/su.te b/sepolicy/vendor/google/su.te new file mode 100644 index 00000000..917c2b3c --- /dev/null +++ b/sepolicy/vendor/google/su.te @@ -0,0 +1,2 @@ +# Ignore access to firmware_file (may be triggered by tradefed). +dontaudit su firmware_file:filesystem *; diff --git a/sepolicy/vendor/google/system_app.te b/sepolicy/vendor/google/system_app.te new file mode 100644 index 00000000..9499c593 --- /dev/null +++ b/sepolicy/vendor/google/system_app.te @@ -0,0 +1,8 @@ +allow system_app hal_wlc_hwservice:hwservice_manager find; +binder_call(system_app, hal_wlc) +binder_call(hal_wlc, system_app) + +allow system_app fwk_stats_hwservice:hwservice_manager find; + +allow system_app hal_wireless_charger_service:service_manager find; +binder_call(system_app, hal_wireless_charger) diff --git a/sepolicy/vendor/google/tcpdump_logger.te b/sepolicy/vendor/google/tcpdump_logger.te new file mode 100644 index 00000000..a6fb808d --- /dev/null +++ b/sepolicy/vendor/google/tcpdump_logger.te @@ -0,0 +1,20 @@ +type tcpdump_logger, domain; +type tcpdump_logger_exec, exec_type, vendor_file_type, file_type; + +userdebug_or_eng(` + # make transition from init to its domain + init_daemon_domain(tcpdump_logger) + + allow tcpdump_logger self:capability net_raw; + allow tcpdump_logger self:packet_socket create_socket_perms; + allowxperm tcpdump_logger self:packet_socket ioctl 0x8933; + allow tcpdump_logger tcpdump_exec:file rx_file_perms; + allow tcpdump_logger tcpdump_vendor_data_file:dir create_dir_perms; + allow tcpdump_logger tcpdump_vendor_data_file:file create_file_perms; + allow tcpdump_logger vendor_radio_data_file:file create_file_perms; + allow tcpdump_logger vendor_radio_data_file:dir create_dir_perms; + allow tcpdump_logger cnss_vendor_data_file:file create_file_perms; + allow tcpdump_logger cnss_vendor_data_file:dir create_dir_perms; + + set_prop(tcpdump_logger, vendor_tcpdump_log_prop) +') diff --git a/sepolicy/vendor/google/toolbox.te b/sepolicy/vendor/google/toolbox.te new file mode 100644 index 00000000..b12911ab --- /dev/null +++ b/sepolicy/vendor/google/toolbox.te @@ -0,0 +1,2 @@ +allow toolbox per_boot_file:dir create_dir_perms; +allow toolbox per_boot_file:file create_file_perms; diff --git a/sepolicy/vendor/google/update_engine.te b/sepolicy/vendor/google/update_engine.te new file mode 100644 index 00000000..8b914f4a --- /dev/null +++ b/sepolicy/vendor/google/update_engine.te @@ -0,0 +1 @@ +get_prop(update_engine, vendor_hw_plat_prop) diff --git a/sepolicy/vendor/google/update_engine_common.te b/sepolicy/vendor/google/update_engine_common.te new file mode 100644 index 00000000..62196f29 --- /dev/null +++ b/sepolicy/vendor/google/update_engine_common.te @@ -0,0 +1,6 @@ +allow update_engine_common custom_ab_block_device:blk_file rw_file_perms; +allow update_engine_common firmware_file:filesystem getattr; +allow update_engine_common metadata_file:dir search; +allow update_engine_common modem_block_device:blk_file rw_file_perms; + +dontaudit update_engine_common gsi_metadata_file:dir search; diff --git a/sepolicy/vendor/google/uv_exposure_reporter.te b/sepolicy/vendor/google/uv_exposure_reporter.te new file mode 100644 index 00000000..8aa682ac --- /dev/null +++ b/sepolicy/vendor/google/uv_exposure_reporter.te @@ -0,0 +1,11 @@ +type uv_exposure_reporter, domain, coredomain; + +app_domain(uv_exposure_reporter) + +allow uv_exposure_reporter app_api_service:service_manager find; +allow uv_exposure_reporter fwk_stats_hwservice:hwservice_manager find; +allow uv_exposure_reporter sysfs_msm_subsys:dir search; +allow uv_exposure_reporter sysfs_msm_subsys:file r_file_perms; +binder_call(uv_exposure_reporter, stats_service_server); +allow uv_exposure_reporter fwk_stats_service:service_manager find; +binder_use(uv_exposure_reporter) diff --git a/sepolicy/vendor/google/vendor_init.te b/sepolicy/vendor/google/vendor_init.te new file mode 100644 index 00000000..bc2ed4ee --- /dev/null +++ b/sepolicy/vendor/google/vendor_init.te @@ -0,0 +1,40 @@ +type vendor_init_exec, exec_type, vendor_file_type, file_type; + +allow vendor_init debugfs_sched_features:file write; +allow vendor_init debugfs_clk:file write; +allow vendor_init ipa_dev:chr_file w_file_perms; +allow vendor_init proc_swappiness:file w_file_perms; +allow vendor_init proc_dirty:file w_file_perms; +allow vendor_init proc_sched_lib_mask_cpuinfo:file w_file_perms; + +get_prop(vendor_init, vendor_hw_plat_prop) +set_prop(vendor_init, vendor_build_type_prop) +set_prop(vendor_init, vendor_ssr_prop) +set_prop(vendor_init, vendor_display_prop) +set_prop(vendor_init, vendor_hvdcp_opti_prop) +set_prop(vendor_init, vendor_audio_prop) +set_prop(vendor_init, vendor_bluetooth_prop) +set_prop(vendor_init, vendor_power_prop) +set_prop(vendor_init, vendor_thermal_prop) +set_prop(vendor_init, vendor_camera_prop) + +#radio related +set_prop(vendor_init, vendor_cnd_prop) +set_prop(vendor_init, vendor_modem_diag_prop) +set_prop(vendor_init, vendor_radio_prop) + +#IMS related +set_prop(vendor_init, vendor_qcom_ims_prop) + +userdebug_or_eng(` + set_prop(vendor_init, logpersistd_logging_prop) + # Allow vendor_init to write vendor_tcpdump_log_prop on userdebug or eng ROM + set_prop(vendor_init, vendor_tcpdump_log_prop) + # IPA Data Stall Detection + allow vendor_init debugfs_ipa_data_stall_detection:file w_file_perms; +') + +set_prop(vendor_init, vendor_logging_prop) +get_prop(vendor_init, test_harness_prop) +get_prop(vendor_init, vendor_battery_profile_prop) +set_prop(vendor_init, vendor_battery_defender_prop) diff --git a/sepolicy/vendor/google/vendor_misc_writer.te b/sepolicy/vendor/google/vendor_misc_writer.te new file mode 100644 index 00000000..886b983c --- /dev/null +++ b/sepolicy/vendor/google/vendor_misc_writer.te @@ -0,0 +1 @@ +get_prop(vendor_misc_writer, vendor_hw_plat_prop) diff --git a/sepolicy/vendor/google/vendor_shell.te b/sepolicy/vendor/google/vendor_shell.te new file mode 100644 index 00000000..2ace587a --- /dev/null +++ b/sepolicy/vendor/google/vendor_shell.te @@ -0,0 +1 @@ +set_prop(vendor_shell, vendor_battery_profile_prop) diff --git a/sepolicy/vendor/google/vndservice.te b/sepolicy/vendor/google/vndservice.te new file mode 100644 index 00000000..d67705ff --- /dev/null +++ b/sepolicy/vendor/google/vndservice.te @@ -0,0 +1 @@ +type rls_service, vndservice_manager_type; diff --git a/sepolicy/vendor/google/vndservice_contexts b/sepolicy/vendor/google/vndservice_contexts new file mode 100644 index 00000000..6e449dec --- /dev/null +++ b/sepolicy/vendor/google/vndservice_contexts @@ -0,0 +1 @@ +rlsservice u:object_r:rls_service:s0 diff --git a/sepolicy/vendor/google/vold.te b/sepolicy/vendor/google/vold.te new file mode 100644 index 00000000..f7b7e262 --- /dev/null +++ b/sepolicy/vendor/google/vold.te @@ -0,0 +1,4 @@ +# Allow to load incremental file system driver +allow vold self:capability sys_module; +allow vold vendor_incremental_module:file r_file_perms; +allow vold vendor_incremental_module:system module_load; diff --git a/sepolicy/vendor/qcom/common/adpl.te b/sepolicy/vendor/qcom/common/adpl.te new file mode 100644 index 00000000..a567abe1 --- /dev/null +++ b/sepolicy/vendor/qcom/common/adpl.te @@ -0,0 +1,20 @@ +type adpl, domain; +type adpl_exec, exec_type, vendor_file_type, file_type; + +userdebug_or_eng(` + init_daemon_domain(adpl) + + allow adpl { rmnet_device ipa_dev }:chr_file rw_file_perms; + allow adpl self:qipcrtr_socket create_socket_perms_no_ioctl; + + r_dir_file(adpl, sysfs_diag); + allow adpl diag_device:chr_file rw_file_perms; + + #Allow adpl to create adpl socket + allow adpl dataadpl_socket:sock_file rw_file_perms; + + allow adpl sysfs_timestamp_switch:file r_file_perms; + allow adpl sysfs_msm_subsys:dir r_dir_perms; + r_dir_file(adpl, sysfs_ssr) + r_dir_file(adpl, sysfs_soc) +')
\ No newline at end of file diff --git a/sepolicy/vendor/qcom/common/adsprpcd.te b/sepolicy/vendor/qcom/common/adsprpcd.te new file mode 100644 index 00000000..afafbab5 --- /dev/null +++ b/sepolicy/vendor/qcom/common/adsprpcd.te @@ -0,0 +1,20 @@ +type adsprpcd, domain; +type adsprpcd_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(adsprpcd) + +allow adsprpcd ion_device:chr_file r_file_perms; +allow adsprpcd qdsp_device:chr_file r_file_perms; +allow adsprpcd mnt_vendor_file:dir r_dir_perms; +allow adsprpcd persist_file:dir search; + +# For sensor +allow adsprpcd sensors_persist_file:dir rw_dir_perms; +allow adsprpcd sensors_persist_file:file create_file_perms; + +# For devices/soc0/* +allow adsprpcd sysfs_soc:dir r_dir_perms; +allow adsprpcd sysfs_soc:file r_file_perms; + +allow adsprpcd sysfs_leds:dir r_dir_perms; +allow adsprpcd sysfs_leds:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/app.te b/sepolicy/vendor/qcom/common/app.te new file mode 100644 index 00000000..3316d9db --- /dev/null +++ b/sepolicy/vendor/qcom/common/app.te @@ -0,0 +1,4 @@ +get_prop(appdomain, vendor_display_prop) + +dontaudit appdomain sysfs_msm_subsys:dir search; +dontaudit appdomain sysfs_msm_subsys:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/attributes b/sepolicy/vendor/qcom/common/attributes new file mode 100644 index 00000000..a43fa65b --- /dev/null +++ b/sepolicy/vendor/qcom/common/attributes @@ -0,0 +1,8 @@ +attribute vendor_persist_type; +attribute hal_display_color; +attribute hal_qseecom; +attribute hal_qseecom_client; +attribute hal_qseecom_server; +attribute hal_qspmhal; +attribute hal_qspmhal_client; +attribute hal_qspmhal_server; diff --git a/sepolicy/vendor/qcom/common/bootanim.te b/sepolicy/vendor/qcom/common/bootanim.te new file mode 100644 index 00000000..934ca3e0 --- /dev/null +++ b/sepolicy/vendor/qcom/common/bootanim.te @@ -0,0 +1,10 @@ +get_prop(bootanim, vendor_display_prop) + +# TODO(b/62954877). On Android Wear, bootanim reads the time +# during boot to display. It currently gets that time from a file +# in /data/system. This should be moved. In the meantime, suppress +# this denial on phones since this functionality is not used. +dontaudit bootanim system_data_file:dir read; + +dontaudit bootanim sysfs_msm_subsys:dir search; +dontaudit bootanim sysfs_msm_subsys:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/cameraserver.te b/sepolicy/vendor/qcom/common/cameraserver.te new file mode 100644 index 00000000..4987377d --- /dev/null +++ b/sepolicy/vendor/qcom/common/cameraserver.te @@ -0,0 +1,11 @@ +# Camera service uses gralloc, gralloc mapper wants to talk to the GPU +# and use debug properties +get_prop(cameraserver, vendor_display_prop) + +# It's confirmed that all attempts of access gpu_device by the gralloc mapper +# are not essential, and access denial to it won't break any gralloc mapper +# functionality. +dontaudit cameraserver gpu_device:chr_file rw_file_perms; + +# dontaudit unnecessary files in /sys +dontaudit cameraserver sysfs_msm_subsys:dir search;
\ No newline at end of file diff --git a/sepolicy/vendor/qcom/common/cdsprpcd.te b/sepolicy/vendor/qcom/common/cdsprpcd.te new file mode 100644 index 00000000..67bdb549 --- /dev/null +++ b/sepolicy/vendor/qcom/common/cdsprpcd.te @@ -0,0 +1,9 @@ +# cdsprpcd daemon +type cdsprpcd, domain; +type cdsprpcd_exec, exec_type, vendor_file_type, file_type; + +# Started by init +init_daemon_domain(cdsprpcd) + +allow cdsprpcd qdsp_device:chr_file r_file_perms; +allow cdsprpcd ion_device:chr_file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/chre.te b/sepolicy/vendor/qcom/common/chre.te new file mode 100644 index 00000000..4006a660 --- /dev/null +++ b/sepolicy/vendor/qcom/common/chre.te @@ -0,0 +1,16 @@ +type chre, domain; +type chre_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(chre) + +allow chre ion_device:chr_file r_file_perms; +allow chre qdsp_device:chr_file r_file_perms; + +# Allow CHRE to obtain wakelock +wakelock_use(chre) + +# Allow CHRE to obtain audio +hal_client_domain(chre, hal_audio) + +# Allow CHRE host to talk to the stats service +allow chre fwk_stats_service:service_manager find; +binder_call(chre, stats_service_server) diff --git a/sepolicy/vendor/qcom/common/cnd.te b/sepolicy/vendor/qcom/common/cnd.te new file mode 100644 index 00000000..de96b7b5 --- /dev/null +++ b/sepolicy/vendor/qcom/common/cnd.te @@ -0,0 +1,53 @@ +type cnd, domain, mlstrustedsubject; +type cnd_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(cnd) + +#communicating with QTI wlan driver for WFC/ VTiWLAN quality +unix_socket_send(cnd, wpa, hal_wifi_supplicant) +allow cnd wpa_data_file:dir w_dir_perms; +allow cnd wpa_data_file:sock_file create_file_perms; + +allow cnd self:udp_socket create_socket_perms; +allow cnd self:{ + # allow receiving NETLINK responses from WLAN driver. + netlink_socket + netlink_generic_socket + qipcrtr_socket +} create_socket_perms_no_ioctl; + +r_dir_file(cnd, sysfs_msm_subsys) +r_dir_file(cnd, sysfs_soc) +r_dir_file(cnd, sysfs_ssr) +r_dir_file(cnd, sysfs_esoc) +allow cnd proc_meminfo:file r_file_perms; + +set_prop(cnd, vendor_cnd_prop) + +# allow cnd to access cnd_data_file +allow cnd cnd_data_file:file create_file_perms; +allow cnd cnd_data_file:dir rw_dir_perms; + +# allow cnd to obtain wakelock +wakelock_use(cnd) + +# To register cnd to hwbinder +add_hwservice(cnd, hal_datafactory_hwservice) + +#for video call +binder_call(cnd, ims) + +# allow diag logging +userdebug_or_eng(` + allow cnd diag_device:chr_file rw_file_perms; + allow cnd sysfs_timestamp_switch:file r_file_perms; + r_dir_file(cnd, sysfs_diag) +') + +# For WFC call(RAT change into IWLAN) +binder_call(cnd, qtidataservices_app) + +get_prop(cnd, wifi_hal_prop) + +add_hwservice(cnd, hal_slmadapter_hwservice) +add_hwservice(cnd, hal_mwqemadapter_hwservice) diff --git a/sepolicy/vendor/qcom/common/con_monitor.te b/sepolicy/vendor/qcom/common/con_monitor.te new file mode 100644 index 00000000..860c16e6 --- /dev/null +++ b/sepolicy/vendor/qcom/common/con_monitor.te @@ -0,0 +1,12 @@ +# ConnectivityMonitor app +type con_monitor_app, domain, coredomain; + +app_domain(con_monitor_app) + +set_prop(con_monitor_app, radio_prop) +allow con_monitor_app app_api_service:service_manager find; +allow con_monitor_app audioserver_service:service_manager find; +allow con_monitor_app radio_service:service_manager find; +allow con_monitor_app vendor_radio_data_file:dir rw_dir_perms; +allow con_monitor_app vendor_radio_data_file:file create_file_perms; +hal_client_domain(con_monitor_app, hal_power_stats); diff --git a/sepolicy/vendor/qcom/common/device.te b/sepolicy/vendor/qcom/common/device.te new file mode 100644 index 00000000..db7a09c3 --- /dev/null +++ b/sepolicy/vendor/qcom/common/device.te @@ -0,0 +1,17 @@ +type diag_device, dev_type, mlstrustedobject; +type rmnet_device, dev_type; +type qdsp_device, dev_type, mlstrustedobject; +type fm_radio_device, dev_type; +type sg_device, dev_type; +type ssd_block_device, dev_type; +type ramdump_device, dev_type; +type ipa_dev, dev_type; +type modem_ssr_device, dev_type; +type qce_device, dev_type; +type at_device, dev_type; +type wlan_device, dev_type; +type custom_ab_block_device, dev_type; +type xbl_block_device, dev_type; +type gpt_block_device, dev_type; +type modem_block_device, dev_type; +type persist_block_device, dev_type; diff --git a/sepolicy/vendor/qcom/common/diag.te b/sepolicy/vendor/qcom/common/diag.te new file mode 100644 index 00000000..ba0972b4 --- /dev/null +++ b/sepolicy/vendor/qcom/common/diag.te @@ -0,0 +1,3 @@ +type diag, domain; +type diag_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(diag) diff --git a/sepolicy/vendor/qcom/common/dspservice.te b/sepolicy/vendor/qcom/common/dspservice.te new file mode 100644 index 00000000..a00a6fb2 --- /dev/null +++ b/sepolicy/vendor/qcom/common/dspservice.te @@ -0,0 +1,18 @@ +# Policy for DSP HAL service +type dspservice, domain; +type dspservice_exec, exec_type, vendor_file_type, file_type; + +# Started by init +init_daemon_domain(dspservice) + +hal_attribute(dspmanager); + +# Allow DSP clients to perform binder IPC to DSP HAL server +binder_call(hal_dspmanager_client, hal_dspmanager_server); +binder_call(hal_dspmanager_server, hal_dspmanager_client); + +hal_server_domain(dspservice, hal_dspmanager); + +# Add dspservice to hwservice_manager and allow it to be discovered +hal_attribute_hwservice(hal_dspmanager, hal_dspmanager_hwservice) + diff --git a/sepolicy/vendor/qcom/common/ecoservice.te b/sepolicy/vendor/qcom/common/ecoservice.te new file mode 100644 index 00000000..da131e38 --- /dev/null +++ b/sepolicy/vendor/qcom/common/ecoservice.te @@ -0,0 +1,2 @@ +allow shell eco_service:service_manager find; + diff --git a/sepolicy/vendor/qcom/common/feature_enabler_client.te b/sepolicy/vendor/qcom/common/feature_enabler_client.te new file mode 100644 index 00000000..9fe8ce02 --- /dev/null +++ b/sepolicy/vendor/qcom/common/feature_enabler_client.te @@ -0,0 +1,21 @@ +type feature_enabler_client, domain; +type feature_enabler_client_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(feature_enabler_client) +vndbinder_use(feature_enabler_client); +allow feature_enabler_client ion_device:chr_file r_file_perms; +allow feature_enabler_client smcinvoke_device:chr_file rw_file_perms; +allow feature_enabler_client graphics_device:chr_file rw_file_perms; +allow feature_enabler_client tee_device:chr_file rw_file_perms; + +allow feature_enabler_client mnt_vendor_file:dir search; +allow feature_enabler_client persist_drm_file:dir r_dir_perms; +allow feature_enabler_client persist_file:dir search; +r_dir_file(feature_enabler_client, persist_display_file); + +hwbinder_use(feature_enabler_client); + +binder_call(feature_enabler_client, hal_graphics_composer) +allow feature_enabler_client qdisplay_service:service_manager find; +add_service(feature_enabler_client, qfeatenab_client_service) +unix_socket_connect(feature_enabler_client, ssgtzd, ssgtzd) diff --git a/sepolicy/vendor/qcom/common/file.te b/sepolicy/vendor/qcom/common/file.te new file mode 100644 index 00000000..503cbe07 --- /dev/null +++ b/sepolicy/vendor/qcom/common/file.te @@ -0,0 +1,66 @@ +type qmuxd_socket, file_type; +type netmgrd_socket, file_type; +type proc_wifi_dbg, proc_type, fs_type; +type proc_shs, fs_type, proc_type; +type proc_swappiness, proc_type, fs_type; +type cnd_data_file, file_type, data_file_type; +type chre_socket, file_type; +type sysfs_soc, sysfs_type, fs_type; +type sysfs_soc_sensitive, sysfs_type, fs_type; +type sysfs_msm_subsys, sysfs_type, fs_type; +type netmgrd_data_file, file_type, data_file_type; +type persist_camera_file, file_type , vendor_persist_type; +type persist_drm_file, file_type , vendor_persist_type; +type dataadpl_socket, file_type; +type persist_hvdcp_file, file_type , vendor_persist_type; +type persist_audio_file, file_type , vendor_persist_type; +type proc_irq, fs_type, proc_type; +type irqbalance_socket, file_type; +type sensors_persist_file, file_type, vendor_persist_type; +type persist_sensors_reg_fac_file, file_type, vendor_persist_type; +type persist_rfs_file, file_type, vendor_persist_type; +type persist_rfs_shared_hlos_file, file_type, vendor_persist_type; +type sysfs_graphics, sysfs_type, fs_type; +type sysfs_graphics_unused, sysfs_type, fs_type; +type sysfs_msm_boot, fs_type, sysfs_type; +type sysfs_timestamp_switch, sysfs_type, fs_type; +type ims_socket, file_type; +type ssgtzd_socket, file_type, mlstrustedobject; +type location_data_file, file_type, data_file_type; +type location_socket, file_type, data_file_type; +type wifihal_socket, file_type; +type sysfs_esoc, sysfs_type, fs_type; +type sysfs_ssr, sysfs_type, fs_type; +type sysfs_ssr_writable, sysfs_type, fs_type; +type display_vendor_data_file, file_type, data_file_type; +type persist_display_file, file_type, vendor_persist_type; +type ipa_vendor_data_file, file_type, data_file_type; +type shsusr_data_file, file_type, data_file_type; +type camera_vendor_data_file, file_type, data_file_type; +type sysfs_rmtfs, sysfs_type, fs_type; +type adsprpcd_file, file_type, mlstrustedobject, vendor_file_type; +type persist_time_file, file_type, vendor_persist_type; +type sysfs_kgsl_proc, sysfs_type, fs_type; +type sysfs_kgsl_shell, sysfs_type, fs_type; +type sysfs_diag, fs_type, sysfs_type; +type vendor_radio_data_file, file_type, data_file_type, mlstrustedobject; +type sensors_vendor_data_file, file_type, data_file_type; +type sysfs_audio, fs_type, sysfs_type; +type audio_vendor_data_file, file_type, data_file_type; +type vendor_tui_data_file, file_type, data_file_type; + +type ssr_log_file, file_type, data_file_type; +typeattribute mnt_vendor_file vendor_persist_type; +type hal_neuralnetworks_data_file, file_type, data_file_type; +type mpss_rfs_data_file, data_file_type, file_type; +type rfs_tombstone_data_file, data_file_type, file_type; +type sysfs_msm_wlan, sysfs_type, fs_type; +type sysfs_scsi_devices_0000, sysfs_type, fs_type; +type debugfs_sched_features, debugfs_type, fs_type; +type debugfs_wlan, debugfs_type, fs_type; +type debugfs_ipc, debugfs_type, fs_type; +type debugfs_icnss, debugfs_type, fs_type; +type debugfs_ion, debugfs_type, fs_type; +type debugfs_tzdbg, debugfs_type, fs_type; +type cnss_vendor_data_file, file_type, data_file_type, mlstrustedobject; +type sscoredump_vendor_data_coredump_file, file_type, data_file_type, mlstrustedobject; diff --git a/sepolicy/vendor/qcom/common/file_contexts b/sepolicy/vendor/qcom/common/file_contexts new file mode 100644 index 00000000..ce842ca4 --- /dev/null +++ b/sepolicy/vendor/qcom/common/file_contexts @@ -0,0 +1,280 @@ +################################### +# System files +# +/(vendor|system/vendor)/bin/PktRspTest u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/hvdcp_opti u:object_r:hvdcp_exec:s0 +/(vendor|system/vendor)/bin/cnd u:object_r:cnd_exec:s0 +/(vendor|system/vendor)/bin/diag_callback_client u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_dci_sample u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_klog u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_mdlog u:object_r:qlogd_exec:s0 +/(vendor|system/vendor)/bin/drmdiagapp u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_qshrink4_daemon u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_socket_log u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_uart_log u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/diag_buffering_test u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/irsc_util u:object_r:irsc_util_exec:s0 +/(vendor|system/vendor)/bin/qrtr-cfg u:object_r:qrtr_exec:s0 +/(vendor|system/vendor)/bin/qrtr-ns u:object_r:qrtr_exec:s0 +/(vendor|system/vendor)/bin/init\.sensors\.sh u:object_r:qti_init_shell_exec:s0 +/(vendor|system/vendor)/bin/msm_irqbalance u:object_r:msm_irqbalanced_exec:s0 +/(vendor|system/vendor)/bin/imsdatadaemon u:object_r:ims_exec:s0 +/(vendor|system/vendor)/bin/imsqmidaemon u:object_r:ims_exec:s0 +/(vendor|system/vendor)/bin/ims_rtp_daemon u:object_r:hal_imsrtp_exec:s0 +/(vendor|system/vendor)/bin/netmgrd u:object_r:netmgrd_exec:s0 +/(vendor|system/vendor)/bin/shsusrd u:object_r:shsusrd_exec:s0 +/(vendor|system/vendor)/bin/port-bridge u:object_r:port-bridge_exec:s0 +/(vendor|system/vendor)/bin/sensors.qcom u:object_r:sensors_exec:s0 +/(vendor|system/vendor)/bin/sensors.qti u:object_r:sensors_exec:s0 +/(vendor|system/vendor)/bin/test_diag u:object_r:diag_exec:s0 +/(vendor|system/vendor)/bin/time_daemon u:object_r:time_daemon_exec:s0 +/(vendor|system/vendor)/bin/rmt_storage u:object_r:rmt_storage_exec:s0 +/(vendor|system/vendor)/bin/tftp_server u:object_r:rfs_access_exec:s0 +/(vendor|system/vendor)/bin/hvdcp u:object_r:hvdcp_exec:s0 +/(vendor|system/vendor)/bin/qseecomd u:object_r:tee_exec:s0 +/(vendor|system/vendor)/bin/spdaemon u:object_r:spdaemon_exec:s0 +/(vendor|system/vendor)/bin/sec_nvm u:object_r:sec_nvm_exec:s0 +/(vendor|system/vendor)/bin/cnss-daemon u:object_r:wcnss_service_exec:s0 +/(vendor|system/vendor)/bin/cnss_diag u:object_r:wcnss_service_exec:s0 +/(vendor|system/vendor)/bin/adsprpcd u:object_r:adsprpcd_exec:s0 +/(vendor|system/vendor)/bin/cdsprpcd u:object_r:cdsprpcd_exec:s0 +/vendor/bin/dspservice u:object_r:dspservice_exec:s0 +/(vendor|system/vendor)/bin/wpa_cli u:object_r:wcnss_service_exec:s0 +/(vendor|system/vendor)/bin/mdm_helper u:object_r:mdm_helper_exec:s0 +/(vendor|system/vendor)/bin/mdm_helper_proxy u:object_r:mdm_helper_exec:s0 +/(vendor|system/vendor)/bin/ks u:object_r:mdm_helper_exec:s0 +/(vendor|system/vendor)/bin/pm-service u:object_r:vendor_per_mgr_exec:s0 +/(vendor|system/vendor)/bin/pm-proxy u:object_r:vendor_per_mgr_exec:s0 +/(vendor|system/vendor)/bin/pd-mapper u:object_r:vendor_pd_mapper_exec:s0 +/(vendor|system/vendor)/bin/pd-api-test u:object_r:vendor_pd_mapper_exec:s0 +/(vendor|system/vendor)/xbin/qlogd u:object_r:qlogd_exec:s0 +/(vendor|system/vendor)/bin/ssr_setup u:object_r:vendor_ssr_setup_exec:s0 +/(vendor|system/vendor)/bin/subsystem_ramdump u:object_r:vendor_subsystem_ramdump_exec:s0 +/(vendor|system/vendor)/bin/ssr_diag u:object_r:vendor_ssr_diag_exec:s0 +/(vendor|system/vendor)/bin/hw/qcrild u:object_r:rild_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.drm@[0-9]+\.[0-9]+-(service|service-lazy)\.clearkey u:object_r:hal_drm_clearkey_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.drm(@[0-9]+\.[0-9]+)?-(service|service-lazy)\.widevine(-v17)? u:object_r:hal_drm_widevine_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.gnss@.*-service-qti u:object_r:hal_gnss_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.gnss@.*-service u:object_r:hal_gnss_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.bluetooth@1\.0-service-qti u:object_r:hal_bluetooth_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.display\.color@1\.0-service u:object_r:hal_display_color_default_exec:s0 +/(vendor|system/vendor)/bin/sscrpcd u:object_r:sensors_exec:s0 +/(vendor|system/vendor)/bin/loc_launcher u:object_r:location_exec:s0 +/(vendor|system/vendor)/bin/lowi-server u:object_r:location_exec:s0 +/(vendor|system/vendor)/bin/xtra-daemon u:object_r:location_exec:s0 +/(vendor|system/vendor)/bin/wcnss_service u:object_r:wcnss_service_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@3\.0-service-qti u:object_r:hal_keymaster_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@4\.0-service-qti u:object_r:hal_keymaster_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@4\.0-strongbox-service-qti u:object_r:hal_keymaster_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@4\.1-service-qti u:object_r:hal_keymaster_qti_exec:s0 +/(vendor|system/vendor)/bin/init\.qti\.keymaster\.sh u:object_r:init-qti-keymaster-sh_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.gatekeeper@1\.0-service-qti u:object_r:hal_gatekeeper_qti_exec:s0 +/(vendor|system/vendor)/bin/imsrcsd u:object_r:hal_rcsservice_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.qteeconnector@1\.0-service u:object_r:hal_qteeconnector_qti_exec:s0 +/vendor/bin/hw/vendor\.qti\.hardware\.qseecom@1\.0-service u:object_r:hal_qseecom_default_exec:s0 +/vendor/bin/vendor\.qti\.qspmhal@1\.0-service u:object_r:hal_qspmhal_default_exec:s0 +/(vendor|system/vendor)/bin/chre u:object_r:chre_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.display\.allocator@1\.0-service u:object_r:hal_graphics_allocator_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.display\.allocator-service u:object_r:hal_graphics_allocator_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.tui_comm@1\.0-service-qti u:object_r:hal_tui_comm_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.media\.c2@1\.0-service u:object_r:mediacodec_exec:s0 +/(vendor|system/vendor)/bin/qti u:object_r:qti_exec:s0 +/(vendor|system/vendor)/bin/adpl u:object_r:adpl_exec:s0 +/(vendor|system/vendor)/bin/ssgtzd u:object_r:ssgtzd_exec:s0 +/(vendor|system/vendor)/bin/feature_enabler_client u:object_r:feature_enabler_client_exec:s0 + +# dev socket nodes +/dev/socket/chre u:object_r:chre_socket:s0 +/dev/socket/msm_irqbalance u:object_r:irqbalance_socket:s0 +/dev/socket/qmux_radio(/.*)? u:object_r:qmuxd_socket:s0 +/dev/socket/netmgr(/.*)? u:object_r:netmgrd_socket:s0 +/dev/socket/ims_qmid u:object_r:ims_socket:s0 +/dev/socket/ims_datad u:object_r:ims_socket:s0 +/dev/socket/ssgtzd u:object_r:ssgtzd_socket:s0 +/dev/socket/adpl_cmd_uds_file u:object_r:dataadpl_socket:s0 + +################################### +# persist files +# +/mnt/vendor/persist/camera(/.*)? u:object_r:persist_camera_file:s0 +/mnt/vendor/persist/drm(/.*)? u:object_r:persist_drm_file:s0 +/mnt/vendor/persist/sensors(/.*)? u:object_r:sensors_persist_file:s0 +/mnt/vendor/persist/sensors/registry/factory_data(/.*)? u:object_r:persist_sensors_reg_fac_file:s0 +/mnt/vendor/persist/time(/.*)? u:object_r:persist_time_file:s0 +/mnt/vendor/persist/data(/.*)? u:object_r:persist_drm_file:s0 +/mnt/vendor/persist/data/tz(/.*)? u:object_r:persist_drm_file:s0 +/mnt/vendor/persist/data/sfs(/.*)? u:object_r:persist_drm_file:s0 +/mnt/vendor/persist/hlos_rfs(/.*)? u:object_r:persist_rfs_shared_hlos_file:s0 +/mnt/vendor/persist/display(/.*)? u:object_r:persist_display_file:s0 +/mnt/vendor/persist/rfs.* u:object_r:persist_rfs_file:s0 +/mnt/vendor/persist/hvdcp_opti(/.*)? u:object_r:persist_hvdcp_file:s0 +/mnt/vendor/persist/audio(/.*)? u:object_r:persist_audio_file:s0 + +################################### +# adsp files +# +/(vendor|system/vendor)/dsp(/.*)? u:object_r:adsprpcd_file:s0 +/dsp(/.*)? u:object_r:adsprpcd_file:s0 + +################################### +# cache files +# + +################################### +# vendor files +# +/vendor/package(/.*)?/overlay(/.*)? u:object_r:vendor_overlay_file:s0 +/vendor/package(/.*)?/app(/.*)? u:object_r:vendor_app_file:s0 + +# same-process HAL files and their dependencies +# +/vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@2\.0-impl-qti-display\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@1\.0\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@2\.0\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapperextensions@1\.0\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapperextensions@1\.1\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@3\.0-impl-qti-display\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@3\.0\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@4\.0-impl-qti-display\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@4\.0\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libcamxexternalformatutils\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libqdMetaData\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libgralloc\.qti\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/lib_aion_buffer\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libqservice\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libqdutils\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libadreno_utils\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libgpudataproducer\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libgsl\.so u:object_r:same_process_hal_file:s0 +/vendor/lib64/libipebpsstriping\.so u:object_r:same_process_hal_file:s0 + +/vendor/lib(64)?/libEGL_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libGLESv1_CM_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libGLESv2_adreno\.so u:object_r:same_process_hal_file:s0 + +/vendor/lib(64)?/libdrmutils\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libdrm\.so u:object_r:same_process_hal_file:s0 + +/vendor/lib(64)?/libavenhancements\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libgrallocutils\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libgralloccore\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libExtendedExtractor.so u:object_r:same_process_hal_file:s0 +# RenderScript dependencies. +# To test: run cts -m CtsRenderscriptTestCases +/vendor/lib(64)?/libRSDriver_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libCB\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libllvm-qgl\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libbccQTI\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libllvm-qcom\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/librs_adreno\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/librs_adreno_sha1\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libqti-perfd-client\.so u:object_r:same_process_hal_file:s0 +# perf-hal client lib (included by libqti-perfd-client.so) +/vendor/lib(64)?/vendor\.qti\.hardware\.perf@1\.0\.so u:object_r:same_process_hal_file:s0 + +# libGLESv2_adreno depends on this +/vendor/lib(64)?/libllvm-glnext\.so u:object_r:same_process_hal_file:s0 + +# libOpenCL-pixel and its dependencies +/vendor/lib(64)?/libOpenCL-pixel\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libOpenCL\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libq3dtools_adreno\.so u:object_r:same_process_hal_file:s0 + +# Game profiling library +/vendor/lib(64)?/libadreno_app_profiles\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.qspmhal@1\.0\.so u:object_r:same_process_hal_file:s0 + +#Loaded by native loader (zygote) for all processes +/vendor/lib(64)?/libhalide_hexagon_host\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libadsprpc\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libcdsprpc\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libsdsprpc\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/vendor\.qti\.hardware\.dsp@1\.0\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libdiag\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libtime_genoff\.so u:object_r:same_process_hal_file:s0 + +# libmmi_jni +/vendor/lib(64)?/libmmi_jni\.so u:object_r:same_process_hal_file:s0 + +# Fastcv libs +/vendor/lib(64)?/libfastcvdsp_stub\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libfastcvadsp_stub\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libfastcvopt\.so u:object_r:same_process_hal_file:s0 + +# SVA files +/vendor/lib(64)?/liblistenjni\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/liblistensoundmodel2\.so u:object_r:same_process_hal_file:s0 +################################### +# firmware images +# + +#Android NN Driver +/(vendor|system/vendor)/bin/hw/android\.hardware\.neuralnetworks@1\.3-service-qti u:object_r:hal_neuralnetworks_default_exec:s0 + +# dev nodes +/dev/ipa u:object_r:ipa_dev:s0 +/dev/ipa_adpl u:object_r:ipa_dev:s0 +/dev/ipa_odl_ctl u:object_r:ipa_dev:s0 +/dev/dpl_ctrl u:object_r:rmnet_device:s0 +/dev/wwan_ioctl u:object_r:ipa_dev:s0 +/dev/ipaNatTable u:object_r:ipa_dev:s0 +/dev/sg[0-9]+ u:object_r:sg_device:s0 +/dev/qseecom u:object_r:tee_device:s0 +/dev/video([0-9])+ u:object_r:video_device:s0 +/dev/media([0-9])+ u:object_r:video_device:s0 +/dev/v4l-subdev.* u:object_r:video_device:s0 +/dev/jpeg[0-9]* u:object_r:video_device:s0 +/dev/dri/card0 u:object_r:graphics_device:s0 +/dev/adsprpc-smd u:object_r:qdsp_device:s0 +/dev/adsprpc-smd-secure u:object_r:qdsp_device:s0 +/dev/kgsl-3d0 u:object_r:gpu_device:s0 +/dev/wlan u:object_r:wlan_device:s0 +/dev/subsys_modem u:object_r:modem_ssr_device:s0 +/dev/diag u:object_r:diag_device:s0 +/dev/btpower u:object_r:hci_attach_dev:s0 +/dev/ttyHS0 u:object_r:hci_attach_dev:s0 +/dev/ttyMSM0 u:object_r:tty_device:s0 +/dev/block/sda u:object_r:gpt_block_device:s0 +/dev/block/sd[bc]1? u:object_r:xbl_block_device:s0 +/dev/block/sde u:object_r:boot_block_device:s0 +/dev/msm_.* u:object_r:audio_device:s0 +/dev/ramdump_.* u:object_r:ramdump_device:s0 +/dev/at_.* u:object_r:at_device:s0 +/dev/smcinvoke u:object_r:smcinvoke_device:s0 +/dev/qce u:object_r:qce_device:s0 + +# dev socket nodes +/dev/socket/location(/.*)? u:object_r:location_socket:s0 +/dev/socket/wifihal(/.*)? u:object_r:wifihal_socket:s0 + +# files in /vendor +/vendor/bin/ipacm u:object_r:hal_tetheroffload_default_exec:s0 +/vendor/bin/ipacm-diag u:object_r:hal_tetheroffload_default_exec:s0 + +# data files +/data/vendor/ipa(/.*)? u:object_r:ipa_vendor_data_file:s0 +/data/vendor/sensors(/.*)? u:object_r:sensors_vendor_data_file:s0 +/data/vendor/rfs/mpss(/.*)? u:object_r:mpss_rfs_data_file:s0 +/data/vendor/radio(/.*)? u:object_r:vendor_radio_data_file:s0 +/data/vendor/netmgr(/.*)? u:object_r:netmgrd_data_file:s0 +/data/vendor/shsusr(/.*)? u:object_r:shsusr_data_file:s0 +/data/vendor/mediadrm(/.*)? u:object_r:mediadrm_vendor_data_file:s0 +/data/vendor/nnhal(/.*)? u:object_r:hal_neuralnetworks_data_file:s0 +/data/vendor/ssrdump(/.*)? u:object_r:ramdump_vendor_data_file:s0 +/data/vendor/ssrdump/coredump(/.*)? u:object_r:sscoredump_vendor_data_coredump_file:s0 +/data/vendor/ssrlog(/.*)? u:object_r:ssr_log_file:s0 +/data/vendor/camera(/.*)? u:object_r:camera_vendor_data_file:s0 +/data/vendor/location(/.*)? u:object_r:location_data_file:s0 +/data/vendor/tombstones/rfs(/.*)? u:object_r:rfs_tombstone_data_file:s0 +/data/vendor/audio(/.*)? u:object_r:audio_vendor_data_file:s0 +/data/vendor/display(/.*)? u:object_r:display_vendor_data_file:s0 +/data/vendor/time(/.*)? u:object_r:time_data_file:s0 + +# spdaemon and sec_nvm files + +# cnss_diag files +/data/vendor/wifi/cnss_diag(/.*)? u:object_r:cnss_vendor_data_file:s0 +# iotap_ps.bin file +/data/vendor/wifi/cnss_daemon(/.*)? u:object_r:cnss_vendor_data_file:s0 + +/data/vendor/connectivity(/.*)? u:object_r:cnd_data_file:s0 diff --git a/sepolicy/vendor/qcom/common/genfs_contexts b/sepolicy/vendor/qcom/common/genfs_contexts new file mode 100644 index 00000000..5b8182a7 --- /dev/null +++ b/sepolicy/vendor/qcom/common/genfs_contexts @@ -0,0 +1,35 @@ +genfscon sysfs /kernel/wlan u:object_r:sysfs_msm_wlan:s0 +genfscon sysfs /kernel/boot_adsp/boot u:object_r:sysfs_msm_boot:s0 +genfscon sysfs /kernel/boot_cdsp/boot u:object_r:sysfs_msm_boot:s0 +genfscon sysfs /kernel/boot_slpi/boot u:object_r:sysfs_msm_boot:s0 +genfscon sysfs /class/uio u:object_r:sysfs_uio:s0 +genfscon sysfs /devices/virtual/kgsl/kgsl/proc u:object_r:sysfs_kgsl_proc:s0 +genfscon sysfs /devices/platform/soc/0.qcom,rmtfs_sharedmem u:object_r:sysfs_rmtfs:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3d00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/perfcounter u:object_r:sysfs_kgsl_shell:s0 +genfscon sysfs /bus/esoc u:object_r:sysfs_esoc:s0 +genfscon sysfs /bus/msm_subsys u:object_r:sysfs_msm_subsys:s0 +genfscon debugfs /wlan u:object_r:debugfs_wlan:s0 +genfscon debugfs /wlan0 u:object_r:debugfs_wlan:s0 +genfscon debugfs /icnss u:object_r:debugfs_icnss:s0 +genfscon debugfs /ipc_logging u:object_r:debugfs_ipc:s0 +genfscon debugfs /ion u:object_r:debugfs_ion:s0 +genfscon debugfs /tzdbg u:object_r:debugfs_tzdbg:s0 +genfscon sysfs /module/diagchar u:object_r:sysfs_diag:s0 +genfscon proc /debugdriver/driverdump u:object_r:proc_wifi_dbg:s0 +genfscon proc /ath_pktlog/cld u:object_r:proc_wifi_dbg:s0 +genfscon proc /shs u:object_r:proc_shs:s0 +genfscon sysfs /devices/platform/soc/a88000.i2c/i2c-0/0-000c/a88000.i2c:qcom,smb1355@c:qcom,smb1355-charger@1000/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_rotator u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/18800000.qcom,icnss/net u:object_r:sysfs_net:s0 +genfscon sysfs /module/diagchar/parameters/timestamp_switch u:object_r:sysfs_timestamp_switch:s0 +genfscon sysfs /devices/platform/vim2m.0/video4linux/video0/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/vicodec.0/video4linux/video1/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/vicodec.0/video4linux/video2/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,cam-req-mgr/video4linux/video3/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,cam-req-mgr/video4linux/video4/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/cam_sync/video4linux/video3/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/cam_sync/video4linux/video4/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/soc/aa00000.qcom,vidc0/video4linux/video32/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/soc/aa00000.qcom,vidc0/video4linux/video33/name u:object_r:sysfs_graphics_unused:s0 +genfscon sysfs /devices/platform/soc/aa00000.qcom,vidc0/video4linux/video34/name u:object_r:sysfs_graphics_unused:s0 diff --git a/sepolicy/vendor/qcom/common/hal_audio_default.te b/sepolicy/vendor/qcom/common/hal_audio_default.te new file mode 100644 index 00000000..296c1e76 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_audio_default.te @@ -0,0 +1,37 @@ +# For interfacing with PowerHAL +hal_client_domain(hal_audio_default, hal_power); + +# For interfacing with ThermalHAL +hal_client_domain(hal_audio_default, hal_thermal); + +# For QCOM diag port access +userdebug_or_eng(` + allow hal_audio diag_device:chr_file rw_file_perms; +'); + +r_dir_file(hal_audio_default, sysfs_soc); + +# read-only permission to obtain the calibration data +r_dir_file(hal_audio_default, persist_audio_file); +allow hal_audio_default mnt_vendor_file:dir search; +allow hal_audio_default persist_file:lnk_file read; +allow hal_audio_default persist_file:dir search; + +allow hal_audio_default audio_vendor_data_file:dir rw_dir_perms; +allow hal_audio_default audio_vendor_data_file:file create_file_perms; +allow hal_audio_default debugfs_ipc:dir r_dir_perms; + +# Allow hal audio to use wakelock +wakelock_use(hal_audio_default) + +#Allow hal audio to use Binder IPC +vndbinder_use(hal_audio); + +# For audio properties +get_prop(hal_audio_default, vendor_audio_prop); + +# For audio hal to talk with rainbow sensor +allow hal_audio_default rls_device:chr_file rw_file_perms; + +# Allow audio HAL to communicate with CHRE daemon via socket +unix_socket_connect(hal_audio_default, chre, chre); diff --git a/sepolicy/vendor/qcom/common/hal_bluetooth_default.te b/sepolicy/vendor/qcom/common/hal_bluetooth_default.te new file mode 100644 index 00000000..f5f21288 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_bluetooth_default.te @@ -0,0 +1,19 @@ +allow hal_bluetooth_default hci_attach_dev:chr_file rw_file_perms; +allow hal_bluetooth_default self:qipcrtr_socket create_socket_perms_no_ioctl; +allow hal_bluetooth_default hal_bluetooth_coexistence_hwservice:hwservice_manager { add find }; + +userdebug_or_eng(` + allow hal_bluetooth_default diag_device:chr_file rw_file_perms; + allow hal_bluetooth_default ramdump_vendor_data_file:dir create_dir_perms; + allow hal_bluetooth_default ramdump_vendor_data_file:file create_file_perms; + allow hal_bluetooth_default sscoredump_vendor_data_coredump_file:dir create_dir_perms; + allow hal_bluetooth_default sscoredump_vendor_data_coredump_file:file create_file_perms; + r_dir_file(hal_bluetooth_default, debugfs_ipc) + set_prop(hal_bluetooth_default, vendor_ssr_prop) +') + +set_prop(hal_bluetooth_default, vendor_bluetooth_prop) + +dontaudit hal_bluetooth_default kernel:system module_request; +dontaudit hal_bluetooth_default vendor_bluetooth_address_prop:property_service set; +dontaudit hal_bluetooth_default vendor_bluetooth_address_prop:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/hal_bootctl.te b/sepolicy/vendor/qcom/common/hal_bootctl.te new file mode 100644 index 00000000..7c9837a6 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_bootctl.te @@ -0,0 +1,29 @@ +# These are the permissions required to use the boot_control HAL implemented +# here: hardware/qcom/bootctrl/boot_control.c + +# Getting and setting GPT attributes for the bootloader iterates over all the +# partition names in the block_device directory /dev/block/.../by-name +allow hal_bootctl_default block_device:dir r_dir_perms; + +# Edit the attributes stored in the GPT. +allow hal_bootctl_default boot_block_device:blk_file rw_file_perms; +allow hal_bootctl_default gpt_block_device:blk_file rw_file_perms; +allow hal_bootctl_default custom_ab_block_device:blk_file getattr; +allow hal_bootctl_default modem_block_device:blk_file getattr; +allow hal_bootctl_default dp_block_device:blk_file getattr; + +# Access /dev/sgN devices (generic SCSI) to write the +# A/B slot selection for the XBL partition. Allow also to issue a +# UFS_IOCTL_QUERY ioctl. +allow hal_bootctl_default sg_device:chr_file rw_file_perms; + +allow hal_bootctl_default sysfs_scsi_devices_0000:dir r_dir_perms; + +# Write to the XBL devices. +allow hal_bootctl_default xbl_block_device:blk_file rw_file_perms; + +# We never apply OTAs when GSI is running +dontaudit hal_bootctl_default gsi_metadata_file:dir search; + +# Allow bootctl HAL to read ro.boot.hardware.platform +get_prop(hal_bootctl_default, vendor_hw_plat_prop) diff --git a/sepolicy/vendor/qcom/common/hal_display_color.te b/sepolicy/vendor/qcom/common/hal_display_color.te new file mode 100644 index 00000000..72b38370 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_display_color.te @@ -0,0 +1,9 @@ +type hal_display_color_default, domain; +type hal_display_color_default_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_display_color_default) + +vndbinder_use(hal_display_color_default); +get_prop(hal_display_color_default, hwservicemanager_prop) +hwbinder_use(hal_display_color_default); +add_hwservice(hal_display_color_default, hal_display_color_hwservice) +add_hwservice(hal_display_color_default, hal_display_postproc_hwservice) diff --git a/sepolicy/vendor/qcom/common/hal_drm_clearkey.te b/sepolicy/vendor/qcom/common/hal_drm_clearkey.te new file mode 100644 index 00000000..44518feb --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_drm_clearkey.te @@ -0,0 +1,7 @@ +type hal_drm_clearkey, domain; +type hal_drm_clearkey_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(hal_drm_clearkey) + +hal_server_domain(hal_drm_clearkey, hal_drm) +allow hal_drm_clearkey hal_allocator_server:fd use; diff --git a/sepolicy/vendor/qcom/common/hal_drm_widevine.te b/sepolicy/vendor/qcom/common/hal_drm_widevine.te new file mode 100644 index 00000000..b2be68ff --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_drm_widevine.te @@ -0,0 +1,16 @@ +type hal_drm_widevine, domain; + +type hal_drm_widevine_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_drm_widevine) + +hal_server_domain(hal_drm_widevine, hal_drm) +vndbinder_use(hal_drm_widevine); +allow hal_drm_widevine mediadrm_vendor_data_file:dir create_dir_perms; +allow hal_drm_widevine mediadrm_vendor_data_file:file create_file_perms; +allow hal_drm_widevine hal_display_config_hwservice:hwservice_manager find; +binder_call(hal_drm_widevine, hal_graphics_composer_default) + +allow hal_drm_widevine { appdomain -isolated_app }:fd use; + +allow hal_drm_widevine qce_device:chr_file rw_file_perms; +allow hal_drm_widevine smcinvoke_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/qcom/common/hal_fingerprint.te b/sepolicy/vendor/qcom/common/hal_fingerprint.te new file mode 100644 index 00000000..699a781a --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_fingerprint.te @@ -0,0 +1,2 @@ +dontaudit hal_fingerprint_default sysfs_msm_subsys:dir search; +dontaudit hal_fingerprint_default sysfs_msm_subsys:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/hal_gatekeeper_qti.te b/sepolicy/vendor/qcom/common/hal_gatekeeper_qti.te new file mode 100644 index 00000000..27b35119 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_gatekeeper_qti.te @@ -0,0 +1,7 @@ +type hal_gatekeeper_qti, domain; +hal_server_domain(hal_gatekeeper_qti, hal_gatekeeper) + +type hal_gatekeeper_qti_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_gatekeeper_qti) + +get_prop(hal_gatekeeper_qti, vendor_tee_listener_prop) diff --git a/sepolicy/vendor/qcom/common/hal_gnss_qti.te b/sepolicy/vendor/qcom/common/hal_gnss_qti.te new file mode 100644 index 00000000..d3186612 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_gnss_qti.te @@ -0,0 +1,22 @@ +type hal_gnss_qti, domain; +hal_server_domain(hal_gnss_qti, hal_gnss) + +type hal_gnss_qti_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_gnss_qti) +vndbinder_use(hal_gnss_qti) + +r_dir_file(hal_gnss_qti, sysfs_msm_subsys) +r_dir_file(hal_gnss_qti, sysfs_soc) +r_dir_file(hal_gnss_qti, sysfs_ssr) + +binder_call(hal_gnss_qti, vendor_per_mgr) + +hal_client_domain(hal_gnss_qti, hal_health) + +allow hal_gnss_qti location:unix_dgram_socket sendto; +allow hal_gnss_qti location_socket:dir w_dir_perms; +allow hal_gnss_qti location_socket:sock_file create_file_perms; +allow hal_gnss_qti vendor_per_mgr_service:service_manager find; + +allow hal_gnss_qti self:qipcrtr_socket create_socket_perms_no_ioctl; +allow hal_gnss_qti location_data_file:dir r_dir_perms; diff --git a/sepolicy/vendor/qcom/common/hal_graphics_allocator_default.te b/sepolicy/vendor/qcom/common/hal_graphics_allocator_default.te new file mode 100644 index 00000000..a49e55ed --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_graphics_allocator_default.te @@ -0,0 +1,7 @@ +get_prop(hal_graphics_allocator_default, vendor_display_prop) + +dontaudit hal_graphics_allocator_default sysfs_msm_subsys:dir search; +dontaudit hal_graphics_allocator_default sysfs_msm_subsys:file r_file_perms; + +allow hal_graphics_allocator_default sysfs_soc:dir search; +allow hal_graphics_allocator_default sysfs_soc:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/hal_graphics_composer_default.te b/sepolicy/vendor/qcom/common/hal_graphics_composer_default.te new file mode 100644 index 00000000..d27ef8fe --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_graphics_composer_default.te @@ -0,0 +1,48 @@ +allow hal_graphics_composer_default display_vendor_data_file:dir search; +allow hal_graphics_composer_default fwk_sensor_hwservice:hwservice_manager find; +binder_call(hal_graphics_composer, sensor_service_server) +allow hal_graphics_composer_default mnt_vendor_file:dir search; +allow hal_graphics_composer_default persist_file:dir search; +allow hal_graphics_composer_default ion_device:chr_file rw_file_perms; +r_dir_file(hal_graphics_composer_default, persist_display_file); + +allow hal_graphics_composer_default self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; + +allow hal_graphics_composer_default sysfs_leds:dir search; +allow hal_graphics_composer_default sysfs_leds:file rw_file_perms; + +allow hal_graphics_composer_default sysfs_display:file rw_file_perms; + +r_dir_file(hal_graphics_composer_default, sysfs_msm_subsys) + +r_dir_file(hal_graphics_composer_default, sysfs_graphics) + +get_prop(hal_graphics_composer_default, vendor_display_prop) +vndbinder_use(hal_graphics_composer_default) + +add_service(hal_graphics_composer_default, qdisplay_service) +add_hwservice(hal_graphics_composer_default, hal_display_config_hwservice); + +dontaudit hal_graphics_composer_default sysfs_graphics_unused:file r_file_perms; + +userdebug_or_eng(` + allow hal_graphics_composer_default diag_device:chr_file rw_file_perms; +') + +allow hal_graphics_composer_default oemfs:dir search; + +allow hal_graphics_composer_default sysfs_soc:dir search; +allow hal_graphics_composer_default sysfs_soc:file r_file_perms; + +hal_client_domain(hal_graphics_composer_default, hal_graphics_allocator); + +# Allow r/w to data partition for writeback dumps +allow hal_graphics_composer_default display_vendor_data_file:dir create_dir_perms; +allow hal_graphics_composer_default display_vendor_data_file:file create_file_perms; + +#allow composer access hal_light +hal_client_domain(hal_graphics_composer_default, hal_light); + +allow hal_graphics_composer_default pps_socket:sock_file write; + +add_service(hal_graphics_composer_default, hal_pixel_display_service) diff --git a/sepolicy/vendor/qcom/common/hal_imsrtp.te b/sepolicy/vendor/qcom/common/hal_imsrtp.te new file mode 100644 index 00000000..55c0ecd0 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_imsrtp.te @@ -0,0 +1,30 @@ +type hal_imsrtp, domain; +type hal_imsrtp_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(hal_imsrtp) + +hwbinder_use(hal_imsrtp) +net_domain(hal_imsrtp) + +add_hwservice(hal_imsrtp, hal_imsrtp_hwservice) +binder_call(hal_imsrtp, radio) +binder_call(hal_imsrtp, qtelephony) +unix_socket_connect(hal_imsrtp, ims, ims) + +get_prop(hal_imsrtp, hwservicemanager_prop) +get_prop(hal_imsrtp, vendor_qcom_ims_prop) + +allow hal_imsrtp ion_device:chr_file r_file_perms; +allow hal_imsrtp self:qipcrtr_socket create_socket_perms_no_ioctl; +allow hal_imsrtp sysfs_ssr:file r_file_perms; +allow hal_imsrtp sysfs_timestamp_switch:file r_file_perms; + +r_dir_file(hal_imsrtp, sysfs_soc) +r_dir_file(hal_imsrtp, sysfs_msm_subsys) + +userdebug_or_eng(` + r_dir_file(hal_imsrtp, sysfs_diag) + allow hal_imsrtp diag_device:chr_file rw_file_perms; +') + +crash_dump_fallback(hal_imsrtp) diff --git a/sepolicy/vendor/qcom/common/hal_keymaster_qti.te b/sepolicy/vendor/qcom/common/hal_keymaster_qti.te new file mode 100644 index 00000000..70c7cc21 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_keymaster_qti.te @@ -0,0 +1,8 @@ +type hal_keymaster_qti, domain; +hal_server_domain(hal_keymaster_qti, hal_keymaster) + +type hal_keymaster_qti_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_keymaster_qti) + +get_prop(hal_keymaster_qti, vendor_security_patch_level_prop) +get_prop(hal_keymaster_qti, vendor_tee_listener_prop) diff --git a/sepolicy/vendor/qcom/common/hal_memtrack_default.te b/sepolicy/vendor/qcom/common/hal_memtrack_default.te new file mode 100644 index 00000000..4882eca2 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_memtrack_default.te @@ -0,0 +1,2 @@ +allow hal_memtrack_default sysfs_kgsl_proc:file r_file_perms; +allow hal_memtrack_default sysfs_kgsl_proc:dir search; diff --git a/sepolicy/vendor/qcom/common/hal_neuralnetworks.te b/sepolicy/vendor/qcom/common/hal_neuralnetworks.te new file mode 100644 index 00000000..6ccdd390 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_neuralnetworks.te @@ -0,0 +1,22 @@ +type hal_neuralnetworks_default, domain; + +type hal_neuralnetworks_default_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_neuralnetworks_default) + +hal_server_domain(hal_neuralnetworks_default, hal_neuralnetworks) + +allow hal_neuralnetworks_default fwk_sensor_hwservice:hwservice_manager find; +allow hal_neuralnetworks_default qdsp_device:chr_file r_file_perms; +allow hal_neuralnetworks_default ion_device:chr_file r_file_perms; + +allow hal_neuralnetworks_default hal_neuralnetworks_data_file:dir create_dir_perms; +allow hal_neuralnetworks_default hal_neuralnetworks_data_file:{ file fifo_file } create_file_perms; +allow hal_neuralnetworks_default gpu_device:chr_file rw_file_perms; + +r_dir_file(hal_neuralnetworks_default, sysfs_soc) +r_dir_file(hal_neuralnetworks_default, adsprpcd_file) + +dontaudit hal_neuralnetworks_default vendor_display_prop:file read; + +# b/159570217 suppress warning related to zeroth.debuglog.logmask +dontaudit hal_neuralnetworks_default default_prop:file { open read }; diff --git a/sepolicy/vendor/qcom/common/hal_qseecom.te b/sepolicy/vendor/qcom/common/hal_qseecom.te new file mode 100644 index 00000000..fc37ddf8 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_qseecom.te @@ -0,0 +1,25 @@ +#define the domain +type hal_qseecom_default, domain; +hal_server_domain(hal_qseecom_default, hal_qseecom) +type hal_qseecom_default_exec, exec_type, file_type, vendor_file_type; + +init_daemon_domain(hal_qseecom_default) + +#Allow hal_qseecom client domain apps to find hwservice +binder_call(hal_qseecom_client, hal_qseecom_server) +binder_call(hal_qseecom_server, hal_qseecom_client) + +#allow the service to be added to hwservice list +hal_attribute_hwservice(hal_qseecom, hal_qseecom_hwservice) + +#allow access to hal_allocator +hal_client_domain(hal_qseecom_default, hal_allocator) + +#allow access to ion device +allow hal_qseecom_default ion_device:chr_file rw_file_perms; + +#Allow access to firmware +r_dir_file(hal_qseecom_default, firmware_file); + +#Allow access to tee device +allow hal_qseecom_default tee_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/qcom/common/hal_qteeconnector_qti.te b/sepolicy/vendor/qcom/common/hal_qteeconnector_qti.te new file mode 100644 index 00000000..e305090b --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_qteeconnector_qti.te @@ -0,0 +1,7 @@ +type hal_qteeconnector_qti, domain; +type hal_qteeconnector_qti_exec, exec_type, file_type, vendor_file_type; +init_daemon_domain(hal_qteeconnector_qti) + +hwbinder_use(hal_qteeconnector_qti) +get_prop(hal_qteeconnector_qti, hwservicemanager_prop) +add_hwservice(hal_qteeconnector_qti, hal_qteeconnector_hwservice) diff --git a/sepolicy/vendor/qcom/common/hal_rcsservice.te b/sepolicy/vendor/qcom/common/hal_rcsservice.te new file mode 100644 index 00000000..c8257459 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_rcsservice.te @@ -0,0 +1,34 @@ +type hal_rcsservice, domain; +type hal_rcsservice_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(hal_rcsservice) +net_domain(hal_rcsservice) + +# To register imsrcsd to hwBinder +hwbinder_use(hal_rcsservice) + +allow hal_rcsservice hidl_manager_hwservice:hwservice_manager find; + +# add IUceSerive and IService to Hidl interface +add_hwservice(hal_rcsservice, hal_imsrcsd_hwservice) +add_hwservice(hal_rcsservice, hal_imscallinfo_hwservice) +# add imsfactory to HIDl interface +add_hwservice(hal_rcsservice, hal_imsfactory_hwservice) + +get_prop(hal_rcsservice, hwservicemanager_prop) +set_prop(hal_rcsservice, vendor_qcom_ims_prop) + +allow hal_rcsservice sysfs_timestamp_switch:file r_file_perms; +allow hal_rcsservice self:qipcrtr_socket create_socket_perms_no_ioctl; + +unix_socket_connect(hal_rcsservice, ims, ims) + +# imsrcsd to bind with UceShimService.apk +binder_call(hal_rcsservice, dataservice_app) + +binder_call(hal_rcsservice, radio) + +userdebug_or_eng(` + r_dir_file(hal_rcsservice, sysfs_diag) + allow hal_rcsservice diag_device:chr_file rw_file_perms; +') diff --git a/sepolicy/vendor/qcom/common/hal_sensors_default.te b/sepolicy/vendor/qcom/common/hal_sensors_default.te new file mode 100644 index 00000000..19526438 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_sensors_default.te @@ -0,0 +1,44 @@ +# Read and write factory calibration and sensor configuration data +allow hal_sensors_default persist_file:dir search; +allow hal_sensors_default persist_file:lnk_file read; +allow hal_sensors_default mnt_vendor_file:dir search; +r_dir_file(hal_sensors_default, sensors_persist_file) +allow hal_sensors_default sensors_vendor_data_file:dir create_dir_perms; +allow hal_sensors_default sensors_vendor_data_file:file create_file_perms; + +# Interact with the sensors low power island (SLPI/ADSP) CPU +allow hal_sensors_default self:qipcrtr_socket create_socket_perms_no_ioctl; + +# sysfs needed for HW version info +r_dir_file(hal_sensors_default, sysfs_msm_subsys); + +# For QCOM diag port access +userdebug_or_eng(` + allow hal_sensors_default diag_device:chr_file rw_file_perms; +') + +vndbinder_use(hal_sensors_default); + +allow hal_sensors_default sysfs_ssr:file r_file_perms; + +# for MagCC +r_dir_file(hal_sensors_default, sysfs_batteryinfo) + +allow hal_sensors_default hal_graphics_mapper_hwservice:hwservice_manager find; +allow hal_sensors_default qdsp_device:chr_file r_file_perms; + +# For Suez metrics collection +allow hal_sensors_default fwk_stats_hwservice:hwservice_manager find; +allow hal_sensors_default system_server:binder call; + +# For rear light +allow hal_sensors_default rls_service:service_manager find; +binder_call(hal_sensors_default, rlsservice) + +# For call state +allow hal_sensors_default sysfs_call_state:file r_file_perms; + +# For touch palm +allow hal_sensors_default sysfs_touch:file rw_file_perms; +allow hal_sensors_default sysfs_touch:dir r_dir_perms; +get_prop(hal_sensors_default, vendor_sensor_prop) diff --git a/sepolicy/vendor/qcom/common/hal_tetheroffload_default.te b/sepolicy/vendor/qcom/common/hal_tetheroffload_default.te new file mode 100644 index 00000000..b463fc35 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_tetheroffload_default.te @@ -0,0 +1,11 @@ +# associate netdomain to use for accessing internet sockets +net_domain(hal_tetheroffload_default) + +# Allow operations with /dev/ipa, /dev/wwan_ioctl and /dev/ipaNatTable +allow hal_tetheroffload_default ipa_dev:chr_file rw_file_perms; + +# Allow creating and modifying the PID file +allow hal_tetheroffload_default ipa_vendor_data_file:dir w_dir_perms; +allow hal_tetheroffload_default ipa_vendor_data_file:file create_file_perms; + +dontaudit hal_tetheroffload_default shell_data_file:dir search; diff --git a/sepolicy/vendor/qcom/common/hal_tui_comm_qti.te b/sepolicy/vendor/qcom/common/hal_tui_comm_qti.te new file mode 100644 index 00000000..b5a00b19 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_tui_comm_qti.te @@ -0,0 +1,10 @@ +type hal_tui_comm_qti, domain; +type hal_tui_comm_qti_exec, exec_type, file_type, vendor_file_type; +init_daemon_domain(hal_tui_comm_qti) + +hwbinder_use(hal_tui_comm_qti) +binder_call(hal_tui_comm_qti, secure_ui_service_app) +add_hwservice(hal_tui_comm_qti, hal_tui_comm_hwservice) +get_prop(hal_tui_comm_qti, hwservicemanager_prop) + +allow hal_tui_comm_qti hal_graphics_allocator_default:fd use; diff --git a/sepolicy/vendor/qcom/common/hal_wifi_supplicant_default.te b/sepolicy/vendor/qcom/common/hal_wifi_supplicant_default.te new file mode 100644 index 00000000..b046a9b0 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hal_wifi_supplicant_default.te @@ -0,0 +1 @@ +allow hal_wifi_supplicant_default cnd:unix_dgram_socket sendto; diff --git a/sepolicy/vendor/qcom/common/hvdcp.te b/sepolicy/vendor/qcom/common/hvdcp.te new file mode 100644 index 00000000..9c1b7eb8 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hvdcp.te @@ -0,0 +1,17 @@ +type hvdcp, domain; +type hvdcp_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hvdcp) + +allow hvdcp sysfs_batteryinfo:file rw_file_perms; +allow hvdcp sysfs_batteryinfo:dir r_dir_perms; +allow hvdcp qg_device:chr_file rw_file_perms; +allow hvdcp self:capability2 wake_alarm; +allow hvdcp self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; +allow hvdcp kmsg_device:chr_file rw_file_perms; +allow hvdcp mnt_vendor_file:dir r_dir_perms; +allow hvdcp persist_file:dir search; +allow hvdcp persist_hvdcp_file:dir search; +allow hvdcp persist_hvdcp_file:file rw_file_perms; + +set_prop(hvdcp, vendor_hvdcp_opti_prop) +wakelock_use(hvdcp) diff --git a/sepolicy/vendor/qcom/common/hwservice.te b/sepolicy/vendor/qcom/common/hwservice.te new file mode 100644 index 00000000..08c0a769 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hwservice.te @@ -0,0 +1,21 @@ +type hal_display_color_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_iwlan_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_display_config_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_display_postproc_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_imsrtp_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_imscallinfo_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_datafactory_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_cne_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_imsrcsd_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_qteeconnector_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_tui_comm_hwservice, hwservice_manager_type, vendor_hwservice_type; +type vnd_atcmdfwd_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_dataconnection_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_cacert_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_capabilityconfigstore_qti_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_qseecom_hwservice, hwservice_manager_type, protected_hwservice, vendor_hwservice_type; +type hal_imsfactory_hwservice, hwservice_manager_type, protected_hwservice, vendor_hwservice_type; +type hal_qspmhal_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_slmadapter_hwservice, hwservice_manager_type, protected_hwservice; +type hal_dspmanager_hwservice, hwservice_manager_type, vendor_hwservice_type; +type hal_mwqemadapter_hwservice, hwservice_manager_type, protected_hwservice; diff --git a/sepolicy/vendor/qcom/common/hwservice_contexts b/sepolicy/vendor/qcom/common/hwservice_contexts new file mode 100644 index 00000000..053545a8 --- /dev/null +++ b/sepolicy/vendor/qcom/common/hwservice_contexts @@ -0,0 +1,38 @@ +com.qualcomm.qti.qcril.qcrilhook::IQtiOemHook u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.data.iwlan::IIWlan u:object_r:hal_iwlan_hwservice:s0 +com.qualcomm.qti.uceservice::IUceService u:object_r:hal_imsrcsd_hwservice:s0 +com.qualcomm.qti.imscmservice::IImsCmService u:object_r:hal_imsrcsd_hwservice:s0 +vendor.display.color::IDisplayColor u:object_r:hal_display_color_hwservice:s0 +vendor.display.config::IDisplayConfig u:object_r:hal_display_config_hwservice:s0 +vendor.display.postproc::IDisplayPostproc u:object_r:hal_display_postproc_hwservice:s0 +vendor.qti.hardware.display.composer::IQtiComposer u:object_r:hal_graphics_composer_hwservice:s0 +vendor.qti.hardware.display.mapper::IQtiMapper u:object_r:hal_graphics_mapper_hwservice:s0 +vendor.qti.hardware.qteeconnector::IAppConnector u:object_r:hal_qteeconnector_hwservice:s0 +vendor.qti.hardware.qteeconnector::IGPAppConnector u:object_r:hal_qteeconnector_hwservice:s0 +vendor.qti.hardware.radio.am::IQcRilAudio u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.internal.deviceinfo::IDeviceInfo u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.lpa::IUimLpa u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.qcrilhook::IQtiOemHook u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.qtiradio::IQtiRadio u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.uim_remote_server::IUimRemoteServiceServer u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.uim_remote_client::IUimRemoteServiceClient u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.uim::IUim u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.radio.ims::IImsRadio u:object_r:hal_telephony_hwservice:s0 +vendor.qti.hardware.tui_comm::ITuiComm u:object_r:hal_tui_comm_hwservice:s0 +vendor.qti.hardware.radio.atcmdfwd::IAtCmdFwd u:object_r:vnd_atcmdfwd_hwservice:s0 +vendor.qti.data.factory::IFactory u:object_r:hal_datafactory_hwservice:s0 +vendor.qti.ims.factory::IImsFactory u:object_r:hal_imsfactory_hwservice:s0 +vendor.qti.imsrtpservice::IRTPService u:object_r:hal_imsrtp_hwservice:s0 +vendor.qti.hardware.cacert::IService u:object_r:hal_cacert_hwservice:s0 +hardware.google.media.c2::IConfigurable u:object_r:hal_codec2_hwservice:s0 +vendor.qti.hardware.data.connection::IDataConnection u:object_r:hal_dataconnection_hwservice:s0 +vendor.qti.hardware.capabilityconfigstore::ICapabilityConfigStore u:object_r:hal_capabilityconfigstore_qti_hwservice:s0 +vendor.qti.hardware.display.allocator::IQtiAllocator u:object_r:hal_graphics_allocator_hwservice:s0 +vendor.qti.ims.callinfo::IService u:object_r:hal_imscallinfo_hwservice:s0 +vendor.qti.hardware.qseecom::IQSEECom u:object_r:hal_qseecom_hwservice:s0 +vendor.qti.qspmhal::IQspmhal u:object_r:hal_qspmhal_hwservice:s0 +vendor.qti.hardware.slmadapter::ISlmAdapter u:object_r:hal_slmadapter_hwservice:s0 +vendor.qti.hardware.dsp::IDspService u:object_r:hal_dspmanager_hwservice:s0 +vendor.qti.hardware.mwqemadapter::IMwqemAdapter u:object_r:hal_mwqemadapter_hwservice:s0 +vendor.qti.hardware.bluetooth_sar::IBluetoothSar u:object_r:hal_bluetooth_coexistence_hwservice:s0 +vendor.qti.hardware.bt_channel_avoidance::IBTChannelAvoidance u:object_r:hal_bluetooth_coexistence_hwservice:s0 diff --git a/sepolicy/vendor/qcom/common/ims.te b/sepolicy/vendor/qcom/common/ims.te new file mode 100644 index 00000000..42a7200d --- /dev/null +++ b/sepolicy/vendor/qcom/common/ims.te @@ -0,0 +1,50 @@ +type ims, domain; +type ims_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(ims) + +net_domain(ims) + +allow ims self:{ + socket + netlink_generic_socket + qipcrtr_socket +} create_socket_perms_no_ioctl; + +set_prop(ims, vendor_qcom_ims_prop) + +#Allow access to netmgrd socket +allow ims netmgrd_socket:dir r_dir_perms; +unix_socket_connect(ims, netmgrd, netmgrd) +allow ims netmgrd_socket:sock_file rw_file_perms; + +hwbinder_use(ims) +get_prop(ims, hwservicemanager_prop) + +r_dir_file(ims, sysfs_msm_subsys) + +allow ims sysfs_soc:dir search; +allow ims sysfs_soc:file r_file_perms; + +get_prop(ims, vendor_cnd_prop) + +# for wfc, video call +binder_call(ims, cnd) +allow ims hal_datafactory_hwservice:hwservice_manager find; + +allow ims vendor_radio_data_file:dir rw_dir_perms; +allow ims vendor_radio_data_file:file create_file_perms; + +allow ims sysfs_timestamp_switch:file r_file_perms; + +#diag +userdebug_or_eng(` + r_dir_file(ims, sysfs_diag) + allow ims diag_device:chr_file rw_file_perms; +') + +set_prop(ims, ctl_start_prop) +set_prop(ims, ctl_stop_prop) + +r_dir_file(ims, sysfs_ssr) + +dontaudit ims diag_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/qcom/common/init-qti-keymaster-sh.te b/sepolicy/vendor/qcom/common/init-qti-keymaster-sh.te new file mode 100644 index 00000000..f5a6c316 --- /dev/null +++ b/sepolicy/vendor/qcom/common/init-qti-keymaster-sh.te @@ -0,0 +1,37 @@ +# Copyright (c) 2020, The Linux Foundation. All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +type init-qti-keymaster-sh, domain; +type init-qti-keymaster-sh_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init-qti-keymaster-sh) + +# Set vendor.keymaster.strongbox.version to 40 or 41 +set_prop(init-qti-keymaster-sh, vendor_km_strongbox_version_prop); + +allow init-qti-keymaster-sh vendor_shell_exec:file rx_file_perms; +allow init-qti-keymaster-sh vendor_toolbox_exec:file rx_file_perms; diff --git a/sepolicy/vendor/qcom/common/init_shell.te b/sepolicy/vendor/qcom/common/init_shell.te new file mode 100644 index 00000000..11ea6a36 --- /dev/null +++ b/sepolicy/vendor/qcom/common/init_shell.te @@ -0,0 +1,8 @@ +type qti_init_shell, domain; +type qti_init_shell_exec, exec_type, vendor_file_type,file_type; +init_daemon_domain(qti_init_shell); +set_prop(qti_init_shell, vendor_adsp_version_prop); +set_prop(qti_init_shell, vendor_sensor_prop); +allow qti_init_shell vendor_toolbox_exec:file execute_no_trans; +allow qti_init_shell sysfs_soc:dir search; +allow qti_init_shell sysfs_soc:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/ioctl_defines b/sepolicy/vendor/qcom/common/ioctl_defines new file mode 100644 index 00000000..1a7a207c --- /dev/null +++ b/sepolicy/vendor/qcom/common/ioctl_defines @@ -0,0 +1,57 @@ +# gpu_device ioctls defined in the kernel in include/uapi/linux/msm_kgsl.h +define(`IOCTL_KGSL_DEVICE_GETPROPERTY', `0x00000902') +define(`IOCTL_KGSL_DEVICE_WAITTIMESTAMP', `0x00000906') +define(`IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID', `0x00000907') +define(`IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS', `0x00000910') +define(`IOCTL_KGSL_CMDSTREAM_READTIMESTAMP', `0x00000911') +define(`IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP', `0x00000912') +define(`IOCTL_KGSL_DRAWCTXT_CREATE', `0x00000913') +define(`IOCTL_KGSL_DRAWCTXT_DESTROY', `0x00000914') +define(`IOCTL_KGSL_MAP_USER_MEM', `0x00000915') +define(`IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID', `0x00000916') +define(`IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID', `0x00000917') +define(`IOCTL_KGSL_SHAREDMEM_FROM_PMEM', `0x00000920') +define(`IOCTL_KGSL_SHAREDMEM_FREE', `0x00000921') +define(`IOCTL_KGSL_DRAWCTXT_BIND_GMEM_SHADOW', `0x00000922') +define(`IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC', `0x00000923') +define(`IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE', `0x00000924') +define(`IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET', `0x00000925') +define(`IOCTL_KGSL_CMDWINDOW_WRITE', `0x0000092e') +define(`IOCTL_KGSL_GPUMEM_ALLOC', `0x0000092f') +define(`IOCTL_KGSL_CFF_SYNCMEM', `0x00000930') +define(`IOCTL_KGSL_CFF_USER_EVENT', `0x00000931') +define(`IOCTL_KGSL_SETPROPERTY', `0x00000932') +define(`IOCTL_KGSL_TIMESTAMP_EVENT', `0x00000933') +define(`IOCTL_KGSL_GPUMEM_ALLOC_ID', `0x00000934') +define(`IOCTL_KGSL_GPUMEM_FREE_ID', `0x00000935') +define(`IOCTL_KGSL_GPUMEM_GET_INFO', `0x00000936') +define(`IOCTL_KGSL_GPUMEM_SYNC_CACHE', `0x00000937') +define(`IOCTL_KGSL_PERFCOUNTER_GET', `0x00000938') +define(`IOCTL_KGSL_PERFCOUNTER_PUT', `0x00000939') +define(`IOCTL_KGSL_PERFCOUNTER_QUERY', `0x0000093a') +define(`IOCTL_KGSL_PERFCOUNTER_READ', `0x0000093b') +define(`IOCTL_KGSL_GPUMEM_SYNC_CACHE_BULK', `0x0000093c') +define(`IOCTL_KGSL_SUBMIT_COMMANDS', `0x0000093d') +define(`IOCTL_KGSL_SYNCSOURCE_CREATE', `0x00000940') +define(`IOCTL_KGSL_SYNCSOURCE_DESTROY', `0x00000941') +define(`IOCTL_KGSL_SYNCSOURCE_CREATE_FENCE', `0x00000942') +define(`IOCTL_KGSL_SYNCSOURCE_SIGNAL_FENCE', `0x00000943') +define(`IOCTL_KGSL_CFF_SYNC_GPUOBJ', `0x00000944') +define(`IOCTL_KGSL_GPUOBJ_ALLOC', `0x00000945') +define(`IOCTL_KGSL_GPUOBJ_FREE', `0x00000946') +define(`IOCTL_KGSL_GPUOBJ_INFO', `0x00000947') +define(`IOCTL_KGSL_GPUOBJ_IMPORT', `0x00000948') +define(`IOCTL_KGSL_GPUOBJ_SYNC', `0x00000949') +define(`IOCTL_KGSL_GPU_COMMAND', `0x0000094a') +define(`IOCTL_KGSL_PREEMPTIONCOUNTER_QUERY', `0x0000094b') +define(`IOCTL_KGSL_GPUOBJ_SET_INFO', `0x0000094c') + +# socket ioctls defined in the kernel in include/uapi/linux/msm_ipc.h +define(`IPC_ROUTER_IOCTL_GET_VERSION', `0x0000c300') +define(`IPC_ROUTER_IOCTL_GET_MTU', `0x0000c301') +define(`IPC_ROUTER_IOCTL_LOOKUP_SERVER', `0x0000c302') +define(`IPC_ROUTER_IOCTL_GET_CURR_PKT_SIZE', `0x0000c303') +define(`IPC_ROUTER_IOCTL_BIND_CONTROL_PORT', `0x0000c304') +define(`IPC_ROUTER_IOCTL_CONFIG_SEC_RULES', `0x0000c305') + +define(`RMNET_IOCTL_EXTENDED', `0x000089FD') diff --git a/sepolicy/vendor/qcom/common/ioctl_macros b/sepolicy/vendor/qcom/common/ioctl_macros new file mode 100644 index 00000000..ae50a635 --- /dev/null +++ b/sepolicy/vendor/qcom/common/ioctl_macros @@ -0,0 +1,66 @@ +define(`gpu_ioctls', `{ +IOCTL_KGSL_DEVICE_GETPROPERTY +IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID +IOCTL_KGSL_DRAWCTXT_CREATE +IOCTL_KGSL_DRAWCTXT_DESTROY +IOCTL_KGSL_MAP_USER_MEM +IOCTL_KGSL_SHAREDMEM_FREE +IOCTL_KGSL_SETPROPERTY +IOCTL_KGSL_TIMESTAMP_EVENT +IOCTL_KGSL_PERFCOUNTER_GET +IOCTL_KGSL_PERFCOUNTER_PUT +IOCTL_KGSL_SYNCSOURCE_CREATE +IOCTL_KGSL_SYNCSOURCE_DESTROY +IOCTL_KGSL_SYNCSOURCE_CREATE_FENCE +IOCTL_KGSL_SYNCSOURCE_SIGNAL_FENCE +IOCTL_KGSL_GPUOBJ_ALLOC +IOCTL_KGSL_GPUOBJ_FREE +IOCTL_KGSL_GPUOBJ_INFO +IOCTL_KGSL_GPUOBJ_IMPORT +IOCTL_KGSL_GPUOBJ_SYNC +IOCTL_KGSL_GPU_COMMAND +}') + +define(`msm_sock_ipc_ioctls', `{ +IPC_ROUTER_IOCTL_GET_VERSION +IPC_ROUTER_IOCTL_GET_MTU +IPC_ROUTER_IOCTL_LOOKUP_SERVER +IPC_ROUTER_IOCTL_GET_CURR_PKT_SIZE +IPC_ROUTER_IOCTL_BIND_CONTROL_PORT +IPC_ROUTER_IOCTL_CONFIG_SEC_RULES +}') + +define(`msm_sock_qrtr_ioctls', `{ +TIOCOUTQ +}') + +define(`rmnet_sock_ioctls', `{ +SIOCDEVPRIVATE_1 +SIOCDEVPRIVATE_2 +SIOCDEVPRIVATE_3 +SIOCDEVPRIVATE_4 +SIOCDEVPRIVATE_5 +SIOCDEVPRIVATE_6 +SIOCDEVPRIVATE_7 +SIOCDEVPRIVATE_8 +SIOCDEVPRIVATE_9 +SIOCDEVPRIVATE_A +SIOCDEVPRIVATE_B +SIOCDEVPRIVATE_C +SIOCDEVPRIVATE_D +}') + +define(`wlan_sock_ioctls', `{ +SIOCSIWPRIV +SIOCIWFIRSTPRIV_15 +}') + +define(`lowi_server_ioctls', `{ +SIOCGIFINDEX +SIOCGIFHWADDR +SIOCGIFFLAGS +SIOCIWFIRSTPRIV_05 +SIOCIWFIRSTPRIV_11 +SIOCIWFIRSTPRIV_13 +SIOCDEVPRIVATE_1 +}') diff --git a/sepolicy/vendor/qcom/common/irsc_util.te b/sepolicy/vendor/qcom/common/irsc_util.te new file mode 100644 index 00000000..13401f91 --- /dev/null +++ b/sepolicy/vendor/qcom/common/irsc_util.te @@ -0,0 +1,7 @@ +type irsc_util, domain; +type irsc_util_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(irsc_util) + +allow irsc_util self:socket create; + +dontaudit irsc_util kernel:system module_request; diff --git a/sepolicy/vendor/qcom/common/kernel.te b/sepolicy/vendor/qcom/common/kernel.te new file mode 100644 index 00000000..19d3986e --- /dev/null +++ b/sepolicy/vendor/qcom/common/kernel.te @@ -0,0 +1,14 @@ +# For diag over socket +allow kernel self:qipcrtr_socket create; + +userdebug_or_eng(` + allow kernel debugfs_wlan:dir search; + allow kernel debugfs_ipc:dir search; +') + +allow kernel debugfs_pmic:dir create_dir_perms; +allow kernel debugfs_pmic:file create_file_perms; + +dontaudit kernel self:qipcrtr_socket create; +dontaudit kernel debugfs_wlan:dir search; +dontaudit kernel debugfs_ipc:dir search; diff --git a/sepolicy/vendor/qcom/common/location.te b/sepolicy/vendor/qcom/common/location.te new file mode 100644 index 00000000..751f8471 --- /dev/null +++ b/sepolicy/vendor/qcom/common/location.te @@ -0,0 +1,46 @@ +type location, domain; +type location_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(location) + +allow location hal_cacert_hwservice:hwservice_manager find; +allow location hal_datafactory_hwservice:hwservice_manager find; +allow location hal_cne_hwservice:hwservice_manager find; + +binder_call(location, qtidataservices_app) +get_prop(location, hwservicemanager_prop) +hwbinder_use(location) + +# Enable standard network access (for XTRA download) +net_domain(location) + +r_dir_file(location, sysfs_msm_subsys) +r_dir_file(location, sysfs_soc) +r_dir_file(location, sysfs_ssr) + +allow location hal_gnss_qti:unix_dgram_socket sendto; + +allow location location_data_file:dir create_dir_perms; +allow location location_data_file:file create_file_perms; +allow location location_exec:file execute_no_trans; +allow location location_socket:dir w_dir_perms; +allow location location_socket:sock_file create_file_perms; + +allow location self:capability setgid; +allow location self:qipcrtr_socket create_socket_perms_no_ioctl; + +# Network access for lowi-server +allow location self:netlink_generic_socket create_socket_perms_no_ioctl; +allow location self:netlink_socket create_socket_perms_no_ioctl; +allowxperm location self:udp_socket ioctl lowi_server_ioctls; +allow location wpa_data_file:dir rw_dir_perms; +allow location wpa_data_file:sock_file create_file_perms; +allow location hal_wifi_supplicant_default:unix_dgram_socket sendto; +allow location wifihal_socket:dir search; +unix_socket_send(location, wifihal, hal_wifi_ext); + +userdebug_or_eng(` + allow location diag_device:chr_file rw_file_perms; +') + +# xtra-daemon control +get_prop(location, xtra_control_prop) diff --git a/sepolicy/vendor/qcom/common/mdm_helper.te b/sepolicy/vendor/qcom/common/mdm_helper.te new file mode 100644 index 00000000..7911e1b9 --- /dev/null +++ b/sepolicy/vendor/qcom/common/mdm_helper.te @@ -0,0 +1,3 @@ +type mdm_helper, domain; +type mdm_helper_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(mdm_helper); diff --git a/sepolicy/vendor/qcom/common/mediacodec.te b/sepolicy/vendor/qcom/common/mediacodec.te new file mode 100644 index 00000000..4a5d2a3c --- /dev/null +++ b/sepolicy/vendor/qcom/common/mediacodec.te @@ -0,0 +1,10 @@ +get_prop(mediacodec, vendor_display_prop) +allow mediacodec hal_capabilityconfigstore_qti_hwservice:hwservice_manager find; +# Add sepolicy for ECOService +add_service(mediacodec, eco_service) +get_prop(mediacodec, vendor_ecoservice_prop) +allow mediacodec hal_camera_default:binder call; +r_dir_file(mediacodec, sysfs_soc) +binder_use(mediacodec) + +dontaudit mediacodec sysfs_msm_subsys:dir search; diff --git a/sepolicy/vendor/qcom/common/mediaserver.te b/sepolicy/vendor/qcom/common/mediaserver.te new file mode 100644 index 00000000..ef486cfd --- /dev/null +++ b/sepolicy/vendor/qcom/common/mediaserver.te @@ -0,0 +1,4 @@ +get_prop(mediaserver, vendor_display_prop) +r_dir_file(mediaserver, sysfs_soc) + +dontaudit mediaserver sysfs_msm_subsys:dir search; diff --git a/sepolicy/vendor/qcom/common/mediaswcodec.te b/sepolicy/vendor/qcom/common/mediaswcodec.te new file mode 100644 index 00000000..33b737ef --- /dev/null +++ b/sepolicy/vendor/qcom/common/mediaswcodec.te @@ -0,0 +1,4 @@ +get_prop(mediaswcodec, vendor_display_prop) +allow mediaswcodec gpu_device:chr_file rw_file_perms; +allow mediaswcodec sysfs_msm_subsys:dir search; +allow mediaswcodec sysfs_msm_subsys:file rw_file_perms; diff --git a/sepolicy/vendor/qcom/common/mediatranscoding.te b/sepolicy/vendor/qcom/common/mediatranscoding.te new file mode 100644 index 00000000..ab3f09dc --- /dev/null +++ b/sepolicy/vendor/qcom/common/mediatranscoding.te @@ -0,0 +1,2 @@ +get_prop(domain, vendor_display_prop) + diff --git a/sepolicy/vendor/qcom/common/msm_irqbalanced.te b/sepolicy/vendor/qcom/common/msm_irqbalanced.te new file mode 100644 index 00000000..886b4308 --- /dev/null +++ b/sepolicy/vendor/qcom/common/msm_irqbalanced.te @@ -0,0 +1,10 @@ +type msm_irqbalanced, domain; +type msm_irqbalanced_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(msm_irqbalanced) + +allow msm_irqbalanced sysfs_devices_system_cpu:file rw_file_perms; +allow msm_irqbalanced proc_irq:dir r_dir_perms; +allow msm_irqbalanced proc_irq:file rw_file_perms; + +allow msm_irqbalanced proc_stat:file r_file_perms; +allow msm_irqbalanced proc_interrupts:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/netmgrd.te b/sepolicy/vendor/qcom/common/netmgrd.te new file mode 100644 index 00000000..49ec1026 --- /dev/null +++ b/sepolicy/vendor/qcom/common/netmgrd.te @@ -0,0 +1,67 @@ +type netmgrd, domain; +type netmgrd_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(netmgrd) +net_domain(netmgrd) + +userdebug_or_eng(` + allow netmgrd diag_device:chr_file rw_file_perms; + #Allow diag logging + allow netmgrd sysfs_timestamp_switch:file r_file_perms; + r_dir_file(netmgrd, sysfs_diag) +') + +#Allow netmgrd operations +allow netmgrd netmgrd:capability { + net_raw + net_admin + setgid + setuid + setpcap +}; + +#Allow set persist.vendor.data.shs_ko_load +#Allow set persist.vendor.data.shsusr_load +#Allow set persist.vendor.data.perf_ko_load +#Allow set persist.vendor.data.qmipriod_load +#Allow set persist.vendor.data.offload_ko_load +set_prop(netmgrd, vendor_radio_prop); + +#Allow netmgrd to use wakelock +wakelock_use(netmgrd) + +r_dir_file(netmgrd, sysfs_ssr); + +#Allow operations on different types of sockets +allow netmgrd self:netlink_route_socket nlmsg_write; +allow netmgrd self:netlink_socket create_socket_perms_no_ioctl; +allow netmgrd self:netlink_xfrm_socket create_socket_perms_no_ioctl; +allow netmgrd self:netlink_generic_socket create_socket_perms_no_ioctl; +allow netmgrd self:qipcrtr_socket create_socket_perms_no_ioctl; + +#Allow writing of ipv6 network properties +allow netmgrd proc_net:file rw_file_perms; + +#Allow netmgrd to create netmgrd socket +allow netmgrd netmgrd_socket:dir create_dir_perms; +allow netmgrd netmgrd_socket:sock_file create_file_perms; + +allowxperm netmgrd self:udp_socket ioctl priv_sock_ioctls; +#Allow netmgrd to use netd HAL via HIDL +allow netmgrd system_net_netd_hwservice:hwservice_manager find; +get_prop(netmgrd, hwservicemanager_prop) +hwbinder_use(netmgrd) +binder_call(netmgrd, netd) + +allow netmgrd sysfs_net:dir r_dir_perms; +allow netmgrd sysfs_net:file rw_file_perms; +allow netmgrd sysfs_soc:dir search; +allow netmgrd sysfs_soc:file r_file_perms; +allow netmgrd sysfs_msm_subsys:dir r_dir_perms; +allow netmgrd sysfs_msm_subsys:file r_file_perms; + +# Allow netmgrd logging mechanism +allow netmgrd netmgrd_data_file:dir rw_dir_perms; +allow netmgrd netmgrd_data_file:file create_file_perms; + +#Ignore if device loading for private IOCTL failed +dontaudit netmgrd kernel:system module_request; diff --git a/sepolicy/vendor/qcom/common/netutils_wrapper.te b/sepolicy/vendor/qcom/common/netutils_wrapper.te new file mode 100644 index 00000000..299375b2 --- /dev/null +++ b/sepolicy/vendor/qcom/common/netutils_wrapper.te @@ -0,0 +1,3 @@ +allow netutils_wrapper netmgrd:fd use; +allow netutils_wrapper netmgrd:fifo_file { getattr ioctl read write }; +allowxperm netutils_wrapper netmgrd:fifo_file ioctl { TCGETS }; diff --git a/sepolicy/vendor/qcom/common/omadm.te b/sepolicy/vendor/qcom/common/omadm.te new file mode 100644 index 00000000..377a0519 --- /dev/null +++ b/sepolicy/vendor/qcom/common/omadm.te @@ -0,0 +1,10 @@ +# OMADM app +type omadm_app, domain; + +app_domain(omadm_app) +net_domain(omadm_app) + +allow omadm_app app_api_service:service_manager find; +allow omadm_app vendor_radio_data_file:dir rw_dir_perms; +allow omadm_app vendor_radio_data_file:file create_file_perms; +allow omadm_app radio_service:service_manager find; diff --git a/sepolicy/vendor/qcom/common/pd_services.te b/sepolicy/vendor/qcom/common/pd_services.te new file mode 100644 index 00000000..1c6e09c8 --- /dev/null +++ b/sepolicy/vendor/qcom/common/pd_services.te @@ -0,0 +1,10 @@ +type vendor_pd_mapper, domain; + +type vendor_pd_mapper_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(vendor_pd_mapper); + +allow vendor_pd_mapper self:qipcrtr_socket create_socket_perms_no_ioctl; + +userdebug_or_eng(` + allow vendor_pd_mapper kmsg_device:chr_file rw_file_perms; +') diff --git a/sepolicy/vendor/qcom/common/peripheral_manager.te b/sepolicy/vendor/qcom/common/peripheral_manager.te new file mode 100644 index 00000000..edafb01e --- /dev/null +++ b/sepolicy/vendor/qcom/common/peripheral_manager.te @@ -0,0 +1,26 @@ +# Policy for peripheral_manager +# per_mgr - peripheral_manager domain +type vendor_per_mgr, domain; + +type vendor_per_mgr_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(vendor_per_mgr); + +vndbinder_use(vendor_per_mgr) +binder_call(vendor_per_mgr, vendor_per_mgr) +binder_call(vendor_per_mgr, wcnss_service) +binder_call(vendor_per_mgr, rild) +binder_call(vendor_per_mgr, hal_gnss_qti) +set_prop(vendor_per_mgr, vendor_per_mgr_state_prop) + +allow vendor_per_mgr self:qipcrtr_socket create_socket_perms_no_ioctl; +allow vendor_per_mgr modem_ssr_device:chr_file r_file_perms; +add_service(vendor_per_mgr, vendor_per_mgr_service) + +allow vendor_per_mgr sysfs_msm_subsys:dir r_dir_perms; +allow vendor_per_mgr sysfs_ssr:file r_file_perms; + +userdebug_or_eng(` + allow vendor_per_mgr debugfs_ipc:dir search; +') + +dontaudit vendor_per_mgr debugfs_ipc:dir search; diff --git a/sepolicy/vendor/qcom/common/port-bridge.te b/sepolicy/vendor/qcom/common/port-bridge.te new file mode 100644 index 00000000..9057dd5a --- /dev/null +++ b/sepolicy/vendor/qcom/common/port-bridge.te @@ -0,0 +1,9 @@ +type port-bridge, domain; +type port-bridge_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(port-bridge) + +allow port-bridge at_device:chr_file rw_file_perms; + +r_dir_file(port-bridge, sysfs_msm_subsys) +r_dir_file(port-bridge, sysfs_soc) +r_dir_file(port-bridge, sysfs_ssr) diff --git a/sepolicy/vendor/qcom/common/property.te b/sepolicy/vendor/qcom/common/property.te new file mode 100644 index 00000000..5867d8cc --- /dev/null +++ b/sepolicy/vendor/qcom/common/property.te @@ -0,0 +1,22 @@ +vendor_internal_prop(vendor_adsp_version_prop) +vendor_internal_prop(vendor_audio_prop) +vendor_internal_prop(vendor_bluetooth_address_prop) +vendor_internal_prop(vendor_bluetooth_prop) +vendor_internal_prop(vendor_cnd_prop) +vendor_internal_prop(vendor_cnss_diag_prop) +vendor_internal_prop(vendor_modem_diag_prop) +vendor_internal_prop(vendor_per_mgr_state_prop) +vendor_internal_prop(vendor_ssr_prop) +vendor_internal_prop(vendor_tee_listener_prop) +vendor_internal_prop(vendor_usb_prop) +vendor_internal_prop(vendor_wifi_version) +vendor_internal_prop(vendor_xlat_prop) + +vendor_restricted_prop(vendor_camera_prop) +vendor_restricted_prop(vendor_km_strongbox_version_prop) +vendor_restricted_prop(vendor_display_prop) +vendor_restricted_prop(vendor_hvdcp_opti_prop) +vendor_restricted_prop(vendor_qcom_ims_prop) +vendor_restricted_prop(vendor_radio_prop) + +vendor_public_prop(vendor_telephony_vtcam_prop) diff --git a/sepolicy/vendor/qcom/common/property_contexts b/sepolicy/vendor/qcom/common/property_contexts new file mode 100644 index 00000000..0b3c63b4 --- /dev/null +++ b/sepolicy/vendor/qcom/common/property_contexts @@ -0,0 +1,90 @@ +# vendor_audio_prop +vendor.audio.snd_card.open.retries u:object_r:vendor_audio_prop:s0 +vendor.audio.adm.buffering.ms u:object_r:vendor_audio_prop:s0 + +vendor.audio.volume.listener.dump u:object_r:vendor_audio_prop:s0 +vendor.audio.volume.headset.gain.depcal u:object_r:vendor_audio_prop:s0 +vendor.audio_hal.in_period_size u:object_r:vendor_audio_prop:s0 +vendor.audio_hal.period_multiplier u:object_r:vendor_audio_prop:s0 +vendor.audio_hal.period_size u:object_r:vendor_audio_prop:s0 +persist.vendor.audio.dualmic.config u:object_r:vendor_audio_prop:s0 + +persist.vendor.audio.fluence.speaker u:object_r:vendor_audio_prop:s0 +persist.vendor.audio.fluence.voicecall u:object_r:vendor_audio_prop:s0 +persist.vendor.audio.fluence.voicerec u:object_r:vendor_audio_prop:s0 + +persist.camera. u:object_r:vendor_camera_prop:s0 +vendor.debug.camera. u:object_r:vendor_camera_prop:s0 +persist.vendor.camera. u:object_r:vendor_camera_prop:s0 +persist.vendor.sys.cnd u:object_r:vendor_cnd_prop:s0 +persist.vendor.cnd.wqe u:object_r:vendor_cnd_prop:s0 +persist.vendor.cne.feature u:object_r:vendor_cnd_prop:s0 +persist.vendor.cne.logging.qxdm u:object_r:vendor_cnd_prop:s0 +persist.vendor.net.doxlat u:object_r:vendor_xlat_prop:s0 +persist.vendor.radio u:object_r:vendor_radio_prop:s0 +persist.vendor.sys.modem.diag. u:object_r:vendor_modem_diag_prop:s0 + +# vendor_bluetooth_prop +persist.vendor.service.bdroid.bdaddr u:object_r:vendor_bluetooth_address_prop:s0 +persist.vendor.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.bluetooth.csoc.cnt u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.bluetooth.diag_enabled u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.fwsnoop u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.sibs u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.snooplog u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.soclog u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0 +ro.vendor.bluetooth.emb_wp_mode u:object_r:vendor_bluetooth_prop:s0 +ro.vendor.bluetooth.wipower u:object_r:vendor_bluetooth_prop:s0 +persist.vendor.bt.soc.scram_freqs u:object_r:vendor_bluetooth_prop:s0 + +ro.vendor.audio.sdk.fluencetype u:object_r:vendor_audio_prop:s0 +ro.vendor.ril. u:object_r:vendor_radio_prop:s0 + +# vendor display prop +vendor.gralloc.disable_ahardware_buffer u:object_r:vendor_display_prop:s0 +vendor.gralloc.use_system_heap_for_sensors u:object_r:vendor_display_prop:s0 +vendor.gralloc.disable_ubwc u:object_r:vendor_display_prop:s0 +vendor.debug.egl.changepixelformat u:object_r:vendor_display_prop:s0 +vendor.debug.egl.profiler u:object_r:vendor_display_prop:s0 +vendor.debug.prerotation.disable u:object_r:vendor_display_prop:s0 +vendor.debug.egl.swapinterval u:object_r:vendor_display_prop:s0 +ro.vendor.graphics.memory u:object_r:vendor_display_prop:s0 +vendor.debug.rs. u:object_r:vendor_display_prop:s0 + +vendor.ims. u:object_r:vendor_qcom_ims_prop:s0 +vendor.peripheral. u:object_r:vendor_per_mgr_state_prop:s0 +vendor.sys.listeners.registered u:object_r:vendor_tee_listener_prop:s0 +vendor.usb. u:object_r:vendor_usb_prop:s0 +vendor.wlan.driver.version u:object_r:vendor_wifi_version:s0 +vendor.wlan.firmware.version u:object_r:vendor_wifi_version:s0 +vendor.radio u:object_r:vendor_radio_prop:s0 +vendor.sys.modem.diag. u:object_r:vendor_modem_diag_prop:s0 +vendor.debug.ssrdump u:object_r:vendor_ssr_prop:s0 + +persist.vendor.sys.cnss. u:object_r:vendor_cnss_diag_prop:s0 +persist.vendor.sys.crash_rcu u:object_r:vendor_ramdump_prop:s0 +persist.vendor.sys.ssr. u:object_r:vendor_ssr_prop:s0 +vendor.sys.ssr. u:object_r:vendor_ssr_prop:s0 + +vendor.sys.adsp.firmware.version u:object_r:vendor_adsp_version_prop:s0 + +vendor.media.ecoservice.log. u:object_r:vendor_ecoservice_prop:s0 + +persist.vendor.data.netmgr.log_to_file u:object_r:vendor_default_prop:s0 +persist.vendor.ims. u:object_r:vendor_qcom_ims_prop:s0 +persist.vendor.qti.telephony.vt_cam_interface u:object_r:vendor_telephony_vtcam_prop:s0 + +# hvdcp_opti prop +persist.vendor.hvdcp_opti.start u:object_r:vendor_hvdcp_opti_prop:s0 +persist.vendor.hvdcp_opti.version u:object_r:vendor_hvdcp_opti_prop:s0 + +# vendor_radio_prop +persist.vendor.data.shs_ko_load u:object_r:vendor_radio_prop:s0 +persist.vendor.data.shsusr_load u:object_r:vendor_radio_prop:s0 +persist.vendor.data.perf_ko_load u:object_r:vendor_radio_prop:s0 +persist.vendor.data.qmipriod_load u:object_r:vendor_radio_prop:s0 +persist.vendor.data.offload_ko_load u:object_r:vendor_radio_prop:s0 + +#keymaster strongbox service +vendor.keymaster.strongbox.version u:object_r:vendor_km_strongbox_version_prop:s0 diff --git a/sepolicy/vendor/qcom/common/qlogd.te b/sepolicy/vendor/qcom/common/qlogd.te new file mode 100644 index 00000000..99c821b2 --- /dev/null +++ b/sepolicy/vendor/qcom/common/qlogd.te @@ -0,0 +1,13 @@ +type qlogd, domain, mlstrustedsubject; +type qlogd_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(qlogd) + +allow qlogd diag_device:chr_file rw_file_perms; + +allow qlogd vendor_radio_data_file:file create_file_perms; +allow qlogd vendor_radio_data_file:dir create_dir_perms; + +set_prop(qlogd, vendor_modem_diag_prop) + +allow qlogd self:socket create_socket_perms; +allowxperm qlogd self:socket ioctl msm_sock_ipc_ioctls; diff --git a/sepolicy/vendor/qcom/common/qrtr.te b/sepolicy/vendor/qcom/common/qrtr.te new file mode 100644 index 00000000..6cd4ac94 --- /dev/null +++ b/sepolicy/vendor/qcom/common/qrtr.te @@ -0,0 +1,5 @@ +type qrtr, domain; +type qrtr_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(qrtr) + +allow qrtr self:qipcrtr_socket create_socket_perms_no_ioctl; diff --git a/sepolicy/vendor/qcom/common/qspmhal.te b/sepolicy/vendor/qcom/common/qspmhal.te new file mode 100644 index 00000000..5f2724b5 --- /dev/null +++ b/sepolicy/vendor/qcom/common/qspmhal.te @@ -0,0 +1,28 @@ +#define the domain +type hal_qspmhal_default, domain; +type hal_qspmhal_default_exec, exec_type, file_type, vendor_file_type; + +init_daemon_domain(hal_qspmhal_default) + +hal_server_domain(hal_qspmhal_default, hal_qspmhal) + +binder_call(hal_qspmhal_client, hal_qspmhal_server) +binder_call(hal_qspmhal_server, hal_qspmhal_client) + +hal_attribute_hwservice(hal_qspmhal, hal_qspmhal_hwservice) + +hal_client_domain(hal_qspmhal_default, hal_allocator) + +hal_client_domain(untrusted_app, hal_qspmhal) +hal_client_domain(platform_app, hal_qspmhal) +hal_client_domain(gmscore_app, hal_qspmhal) +hal_client_domain(surfaceflinger, hal_qspmhal) +hal_client_domain(bootanim, hal_qspmhal) +hal_client_domain(system_server, hal_qspmhal) +hal_client_domain(priv_app, hal_qspmhal) +hal_client_domain(system_app, hal_qspmhal) + +# It's not necessary to use the google camera app. +dontaudit google_camera_app hal_qspmhal_hwservice:hwservice_manager find; + +dontaudit untrusted_app_all hal_qspmhal_hwservice:hwservice_manager find; diff --git a/sepolicy/vendor/qcom/common/qtelephony.te b/sepolicy/vendor/qcom/common/qtelephony.te new file mode 100644 index 00000000..a0650401 --- /dev/null +++ b/sepolicy/vendor/qcom/common/qtelephony.te @@ -0,0 +1,31 @@ +# For atfwd service +type qtelephony, domain; +app_domain(qtelephony) + +allow qtelephony app_api_service:service_manager find; +allow qtelephony hal_imsrtp_hwservice:hwservice_manager find; +allow qtelephony hal_telephony_service:service_manager find; +allow qtelephony radio_service:service_manager find; +allow qtelephony sysfs_diag:dir search; +allow qtelephony sysfs_timestamp_switch:file r_file_perms; +allow qtelephony audioserver_service:service_manager find; +allow qtelephony cameraserver_service:service_manager find; +allow qtelephony mediaextractor_service:service_manager find; +allow qtelephony mediametrics_service:service_manager find; +allow qtelephony mediaserver_service:service_manager find; +allow qtelephony sysfs_soc:dir search; +allow qtelephony sysfs_soc:file r_file_perms; + +binder_call(qtelephony, hal_imsrtp) +hal_client_domain(qtelephony, hal_telephony) + +get_prop(qtelephony, vendor_radio_prop) +get_prop(qtelephony, vendor_telephony_vtcam_prop) +set_prop(qtelephony, vendor_qcom_ims_prop) + +userdebug_or_eng(` + allow qtelephony diag_device:chr_file rw_file_perms; +') + +# b/265255811#comment26 Ignore access AIDL as we freezed target for HIDL +dontaudit qtelephony default_android_service:service_manager { find }; diff --git a/sepolicy/vendor/qcom/common/qti.te b/sepolicy/vendor/qcom/common/qti.te new file mode 100644 index 00000000..187a9ddc --- /dev/null +++ b/sepolicy/vendor/qcom/common/qti.te @@ -0,0 +1,3 @@ +type qti, domain; +type qti_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(qti)
\ No newline at end of file diff --git a/sepolicy/vendor/qcom/common/qtidataservices_app.te b/sepolicy/vendor/qcom/common/qtidataservices_app.te new file mode 100644 index 00000000..d963c469 --- /dev/null +++ b/sepolicy/vendor/qcom/common/qtidataservices_app.te @@ -0,0 +1,25 @@ +type qtidataservices_app, domain; +app_domain(qtidataservices_app) +net_domain(qtidataservices_app) + +add_hwservice(qtidataservices_app, hal_cacert_hwservice) + +get_prop(qtidataservices_app, vendor_default_prop) +set_prop(qtidataservices_app, telephony_status_prop) + +allow qtidataservices_app hal_datafactory_hwservice:hwservice_manager find; +allow qtidataservices_app hal_iwlan_hwservice:hwservice_manager find; +allow qtidataservices_app radio_service:service_manager find; + +allow qtidataservices_app self:qipcrtr_socket create_socket_perms_no_ioctl; +allow qtidataservices_app radio_data_file:dir r_dir_perms; +allow qtidataservices_app app_api_service:service_manager find; + +allow qtidataservices_app sysfs_msm_subsys:dir r_dir_perms; +allow qtidataservices_app sysfs_soc:dir search; +allow qtidataservices_app sysfs_soc:file r_file_perms; +allow qtidataservices_app sysfs_ssr:file r_file_perms; + +binder_call(qtidataservices_app, cnd) +binder_call(qtidataservices_app, rild) +binder_call(qtidataservices_app, location) diff --git a/sepolicy/vendor/qcom/common/radio.te b/sepolicy/vendor/qcom/common/radio.te new file mode 100644 index 00000000..216ada19 --- /dev/null +++ b/sepolicy/vendor/qcom/common/radio.te @@ -0,0 +1,17 @@ +#for video call +binder_call(radio, hal_imsrtp) +binder_call(radio, hal_rcsservice) +allow radio hal_imsrtp_hwservice:hwservice_manager find; + +allow radio mediaextractor_service:service_manager find; + +add_hwservice(radio, vnd_atcmdfwd_hwservice) + +userdebug_or_eng(` + allow radio diag_device:chr_file rw_file_perms; +') +allow radio hal_imsrcsd_hwservice:hwservice_manager find; + +get_prop(radio, vendor_radio_prop) +#get_prop(radio, vendor_telephony_vtcam_prop) +get_prop(radio, vendor_qcom_ims_prop) diff --git a/sepolicy/vendor/qcom/common/rfs_access.te b/sepolicy/vendor/qcom/common/rfs_access.te new file mode 100644 index 00000000..a5b5ba84 --- /dev/null +++ b/sepolicy/vendor/qcom/common/rfs_access.te @@ -0,0 +1,19 @@ +type rfs_access, domain; +type rfs_access_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(rfs_access) + +allow rfs_access mnt_vendor_file:dir search; +allow rfs_access mpss_rfs_data_file:dir create_dir_perms; +allow rfs_access mpss_rfs_data_file:file create_file_perms; +allow rfs_access persist_file:dir search; +allow rfs_access persist_rfs_file:dir create_dir_perms; +allow rfs_access persist_rfs_file:file create_file_perms; +allow rfs_access persist_rfs_shared_hlos_file:dir create_dir_perms; +allow rfs_access rfs_tombstone_data_file:dir create_dir_perms; +allow rfs_access rfs_tombstone_data_file:file create_file_perms; +allow rfs_access self:capability { setuid setgid chown setpcap }; +allow rfs_access self:qipcrtr_socket create_socket_perms_no_ioctl; + +wakelock_use(rfs_access) + +dontaudit rfs_access self:capability { dac_override dac_read_search }; diff --git a/sepolicy/vendor/qcom/common/ril_config_service.te b/sepolicy/vendor/qcom/common/ril_config_service.te new file mode 100644 index 00000000..a28d7c64 --- /dev/null +++ b/sepolicy/vendor/qcom/common/ril_config_service.te @@ -0,0 +1,7 @@ +type ril_config_service_app, domain; +app_domain(ril_config_service_app) + +set_prop(ril_config_service_app, vendor_radio_prop) +allow ril_config_service_app app_api_service:service_manager find; +allow ril_config_service_app vendor_radio_data_file:dir rw_dir_perms; +allow ril_config_service_app vendor_radio_data_file:file create_file_perms; diff --git a/sepolicy/vendor/qcom/common/rild.te b/sepolicy/vendor/qcom/common/rild.te new file mode 100644 index 00000000..5bc8795a --- /dev/null +++ b/sepolicy/vendor/qcom/common/rild.te @@ -0,0 +1,35 @@ +vndbinder_use(rild) +allow rild self:qipcrtr_socket { create getattr read setopt write }; + +binder_call(rild, vendor_per_mgr) + +#Allow access to netmgrd socket +allow rild netmgrd_socket:dir r_dir_perms; +unix_socket_connect(rild, netmgrd, netmgrd) + +allow rild vendor_radio_data_file:dir rw_dir_perms; +allow rild vendor_radio_data_file:file create_file_perms; +allow rild vendor_per_mgr_service:service_manager find; + +#Allow set property persist.vendo.radio.adb_log_on +get_prop(rild, sota_prop) +set_prop(rild, vendor_radio_prop) + +hal_server_domain(rild, hal_secure_element) +add_hwservice(rild, hal_iwlan_hwservice) + +#Fix no service problem +binder_call(rild, qtidataservices_app) + +#Fix the avc denied for QCRILD QtiBusSocketTransport access b/131700006 +allow rild qmuxd_socket:dir create_dir_perms; +allow rild qmuxd_socket:sock_file create_file_perms; + +userdebug_or_eng(` +#Allow qcrild to logging log into QXDM. +allow rild diag_device:chr_file rw_file_perms; +') + +add_hwservice(rild, hal_dataconnection_hwservice) +allow rild time_daemon:unix_stream_socket connectto; +set_prop(rild, vendor_xlat_prop) diff --git a/sepolicy/vendor/qcom/common/rmt_storage.te b/sepolicy/vendor/qcom/common/rmt_storage.te new file mode 100644 index 00000000..b58b734f --- /dev/null +++ b/sepolicy/vendor/qcom/common/rmt_storage.te @@ -0,0 +1,20 @@ +type rmt_storage, domain; +type rmt_storage_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(rmt_storage) + +wakelock_use(rmt_storage) + +r_dir_file(rmt_storage, sysfs_uio) + +set_prop(rmt_storage, vendor_modem_prop) +get_prop(rmt_storage, radio_control_prop) + +allow rmt_storage kmsg_device:chr_file w_file_perms; +allow rmt_storage modem_block_device:blk_file rw_file_perms; +allow rmt_storage uio_device:chr_file rw_file_perms; +allow rmt_storage block_device:dir search; +allow rmt_storage sysfs_rmtfs:dir search; +allow rmt_storage sysfs_rmtfs:file r_file_perms; + +allow rmt_storage self:qipcrtr_socket create_socket_perms; +allowxperm rmt_storage self:qipcrtr_socket ioctl msm_sock_ipc_ioctls; diff --git a/sepolicy/vendor/qcom/common/seapp_contexts b/sepolicy/vendor/qcom/common/seapp_contexts new file mode 100644 index 00000000..7360124d --- /dev/null +++ b/sepolicy/vendor/qcom/common/seapp_contexts @@ -0,0 +1,33 @@ +#TODO(b/126137625): moving dataservice app from system to radio process +#user=radio seinfo=platform name=.dataservices domain=dataservice_app type=radio_data_file +user=system seinfo=platform name=.dataservices domain=dataservice_app type=system_app_data_file levelFrom=user + +# Hardware Info Collection +user=_app isPrivApp=true name=com.google.android.hardwareinfo domain=hardware_info_app type=app_data_file levelFrom=user + +user=radio isPrivApp=true seinfo=platform name=com.google.RilConfigService domain=ril_config_service_app type=app_data_file levelFrom=all + +user=_app seinfo=platform name=.qtidataservices domain=qtidataservices_app type=app_data_file levelFrom=all + +#Domain for omadm +user=_app isPrivApp=true seinfo=platform name=com.android.omadm.service domain=omadm_app type=app_data_file levelFrom=all + +user=_app seinfo=platform name=com.qualcomm.qti.services.secureui* domain=secure_ui_service_app levelFrom=all + +#Needed for time service apk +user=_app seinfo=platform name=com.qualcomm.timeservice domain=timeservice_app type=app_data_file levelFrom=all + +# For atfwd service +user=_app seinfo=platform name=com.qualcomm.telephony domain=qtelephony type=app_data_file levelFrom=all + +#Add new domain for ims app +user=_app seinfo=platform name=org.codeaurora.ims isPrivApp=true domain=qtelephony type=app_data_file levelFrom=all + +#Add DeviceInfoHidlClient to vendor_qtelephony +user=_app seinfo=platform name=com.qualcomm.qti.devicestatisticsservice domain=qtelephony type=app_data_file levelFrom=all + +#Add ExtTelephonyService to vendor_qtelephony +user=_app seinfo=platform name=com.qti.phone domain=qtelephony type=app_data_file levelFrom=all + +# QtiTelephonyService app +user=_app seinfo=platform name=com.qualcomm.qti.telephonyservice domain=qtelephony type=app_data_file levelFrom=all diff --git a/sepolicy/vendor/qcom/common/sec_nvm.te b/sepolicy/vendor/qcom/common/sec_nvm.te new file mode 100644 index 00000000..98701de0 --- /dev/null +++ b/sepolicy/vendor/qcom/common/sec_nvm.te @@ -0,0 +1,3 @@ +type sec_nvm, domain; +type sec_nvm_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(sec_nvm)
\ No newline at end of file diff --git a/sepolicy/vendor/qcom/common/secure_ui_service_app.te b/sepolicy/vendor/qcom/common/secure_ui_service_app.te new file mode 100644 index 00000000..3024627b --- /dev/null +++ b/sepolicy/vendor/qcom/common/secure_ui_service_app.te @@ -0,0 +1,10 @@ +type secure_ui_service_app, domain; + +app_domain(secure_ui_service_app); + +binder_call(secure_ui_service_app, system_server) +binder_call(secure_ui_service_app, hal_tui_comm_qti) + +allow secure_ui_service_app app_api_service:service_manager find; + +allow secure_ui_service_app hal_tui_comm_hwservice:hwservice_manager find; diff --git a/sepolicy/vendor/qcom/common/sensors.te b/sepolicy/vendor/qcom/common/sensors.te new file mode 100644 index 00000000..789047ca --- /dev/null +++ b/sepolicy/vendor/qcom/common/sensors.te @@ -0,0 +1,45 @@ +type sensors, domain; +type sensors_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(sensors) + +# Read/write persist partition for sensors registry +allow sensors sensors_persist_file:dir rw_dir_perms; +allow sensors sensors_persist_file:file create_file_perms; +allow sensors sensors_persist_file:fifo_file r_file_perms; +allow sensors persist_file:dir search; + +# For sensor factory calibrated registry +allow sensors sensors_persist_file:dir create; +allow sensors persist_sensors_reg_fac_file:dir r_dir_perms; +allow sensors persist_sensors_reg_fac_file:file { unlink r_file_perms }; +userdebug_or_eng(` + allow sensors persist_sensors_reg_fac_file:dir w_dir_perms; + allow sensors persist_sensors_reg_fac_file:file w_file_perms; +') + +allow sensors mnt_vendor_file:dir search; + +allow sensors sysfs_soc:dir search; +allow sensors sysfs_soc:file r_file_perms; +r_dir_file(sensors, sysfs_msm_subsys) + +allow sensors ion_device:chr_file r_file_perms; + +# ALlow for sensor direct report mode +allow sensors qdsp_device:chr_file r_file_perms; + +allow sensors sysfs_ssr:file r_file_perms; +allow sensors self:qipcrtr_socket create; + +# For QCOM diag port access +userdebug_or_eng(` + allow sensors diag_device:chr_file rw_file_perms; +') + +# Allow to getprop persist.vendor.sys.modem.diag.mdlog +get_prop(sensors, vendor_modem_diag_prop) + +wakelock_use(sensors) + +allow sensors sensors_vendor_data_file:dir rw_dir_perms; +allow sensors sensors_vendor_data_file:file { create setattr rw_file_perms }; diff --git a/sepolicy/vendor/qcom/common/service.te b/sepolicy/vendor/qcom/common/service.te new file mode 100644 index 00000000..9da5a979 --- /dev/null +++ b/sepolicy/vendor/qcom/common/service.te @@ -0,0 +1 @@ +type hal_telephony_service, service_manager_type, hal_service_type, protected_service; diff --git a/sepolicy/vendor/qcom/common/service_contexts b/sepolicy/vendor/qcom/common/service_contexts new file mode 100644 index 00000000..48db21b6 --- /dev/null +++ b/sepolicy/vendor/qcom/common/service_contexts @@ -0,0 +1,10 @@ +vendor.qti.hardware.radio.ims.IImsRadio/default u:object_r:hal_telephony_service:s0 +vendor.qti.hardware.radio.ims.IImsRadio/imsradio0 u:object_r:hal_telephony_service:s0 +vendor.qti.hardware.radio.ims.IImsRadio/imsradio1 u:object_r:hal_telephony_service:s0 +vendor.qti.hardware.radio.am.IQcRilAudio/slot1 u:object_r:hal_telephony_service:s0 +vendor.qti.hardware.radio.am.IQcRilAudio/slot2 u:object_r:hal_telephony_service:s0 +vendor.qti.hardware.radio.qcrilhook.IQtiOemHook/oemhook0 u:object_r:radio_service:s0 +vendor.qti.hardware.radio.qcrilhook.IQtiOemHook/oemhook1 u:object_r:radio_service:s0 + +vendor.qti.hardware.radio.atcmdfwd.IAtCmdFwd/AtCmdFwdAidl u:object_r:radio_service:s0 +vendor.qti.hardware.radio.atfwd.IAtFwd/AtFwdAidl u:object_r:radio_service:s0 diff --git a/sepolicy/vendor/qcom/common/shell.te b/sepolicy/vendor/qcom/common/shell.te new file mode 100644 index 00000000..cd0e4a4d --- /dev/null +++ b/sepolicy/vendor/qcom/common/shell.te @@ -0,0 +1,3 @@ +# allow shell users to control kgsl perfcounters +allow shell sysfs_kgsl_shell:file rw_file_perms; +allow shell sysfs_msm_subsys:dir r_dir_perms; diff --git a/sepolicy/vendor/qcom/common/shsusrd.te b/sepolicy/vendor/qcom/common/shsusrd.te new file mode 100644 index 00000000..68e454bf --- /dev/null +++ b/sepolicy/vendor/qcom/common/shsusrd.te @@ -0,0 +1,17 @@ +type shsusrd, domain; +type shsusrd_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(shsusrd) + +allow shsusrd sysfs_soc:dir search; +allow shsusrd sysfs_soc:file r_file_perms; +allow shsusrd sysfs_ssr:file r_file_perms; +allow shsusrd sysfs_msm_subsys:dir r_dir_perms; + +allow shsusrd proc_shs:file rw_file_perms; +allow shsusrd proc_shs:dir r_dir_perms; +allow shsusrd self:netlink_generic_socket create_socket_perms_no_ioctl; +allow shsusrd self:qipcrtr_socket create_socket_perms_no_ioctl; + +allow shsusrd shsusr_data_file:dir rw_dir_perms; +allow shsusrd shsusr_data_file:file create_file_perms; diff --git a/sepolicy/vendor/qcom/common/spdaemon.te b/sepolicy/vendor/qcom/common/spdaemon.te new file mode 100644 index 00000000..bcf4fd7b --- /dev/null +++ b/sepolicy/vendor/qcom/common/spdaemon.te @@ -0,0 +1,3 @@ +type spdaemon, domain; +type spdaemon_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(spdaemon)
\ No newline at end of file diff --git a/sepolicy/vendor/qcom/common/ssgtzd.te b/sepolicy/vendor/qcom/common/ssgtzd.te new file mode 100644 index 00000000..055d0001 --- /dev/null +++ b/sepolicy/vendor/qcom/common/ssgtzd.te @@ -0,0 +1,8 @@ +# ssgtzd - SSG TZ Daemon +type ssgtzd, domain; +type ssgtzd_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(ssgtzd) + +#Allow access to smcinvoke device +allow ssgtzd smcinvoke_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/qcom/common/ssr_diag.te b/sepolicy/vendor/qcom/common/ssr_diag.te new file mode 100644 index 00000000..47f00d3c --- /dev/null +++ b/sepolicy/vendor/qcom/common/ssr_diag.te @@ -0,0 +1,3 @@ +type vendor_ssr_diag, domain; +type vendor_ssr_diag_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(vendor_ssr_diag); diff --git a/sepolicy/vendor/qcom/common/ssr_setup.te b/sepolicy/vendor/qcom/common/ssr_setup.te new file mode 100644 index 00000000..cf3e67fe --- /dev/null +++ b/sepolicy/vendor/qcom/common/ssr_setup.te @@ -0,0 +1,9 @@ +type vendor_ssr_setup, domain; +type vendor_ssr_setup_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(vendor_ssr_setup); + +allow vendor_ssr_setup sysfs_ssr:file r_file_perms; +allow vendor_ssr_setup sysfs_ssr_writable:file w_file_perms; +allow vendor_ssr_setup sysfs_msm_subsys:dir r_dir_perms; + +get_prop(vendor_ssr_setup, vendor_ssr_prop) diff --git a/sepolicy/vendor/qcom/common/subsystem_ramdump.te b/sepolicy/vendor/qcom/common/subsystem_ramdump.te new file mode 100644 index 00000000..59d059d7 --- /dev/null +++ b/sepolicy/vendor/qcom/common/subsystem_ramdump.te @@ -0,0 +1,23 @@ +type vendor_subsystem_ramdump, domain; +type vendor_subsystem_ramdump_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(vendor_subsystem_ramdump); + +userdebug_or_eng(` + allow vendor_subsystem_ramdump ramdump_device:chr_file r_file_perms; + allow vendor_subsystem_ramdump device:dir r_dir_perms; + + allow vendor_subsystem_ramdump proc_sysrq:file w_file_perms; + + allow vendor_subsystem_ramdump ramdump_vendor_data_file:file create_file_perms; + allow vendor_subsystem_ramdump ramdump_vendor_data_file:dir rw_dir_perms; + + r_dir_file(vendor_subsystem_ramdump, sysfs_msm_subsys) + + allow vendor_subsystem_ramdump sysfs_ssr:file r_file_perms; + + allow vendor_subsystem_ramdump ssr_log_file:dir rw_dir_perms; + allow vendor_subsystem_ramdump ssr_log_file:file create_file_perms; + + set_prop(vendor_subsystem_ramdump, vendor_ssr_prop); + get_prop(vendor_subsystem_ramdump, vendor_ramdump_prop); +') diff --git a/sepolicy/vendor/qcom/common/surfaceflinger.te b/sepolicy/vendor/qcom/common/surfaceflinger.te new file mode 100644 index 00000000..ec3cace3 --- /dev/null +++ b/sepolicy/vendor/qcom/common/surfaceflinger.te @@ -0,0 +1,4 @@ +get_prop(surfaceflinger, vendor_display_prop) + +dontaudit surfaceflinger sysfs_msm_subsys:dir search; +dontaudit surfaceflinger sysfs_msm_subsys:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/system_server.te b/sepolicy/vendor/qcom/common/system_server.te new file mode 100644 index 00000000..89ec16cb --- /dev/null +++ b/sepolicy/vendor/qcom/common/system_server.te @@ -0,0 +1,4 @@ +get_prop(system_server, vendor_display_prop) + +dontaudit system_server sysfs_msm_subsys:dir search; +dontaudit system_server sysfs_msm_subsys:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/tee.te b/sepolicy/vendor/qcom/common/tee.te new file mode 100644 index 00000000..1aac0292 --- /dev/null +++ b/sepolicy/vendor/qcom/common/tee.te @@ -0,0 +1,38 @@ +allow tee self:capability { chown setgid setuid sys_rawio sys_admin }; + +allow tee vendor_tui_data_file:dir r_dir_perms; +allow tee vendor_tui_data_file:file rw_file_perms; + +allow tee device:dir r_dir_perms; + +set_prop(tee, vendor_tee_listener_prop) +vndbinder_use(tee) +allow tee block_device:dir r_dir_perms; +allow tee ssd_block_device:blk_file rw_file_perms; +allow tee sg_device:chr_file { rw_file_perms setattr }; + +allow tee mnt_vendor_file:dir r_dir_perms; +allow tee persist_file:dir r_dir_perms; +allow tee persist_file:lnk_file read; +allow tee persist_drm_file:dir create_dir_perms; +allow tee persist_drm_file:file create_file_perms; + +# b/198130336 +dontaudit tee tmpfs:dir read; + +wakelock_use(tee); + +hwbinder_use(tee) +get_prop(tee, hwservicemanager_prop) + +binder_call(tee, hal_tui_comm_qti) +allow tee hal_tui_comm_hwservice:hwservice_manager find; + +binder_call(tee, hal_graphics_composer_default) +allow tee hal_display_config_hwservice:hwservice_manager find; +allow tee hal_graphics_allocator_default:fd use; + +allow tee time_daemon:unix_stream_socket connectto; + +# allow tee access for secure UI to work +allow tee graphics_device:chr_file rw_file_perms; diff --git a/sepolicy/vendor/qcom/common/time_daemon.te b/sepolicy/vendor/qcom/common/time_daemon.te new file mode 100644 index 00000000..2ec86d2a --- /dev/null +++ b/sepolicy/vendor/qcom/common/time_daemon.te @@ -0,0 +1,20 @@ +type time_daemon, domain, mlstrustedsubject; +type time_daemon_exec, exec_type, vendor_file_type, file_type; +type time_data_file, file_type, data_file_type; + +init_daemon_domain(time_daemon) + +allow time_daemon mnt_vendor_file:dir r_dir_perms; +allow time_daemon persist_file:dir r_dir_perms; +allow time_daemon persist_time_file:dir rw_dir_perms; +allow time_daemon persist_time_file:file create_file_perms; +allow time_daemon rtc_device:chr_file r_file_perms; +allow time_daemon self:qipcrtr_socket create_socket_perms_no_ioctl; +allow time_daemon sysfs_msm_subsys:dir r_dir_perms; +allow time_daemon sysfs_soc:dir r_dir_perms; +allow time_daemon sysfs_soc:file r_file_perms; +allow time_daemon sysfs_ssr:file r_file_perms; +allow time_daemon time_data_file:dir rw_dir_perms; +allow time_daemon time_data_file:file create_file_perms; + +allow time_daemon self:capability sys_time; diff --git a/sepolicy/vendor/qcom/common/timeservice_app.te b/sepolicy/vendor/qcom/common/timeservice_app.te new file mode 100644 index 00000000..9611ec86 --- /dev/null +++ b/sepolicy/vendor/qcom/common/timeservice_app.te @@ -0,0 +1,5 @@ +type timeservice_app, domain; +app_domain(timeservice_app); + +allow timeservice_app app_api_service:service_manager find; +allow timeservice_app time_daemon:unix_stream_socket connectto; diff --git a/sepolicy/vendor/qcom/common/vendor_init.te b/sepolicy/vendor/qcom/common/vendor_init.te new file mode 100644 index 00000000..e543bbf6 --- /dev/null +++ b/sepolicy/vendor/qcom/common/vendor_init.te @@ -0,0 +1,8 @@ +userdebug_or_eng(` + # Allow vendor_init to write to /proc/sysrq-trigger on userdebug and eng builds + allow vendor_init proc_sysrq:file w_file_perms; + + # Allow vendor_init to write to /sys/kernel/debug/google_charger + allow vendor_init debugfs_batteryinfo:file write; +') + diff --git a/sepolicy/vendor/qcom/common/vendor_modprobe.te b/sepolicy/vendor/qcom/common/vendor_modprobe.te new file mode 100644 index 00000000..8a069fa3 --- /dev/null +++ b/sepolicy/vendor/qcom/common/vendor_modprobe.te @@ -0,0 +1 @@ +dontaudit vendor_modprobe proc_cmdline:file r_file_perms; diff --git a/sepolicy/vendor/qcom/common/vndservice.te b/sepolicy/vendor/qcom/common/vndservice.te new file mode 100644 index 00000000..7cf5bba2 --- /dev/null +++ b/sepolicy/vendor/qcom/common/vndservice.te @@ -0,0 +1,3 @@ +type vendor_per_mgr_service, vndservice_manager_type; +type qdisplay_service, vndservice_manager_type; +type qfeatenab_client_service, vndservice_manager_type; diff --git a/sepolicy/vendor/qcom/common/vndservice_contexts b/sepolicy/vendor/qcom/common/vndservice_contexts new file mode 100644 index 00000000..c86bf6c1 --- /dev/null +++ b/sepolicy/vendor/qcom/common/vndservice_contexts @@ -0,0 +1,3 @@ +display.qservice u:object_r:qdisplay_service:s0 +vendor.qcom.PeripheralManager u:object_r:vendor_per_mgr_service:s0 +featenab_client.service u:object_r:qfeatenab_client_service:s0 diff --git a/sepolicy/vendor/qcom/common/vold.te b/sepolicy/vendor/qcom/common/vold.te new file mode 100644 index 00000000..fb2b59cf --- /dev/null +++ b/sepolicy/vendor/qcom/common/vold.te @@ -0,0 +1,4 @@ +dontaudit vold kernel:system module_request; + +allow vold sysfs_scsi_devices_0000:file w_file_perms; +get_prop(vold, vendor_hw_plat_prop) diff --git a/sepolicy/vendor/qcom/common/wcnss_service.te b/sepolicy/vendor/qcom/common/wcnss_service.te new file mode 100644 index 00000000..680aaa5c --- /dev/null +++ b/sepolicy/vendor/qcom/common/wcnss_service.te @@ -0,0 +1,34 @@ +type wcnss_service, domain; +type wcnss_service_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(wcnss_service) +net_domain(wcnss_service) +vndbinder_use(wcnss_service) + +# qipcrtr_socket is used for modem IPC router socket to communicate with QMI +allow wcnss_service self:qipcrtr_socket create_socket_perms_no_ioctl; + +# netlink_generic_socket is used for event/data change with WLAN driver +allow wcnss_service self:netlink_generic_socket create_socket_perms_no_ioctl; +allow wcnss_service self:netlink_socket create_socket_perms_no_ioctl; + +allow wcnss_service cnss_vendor_data_file:dir create_dir_perms; +allow wcnss_service cnss_vendor_data_file:file create_file_perms; + +# pkt logging for cnss_diag +userdebug_or_eng(` + r_dir_file(wcnss_service, proc_wifi_dbg) +') + +# For Peripheral Manager in cnss-daemon +binder_call(wcnss_service, vendor_per_mgr) +allow wcnss_service vendor_per_mgr_service:service_manager find; + +# files in /data/vendor/firmware/wifi +allow wcnss_service updated_wifi_firmware_data_file:dir r_dir_perms; +allow wcnss_service updated_wifi_firmware_data_file:file r_file_perms; + +# files in /sys +r_dir_file(wcnss_service, sysfs_msm_subsys) +r_dir_file(wcnss_service, sysfs_soc) +r_dir_file(wcnss_service, sysfs_ssr) +r_dir_file(wcnss_service, sysfs_net) diff --git a/sepolicy/vendor/qcom/common/zygote.te b/sepolicy/vendor/qcom/common/zygote.te new file mode 100644 index 00000000..77d172a2 --- /dev/null +++ b/sepolicy/vendor/qcom/common/zygote.te @@ -0,0 +1,2 @@ +# Allow the Zygote to read vendor graphics device properties +get_prop(zygote, vendor_display_prop) diff --git a/sepolicy/vendor/qcom/sm7250/file_contexts b/sepolicy/vendor/qcom/sm7250/file_contexts new file mode 100644 index 00000000..21189e8d --- /dev/null +++ b/sepolicy/vendor/qcom/sm7250/file_contexts @@ -0,0 +1,36 @@ +# Same process file +/vendor/lib(64)?/hw/gralloc\.lito\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/hw/vulkan\.adreno\.so u:object_r:same_process_hal_file:s0 + +/dev/block/platform/soc/1d84000\.ufshc/by-name/abl_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/aop_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/apdp_[ab] u:object_r:dp_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/boot_[ab] u:object_r:boot_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/cmnlib64_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/cmnlib_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/devcfg_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/dtbo_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/featenabler_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/frp u:object_r:frp_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/fsc u:object_r:modem_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/fsg u:object_r:modem_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/hyp_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/imagefv_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/keymaster_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/metadata u:object_r:metadata_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/misc u:object_r:misc_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/modem_[ab] u:object_r:modem_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/modemst[12] u:object_r:modem_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/multiimgoem_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/persist u:object_r:persist_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/qupfw_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/ssd u:object_r:ssd_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/super u:object_r:super_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/tz_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/uefisecapp_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/userdata u:object_r:userdata_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/vbmeta_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/vbmeta_system_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/vendor_boot_[ab] u:object_r:boot_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/xbl_[ab] u:object_r:custom_ab_block_device:s0 +/dev/block/platform/soc/1d84000\.ufshc/by-name/xbl_config_[ab] u:object_r:custom_ab_block_device:s0 diff --git a/sepolicy/vendor/qcom/sm7250/genfs_contexts b/sepolicy/vendor/qcom/sm7250/genfs_contexts new file mode 100644 index 00000000..4877b549 --- /dev/null +++ b/sepolicy/vendor/qcom/sm7250/genfs_contexts @@ -0,0 +1,168 @@ +genfscon sysfs /module/subsystem_restart/parameters/enable_ramdumps u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3d00000.qcom,kgsl-3d0 u:object_r:sysfs_msm_subsys:s0 + +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/rtc u:object_r:sysfs_rtc:s0 + +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/rtc u:object_r:sysfs_rtc:s0 + +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys0/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys1/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys2/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys3/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys4/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys5/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys6/crash_reason u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/3000000.qcom,lpass/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/8300000.qcom,turing/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/aae0000.qcom,venus/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys0 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys0/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys0/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys1 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys1/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys1/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys2 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys2/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys2/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys3 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys3/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys3/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys4 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys4/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys4/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys5 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys5/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys5/restart_level u:object_r:sysfs_ssr_writable:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys6 u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys6/name u:object_r:sysfs_ssr:s0 +genfscon sysfs /devices/platform/soc/9800000.qcom,npu/subsys6/restart_level u:object_r:sysfs_ssr_writable:s0 + diff --git a/sepolicy/vendor/st/file_contexts b/sepolicy/vendor/st/file_contexts new file mode 100644 index 00000000..b9031f82 --- /dev/null +++ b/sepolicy/vendor/st/file_contexts @@ -0,0 +1,15 @@ +################################### +# vendor binaries +/(vendor|system/vendor)/bin/hw/android\.hardware\.nfc-service\.st u:object_r:hal_nfc_default_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.secure_element@1\.2-service\.st u:object_r:hal_secure_element_default_exec:s0 + + +################################### +# dev nodes +/dev/st54j_se u:object_r:secure_element_device:s0 +/dev/st21nfc u:object_r:nfc_device:s0 + +################################### +# data files +/data/nfc(/.*)? u:object_r:nfc_data_file:s0 + diff --git a/sepolicy/vendor/st/hal_nfc_default.te b/sepolicy/vendor/st/hal_nfc_default.te new file mode 100644 index 00000000..3ec0448e --- /dev/null +++ b/sepolicy/vendor/st/hal_nfc_default.te @@ -0,0 +1,10 @@ +# NFC property +set_prop(hal_nfc_default, vendor_nfc_prop) + +# SecureElement property +set_prop(hal_nfc_default, vendor_secure_element_prop) + +# Modem property +set_prop(hal_nfc_default, vendor_modem_prop) + +allow hal_nfc_default sysfs_audio:file rw_file_perms; diff --git a/sepolicy/vendor/st/hal_secure_element_default.te b/sepolicy/vendor/st/hal_secure_element_default.te new file mode 100644 index 00000000..84cde422 --- /dev/null +++ b/sepolicy/vendor/st/hal_secure_element_default.te @@ -0,0 +1,7 @@ +allow hal_secure_element_default secure_element_device:chr_file rw_file_perms; +allow hal_secure_element_default nfc_device:chr_file rw_file_perms; +dontaudit hal_secure_element_default debugfs_ipc:dir search; +set_prop(hal_secure_element_default, vendor_secure_element_prop) +set_prop(hal_secure_element_default, vendor_nfc_prop) +set_prop(hal_secure_element_default, vendor_modem_prop) + diff --git a/sepolicy/vendor/st/property.te b/sepolicy/vendor/st/property.te new file mode 100644 index 00000000..723121a0 --- /dev/null +++ b/sepolicy/vendor/st/property.te @@ -0,0 +1,2 @@ +vendor_internal_prop(vendor_nfc_prop) +vendor_internal_prop(vendor_secure_element_prop) diff --git a/sepolicy/vendor/st/property_contexts b/sepolicy/vendor/st/property_contexts new file mode 100644 index 00000000..c6cd8a45 --- /dev/null +++ b/sepolicy/vendor/st/property_contexts @@ -0,0 +1,6 @@ +# SecureElement +persist.vendor.se. u:object_r:vendor_secure_element_prop:s0 + +# NFC +persist.vendor.nfc. u:object_r:vendor_nfc_prop:s0 + diff --git a/sepolicy/vendor/st/vendor_init.te b/sepolicy/vendor/st/vendor_init.te new file mode 100644 index 00000000..abc7580b --- /dev/null +++ b/sepolicy/vendor/st/vendor_init.te @@ -0,0 +1,4 @@ +# NFC vendor property +set_prop(vendor_init, vendor_nfc_prop) +# SecureElement vendor property +set_prop(vendor_init, vendor_secure_element_prop) diff --git a/sepolicy/vendor/verizon/keys.conf b/sepolicy/vendor/verizon/keys.conf new file mode 100644 index 00000000..208863f6 --- /dev/null +++ b/sepolicy/vendor/verizon/keys.conf @@ -0,0 +1,2 @@ +[@VERIZON] +ALL : device/google/redbull/sepolicy/vendor/verizon/verizon.x509.pem diff --git a/sepolicy/vendor/verizon/mac_permissions.xml b/sepolicy/vendor/verizon/mac_permissions.xml new file mode 100644 index 00000000..770f40a6 --- /dev/null +++ b/sepolicy/vendor/verizon/mac_permissions.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<policy> + <signer signature="@VERIZON" > + <seinfo value="verizon" /> + </signer> +</policy> diff --git a/sepolicy/vendor/verizon/obdm_app.te b/sepolicy/vendor/verizon/obdm_app.te new file mode 100644 index 00000000..c1ca9a15 --- /dev/null +++ b/sepolicy/vendor/verizon/obdm_app.te @@ -0,0 +1,27 @@ +type obdm_app, domain, coredomain; + +app_domain(obdm_app) +net_domain(obdm_app) + +allow obdm_app app_api_service:service_manager find; +allow obdm_app radio_service:service_manager find; +allow obdm_app surfaceflinger_service:service_manager find; + +userdebug_or_eng(` + allow obdm_app proc_stat:file r_file_perms; + + # talk to /dev/diag + allow obdm_app diag_device:chr_file rw_file_perms; + + allow obdm_app self:socket create_socket_perms; + allowxperm obdm_app self:socket ioctl { 0x0000c302 0x0000c304 }; + + allow obdm_app sysfs:dir r_dir_perms; + r_dir_file(obdm_app, sysfs_msm_subsys) + + # b/162012722 + allow obdm_app self:qipcrtr_socket { create getattr read setopt write }; + allow obdm_app sysfs_soc:dir search; + allow obdm_app sysfs_soc:file r_file_perms; + allow obdm_app sysfs_ssr:file r_file_perms; +') diff --git a/sepolicy/vendor/verizon/verizon.x509.pem b/sepolicy/vendor/verizon/verizon.x509.pem new file mode 100644 index 00000000..a06efc24 --- /dev/null +++ b/sepolicy/vendor/verizon/verizon.x509.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDczCCAlugAwIBAgIEMzx+mzANBgkqhkiG9w0BAQsFADBpMQswCQYDVQQGEwJV +UzELMAkGA1UECBMCTkoxDzANBgNVBAcTBldhcnJlbjEZMBcGA1UEChMQVmVyaXpv +biBXaXJlbGVzczELMAkGA1UECxMCRFQxFDASBgNVBAMTC0RNQVQgQ2xpZW50MCAX +DTE2MTAxMTIxMzgzN1oYDzIxMTYwOTE3MjEzODM3WjBpMQswCQYDVQQGEwJVUzEL +MAkGA1UECBMCTkoxDzANBgNVBAcTBldhcnJlbjEZMBcGA1UEChMQVmVyaXpvbiBX +aXJlbGVzczELMAkGA1UECxMCRFQxFDASBgNVBAMTC0RNQVQgQ2xpZW50MIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr8y6pz1KPVolO8wj02oWSzuLZHWg +HuatQ5RlbXFBqS9/ScPSw3t/Yt+jg2++VUG726qL7ydx8g3AzMktWHNkdhg6j8Dz +fkEMa/oqcr+VOAQyPw4X0xkUs6ICsEuULRaAwY1NwSVCrTuSlxzlmumbTCg+tp4Y +m2FXEct8VNayJcrLnTwl/IiYmFLNLLiZPrwqbSkMVfYbfxws7c2lVZI4qhIC7WWA +HW5PyhO3Vdhjoj4E1QzkyabtB6el3kfE0xIta1IHV2iJdoAlESjaj3UT1i9d+Twt +7DCsu/ZevIl/g/vwbYi2uqQuSs/a3/qeUcawvcQZR4vWHo/Gx8PyiTZHJwIDAQAB +oyEwHzAdBgNVHQ4EFgQUMytyC5Cq0A2kE99nyokx0kTzVH0wDQYJKoZIhvcNAQEL +BQADggEBAE8AexGFmzTp0ZGgRaiv80ONc5PVA12T7h2F5ZN1Yqg99yhpoS6kBIsw +EG149nIcgOnSYk7ukTcjfsKcbFaB7tV1dw6SUqjmsqLpzVxGI32/DVdIorfxwaHZ +dKjvlC9Yh1uDEipKuEzR+nXRnzMdMzEv6KOXeIXJxTHY/f538oPVuiXksdnjllmV +xL1waQrZzdS15hfeBpGlC0WXk9wMiBbJNfEqQ5/J0EaFu+zPk8R3VLQ8WvKcXPyK +30vZ56McQuwz2MT/gQxnR84LRXUhLGoWOr0MYFzOwhTso2vhIlEysGX+HtkEJh3L +Hc+p+viW7lz17QqvZmOxjb6atkRpOVY= +-----END CERTIFICATE----- @@ -166,3 +166,5 @@ firmware_directories /vendor/firmware_mnt/image/ #KGSL /sys/class/kgsl/kgsl-3d0 perfcounter 0660 root shell +# socinfo +/sys/devices/soc0 serial_number 0000 root root diff --git a/vendor.prop b/vendor.prop new file mode 100644 index 00000000..8d93f7f9 --- /dev/null +++ b/vendor.prop @@ -0,0 +1,7 @@ +# DRM +drm.service.enabled=true +media.mediadrmservice.enable=true + +# Graphics +ro.hardware.egl=adreno +ro.hardware.vulkan=adreno |
