diff --git a/aoc/dump_aoc.cpp b/aoc/dump_aoc.cpp index 97da3b5..8d5278d 100644 --- a/aoc/dump_aoc.cpp +++ b/aoc/dump_aoc.cpp @@ -19,22 +19,24 @@ // Dump Aoc. int main() { setbuf(stdout, NULL); - dumpFileContent("AoC Service Status", "/sys/devices/platform/19000000.aoc/services"); - dumpFileContent("AoC Restarts", "/sys/devices/platform/19000000.aoc/restart_count"); - dumpFileContent("AoC Coredumps", "/sys/devices/platform/19000000.aoc/coredump_count"); - dumpFileContent("AoC ring buf wake", "/sys/devices/platform/19000000.aoc/control/ring_buffer_wakeup"); - dumpFileContent("AoC host ipc wake", "/sys/devices/platform/19000000.aoc/control/host_ipc_wakeup"); - dumpFileContent("AoC usf wake", "/sys/devices/platform/19000000.aoc/control/usf_wakeup"); - dumpFileContent("AoC audio wake", "/sys/devices/platform/19000000.aoc/control/audio_wakeup"); - dumpFileContent("AoC logging wake", "/sys/devices/platform/19000000.aoc/control/logging_wakeup"); - dumpFileContent("AoC hotword wake", "/sys/devices/platform/19000000.aoc/control/hotword_wakeup"); - dumpFileContent("AoC memory exception wake", "/sys/devices/platform/19000000.aoc/control/memory_exception"); - dumpFileContent("AoC memory votes", "/sys/devices/platform/19000000.aoc/control/memory_votes_a32"); - dumpFileContent("AoC memory votes", "/sys/devices/platform/19000000.aoc/control/memory_votes_ff1"); + runCommand("AoC Service Status", "timeout 0.1 cat /sys/devices/platform/*.aoc/services"); + runCommand("AoC Restarts", "timeout 0.1 cat /sys/devices/platform/*.aoc/restart_count"); + runCommand("AoC Coredumps", "timeout 0.1 cat /sys/devices/platform/*.aoc/coredump_count"); + runCommand("AoC ring buf wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/ring_buffer_wakeup"); + runCommand("AoC host ipc wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/host_ipc_wakeup"); + runCommand("AoC usf wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/usf_wakeup"); + runCommand("AoC audio wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/audio_wakeup"); + runCommand("AoC logging wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/logging_wakeup"); + runCommand("AoC hotword wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/hotword_wakeup"); + runCommand("AoC memory exception wake", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/memory_exception"); + runCommand("AoC memory votes", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/memory_votes_a32"); + runCommand("AoC memory votes", "timeout 0.1 cat /sys/devices/platform/*.aoc/control/memory_votes_ff1"); runCommand("clean AoC buffer","echo ' ' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); runCommand("AoC Heap Stats (A32)", "echo 'dbg heap -c 1' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); runCommand("AoC Heap Stats (F1)", "echo 'dbg heap -c 2' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); runCommand("AoC Heap Stats (HF0)", "echo 'dbg heap -c 3' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); runCommand("AoC Heap Stats (HF1)", "echo 'dbg heap -c 4' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); + runCommand("AoC DVFS (FF1)", "echo 'dbg info -c 2 DVFSFF1' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); + runCommand("AoC Monitor Mode Status", "echo 'monitor_mode status' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"); return 0; } diff --git a/aoc/sepolicy/dump_aoc.te b/aoc/sepolicy/dump_aoc.te index f5f085c..0731da4 100644 --- a/aoc/sepolicy/dump_aoc.te +++ b/aoc/sepolicy/dump_aoc.te @@ -1,5 +1,6 @@ pixel_bugreport(dump_aoc) allow dump_aoc sysfs_aoc:dir search; +allow dump_aoc sysfs:dir r_dir_perms; allow dump_aoc sysfs_aoc_dumpstate:file r_file_perms; allow dump_aoc aoc_device:chr_file rw_file_perms; allow dump_aoc vendor_shell_exec:file execute_no_trans; diff --git a/aoc/sepolicy/file_contexts b/aoc/sepolicy/file_contexts index fef8d73..c3a4754 100644 --- a/aoc/sepolicy/file_contexts +++ b/aoc/sepolicy/file_contexts @@ -18,6 +18,8 @@ /dev/acd-com.google.umfw_stat u:object_r:aoc_device:s0 /dev/acd-com.google.usf u:object_r:aoc_device:s0 /dev/acd-com.google.usf.non_wake_up u:object_r:aoc_device:s0 +/dev/acd-com.google.chre u:object_r:aoc_device:s0 +/dev/acd-com.google.chre.non_wake_up u:object_r:aoc_device:s0 /dev/acd-logging u:object_r:aoc_device:s0 /dev/aoc u:object_r:aoc_device:s0 /dev/acd-audio_ap_offload_rx u:object_r:aoc_device:s0 diff --git a/audio/aidl.mk b/audio/aidl.mk index 172b63d..bd11249 100644 --- a/audio/aidl.mk +++ b/audio/aidl.mk @@ -2,7 +2,8 @@ DEVICE_MANIFEST_FILE += device/google/gs-common/audio/aidl/manifest.xml # Audio HALs PRODUCT_PACKAGES += \ - android.hardware.audio.service-aidl.aoc + android.hardware.audio.service-aidl.aoc \ + vendor.google.whitechapel.audio.hal.parserservice \ # AIDL software effects. These are the effects supporting in all projects. # For the project-specific effects, such as haptic generator, please add them diff --git a/audio/aidl/device_framework_matrix_product.xml b/audio/aidl/device_framework_matrix_product.xml index 48b8889..10b6e4b 100644 --- a/audio/aidl/device_framework_matrix_product.xml +++ b/audio/aidl/device_framework_matrix_product.xml @@ -1,4 +1,4 @@ - + vendor.google.audiometricext 1.0 @@ -7,4 +7,12 @@ default + + vendor.google.whitechapel.audio.extension + 1 + + IAudioExtension + default + + diff --git a/audio/aidl/manifest.xml b/audio/aidl/manifest.xml index 8d957cc..237aa4a 100644 --- a/audio/aidl/manifest.xml +++ b/audio/aidl/manifest.xml @@ -1,4 +1,4 @@ - + vendor.google.audiometricext hwbinder diff --git a/audio/hidl/device_framework_matrix_product.xml b/audio/hidl/device_framework_matrix_product.xml index 4c0a3c1..3005497 100644 --- a/audio/hidl/device_framework_matrix_product.xml +++ b/audio/hidl/device_framework_matrix_product.xml @@ -1,4 +1,4 @@ - + vendor.google.whitechapel.audio.audioext 4.0 diff --git a/audio/hidl/manifest.xml b/audio/hidl/manifest.xml index 80eec22..a8d4979 100644 --- a/audio/hidl/manifest.xml +++ b/audio/hidl/manifest.xml @@ -1,4 +1,4 @@ - + android.hardware.audio hwbinder diff --git a/audio/hidl_zuma.mk b/audio/hidl_zuma.mk index 980d5fb..3a5c211 100644 --- a/audio/hidl_zuma.mk +++ b/audio/hidl_zuma.mk @@ -22,6 +22,7 @@ PRODUCT_PACKAGES += \ audio_fortemedia_aoc \ audio_bluenote_aoc \ audio_usb_aoc \ + audio_cca_aoc \ libamcsextfile \ audio_amcs_ext \ audio.usb.default \ @@ -29,9 +30,11 @@ PRODUCT_PACKAGES += \ audio.bluetooth.default \ audio.r_submix.default \ audio_spk_35l41 \ + audio_hdmi_aoc \ sound_trigger.primary.$(TARGET_BOARD_PLATFORM) BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hdmi_audio include device/google/gs-common/audio/common.mk diff --git a/audio/sepolicy/aidl/file_contexts b/audio/sepolicy/aidl/file_contexts index 9e07893..3f3390e 100644 --- a/audio/sepolicy/aidl/file_contexts +++ b/audio/sepolicy/aidl/file_contexts @@ -1,2 +1,3 @@ # Audio Hal AIDL Service for Aoc /vendor/bin/hw/android\.hardware\.audio\.service-aidl\.aoc u:object_r:hal_audio_default_exec:s0 +/system_ext/bin/hw/vendor\.google\.whitechapel\.audio\.hal\.parserservice u:object_r:hal_audio_parameter_parser_exec:s0 diff --git a/audio/sepolicy/aidl/parser_service.te b/audio/sepolicy/aidl/parser_service.te new file mode 100644 index 0000000..bce6d49 --- /dev/null +++ b/audio/sepolicy/aidl/parser_service.te @@ -0,0 +1,14 @@ +# Define a parameter parser service +type hal_audio_parameter_parser, coredomain, domain; +type hal_audio_parameter_parser_exec, system_file_type, file_type, exec_type; +init_daemon_domain(hal_audio_parameter_parser) + +# The server will serve a binder service. +binder_service(hal_audio_parameter_parser) + +add_service(hal_audio_parameter_parser, hal_audio_parameter_parser_service); + +binder_call(audioserver, hal_audio_parameter_parser) +binder_call(hal_audio_parameter_parser, servicemanager) + +allow audioserver hal_audio_parameter_parser_service:service_manager find; diff --git a/audio/sepolicy/aidl/radio.te b/audio/sepolicy/aidl/radio.te new file mode 100644 index 0000000..dcd8458 --- /dev/null +++ b/audio/sepolicy/aidl/radio.te @@ -0,0 +1,2 @@ +allow radio hal_audio_ext_service:service_manager find; +binder_call(radio, hal_audio_default) diff --git a/audio/sepolicy/aidl/service.te b/audio/sepolicy/aidl/service.te index 052558c..cbdc404 100644 --- a/audio/sepolicy/aidl/service.te +++ b/audio/sepolicy/aidl/service.te @@ -1,2 +1,3 @@ # Audio -type hal_audio_ext_service, service_manager_type; +type hal_audio_ext_service, hal_service_type, service_manager_type; +type hal_audio_parameter_parser_service, service_manager_type; diff --git a/audio/sepolicy/aidl/service_contexts b/audio/sepolicy/aidl/service_contexts index 1b5f301..c2b7716 100644 --- a/audio/sepolicy/aidl/service_contexts +++ b/audio/sepolicy/aidl/service_contexts @@ -1,2 +1,4 @@ # Audio vendor.google.whitechapel.audio.extension.IAudioExtension/default u:object_r:hal_audio_ext_service:s0 +android.media.audio.IHalAdapterVendorExtension/default u:object_r:hal_audio_parameter_parser_service:s0 + diff --git a/audio/sepolicy/common/genfs_contexts b/audio/sepolicy/common/genfs_contexts index 1df3116..013b913 100644 --- a/audio/sepolicy/common/genfs_contexts +++ b/audio/sepolicy/common/genfs_contexts @@ -10,4 +10,11 @@ genfscon sysfs /devices/platform/audiometrics/codec_crashed_counter u:ob genfscon sysfs /devices/platform/audiometrics/hwinfo_part_number u:object_r:sysfs_pixelstats:s0 genfscon sysfs /devices/platform/audiometrics/ams_rate_read_once u:object_r:sysfs_pixelstats:s0 genfscon sysfs /devices/platform/audiometrics/cca_rate_read_once u:object_r:sysfs_pixelstats:s0 - +genfscon sysfs /devices/platform/audiometrics/cca_count_read_once u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/pdm_state u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/waves u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/adapted_info_active_count u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/adapted_info_active_duration u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/pcm_count u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/pcm_latency u:object_r:sysfs_pixelstats:s0 +genfscon sysfs /devices/platform/audiometrics/call_count u:object_r:sysfs_pixelstats:s0 diff --git a/audio/sepolicy/common/hal_audio_default.te b/audio/sepolicy/common/hal_audio_default.te index 7465532..5cb03ac 100644 --- a/audio/sepolicy/common/hal_audio_default.te +++ b/audio/sepolicy/common/hal_audio_default.te @@ -13,6 +13,10 @@ allow hal_audio_default amcs_device:file rw_file_perms; allow hal_audio_default amcs_device:chr_file rw_file_perms; allow hal_audio_default sysfs_pixelstats:file rw_file_perms; +#allow access to aoc and kernel boottime +allow hal_audio_default sysfs_aoc:dir { search }; +allow hal_audio_default sysfs_aoc_boottime:file r_file_perms; + #allow access to DMABUF Heaps for AAudio API allow hal_audio_default dmabuf_heap_device:chr_file r_file_perms; diff --git a/audio/sepolicy/hdmi_audio/genfs_contexts b/audio/sepolicy/hdmi_audio/genfs_contexts new file mode 100644 index 0000000..eb7e1cf --- /dev/null +++ b/audio/sepolicy/hdmi_audio/genfs_contexts @@ -0,0 +1 @@ +genfscon sysfs /devices/platform/drmdp-adma/extcon/hdmi_audio u:object_r:sysfs_extcon:s0 diff --git a/audio/sepolicy/hidl/radio.te b/audio/sepolicy/hidl/radio.te new file mode 100644 index 0000000..43585cd --- /dev/null +++ b/audio/sepolicy/hidl/radio.te @@ -0,0 +1,2 @@ +allow radio hal_audio_ext_hwservice:hwservice_manager find; +binder_call(radio, hal_audio_default) diff --git a/battery_mitigation/battery_mitigation.cpp b/battery_mitigation/battery_mitigation.cpp index 230f297..2443226 100644 --- a/battery_mitigation/battery_mitigation.cpp +++ b/battery_mitigation/battery_mitigation.cpp @@ -19,6 +19,8 @@ #include #include +#define COUNT_LIMIT 10 + using android::hardware::google::pixel::BatteryMitigation; using android::hardware::google::pixel::MitigationConfig; @@ -94,7 +96,7 @@ int main(int /*argc*/, char ** /*argv*/) { bool isBatteryMitigationReady = false; std::string ready_str; int val = 0; - while (!isBatteryMitigationReady) { + for (int i = 0; i < COUNT_LIMIT; i++) { if (!android::base::ReadFileToString(kReadyFilePath, &ready_str)) { continue; } @@ -104,9 +106,12 @@ int main(int /*argc*/, char ** /*argv*/) { } if (val == 1) { isBatteryMitigationReady = true; + break; } } - android::base::SetProperty(kReadyProperty, "1"); + if (isBatteryMitigationReady) { + android::base::SetProperty(kReadyProperty, "1"); + } while (true) { pause(); } diff --git a/battery_mitigation/bcl.mk b/battery_mitigation/bcl.mk index 87e0f95..13e5788 100644 --- a/battery_mitigation/bcl.mk +++ b/battery_mitigation/bcl.mk @@ -1,7 +1,13 @@ +ifeq (,$(filter factory_%,$(TARGET_PRODUCT))) PRODUCT_PACKAGES += battery_mitigation +endif ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +ifeq (,$(filter factory_%,$(TARGET_PRODUCT))) PRODUCT_PACKAGES += BrownoutDetection endif +endif -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/vendor +SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/system_ext/private +SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/system_ext/public PRODUCT_SOONG_NAMESPACES += device/google/gs-common/battery_mitigation diff --git a/battery_mitigation/sepolicy/brownout_detection_app.te b/battery_mitigation/sepolicy/system_ext/private/brownout_detection_app.te similarity index 67% rename from battery_mitigation/sepolicy/brownout_detection_app.te rename to battery_mitigation/sepolicy/system_ext/private/brownout_detection_app.te index 6146a74..c342cbf 100644 --- a/battery_mitigation/sepolicy/brownout_detection_app.te +++ b/battery_mitigation/sepolicy/system_ext/private/brownout_detection_app.te @@ -1,9 +1,8 @@ -type brownout_detection_app, domain, coredomain; +typeattribute brownout_detection_app coredomain; userdebug_or_eng(` app_domain(brownout_detection_app) net_domain(brownout_detection_app) allow brownout_detection_app app_api_service:service_manager find; allow brownout_detection_app system_api_service:service_manager find; - get_prop(brownout_detection_app, vendor_brownout_reason_prop) ') diff --git a/battery_mitigation/sepolicy/seapp_contexts b/battery_mitigation/sepolicy/system_ext/private/seapp_contexts similarity index 100% rename from battery_mitigation/sepolicy/seapp_contexts rename to battery_mitigation/sepolicy/system_ext/private/seapp_contexts diff --git a/battery_mitigation/sepolicy/system_ext/public/brownout_detection_app.te b/battery_mitigation/sepolicy/system_ext/public/brownout_detection_app.te new file mode 100644 index 0000000..7eec57a --- /dev/null +++ b/battery_mitigation/sepolicy/system_ext/public/brownout_detection_app.te @@ -0,0 +1 @@ +type brownout_detection_app, domain; diff --git a/battery_mitigation/sepolicy/battery_mitigation.te b/battery_mitigation/sepolicy/vendor/battery_mitigation.te similarity index 100% rename from battery_mitigation/sepolicy/battery_mitigation.te rename to battery_mitigation/sepolicy/vendor/battery_mitigation.te diff --git a/battery_mitigation/sepolicy/vendor/brownout_detection_app.te b/battery_mitigation/sepolicy/vendor/brownout_detection_app.te new file mode 100644 index 0000000..e2c602f --- /dev/null +++ b/battery_mitigation/sepolicy/vendor/brownout_detection_app.te @@ -0,0 +1,3 @@ +userdebug_or_eng(` + get_prop(brownout_detection_app, vendor_brownout_reason_prop) +') diff --git a/battery_mitigation/sepolicy/file.te b/battery_mitigation/sepolicy/vendor/file.te similarity index 100% rename from battery_mitigation/sepolicy/file.te rename to battery_mitigation/sepolicy/vendor/file.te diff --git a/battery_mitigation/sepolicy/file_contexts b/battery_mitigation/sepolicy/vendor/file_contexts similarity index 100% rename from battery_mitigation/sepolicy/file_contexts rename to battery_mitigation/sepolicy/vendor/file_contexts diff --git a/battery_mitigation/sepolicy/genfs_contexts b/battery_mitigation/sepolicy/vendor/genfs_contexts similarity index 100% rename from battery_mitigation/sepolicy/genfs_contexts rename to battery_mitigation/sepolicy/vendor/genfs_contexts diff --git a/battery_mitigation/sepolicy/property.te b/battery_mitigation/sepolicy/vendor/property.te similarity index 100% rename from battery_mitigation/sepolicy/property.te rename to battery_mitigation/sepolicy/vendor/property.te diff --git a/battery_mitigation/sepolicy/property_contexts b/battery_mitigation/sepolicy/vendor/property_contexts similarity index 100% rename from battery_mitigation/sepolicy/property_contexts rename to battery_mitigation/sepolicy/vendor/property_contexts diff --git a/battery_mitigation/sepolicy/vendor_init.te b/battery_mitigation/sepolicy/vendor/vendor_init.te similarity index 100% rename from battery_mitigation/sepolicy/vendor_init.te rename to battery_mitigation/sepolicy/vendor/vendor_init.te diff --git a/bcmbt/bluetooth.mk b/bcmbt/bluetooth.mk index 6615878..eb6a29b 100644 --- a/bcmbt/bluetooth.mk +++ b/bcmbt/bluetooth.mk @@ -1,6 +1,8 @@ PRODUCT_SOONG_NAMESPACES += vendor/broadcom/bluetooth PRODUCT_PACKAGES += \ - android.hardware.bluetooth@1.1-service.bcmbtlinux \ + android.hardware.bluetooth-V1-ndk.so \ + android.hardware.bluetooth-service.bcmbtlinux \ + vendor.google.bluetooth_ext-V1-ndk.so \ bt_vendor.conf \ android.hardware.bluetooth.prebuilt.xml \ android.hardware.bluetooth_le.prebuilt.xml diff --git a/bcmbt/compatibility_matrix.xml b/bcmbt/compatibility_matrix.xml index ec47e35..1a63ccf 100644 --- a/bcmbt/compatibility_matrix.xml +++ b/bcmbt/compatibility_matrix.xml @@ -1,39 +1,28 @@ - - - hardware.google.bluetooth.ccc - 1.1 + + + vendor.google.bluetooth_ext + 1 + + IBluetoothFinder + default + + IBluetoothFinder/default IBluetoothCcc default - - - hardware.google.bluetooth.bt_channel_avoidance - 1.0 IBTChannelAvoidance default - - - hardware.google.bluetooth.sar - 1.1 IBluetoothSar default - - - hardware.google.bluetooth.ext - 1.0 IBluetoothExt default - - - hardware.google.bluetooth.ewp - 1.0 IBluetoothEwp default diff --git a/bcmbt/dump/Android.bp b/bcmbt/dump/Android.bp new file mode 100644 index 0000000..c22d559 --- /dev/null +++ b/bcmbt/dump/Android.bp @@ -0,0 +1,20 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_binary { + name: "dump_bcmbt", + srcs: ["dump_bcmbt.cpp"], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + shared_libs: [ + "libbase", + "libdump", + "liblog", + ], + vendor: true, + relative_install_path: "dump", +} diff --git a/bcmbt/dump/dump_bcmbt.cpp b/bcmbt/dump/dump_bcmbt.cpp new file mode 100644 index 0000000..91dd7fa --- /dev/null +++ b/bcmbt/dump/dump_bcmbt.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2023 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. + */ +#include +//#include +#include + +#define BCMBT_SNOOP_LOG_DIRECTORY "/data/vendor/bluetooth" +#define BCMBT_FW_LOG_DIRECTORY "/data/vendor/ssrdump/coredump" +#define BCMBT_SNOOP_LOG_PREFIX "btsnoop_hci_vnd" +#define BCMBT_FW_DUMP_LOG_PREFIX "coredump_bt_socdump_" +#define BCMBT_CHRE_DUMP_LOG_PREFIX "coredump_bt_chredump_" + +int main() { + std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "bcmbt"); + if (mkdir(outputDir.c_str(), 0777) == -1) { + printf("Unable to create folder: %s\n", outputDir.c_str()); + return 0; + } + + dumpLogs(BCMBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 2, BCMBT_SNOOP_LOG_PREFIX); + dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_FW_DUMP_LOG_PREFIX); + dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_CHRE_DUMP_LOG_PREFIX); + return 0; +} diff --git a/bcmbt/dump/dumplog.mk b/bcmbt/dump/dumplog.mk new file mode 100644 index 0000000..8dc1765 --- /dev/null +++ b/bcmbt/dump/dumplog.mk @@ -0,0 +1,3 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/bcmbt/dump/sepolicy/ + +PRODUCT_PACKAGES_DEBUG += dump_bcmbt diff --git a/bcmbt/dump/sepolicy/dump_bcmbt.te b/bcmbt/dump/sepolicy/dump_bcmbt.te new file mode 100644 index 0000000..8fa76b8 --- /dev/null +++ b/bcmbt/dump/sepolicy/dump_bcmbt.te @@ -0,0 +1,11 @@ +pixel_bugreport(dump_bcmbt) + +userdebug_or_eng(` + allow dump_bcmbt radio_vendor_data_file:dir create_dir_perms; + allow dump_bcmbt radio_vendor_data_file:file create_file_perms; + allow dump_bcmbt vendor_bt_data_file:dir r_dir_perms; + allow dump_bcmbt vendor_bt_data_file:file r_file_perms; + allow dump_bcmbt sscoredump_vendor_data_coredump_file:dir r_dir_perms; + allow dump_bcmbt sscoredump_vendor_data_coredump_file:file r_file_perms; + allow dump_bcmbt sscoredump_vendor_data_crashinfo_file:dir search; +') diff --git a/bcmbt/dump/sepolicy/file_contexts b/bcmbt/dump/sepolicy/file_contexts new file mode 100644 index 0000000..e3f0df6 --- /dev/null +++ b/bcmbt/dump/sepolicy/file_contexts @@ -0,0 +1 @@ +/vendor/bin/dump/dump_bcmbt u:object_r:dump_bcmbt_exec:s0 diff --git a/bcmbt/manifest_bluetooth.xml b/bcmbt/manifest_bluetooth.xml index 64238c7..f14112c 100644 --- a/bcmbt/manifest_bluetooth.xml +++ b/bcmbt/manifest_bluetooth.xml @@ -1,56 +1,17 @@ - + android.hardware.bluetooth - hwbinder - 1.1 - - IBluetoothHci - default - + 1 + IBluetoothHci/default - - hardware.google.bluetooth.bt_channel_avoidance - hwbinder - 1.0 - - IBTChannelAvoidance - default - - - - hardware.google.bluetooth.sar - hwbinder - 1.1 - - IBluetoothSar - default - - - - hardware.google.bluetooth.ext - hwbinder - 1.0 - - IBluetoothExt - default - - - - hardware.google.bluetooth.ccc - hwbinder - 1.1 - - IBluetoothCcc - default - - - - hardware.google.bluetooth.ewp - hwbinder - 1.0 - - IBluetoothEwp - default - + + vendor.google.bluetooth_ext + 1 + IBTChannelAvoidance/default + IBluetoothCcc/default + IBluetoothEwp/default + IBluetoothExt/default + IBluetoothFinder/default + IBluetoothSar/default diff --git a/bcmbt/sepolicy/file_contexts b/bcmbt/sepolicy/file_contexts index d4681db..e7aac6a 100644 --- a/bcmbt/sepolicy/file_contexts +++ b/bcmbt/sepolicy/file_contexts @@ -1,5 +1,5 @@ # Bluetooth -/(vendor|system/vendor)/bin/hw/android\.hardware\.bluetooth@1\.1-service\.bcmbtlinux u:object_r:hal_bluetooth_btlinux_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.bluetooth-service\.bcmbtlinux u:object_r:hal_bluetooth_btlinux_exec:s0 /dev/wbrc u:object_r:wb_coexistence_dev:s0 /dev/ttySAC16 u:object_r:hci_attach_dev:s0 diff --git a/bcmbt/sepolicy/hal_bluetooth_btlinux.te b/bcmbt/sepolicy/hal_bluetooth_btlinux.te index f348099..263f689 100644 --- a/bcmbt/sepolicy/hal_bluetooth_btlinux.te +++ b/bcmbt/sepolicy/hal_bluetooth_btlinux.te @@ -1,4 +1,5 @@ add_hwservice(hal_bluetooth_btlinux, hal_bluetooth_coexistence_hwservice); +add_service(hal_bluetooth_btlinux, hal_bluetooth_coexistence_service); get_prop(hal_bluetooth_btlinux, boot_status_prop) allow hal_bluetooth_btlinux sysfs_bluetooth_writable:file rw_file_perms; diff --git a/bcmbt/sepolicy/service.te b/bcmbt/sepolicy/service.te new file mode 100644 index 0000000..b8403da --- /dev/null +++ b/bcmbt/sepolicy/service.te @@ -0,0 +1,2 @@ +# Bluetooth HAL extension +type hal_bluetooth_coexistence_service, hal_service_type, service_manager_type; diff --git a/bcmbt/sepolicy/service_contexts b/bcmbt/sepolicy/service_contexts new file mode 100644 index 0000000..4aecc90 --- /dev/null +++ b/bcmbt/sepolicy/service_contexts @@ -0,0 +1,7 @@ +# Bluetooth HAL extension +vendor.google.bluetooth_ext.IBTChannelAvoidance/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothSar/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothCcc/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothEwp/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothExt/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothFinder/default u:object_r:hal_bluetooth_coexistence_service:s0 diff --git a/camera/Android.bp b/camera/Android.bp index 9d647c9..d615e6a 100644 --- a/camera/Android.bp +++ b/camera/Android.bp @@ -18,3 +18,11 @@ cc_binary { vendor: true, relative_install_path: "dump", } + +prebuilt_etc { + name: "lyric_preview_dis_xml", + vendor: true, + filename: "vendor.android.hardware.camera.preview-dis.xml", + src: "vendor.android.hardware.camera.preview-dis.xml", + sub_dir: "permissions", +} diff --git a/camera/OWNERS b/camera/OWNERS new file mode 100644 index 0000000..d5ac048 --- /dev/null +++ b/camera/OWNERS @@ -0,0 +1,2 @@ +krzysio@google.com +yromanenko@google.com diff --git a/camera/compatibility_matrix.xml b/camera/compatibility_matrix.xml new file mode 100644 index 0000000..cd4b76e --- /dev/null +++ b/camera/compatibility_matrix.xml @@ -0,0 +1,13 @@ + + + com.google.pixel.camera.services.binder + 1 + + IServiceBinder + default + + + + 0.0.0 + + diff --git a/camera/device_framework_matrix_product.xml b/camera/device_framework_matrix_product.xml new file mode 100644 index 0000000..171dfa8 --- /dev/null +++ b/camera/device_framework_matrix_product.xml @@ -0,0 +1,10 @@ + + + com.google.pixel.camera.connectivity.hal.provider + 1 + + ICameraProvider + default + + + diff --git a/camera/dump.mk b/camera/dump.mk index a3a5c7a..8569610 100644 --- a/camera/dump.mk +++ b/camera/dump.mk @@ -1,4 +1,6 @@ -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/camera/sepolicy/ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/camera/sepolicy/vendor +PRODUCT_PUBLIC_SEPOLICY_DIRS += device/google/gs-common/camera/sepolicy/product/public +PRODUCT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/camera/sepolicy/product/private PRODUCT_PACKAGES_DEBUG += dump_camera diff --git a/camera/lyric.mk b/camera/lyric.mk new file mode 100644 index 0000000..b9583ea --- /dev/null +++ b/camera/lyric.mk @@ -0,0 +1,60 @@ +PRODUCT_SOONG_NAMESPACES += \ + hardware/google/camera + +$(call soong_config_set,lyric,use_lyric_camera_hal,true) +$(call soong_config_set,google3a_config,gcam_awb,true) +$(call soong_config_set,google3a_config,ghawb_truetone,true) + +# Select GCH backend. +# TODO(b/192681010): This dependency inversion should be removed. +ifneq ($(wildcard vendor/google/services/LyricCameraHAL/src),) +$(call soong_config_set,gch,hwl_library,lyric) +endif + +# Check if we're in PDK build +ifeq ($(wildcard vendor/google/camera),) +# If vendor/google/camera doesn't exist, it's a PDK build. +$(call soong_config_set,lyric,pdk_build,true) +else +# Otherwise, it's an internal Google build. +$(call soong_config_set,lyric,pdk_build,false) + +PRODUCT_SOONG_NAMESPACES += \ + vendor/google/camera \ + vendor/google/camera/google_3a/libs_v4 \ + vendor/google/camera/rlsservice + +# TODO(b/257379485): 3A is incrementally enabling cuttlefish build for native +# code coverage support, temporary require separate namespace for folders that +# can be built successfully. +PRODUCT_SOONG_NAMESPACES += \ + vendor/google/camera/common/g3_shared \ + vendor/google/camera/google_3a/libs_v4/g3ABase \ + vendor/google/camera/google_3a/libs_v4/gABC/native_coverage \ + vendor/google/camera/google_3a/libs_v4/gAF \ + vendor/google/camera/google_3a/libs_v4/gafd \ + vendor/google/camera/google_3a/libs_v4/gHAWB/native_coverage + +# Calibration tool for debug builds +PRODUCT_PACKAGES_DEBUG += tarasque_test + +endif # vendor/google/camera check + +# Init-time log settings for Google 3A +PRODUCT_PACKAGES += libg3a_standalone_gabc_rc +PRODUCT_PACKAGES += libg3a_standalone_gaf_rc +PRODUCT_PACKAGES += libg3a_standalone_ghawb_rc + +# Vendor APEX which contains the camera HAL +PRODUCT_PACKAGES += com.google.pixel.camera.hal +PRODUCT_PACKAGES += init.camera.set-interrupts-ownership +PRODUCT_PACKAGES += lyric_preview_dis_xml + +DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += \ + device/google/gs-common/camera/device_framework_matrix_product.xml + +DEVICE_MATRIX_FILE += \ + device/google/gs-common/camera/compatibility_matrix.xml + +# sepolicy dir is added in dump.mk. +# Make doesn't deduplicate sepolicy dirs, so including it here causes build errors. diff --git a/camera/lyric_soong_variables.md b/camera/lyric_soong_variables.md new file mode 100644 index 0000000..b442943 --- /dev/null +++ b/camera/lyric_soong_variables.md @@ -0,0 +1,46 @@ +# Lyric Soong variables + +## `kernel_version` + +Example: +``` +$(call soong_config_set,lyric,kernel_version,v515) +``` +Linux kernel version on the device. Determines the version of the LWIS userspace +API to use in Lyric. + +## `soc` + +Example: +``` +$(call soong_config_set,lyric,soc,gs101) +``` +The codename for the chip used in the device. Currently only Google silicon +is supported. + +## `camera_hardware` + +Example: +``` +$(call soong_config_set,lyric,camera_hardware,oriole) +``` +Specifies the set of sensors and peripherals present on the device. Determines +the DeviceContext class that will be used. + +## `tuning_product` + +Example: +``` +$(call soong_config_set,lyric,tuning_product,oriole) +``` +Specifies the set of tuning data to use. This may be different than +`camera_hardware` because not all devices have their own tuning data; +development-only devices only have the default tuning for their SoC. + +## `target_device` + +Example: +``` +$(call soong_config_set,google3a_config,target_device,oriole) +``` +A mixture of `camera_hardware` and `tuning_product` used by 3A. diff --git a/camera/sepolicy/product/private/seapp_contexts b/camera/sepolicy/product/private/seapp_contexts new file mode 100644 index 0000000..e78385e --- /dev/null +++ b/camera/sepolicy/product/private/seapp_contexts @@ -0,0 +1,9 @@ +# Pixel PeristentBackgroundCameraServices +user=system seinfo=platform name=com.google.pixel.camera.services domain=vendor_pbcs_app type=system_app_data_file levelFrom=all +# The :* will allow all services, which run in their own processes, to use the same vendor_pbcs_app domain. +user=system seinfo=platform name=com.google.pixel.camera.services:* domain=vendor_pbcs_app type=system_app_data_file levelFrom=all + +# Pixel Camera Services +user=_app seinfo=CameraServices name=com.google.android.apps.camera.services domain=vendor_pcs_app type=app_data_file levelFrom=all +# The :* will allow all services, which run in their own processes, to use the same vendor_pcs_app domain. +user=_app seinfo=CameraServices name=com.google.android.apps.camera.services:* domain=vendor_pcs_app type=app_data_file levelFrom=all diff --git a/camera/sepolicy/product/private/vendor_pbcs_app.te b/camera/sepolicy/product/private/vendor_pbcs_app.te new file mode 100644 index 0000000..d77162e --- /dev/null +++ b/camera/sepolicy/product/private/vendor_pbcs_app.te @@ -0,0 +1,9 @@ +typeattribute vendor_pbcs_app coredomain; + +app_domain(vendor_pbcs_app); + +dontaudit vendor_pbcs_app system_app_data_file:dir *; + +allow vendor_pbcs_app app_api_service:service_manager find; +# Allow PBCS to find Camera Service. +allow vendor_pbcs_app cameraserver_service:service_manager find; diff --git a/camera/sepolicy/product/private/vendor_pcs_app.te b/camera/sepolicy/product/private/vendor_pcs_app.te new file mode 100644 index 0000000..6bf0451 --- /dev/null +++ b/camera/sepolicy/product/private/vendor_pcs_app.te @@ -0,0 +1,12 @@ +typeattribute vendor_pcs_app coredomain; + +app_domain(vendor_pcs_app); + +allow vendor_pcs_app { + app_api_service + audioserver_service + cameraserver_service + mediametrics_service + mediaserver_service + radio_service +}:service_manager find; diff --git a/camera/sepolicy/product/public/vendor_pbcs_app.te b/camera/sepolicy/product/public/vendor_pbcs_app.te new file mode 100644 index 0000000..7180719 --- /dev/null +++ b/camera/sepolicy/product/public/vendor_pbcs_app.te @@ -0,0 +1 @@ +type vendor_pbcs_app, domain; diff --git a/camera/sepolicy/product/public/vendor_pcs_app.te b/camera/sepolicy/product/public/vendor_pcs_app.te new file mode 100644 index 0000000..fb8b0a1 --- /dev/null +++ b/camera/sepolicy/product/public/vendor_pcs_app.te @@ -0,0 +1 @@ +type vendor_pcs_app, domain; diff --git a/camera/sepolicy/property.te b/camera/sepolicy/property.te deleted file mode 100644 index 19d6a2f..0000000 --- a/camera/sepolicy/property.te +++ /dev/null @@ -1,2 +0,0 @@ -vendor_internal_prop(vendor_camera_debug_prop) - diff --git a/camera/sepolicy/property_contexts b/camera/sepolicy/property_contexts deleted file mode 100644 index 5e2c815..0000000 --- a/camera/sepolicy/property_contexts +++ /dev/null @@ -1,2 +0,0 @@ -vendor.camera.debug. u:object_r:vendor_camera_debug_prop:s0 - diff --git a/camera/sepolicy/dump_camera.te b/camera/sepolicy/vendor/dump_camera.te similarity index 100% rename from camera/sepolicy/dump_camera.te rename to camera/sepolicy/vendor/dump_camera.te diff --git a/camera/sepolicy/file.te b/camera/sepolicy/vendor/file.te similarity index 100% rename from camera/sepolicy/file.te rename to camera/sepolicy/vendor/file.te diff --git a/camera/sepolicy/file_contexts b/camera/sepolicy/vendor/file_contexts similarity index 59% rename from camera/sepolicy/file_contexts rename to camera/sepolicy/vendor/file_contexts index 4bb5308..bc21b02 100644 --- a/camera/sepolicy/file_contexts +++ b/camera/sepolicy/vendor/file_contexts @@ -1,5 +1,5 @@ /vendor/bin/dump/dump_camera u:object_r:dump_camera_exec:s0 +/vendor/bin/init\.camera\.set-interrupts-ownership u:object_r:init-camera-set-interrupts-ownership_exec:s0 # Data /data/vendor/camera(/.*)? u:object_r:vendor_camera_data_file:s0 - diff --git a/camera/sepolicy/vendor/hal_camera_default.te b/camera/sepolicy/vendor/hal_camera_default.te new file mode 100644 index 0000000..dd00cc3 --- /dev/null +++ b/camera/sepolicy/vendor/hal_camera_default.te @@ -0,0 +1,12 @@ +allow hal_camera_default vendor_camera_binder_service:service_manager find; +# Allow Lyric Hal to find the LyricConfigProvider service through ServiceManager. +allow hal_camera_default vendor_camera_lyricconfigprovider_service:service_manager find; + +allow hal_camera_default hal_pixel_remote_camera_service:service_manager find; + +binder_call(hal_camera_default, vendor_pbcs_app); + +binder_call(hal_camera_default, vendor_pcs_app); + +# Allow Lyric HAL to start ISP Service +add_service(hal_camera_default, vendor_camera_isp_service) diff --git a/camera/sepolicy/vendor/init.camera.set-interrupts-ownership.te b/camera/sepolicy/vendor/init.camera.set-interrupts-ownership.te new file mode 100644 index 0000000..781e68d --- /dev/null +++ b/camera/sepolicy/vendor/init.camera.set-interrupts-ownership.te @@ -0,0 +1,10 @@ +type init-camera-set-interrupts-ownership, domain; +type init-camera-set-interrupts-ownership_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init-camera-set-interrupts-ownership) + +allow init-camera-set-interrupts-ownership vendor_toolbox_exec:file rx_file_perms; +allow init-camera-set-interrupts-ownership proc_interrupts:file r_file_perms; +allow init-camera-set-interrupts-ownership proc_irq:dir r_dir_perms; +allow init-camera-set-interrupts-ownership proc_irq:file { r_file_perms setattr }; +allow init-camera-set-interrupts-ownership self:capability { chown setuid setgid }; diff --git a/camera/sepolicy/vendor/property.te b/camera/sepolicy/vendor/property.te new file mode 100644 index 0000000..1f899b6 --- /dev/null +++ b/camera/sepolicy/vendor/property.te @@ -0,0 +1,3 @@ +vendor_internal_prop(vendor_camera_debug_prop) +system_vendor_config_prop(vendor_camera_pbcs_debug_prop) + diff --git a/camera/sepolicy/vendor/property_contexts b/camera/sepolicy/vendor/property_contexts new file mode 100644 index 0000000..0093487 --- /dev/null +++ b/camera/sepolicy/vendor/property_contexts @@ -0,0 +1,4 @@ +vendor.camera.debug. u:object_r:vendor_camera_debug_prop:s0 +persist.vendor.camera.pbcs.debug. u:object_r:vendor_camera_pbcs_debug_prop:s0 +vendor.camera.pbcs.debug. u:object_r:vendor_camera_pbcs_debug_prop:s0 + diff --git a/camera/sepolicy/vendor/service.te b/camera/sepolicy/vendor/service.te new file mode 100644 index 0000000..877dbc1 --- /dev/null +++ b/camera/sepolicy/vendor/service.te @@ -0,0 +1,9 @@ +type vendor_camera_binder_service, hal_service_type, protected_service, service_manager_type; + +type hal_pixel_remote_camera_service, hal_service_type, protected_service, service_manager_type; + +type vendor_camera_lyricconfigprovider_service, hal_service_type, protected_service, service_manager_type; + +type vendor_camera_isp_service, hal_service_type, protected_service, service_manager_type; + +type vendor_camera_cameraidremapper_service, hal_service_type, protected_service, service_manager_type; diff --git a/camera/sepolicy/vendor/service_contexts b/camera/sepolicy/vendor/service_contexts new file mode 100644 index 0000000..e6eaa64 --- /dev/null +++ b/camera/sepolicy/vendor/service_contexts @@ -0,0 +1,9 @@ +com.google.pixel.camera.services.binder.IServiceBinder/default u:object_r:vendor_camera_binder_service:s0 + +com.google.pixel.camera.connectivity.hal.provider.ICameraProvider/default u:object_r:hal_pixel_remote_camera_service:s0 + +com.google.pixel.camera.services.lyricconfigprovider.ILyricConfigProvider/default u:object_r:vendor_camera_lyricconfigprovider_service:s0 + +com.google.pixel.camera.isp.IIspService/default u:object_r:vendor_camera_isp_service:s0 + +com.google.pixel.camera.services.cameraidremapper.ICameraIdRemapper/default u:object_r:vendor_camera_cameraidremapper_service:s0 diff --git a/camera/sepolicy/vendor/vendor_pbcs_app.te b/camera/sepolicy/vendor/vendor_pbcs_app.te new file mode 100644 index 0000000..7b9c5e2 --- /dev/null +++ b/camera/sepolicy/vendor/vendor_pbcs_app.te @@ -0,0 +1,12 @@ +# Allow PBCS to add the ServiceBinder service to ServiceManager. +add_service(vendor_pbcs_app, vendor_camera_binder_service); +# Allow PBCS to add the LyricConfigProvider service to ServiceManager. +add_service(vendor_pbcs_app, vendor_camera_lyricconfigprovider_service); +# Allow PBCS to add the CameraIdRemapper service to ServiceManager. +add_service(vendor_pbcs_app, vendor_camera_cameraidremapper_service); + +# Allow PBCS to read debug system properties of the form vendor.camera.pbcs.debug.* +# and persist.vendor.camera.pbcs.debug.* +get_prop(vendor_pbcs_app, vendor_camera_pbcs_debug_prop); + +binder_call(vendor_pbcs_app, hal_camera_default); diff --git a/camera/sepolicy/vendor/vendor_pcs_app.te b/camera/sepolicy/vendor/vendor_pcs_app.te new file mode 100644 index 0000000..e269a2f --- /dev/null +++ b/camera/sepolicy/vendor/vendor_pcs_app.te @@ -0,0 +1,21 @@ +# Allow PCS to find the LyricConfigProvider service through ServiceManager. +allow vendor_pcs_app vendor_camera_lyricconfigprovider_service:service_manager find; +# Allow PCS to find the CameraIdRemapper service through ServiceManager. +allow vendor_pcs_app vendor_camera_cameraidremapper_service:service_manager find; + +allow vendor_pcs_app hal_pixel_remote_camera_service:service_manager add; + +binder_call(vendor_pcs_app, hal_pixel_remote_camera_service); + +binder_call(vendor_pcs_app, hal_camera_default); + +# Allow PCS to open socket connections for HTTP streaming support. +allow vendor_pcs_app vendor_pcs_app:unpriv_socket_class_set create_socket_perms_no_ioctl; +allow vendor_pcs_app fwmarkd_socket:sock_file write; +allow vendor_pcs_app port:tcp_socket name_connect; +allow vendor_pcs_app port:udp_socket name_bind; +allow vendor_pcs_app netd:unix_stream_socket connectto; +allow vendor_pcs_app node:udp_socket node_bind; + +allow netd vendor_pcs_app:unpriv_socket_class_set create_socket_perms_no_ioctl; +allow netd vendor_pcs_app:fd use; diff --git a/camera/vendor.android.hardware.camera.preview-dis.xml b/camera/vendor.android.hardware.camera.preview-dis.xml new file mode 100644 index 0000000..ae54eef --- /dev/null +++ b/camera/vendor.android.hardware.camera.preview-dis.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/gps/brcm/device.mk b/gps/brcm/device.mk index 73d0492..dd64dd3 100644 --- a/gps/brcm/device.mk +++ b/gps/brcm/device.mk @@ -1,13 +1,14 @@ BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gps/brcm/sepolicy -PRODUCT_SOONG_NAMESPACES += device/google/gs-common/gps/brcm/prebuilt +PRODUCT_SOONG_NAMESPACES += vendor/broadcom/gps/bcm47765 -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) - $(call soong_config_set, SensorHub_debug, assertion, true) -endif +$(call soong_config_set, gpssdk, sdkv1, False) + +$(call soong_config_set, gpssdk, gpsmcuversion, gpsv2_$(TARGET_BUILD_VARIANT)) PRODUCT_PACKAGES += \ bcm47765_gps_package \ + sitril-gps \ android.hardware.location.gps.prebuilt.xml PRODUCT_PACKAGES_DEBUG += \ diff --git a/gps/brcm/device_v2.mk b/gps/brcm/device_v2.mk deleted file mode 100644 index 5de9b61..0000000 --- a/gps/brcm/device_v2.mk +++ /dev/null @@ -1,14 +0,0 @@ -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gps/brcm/sepolicy - -PRODUCT_SOONG_NAMESPACES += vendor/broadcom/gps/bcm47765 - -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) - $(call soong_config_set, gpsv2, assertion, true) -endif - -PRODUCT_PACKAGES += \ - bcm47765_gps_package_v2 \ - android.hardware.location.gps.prebuilt.xml - -PRODUCT_PACKAGES_DEBUG += \ - init.gps_log.rc diff --git a/gps/brcm/prebuilt/Android.bp b/gps/brcm/prebuilt/Android.bp deleted file mode 100644 index d12f897..0000000 --- a/gps/brcm/prebuilt/Android.bp +++ /dev/null @@ -1,240 +0,0 @@ -soong_namespace { - imports: [ - "hardware/google/pixel", - ], -} - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -cc_prebuilt_library_shared { - name: "android.hardware.gnss@2.1-impl-google", - arch: { - arm64: { - srcs: ["android.hardware.gnss@2.1-impl-google.so"], - shared_libs: [ - "liblog", - "libutils", - "libbinder_ndk", - "android.hardware.gnss-V3-ndk", - "libhardware", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because libhidltransport is deprecated - check_elf_files: false, -} - -cc_prebuilt_binary { - name: "android.hardware.gnss@2.1-service-brcm", - init_rc: ["init.gps.rc"], - arch: { - arm64: { - srcs: ["android.hardware.gnss@2.1-service-brcm"], - shared_libs: [ - "liblog", - "libutils", - "libhardware", - "libbinder_ndk", - "android.hardware.gnss-V3-ndk", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because libhidltransport is deprecated - // Bypass because libhwbinder is deprecated - check_elf_files: false, - vintf_fragments: ["android.hardware.gnss@2.1-service-brcm.xml"] -} - -cc_prebuilt_library_shared { - name: "flp.default", - arch: { - arm64: { - srcs: ["flp.default.so"], - shared_libs: [ - "liblog", - "libcutils", - "libutils", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because soname mismatch - check_elf_files: false, -} - -cc_prebuilt_binary { - name: "gpsd", - arch: { - arm64: { - srcs: ["gpsd"], - shared_libs: [ - "liblog", - "libutils", - "libhardware_legacy", - "libcutils", - "libssl", - "libcrypto", - // "libsitril-gps", - "android.frameworks.sensorservice@1.0", - "libhidlbase", - "libandroid_net", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because libsitril-gps is Android.mk module - check_elf_files: false, -} - -cc_prebuilt_library_shared { - name: "gps.default", - arch: { - arm64: { - srcs: ["gps.default.so"], - shared_libs: [ - "liblog", - "libcutils", - "libutils", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because soname mismatch - check_elf_files: false, -} - -cc_prebuilt_binary { - name: "lhd", - arch: { - arm64: { - srcs: ["lhd"], - shared_libs: [ - "liblog", - "libutils", - "libhardware_legacy", - "libc++", - "libc", - "libm", - "libz", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, -} - -cc_prebuilt_binary { - name: "scd", - arch: { - arm64: { - srcs: ["scd"], - shared_libs: [ - "liblog", - "libutils", - "libssl", - "libcrypto", - "libandroid_net", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, -} - -soong_config_module_type { - name: "gps_prebuilt_firmware", - module_type: "prebuilt_firmware", - config_namespace: "SensorHub_debug", - bool_variables: [ - "assertion", - ], - properties: [ - "src" - ], -} - -gps_prebuilt_firmware { - name: "SensorHub.patch", - soong_config_variables: { - assertion: { - src: "SensorHub_DebugBuild_A0.patch", - conditions_default: { - src: "SensorHub_A0.patch" - }, - }, - }, - vendor: true, - filename: "SensorHub.patch" -} - -phony { - name: "bcm47765_gps_package", - required: [ - "android.hardware.gnss@2.1-impl-google", - "android.hardware.gnss@2.1-service-brcm", - "flp.default", - "gpsd", - "lhd", - "gps.default", - "scd", - "SensorHub.patch" - ], -} diff --git a/gps/brcm/prebuilt/SensorHub_A0.patch b/gps/brcm/prebuilt/SensorHub_A0.patch deleted file mode 100644 index e831a2a..0000000 --- a/gps/brcm/prebuilt/SensorHub_A0.patch +++ /dev/null @@ -1,7027 +0,0 @@ - - - - - - - - - - - - - - diff --git a/gps/brcm/prebuilt/SensorHub_DebugBuild_A0.patch b/gps/brcm/prebuilt/SensorHub_DebugBuild_A0.patch deleted file mode 100644 index 6cc55a7..0000000 --- a/gps/brcm/prebuilt/SensorHub_DebugBuild_A0.patch +++ /dev/null @@ -1,7050 +0,0 @@ - - - - - - - - - - - - - - diff --git a/gps/brcm/prebuilt/android.hardware.gnss@2.1-impl-google.so b/gps/brcm/prebuilt/android.hardware.gnss@2.1-impl-google.so deleted file mode 100755 index e42bf07..0000000 Binary files a/gps/brcm/prebuilt/android.hardware.gnss@2.1-impl-google.so and /dev/null differ diff --git a/gps/brcm/prebuilt/android.hardware.gnss@2.1-service-brcm b/gps/brcm/prebuilt/android.hardware.gnss@2.1-service-brcm deleted file mode 100755 index 7e7b2df..0000000 Binary files a/gps/brcm/prebuilt/android.hardware.gnss@2.1-service-brcm and /dev/null differ diff --git a/gps/brcm/prebuilt/android.hardware.gnss@2.1-service-brcm.xml b/gps/brcm/prebuilt/android.hardware.gnss@2.1-service-brcm.xml deleted file mode 100644 index 8d06407..0000000 --- a/gps/brcm/prebuilt/android.hardware.gnss@2.1-service-brcm.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - android.hardware.gnss - 3 - IGnss/default - - diff --git a/gps/brcm/prebuilt/flp.default.so b/gps/brcm/prebuilt/flp.default.so deleted file mode 100755 index 169415e..0000000 Binary files a/gps/brcm/prebuilt/flp.default.so and /dev/null differ diff --git a/gps/brcm/prebuilt/gps.default.so b/gps/brcm/prebuilt/gps.default.so deleted file mode 100755 index 8876555..0000000 Binary files a/gps/brcm/prebuilt/gps.default.so and /dev/null differ diff --git a/gps/brcm/prebuilt/gpsd b/gps/brcm/prebuilt/gpsd deleted file mode 100755 index 0956fb0..0000000 Binary files a/gps/brcm/prebuilt/gpsd and /dev/null differ diff --git a/gps/brcm/prebuilt/init.gps.rc b/gps/brcm/prebuilt/init.gps.rc deleted file mode 100644 index a9823ef..0000000 --- a/gps/brcm/prebuilt/init.gps.rc +++ /dev/null @@ -1,26 +0,0 @@ -service lhd /vendor/bin/hw/lhd /vendor/etc/gnss/lhd.conf - class main - user gps - group system inet net_raw sdcard_rw - ioprio be 0 - -service gpsd /vendor/bin/hw/gpsd -c /vendor/etc/gnss/gps.xml - class main - user gps - group system gps radio inet wakelock sdcard_rw net_raw - ioprio be 0 - -service scd /vendor/bin/hw/scd /vendor/etc/gnss/scd.conf - class main - user gps - group system inet net_raw wakelock - ioprio be 0 - priority -1 - -service gnss_service /vendor/bin/hw/android.hardware.gnss@2.1-service-brcm - class hal - user gps - group system gps radio - ioprio be 0 - priority -1 - diff --git a/gps/brcm/prebuilt/lhd b/gps/brcm/prebuilt/lhd deleted file mode 100755 index 9f884fa..0000000 Binary files a/gps/brcm/prebuilt/lhd and /dev/null differ diff --git a/gps/brcm/prebuilt/scd b/gps/brcm/prebuilt/scd deleted file mode 100755 index 2f5a806..0000000 Binary files a/gps/brcm/prebuilt/scd and /dev/null differ diff --git a/gps/dump/dump_gps.cpp b/gps/dump/dump_gps.cpp index d569f9b..62f69f8 100644 --- a/gps/dump/dump_gps.cpp +++ b/gps/dump/dump_gps.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include #include @@ -24,6 +25,9 @@ #define GPS_MCU_LOG_PREFIX "esw-" #define GPS_MALLOC_LOG_DIRECTORY "/data/vendor/gps" #define GPS_MALLOC_LOG_PREFIX "malloc_" +#define GPS_VENDOR_CHIP_INFO "/data/vendor/gps/chip.info" +#define GPS_RAWLOG_PREFIX "rawbin" +#define GPS_MEMDUMP_LOG_PREFIX "memdump_" int main() { if(!::android::base::GetBoolProperty("vendor.gps.aol.enabled", false)) { @@ -41,6 +45,11 @@ int main() { dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), 3, GPS_MCU_LOG_PREFIX); dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, GPS_LOG_PREFIX); dumpLogs(GPS_MALLOC_LOG_DIRECTORY, outputDir.c_str(), 1, GPS_MALLOC_LOG_PREFIX); + if (access(GPS_VENDOR_CHIP_INFO, F_OK) == 0) { + copyFile(GPS_VENDOR_CHIP_INFO, concatenatePath(outputDir.c_str(), "chip.info").c_str()); + } + dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, GPS_RAWLOG_PREFIX); + dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), 18, GPS_MEMDUMP_LOG_PREFIX); return 0; } diff --git a/gxp/dump_gxp.cpp b/gxp/dump_gxp.cpp index 5a0bb3b..518a44a 100644 --- a/gxp/dump_gxp.cpp +++ b/gxp/dump_gxp.cpp @@ -21,17 +21,17 @@ int main() { /* TODO(b/277094681): Set default value to false around device beta milestone. */ - if(::android::base::GetBoolProperty("vendor.gxp.attach_to_bugreport", true)) { - std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "gxp_ssrdump"); - printf("Creating %s", outputDir.c_str()); - if (mkdir(outputDir.c_str(), 0777) == -1) { - printf("Unable to create folder: %s\n", outputDir.c_str()); - return 0; - } - - dumpLogs("/data/vendor/ssrdump/coredump", outputDir.c_str(), maxGxpDebugDumps, "coredump_gxp_"); - dumpLogs("/data/vendor/ssrdump", outputDir.c_str(), maxGxpDebugDumps, "crashinfo_gxp_"); + /* TODO(b/288368306): Create an android property for enabling/disabling + * bugreport collection for gxp */ + std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "gxp_ssrdump"); + printf("Creating %s", outputDir.c_str()); + if (mkdir(outputDir.c_str(), 0777) == -1) { + printf("Unable to create folder: %s\n", outputDir.c_str()); + return 0; } + + dumpLogs("/data/vendor/ssrdump/coredump", outputDir.c_str(), maxGxpDebugDumps, "coredump_gxp_"); + dumpLogs("/data/vendor/ssrdump", outputDir.c_str(), maxGxpDebugDumps, "crashinfo_gxp_"); return 0; } diff --git a/gyotaku_app/gyotaku.mk b/gyotaku_app/gyotaku.mk new file mode 100644 index 0000000..d1d45c0 --- /dev/null +++ b/gyotaku_app/gyotaku.mk @@ -0,0 +1,8 @@ +ifneq ($(TARGET_BUILD_VARIANT), user) + ifeq (,$(filter aosp_%, $(TARGET_PRODUCT))) # Skip aosp target product + PRODUCT_PACKAGES_DEBUG += \ + Gyotaku + + BOARD_SEPOLICY_DIRS += device/google/gs-common/gyotaku_app/sepolicy/ + endif +endif diff --git a/gyotaku_app/sepolicy/gyotaku_app.te b/gyotaku_app/sepolicy/gyotaku_app.te new file mode 100644 index 0000000..80123cf --- /dev/null +++ b/gyotaku_app/sepolicy/gyotaku_app.te @@ -0,0 +1,25 @@ +type gyotaku_app, domain; + +userdebug_or_eng(` + app_domain(gyotaku_app) + net_domain(gyotaku_app) + + # For Gyotaku app common use + allow gyotaku_app app_api_service:service_manager find; + allow gyotaku_app privapp_data_file:lnk_file read; + allow gyotaku_app system_app_data_file:dir create_dir_perms; + allow gyotaku_app system_app_data_file:file create_file_perms; + + # For access /proc/fs/f2fs/* storage use + allow gyotaku_app proc_f2fs:dir search; + allow gyotaku_app proc_f2fs:file r_file_perms; + + # For access /proc/stat use + allow gyotaku_app proc_stat:file r_file_perms; + + # For getproperty isDebuggable use + get_prop(gyotaku_app, userdebug_or_eng_prop) + + # For persistent property use + get_prop(gyotaku_app, logpersistd_logging_prop); +') diff --git a/gyotaku_app/sepolicy/seapp_contexts b/gyotaku_app/sepolicy/seapp_contexts new file mode 100644 index 0000000..b1c6248 --- /dev/null +++ b/gyotaku_app/sepolicy/seapp_contexts @@ -0,0 +1,2 @@ +# Gyotaku app +user=system seinfo=platform name=com.google.android.apps.internal.gyotaku domain=gyotaku_app type=system_app_data_file levelFrom=all diff --git a/insmod/init.common.cfg b/insmod/init.common.cfg index 3a81fd2..340eb4b 100644 --- a/insmod/init.common.cfg +++ b/insmod/init.common.cfg @@ -6,6 +6,7 @@ # Load common kernel modules # Modules here will be loaded *before* device specific modules -modprobe|-b * +modprobe|system -b * +modprobe|vendor -b * # All common modules loaded setprop|vendor.common.modules.ready diff --git a/insmod/insmod.sh b/insmod/insmod.sh index 2c434ef..03843f5 100755 --- a/insmod/insmod.sh +++ b/insmod/insmod.sh @@ -8,16 +8,29 @@ ############################################################# modules_dir= +system_modules_dir= +vendor_modules_dir= -for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do - if [[ -f "$f" ]]; then - modules_dir="$(dirname "$f")" - break - fi +for dir in system vendor; do + for f in /${dir}/lib/modules/*/modules.dep /${dir}/lib/modules/modules.dep; do + if [[ -f "$f" ]]; then + if [[ "${dir}" == "system" ]]; then + system_modules_dir="$(dirname "$f")" + else + vendor_modules_dir="$(dirname "$f")" + modules_dir=${vendor_modules_dir} + fi + break + fi + done done -if [[ -z "${modules_dir}" ]]; then - echo "Unable to locate kernel modules directory" 2>&1 +if [[ -z "${system_modules_dir}" ]]; then + echo "Unable to locate system kernel modules directory" 2>&1 +fi + +if [[ -z "${vendor_modules_dir}" ]]; then + echo "Unable to locate vendor kernel modules directory" 2>&1 exit 1 fi @@ -55,12 +68,23 @@ if [ -f $cfg_file ]; then "enable") echo 1 > $arg ;; "modprobe") case ${arg} in - "-b *" | "-b") - arg="-b --all=${modules_dir}/modules.load" ;; - "*" | "") - arg="--all=${modules_dir}/modules.load" ;; + "system -b *" | "system -b") + modules_dir=${system_modules_dir} + arg="-b --all=${system_modules_dir}/modules.load" ;; + "system *" | "system") + modules_dir=${system_modules_dir} + arg="--all=${system_modules_dir}/modules.load" ;; + "-b *" | "-b" | "vendor -b *" | "vendor -b") + modules_dir=${vendor_modules_dir} + arg="-b --all=${vendor_modules_dir}/modules.load" ;; + "*" | "" | "vendor *" | "vendor") + modules_dir=${vendor_modules_dir} + arg="--all=${vendor_modules_dir}/modules.load" ;; esac - modprobe -a -d "${modules_dir}" $arg ;; + if [[ -d "${modules_dir}" ]]; then + modprobe -a -d "${modules_dir}" $arg + fi + ;; "wait") wait_for_file $arg ;; esac done < $cfg_file diff --git a/insmod/sepolicy/insmod-sh.te b/insmod/sepolicy/insmod-sh.te index d7b4f72..ba82b0a 100644 --- a/insmod/sepolicy/insmod-sh.te +++ b/insmod/sepolicy/insmod-sh.te @@ -3,6 +3,9 @@ type insmod-sh_exec, vendor_file_type, exec_type, file_type; init_daemon_domain(insmod-sh) allow insmod-sh self:capability sys_module; +allow insmod-sh system_dlkm_file:dir r_dir_perms; +allow insmod-sh system_dlkm_file:file r_file_perms; +allow insmod-sh system_dlkm_file:system module_load; allow insmod-sh vendor_kernel_modules:system module_load; allow insmod-sh vendor_toolbox_exec:file execute_no_trans; diff --git a/misc_writer/misc_writer.mk b/misc_writer/misc_writer.mk new file mode 100644 index 0000000..7cb6c9a --- /dev/null +++ b/misc_writer/misc_writer.mk @@ -0,0 +1,4 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/misc_writer + +PRODUCT_PACKAGES += \ + misc_writer diff --git a/misc_writer/vendor_misc_writer.te b/misc_writer/vendor_misc_writer.te new file mode 100644 index 0000000..dd47f02 --- /dev/null +++ b/misc_writer/vendor_misc_writer.te @@ -0,0 +1 @@ +get_prop(vendor_misc_writer, sota_prop) diff --git a/modem/Android.bp b/modem/Android.bp index 84bdd61..dbc1cac 100644 --- a/modem/Android.bp +++ b/modem/Android.bp @@ -9,6 +9,13 @@ sh_binary { sub_dir: "dump", } +cc_defaults { + name: "dump_modemlog_defaults", + srcs: ["modem_log_dumper.cpp"], + local_include_dirs: ["include"], + shared_libs: ["liblog"], +} + cc_binary { name: "dump_modemlog", srcs: ["dump_modemlog.cpp"], @@ -22,7 +29,16 @@ cc_binary { "libdump", "liblog", ], + defaults: ["dump_modemlog_defaults"], vendor: true, relative_install_path: "dump", } +cc_test { + name: "dump_modemlog_test", + srcs: ["test/*.cpp"], + defaults: ["dump_modemlog_defaults"], + local_include_dirs: ["test/include"], + static_libs: ["libgmock"], + vendor: true, +} diff --git a/modem/dump_modem.sh b/modem/dump_modem.sh index f9f7cf2..d1a535d 100644 --- a/modem/dump_modem.sh +++ b/modem/dump_modem.sh @@ -1,5 +1,9 @@ #!/vendor/bin/sh +WAKEUP_EVENTS_FILE=/sys/devices/platform/cpif/wakeup_events +CPIF_LOGBUFFER=/dev/logbuffer_cpif +PCIE_EVENT_STATS=/sys/devices/platform/cpif/modem/pcie_event_stats + echo "------ Modem Stat ------" cat /data/vendor/modem_stat/debug.txt @@ -15,3 +19,23 @@ for f in $(ls /data/vendor/log/rfsd/rfslog_*); do cat $f done +if [ -e $WAKEUP_EVENTS_FILE ] +then + echo "\n------ Wakeup event counts ------" + echo $WAKEUP_EVENTS_FILE + cat $WAKEUP_EVENTS_FILE +fi + +if [ -e $CPIF_LOGBUFFER ] +then + echo "\n------ CPIF Logbuffer ------" + echo $CPIF_LOGBUFFER + cat $CPIF_LOGBUFFER +fi + +if [ -e $PCIE_EVENT_STATS ] +then + echo "\n------ PCIe event stats ------" + echo $PCIE_EVENT_STATS + cat $PCIE_EVENT_STATS +fi diff --git a/modem/dump_modemlog.cpp b/modem/dump_modemlog.cpp index f7ef834..1b6b2e9 100644 --- a/modem/dump_modemlog.cpp +++ b/modem/dump_modemlog.cpp @@ -13,52 +13,61 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include -#include +#include -#define MODEM_LOGGING_PERSIST_PROPERTY "persist.vendor.sys.modem.logging.enable" -#define MODEM_LOGGING_PROPERTY "vendor.sys.modem.logging.enable" -#define MODEM_LOGGING_STATUS_PROPERTY "vendor.sys.modem.logging.status" -#define MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY "persist.vendor.sys.modem.logging.br_num" -#define MODEM_LOGGING_PATH_PROPERTY "vendor.sys.modem.logging.log_path" -#define MODEM_SIM_DIRECTORY "/data/vendor/radio/sim/" -#define MODEM_LOG_PREFIX "sbuff_" -#define SIM_POWERON_LOG_PREFIX "sim_poweron_log_" +#include "dumper.h" +#include "modem_log_dumper.h" + +namespace modem { +namespace logging { + +/** + * @brief Implementation of AndroidPropertyManager that directly forwards to + * android base methods. + */ +class AndroidPropertyManagerImpl : public AndroidPropertyManager { + public: + bool GetBoolProperty(const std::string& key, bool default_value) override { + return android::base::GetBoolProperty(key, default_value); + }; + + std::string GetProperty(const std::string& key, + const std::string& default_value) override { + return android::base::GetProperty(key, default_value); + }; + int GetIntProperty(const std::string& key, int default_value) override { + return android::base::GetIntProperty(key, default_value); + }; + void SetProperty(const std::string& key, const std::string& value) override { + android::base::SetProperty(key, value); + }; +}; + +/** + * @brief Implementation of Dumper that directly forwards to their corresponding + * dumpstate methods. + */ +class DumperImpl : public Dumper { + public: + void DumpLogs(const LogDumpInfo& log_dump_info) override { + dumpLogs(log_dump_info.src_dir.data(), log_dump_info.dest_dir.data(), + log_dump_info.limit, log_dump_info.prefix.data()); + } + void CopyFile(const FileCopyInfo& file_copy_info) override { + copyFile(file_copy_info.src_dir.data(), file_copy_info.dest_dir.data()); + } +}; + +} // namespace logging +} // namespace modem int main() { - bool modemLogEnabled = ::android::base::GetBoolProperty(MODEM_LOGGING_PERSIST_PROPERTY, false); - if (modemLogEnabled && ::android::base::GetProperty(MODEM_LOGGING_PATH_PROPERTY, "") == MODEM_LOG_DIRECTORY) { - bool modemLogStarted = ::android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false); - int maxFileNum = ::android::base::GetIntProperty(MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY, 100); + modem::logging::DumperImpl dumper_impl; + modem::logging::AndroidPropertyManagerImpl android_property_manager_impl; + modem::logging::ModemLogDumper modem_log_dumper( + dumper_impl, android_property_manager_impl); - if (modemLogStarted) { - ::android::base::SetProperty(MODEM_LOGGING_PROPERTY, "false"); - ALOGD("Stopping modem logging...\n"); - } else { - ALOGD("modem logging is not running\n"); - } - - for (int i = 0; i < 15; i++) { - if (!::android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false)) { - ALOGD("modem logging stopped\n"); - sleep(1); - break; - } - sleep(1); - } - - dumpLogs(MODEM_LOG_DIRECTORY, BUGREPORT_PACKING_DIR, maxFileNum, MODEM_LOG_PREFIX); - - if (modemLogStarted) { - ALOGD("Restarting modem logging...\n"); - ::android::base::SetProperty(MODEM_LOGGING_PROPERTY, "true"); - } - } - - dumpLogs("/data/vendor/radio/extended_logs", BUGREPORT_PACKING_DIR, 20, "extended_log_"); - dumpLogs(MODEM_SIM_DIRECTORY, BUGREPORT_PACKING_DIR, 1, SIM_POWERON_LOG_PREFIX); - copyFile("/mnt/vendor/efs/nv_normal.bin", "/data/vendor/radio/logs/always-on/all_logs/nv_normal.bin"); - copyFile("/mnt/vendor/efs/nv_protected.bin", "/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"); - return 0; + modem_log_dumper.DumpModemLogs(); + return 0; } diff --git a/modem/include/android_property_manager.h b/modem/include/android_property_manager.h new file mode 100644 index 0000000..7135d66 --- /dev/null +++ b/modem/include/android_property_manager.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +namespace modem { +namespace logging { + +/** + * @brief Interface for interacting with Android System Properties. + */ +class AndroidPropertyManager { + public: + virtual ~AndroidPropertyManager() = default; + virtual bool GetBoolProperty(const std::string& key, bool default_value); + virtual std::string GetProperty(const std::string& key, + const std::string& default_value); + virtual int GetIntProperty(const std::string& key, int default_value); + virtual void SetProperty(const std::string& key, const std::string& value); +}; +} // namespace logging +} // namespace modem diff --git a/modem/include/dumper.h b/modem/include/dumper.h new file mode 100644 index 0000000..348e666 --- /dev/null +++ b/modem/include/dumper.h @@ -0,0 +1,71 @@ +#pragma once + +#include +#include + +namespace modem { +namespace logging { + +/** + * @brief Data object for information about dumpings logs. + * + * @param src_dir is a const char* containing the path to the directory to be + copied. + * @param dest_dir is a const char* containing the path to the directory that + the contents of the source directory should be copied to. + * @param limit is an int of the maximum number of files to copy. + * @param prefix is a const char* containing a prefix that all files to be + copied should have. +*/ +struct LogDumpInfo { + const std::string_view src_dir; + const std::string_view dest_dir; + int limit; + const std::string_view prefix; + + friend bool operator==(const LogDumpInfo& lhs, const LogDumpInfo& rhs) { + return (lhs.limit == rhs.limit) && (lhs.src_dir == rhs.src_dir) && + (lhs.dest_dir == rhs.dest_dir) && (lhs.prefix == rhs.prefix); + } + + // Do I have to use .data() here? + friend std::ostream& operator<<(std::ostream& os, const LogDumpInfo& obj) { + os << "src_dir: " << obj.src_dir << ", dest_dir: " << obj.dest_dir + << ", limit: " << obj.limit << ", prefix: " << obj.prefix; + return os; + } +}; + +/** + * @brief Data object for information about dumpings logs. + * + * @param src_dir is a const char* containing the path to a file to be copied. + * @param dest_dir is a const char* containing the destination path for the file + * to be copied to. + */ +struct FileCopyInfo { + const std::string_view src_dir; + const std::string_view dest_dir; + + friend bool operator==(const FileCopyInfo& lhs, const FileCopyInfo& rhs) { + return (lhs.src_dir == rhs.src_dir) && (lhs.dest_dir == rhs.dest_dir); + } + + // Do I have to add .data() here? + friend std::ostream& operator<<(std::ostream& os, const FileCopyInfo& obj) { + os << "src_dir: " << obj.src_dir << ", dest_dir: " << obj.dest_dir; + return os; + } +}; + +/** + * @brief Interface for dumping modem logs and files. + */ +class Dumper { + public: + virtual ~Dumper() = default; + virtual void DumpLogs(const LogDumpInfo& log_dump_info); + virtual void CopyFile(const FileCopyInfo& file_copy_info); +}; +} // namespace logging +} // namespace modem diff --git a/modem/include/modem_log_constants.h b/modem/include/modem_log_constants.h new file mode 100644 index 0000000..29a0fa8 --- /dev/null +++ b/modem/include/modem_log_constants.h @@ -0,0 +1,56 @@ +#pragma once +#include + +#include "dumper.h" + +namespace modem { +namespace logging { + +// Modem related Android System Properties + +// Controls triggering `modem_logging_start` and `modem_logging_stop`. +inline constexpr static std::string_view kModemLoggingEnabledProperty = + "vendor.sys.modem.logging.enable"; +// Signals the current modem logging state. This will be set to +// `vendor.sys.modem.logging.enable` when `modem_log_start` or `modem_log_stop` +// terminates. +inline constexpr static std::string_view kModemLoggingStatusProperty = + "vendor.sys.modem.logging.status"; +// Int which specifies how many files to include in the bugreport. +inline constexpr static std::string_view kModemLoggingNumberBugreportProperty = + "persist.vendor.sys.modem.logging.br_num"; +// Signals the current location that is being logged to. This can be used to +// determine the logging type. +inline constexpr static std::string_view kModemLoggingPathProperty = + "vendor.sys.modem.logging.log_path"; + +// Bugreport constants +inline constexpr static int kDefaultBugreportNumberFiles = 100; +inline constexpr static std::string_view kModemAlwaysOnLogDirectory = + "/data/vendor/radio/logs/always-on"; +inline constexpr static std::string_view kModemLogPrefix = "sbuff_"; +inline constexpr static std::string_view kBugreportPackingDirectory = + "/data/vendor/radio/logs/always-on/all_logs"; + +inline constexpr static LogDumpInfo kLogDumpInfo[] = { + {.src_dir = "/data/vendor/radio/extended_logs", + .dest_dir = kBugreportPackingDirectory, + .limit = 20, + .prefix = "extended_log_"}, + {.src_dir = "/data/vendor/radio/sim/", + .dest_dir = kBugreportPackingDirectory, + .limit = 1, + .prefix = "sim_poweron_log_"}, + {.src_dir = "data/vendor/radio/logs/history", + .dest_dir = kBugreportPackingDirectory, + .limit = 2, + .prefix = "Logging"}}; + +constexpr static FileCopyInfo kFileCopyInfo[] = { + {.src_dir = "/mnt/vendor/efs/nv_normal.bin", + .dest_dir = "/data/vendor/radio/logs/always-on/all_logs/nv_normal.bin"}, + {.src_dir = "/mnt/vendor/efs/nv_protected.bin", + .dest_dir = + "/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"}}; +} // namespace logging +} // namespace modem diff --git a/modem/include/modem_log_dumper.h b/modem/include/modem_log_dumper.h new file mode 100644 index 0000000..96911b0 --- /dev/null +++ b/modem/include/modem_log_dumper.h @@ -0,0 +1,81 @@ +#pragma once + +#include "android_property_manager.h" +#include "dumper.h" + +namespace modem { +namespace logging { + +/** + * @brief Responsible for dumping all relevant modem logs. + */ +class ModemLogDumper { + public: + ModemLogDumper(Dumper& dumper, + AndroidPropertyManager& android_property_manager) + : dumper_(dumper), android_property_manager_(android_property_manager){}; + + /** + * @brief Dumps modem related logs and persistent files to bugreport. + * + * If PILOT and On Demand Logging are both not enabled, this method will + * attempt to stop modem logging, copy over the logs, and then restart so that + * the original logging enabled / disabled state is preserved. Additionally, + * all directories specified in `kLogDumpInfo` and all files in + * `kFileCopyInfo` will be included. + */ + void DumpModemLogs(); + + private: + /** + * @brief Checks modem logging status property to assert if logging is + * running or not. + */ + bool isModemLoggingRunning(); + + /** + * @brief Checks if On Demand Logging or PILOT Logging is enabled. + * + * If either of them are enabled, then the `log_path` property will no longer + * point to the always on logging directory. + */ + bool allowedToStopModemLogging(); + + /** + * @brief Stops modem logging. + * + * This sets the modem logging property which in turn triggers + * modem_logging_control's modem_logging_stop service. Modem logging isn't + * guaranteed to have stopped after this call, so it's necessary to poll the + * status property to ensure it's stopped before proceeding. + */ + void stopModemLogging(); + + /** + * @brief Polls modem logging status property to ensure modem logging has + * stopped. + * + * Even after the property is confirmed to be false, it will continue to + * sleep for a second to ensure that the modem_logging_stop service has exited + * properly. + */ + void waitForStopModemLogging(); + + /** + * @brief Starts modem logging. + * + * This sets the modem logging property which in turn triggers + * modem_logging_control's modem_logging_start service. Modem logging isn't + * guaranteed to have started after this call, so it's necessary to poll the + * status property to ensure it's started before proceeding to guarantee + * success. + */ + void startModemLogging(); + + private: + Dumper& dumper_; + AndroidPropertyManager& android_property_manager_; +}; + +} // namespace logging +} // namespace modem diff --git a/modem/modem_log_dumper.cpp b/modem/modem_log_dumper.cpp new file mode 100644 index 0000000..fad8d29 --- /dev/null +++ b/modem/modem_log_dumper.cpp @@ -0,0 +1,80 @@ +#include "modem_log_dumper.h" + +#include + +#include "dumper.h" +#include "modem_log_constants.h" + +namespace modem { +namespace logging { + +void ModemLogDumper::DumpModemLogs() { + bool shouldRestartModemLogging = + allowedToStopModemLogging() && isModemLoggingRunning(); + int maxFileNum = android_property_manager_.GetIntProperty( + kModemLoggingNumberBugreportProperty.data(), + kDefaultBugreportNumberFiles); + + if (shouldRestartModemLogging) { + // If modem logging is running at time of bugreport, it needs to be stopped + // to ensure that the most recent logs are included in the bugreport. If + // this command fails, only older log files will be included, as seen in + // b/289435256. + stopModemLogging(); + waitForStopModemLogging(); + } else { + ALOGD("modem logging is not running\n"); + } + + dumper_.DumpLogs({kModemAlwaysOnLogDirectory, kBugreportPackingDirectory, + maxFileNum, kModemLogPrefix}); + + if (shouldRestartModemLogging) { + startModemLogging(); + } + + for (const LogDumpInfo& log_dump_info : kLogDumpInfo) { + dumper_.DumpLogs(log_dump_info); + } + + for (const FileCopyInfo& file_copy_info : kFileCopyInfo) { + dumper_.CopyFile(file_copy_info); + } +}; + +bool ModemLogDumper::isModemLoggingRunning() { + return android_property_manager_.GetBoolProperty( + kModemLoggingStatusProperty.data(), false); +} + +bool ModemLogDumper::allowedToStopModemLogging() { + return android_property_manager_.GetProperty(kModemLoggingPathProperty.data(), + /*default_value=*/"") == + kModemAlwaysOnLogDirectory; +} + +void ModemLogDumper::stopModemLogging() { + android_property_manager_.SetProperty(kModemLoggingEnabledProperty.data(), + "false"); + ALOGD("Stopping modem logging...\n"); +} + +void ModemLogDumper::waitForStopModemLogging() { + // TODO(b/289582966) improve stop logging mechanism to not use sleep + for (int i = 0; i < 15; i++) { + if (!isModemLoggingRunning()) { + ALOGD("modem logging stopped\n"); + sleep(1); + break; + } + sleep(1); + } +} + +void ModemLogDumper::startModemLogging() { + ALOGD("Restarting modem logging...\n"); + android_property_manager_.SetProperty(kModemLoggingEnabledProperty.data(), + "true"); +} +} // namespace logging +} // namespace modem diff --git a/modem/sepolicy/dump_modem.te b/modem/sepolicy/dump_modem.te index dc9b38d..2ffa351 100644 --- a/modem/sepolicy/dump_modem.te +++ b/modem/sepolicy/dump_modem.te @@ -8,3 +8,5 @@ allow dump_modem vendor_log_file:dir search; allow dump_modem vendor_rfsd_log_file:dir r_dir_perms; allow dump_modem vendor_rfsd_log_file:file r_file_perms; allow dump_modem vendor_toolbox_exec:file execute_no_trans; +allow dump_modem sysfs_dump_modem:file r_file_perms; +allow dump_modem logbuffer_device:chr_file r_file_perms; diff --git a/modem/sepolicy/file.te b/modem/sepolicy/file.te new file mode 100644 index 0000000..383480d --- /dev/null +++ b/modem/sepolicy/file.te @@ -0,0 +1 @@ +type sysfs_dump_modem, sysfs_type, fs_type; diff --git a/modem/sepolicy/genfs_contexts b/modem/sepolicy/genfs_contexts new file mode 100644 index 0000000..98a8fc5 --- /dev/null +++ b/modem/sepolicy/genfs_contexts @@ -0,0 +1,2 @@ +genfscon sysfs /devices/platform/cpif/wakeup_events u:object_r:sysfs_dump_modem:s0 +genfscon sysfs /devices/platform/cpif/modem/pcie_event_stats u:object_r:sysfs_dump_modem:s0 diff --git a/modem/test/include/fake_android_property_manager.h b/modem/test/include/fake_android_property_manager.h new file mode 100644 index 0000000..79fd4f1 --- /dev/null +++ b/modem/test/include/fake_android_property_manager.h @@ -0,0 +1,77 @@ + + +#include +#include +#include + +#include "android_property_manager.h" +#include "modem_log_constants.h" + +namespace modem { +namespace logging { + +/** + * @brief Fake Implementation of AndroidPropertyManager that mocks some of the + * property changing behaviour from pixellogger's `modem_logging_control`. + */ +class FakeAndroidPropertyManager : public AndroidPropertyManager { + public: + inline constexpr static std::string_view kTruthString = "true"; + inline constexpr static std::string_view kFalseString = "false"; + + bool GetBoolProperty(const std::string& key, bool default_value) override { + return MapContainsKey(key) + ? GetPropertyInternal(key) == kTruthString + : default_value; + }; + + std::string GetProperty(const std::string& key, + const std::string& default_value) override { + return MapContainsKey(key) ? GetPropertyInternal(key) : default_value; + ; + }; + + int GetIntProperty(const std::string& key, int default_value) override { + return MapContainsKey(key) ? std::stoi(GetPropertyInternal(key)) + : default_value; + }; + + /** + * This function needs to copy the behaviour of `modem_logging_control` to + * ensure that the right properties are being set in order. + * + * More specifically, this function will also set the + * `kModemLoggingStatusProperty` whenever `kModemLoggingEnabledProperty` is + * set to simulate modem logging stopping / starting. + */ + void SetProperty(const std::string& key, const std::string& value) override { + if (key == kModemLoggingEnabledProperty) { + property_map_[kModemLoggingStatusProperty.data()] = value; + + // need to track if modem logging has restarted or not + if (value == kFalseString) { + modem_logging_has_been_off_ = true; + } + if (modem_logging_has_been_off_ && (value == kTruthString)) { + modem_logging_has_restarted_ = true; + } + } + property_map_[key] = value; + }; + + bool ModemLoggingHasRestarted() { return modem_logging_has_restarted_; } + + private: + bool MapContainsKey(const std::string& key) { + return property_map_.find(key) != property_map_.end(); + } + std::string GetPropertyInternal(const std::string& key) { + return property_map_.find(key)->second; + } + + std::map property_map_; + bool modem_logging_has_been_off_ = false; + bool modem_logging_has_restarted_ = false; +}; +} // namespace logging +} // namespace modem diff --git a/modem/test/modem_log_dumper_test.cpp b/modem/test/modem_log_dumper_test.cpp new file mode 100644 index 0000000..a052d43 --- /dev/null +++ b/modem/test/modem_log_dumper_test.cpp @@ -0,0 +1,106 @@ +#include "modem_log_dumper.h" + +#include + +#include "dumper.h" +#include "fake_android_property_manager.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +namespace modem { +namespace logging { +namespace { + +using ::testing::Eq; + +inline constexpr static std::string_view kFakePilotLoggingPath = + "//pilot/logging/path"; +inline constexpr static std::string_view kFakeOnDemandLoggingPath = + "//on/demand/logging/path"; +inline constexpr static LogDumpInfo kAlwaysOnLogDumpInfo = { + kModemAlwaysOnLogDirectory, kBugreportPackingDirectory, + kDefaultBugreportNumberFiles, kModemLogPrefix}; + +void StartModemLogging( + FakeAndroidPropertyManager& fake_android_property_manager) { + fake_android_property_manager.SetProperty( + kModemLoggingEnabledProperty.data(), + FakeAndroidPropertyManager::kTruthString.data()); +} + +class MockDumper : public Dumper { + public: + ~MockDumper() = default; + MOCK_METHOD(void, DumpLogs, (const LogDumpInfo&), (override)); + MOCK_METHOD(void, CopyFile, (const FileCopyInfo&), (override)); +}; + +class ModemLogDumperTest : public ::testing::Test { + protected: + ModemLogDumperTest() + : modem_log_dumper(mock_dumper, fake_android_property_manager) {} + + void SetUp() override { + // set default logging mode to always on logging + fake_android_property_manager.SetProperty( + kModemLoggingPathProperty.data(), kModemAlwaysOnLogDirectory.data()); + } + + MockDumper mock_dumper; + FakeAndroidPropertyManager fake_android_property_manager; + ModemLogDumper modem_log_dumper; +}; + +TEST_F(ModemLogDumperTest, DumpLogsDumpsAllDirectoriesAndCopiesAllFiles) { + EXPECT_CALL(mock_dumper, DumpLogs(Eq(kAlwaysOnLogDumpInfo))); + + for (const LogDumpInfo& log_dump_info : kLogDumpInfo) { + EXPECT_CALL(mock_dumper, DumpLogs(Eq(log_dump_info))); + } + + for (const FileCopyInfo& fileCopyInfo : kFileCopyInfo) { + EXPECT_CALL(mock_dumper, CopyFile(Eq(fileCopyInfo))); + } + + modem_log_dumper.DumpModemLogs(); +} + +TEST_F(ModemLogDumperTest, DumpLogsRestartModemLoggingWhenEnabled) { + StartModemLogging(fake_android_property_manager); + + modem_log_dumper.DumpModemLogs(); + + EXPECT_TRUE(fake_android_property_manager.ModemLoggingHasRestarted()); +} + +TEST_F(ModemLogDumperTest, DumpLogsDoesNotRestartModemLoggingWhenDisabled) { + modem_log_dumper.DumpModemLogs(); + + EXPECT_FALSE(fake_android_property_manager.ModemLoggingHasRestarted()); +} + +TEST_F(ModemLogDumperTest, DumpLogsDoesNotRestartModemLoggingWhenPilotEnabled) { + // Enable PILOT + fake_android_property_manager.SetProperty(kModemLoggingPathProperty.data(), + kFakePilotLoggingPath.data()); + StartModemLogging(fake_android_property_manager); + + modem_log_dumper.DumpModemLogs(); + + EXPECT_FALSE(fake_android_property_manager.ModemLoggingHasRestarted()); +} + +TEST_F(ModemLogDumperTest, + DumpLogsDoesNotRestartModemLoggingWhenOnDemandLoggingEnabled) { + // Enable On Demand Logging + fake_android_property_manager.SetProperty(kModemLoggingPathProperty.data(), + kFakeOnDemandLoggingPath.data()); + StartModemLogging(fake_android_property_manager); + + modem_log_dumper.DumpModemLogs(); + + EXPECT_FALSE(fake_android_property_manager.ModemLoggingHasRestarted()); +} +} // namespace +} // namespace logging +} // namespace modem diff --git a/mte/fullmte-pixel.mk b/mte/fullmte-pixel.mk new file mode 100644 index 0000000..96120fb --- /dev/null +++ b/mte/fullmte-pixel.mk @@ -0,0 +1,2 @@ +include build/make/target/product/fullmte.mk +BOARD_KERNEL_CMDLINE += bootloader.pixel.MTE_FORCE_ON diff --git a/performance/sepolicy/genfs_contexts b/performance/sepolicy/genfs_contexts new file mode 100644 index 0000000..000c41b --- /dev/null +++ b/performance/sepolicy/genfs_contexts @@ -0,0 +1 @@ +genfscon proc /sys/kernel/sched_pelt_multiplier u:object_r:proc_sched:s0 diff --git a/pixel_metrics/sepolicy/genfs_contexts b/pixel_metrics/sepolicy/genfs_contexts index 3be226a..45ba566 100644 --- a/pixel_metrics/sepolicy/genfs_contexts +++ b/pixel_metrics/sepolicy/genfs_contexts @@ -1,6 +1,7 @@ #vendor-metrics genfscon sysfs /kernel/metrics/resume_latency/resume_latency_metrics u:object_r:sysfs_vendor_metrics:s0 genfscon sysfs /kernel/metrics/irq/long_irq_metrics u:object_r:sysfs_vendor_metrics:s0 +genfscon sysfs /kernel/metrics/irq/stats_reset u:object_r:sysfs_vendor_metrics:s0 genfscon sysfs /kernel/metrics/irq/storm_irq_metrics u:object_r:sysfs_vendor_metrics:s0 genfscon sysfs /kernel/metrics/thermal/tr_by_group/tmu/stats u:object_r:sysfs_vendor_metrics:s0 genfscon sysfs /kernel/metrics/thermal/tr_by_group/spmic/stats u:object_r:sysfs_vendor_metrics:s0 diff --git a/pixel_ril/compatibility_matrix.xml b/pixel_ril/compatibility_matrix.xml index edd9ecd..73d208d 100644 --- a/pixel_ril/compatibility_matrix.xml +++ b/pixel_ril/compatibility_matrix.xml @@ -1,4 +1,4 @@ - + hardware.google.ril_ext 1 diff --git a/soc/dump_devfreq.cpp b/soc/dump_devfreq.cpp index 5cbbb94..da91a62 100644 --- a/soc/dump_devfreq.cpp +++ b/soc/dump_devfreq.cpp @@ -14,16 +14,28 @@ * limitations under the License. */ #include +#include +const char* dvfs_paths[][2] = { + {"MIF DVFS", "/sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/trans_stat"}, + {"INT DVFS", "/sys/devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/trans_stat"}, + {"INTCAM DVFS", "/sys/devices/platform/17000030.devfreq_intcam/devfreq/17000030.devfreq_intcam/trans_stat"}, + {"DISP DVFS", "/sys/devices/platform/17000040.devfreq_disp/devfreq/17000040.devfreq_disp/trans_stat"}, + {"CAM DVFS", "/sys/devices/platform/17000050.devfreq_cam/devfreq/17000050.devfreq_cam/trans_stat"}, + {"TNR DVFS", "/sys/devices/platform/17000060.devfreq_tnr/devfreq/17000060.devfreq_tnr/trans_stat"}, + {"MFC DVFS", "/sys/devices/platform/17000070.devfreq_mfc/devfreq/17000070.devfreq_mfc/trans_stat"}, + {"BO DVFS", "/sys/devices/platform/17000080.devfreq_bo/devfreq/17000080.devfreq_bo/trans_stat"}, + {"BW DVFS", "/sys/devices/platform/17000080.devfreq_bw/devfreq/17000080.devfreq_bw/trans_stat"}, + {"DSU DVFS", "/sys/devices/platform/17000090.devfreq_dsu/devfreq/17000090.devfreq_dsu/trans_stat"}, + {"BCI DVFS", "/sys/devices/platform/170000a0.devfreq_bci/devfreq/170000a0.devfreq_bci/trans_stat"}, + {"BTS stats", "/sys/devices/platform/exynos-bts/bts_stats"} +}; int main() { - dumpFileContent("MIF DVFS", "/sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/time_in_state"); - dumpFileContent("INT DVFS", "/sys/devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/time_in_state"); - dumpFileContent("INTCAM DVFS", "/sys/devices/platform/17000030.devfreq_intcam/devfreq/17000030.devfreq_intcam/time_in_state"); - dumpFileContent("DISP DVFS", "/sys/devices/platform/17000040.devfreq_disp/devfreq/17000040.devfreq_disp/time_in_state"); - dumpFileContent("CAM DVFS", "/sys/devices/platform/17000050.devfreq_cam/devfreq/17000050.devfreq_cam/time_in_state"); - dumpFileContent("TNR DVFS", "/sys/devices/platform/17000060.devfreq_tnr/devfreq/17000060.devfreq_tnr/time_in_state"); - dumpFileContent("MFC DVFS", "/sys/devices/platform/17000070.devfreq_mfc/devfreq/17000070.devfreq_mfc/time_in_state"); - dumpFileContent("BO DVFS", "/sys/devices/platform/17000080.devfreq_bo/devfreq/17000080.devfreq_bo/time_in_state"); - dumpFileContent("BTS stats", "/sys/devices/platform/exynos-bts/bts_stats"); + + for (auto &dvfs_path : dvfs_paths ) { + if(!access(dvfs_path[1], R_OK)) { + dumpFileContent(dvfs_path[0], dvfs_path[1]); + } + } return 0; } diff --git a/soc/dump_soc.cpp b/soc/dump_soc.cpp index 4c34349..ab3ac2d 100644 --- a/soc/dump_soc.cpp +++ b/soc/dump_soc.cpp @@ -31,8 +31,10 @@ std::string readFile(const std::string& file_path) { // Dump chip ID. int main() { dumpFileContent("AP HW TUNE", "/sys/devices/system/chip-id/ap_hw_tune_str"); + dumpFileContent("DVFS VERSION", "/sys/devices/system/chip-id/dvfs_version"); dumpFileContent("EVT VERSION", "/sys/devices/system/chip-id/evt_ver"); dumpFileContent("LOT ID", "/sys/devices/system/chip-id/lot_id"); + dumpFileContent("PACKAGE", "/sys/devices/system/chip-id/pkg_revision"); dumpFileContent("PRODUCT ID", "/sys/devices/system/chip-id/product_id"); dumpFileContent("REVISION", "/sys/devices/system/chip-id/revision"); dumpFileContent("RAW STR", "/sys/devices/system/chip-id/raw_str"); diff --git a/soc/sepolicy/freq/genfs_contexts b/soc/sepolicy/freq/genfs_contexts index 76a783d..7795c12 100644 --- a/soc/sepolicy/freq/genfs_contexts +++ b/soc/sepolicy/freq/genfs_contexts @@ -10,6 +10,17 @@ genfscon sysfs /devices/platform/17000080.devfreq_bw/devfreq/17000080.devfreq_bw genfscon sysfs /devices/platform/17000080.devfreq_bo/devfreq/17000080.devfreq_bo/time_in_state u:object_r:sysfs_cpu:s0 genfscon sysfs /devices/platform/17000090.devfreq_dsu/devfreq/17000090.devfreq_dsu/time_in_state u:object_r:sysfs_cpu:s0 genfscon sysfs /devices/platform/170000a0.devfreq_bci/devfreq/170000a0.devfreq_bci/time_in_state u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000030.devfreq_intcam/devfreq/17000030.devfreq_intcam/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000040.devfreq_disp/devfreq/17000040.devfreq_disp/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000050.devfreq_cam/devfreq/17000050.devfreq_cam/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000060.devfreq_tnr/devfreq/17000060.devfreq_tnr/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000070.devfreq_mfc/devfreq/17000070.devfreq_mfc/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000080.devfreq_bw/devfreq/17000080.devfreq_bw/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000080.devfreq_bo/devfreq/17000080.devfreq_bo/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/17000090.devfreq_dsu/devfreq/17000090.devfreq_dsu/trans_stat u:object_r:sysfs_cpu:s0 +genfscon sysfs /devices/platform/170000a0.devfreq_bci/devfreq/170000a0.devfreq_bci/trans_stat u:object_r:sysfs_cpu:s0 genfscon sysfs /devices/platform/1f000000.mali/time_in_state u:object_r:sysfs_cpu:s0 genfscon sysfs /devices/platform/1f000000.mali/uid_time_in_state u:object_r:sysfs_cpu:s0 genfscon sysfs /devices/platform/cpupm/cpupm/time_in_state u:object_r:sysfs_cpu:s0 diff --git a/soc/sepolicy/soc/genfs_contexts b/soc/sepolicy/soc/genfs_contexts index e718bd1..bba996d 100644 --- a/soc/sepolicy/soc/genfs_contexts +++ b/soc/sepolicy/soc/genfs_contexts @@ -1,6 +1,8 @@ genfscon sysfs /devices/system/chip-id/ap_hw_tune_str u:object_r:sysfs_chip_id:s0 +genfscon sysfs /devices/system/chip-id/dvfs_version u:object_r:sysfs_chip_id:s0 genfscon sysfs /devices/system/chip-id/evt_ver u:object_r:sysfs_chip_id:s0 genfscon sysfs /devices/system/chip-id/lot_id u:object_r:sysfs_chip_id:s0 +genfscon sysfs /devices/system/chip-id/pkg_revision u:object_r:sysfs_chip_id:s0 genfscon sysfs /devices/system/chip-id/product_id u:object_r:sysfs_chip_id:s0 genfscon sysfs /devices/system/chip-id/revision u:object_r:sysfs_chip_id:s0 genfscon sysfs /devices/system/chip-id/raw_str u:object_r:sysfs_chip_id:s0 diff --git a/sota_app/factoryota.mk b/sota_app/factoryota.mk new file mode 100644 index 0000000..14ed2b5 --- /dev/null +++ b/sota_app/factoryota.mk @@ -0,0 +1,4 @@ +PRODUCT_PACKAGES += \ + FactoryOtaPrebuilt + +SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/sota_app/sepolicy/system_ext diff --git a/sota_app/sepolicy/system_ext/factory_ota_app.te b/sota_app/sepolicy/system_ext/factory_ota_app.te new file mode 100644 index 0000000..f48adeb --- /dev/null +++ b/sota_app/sepolicy/system_ext/factory_ota_app.te @@ -0,0 +1,32 @@ +type factory_ota_app, domain, coredomain; + +app_domain(factory_ota_app) +net_domain(factory_ota_app) + +# Write to /data/ota_package for OTA packages. +# Factory OTA client will download OTA image into ota_package folder and unzip it. +# Than Update engine could use it to execute OTA process. +# So Factory OTA client need read / write and create file access right for this folder +allow factory_ota_app ota_package_file:dir rw_dir_perms; +allow factory_ota_app ota_package_file:file create_file_perms; + +# Properties +# For write system property persist.* +set_prop(factory_ota_app, sota_prop); + +# Services +# For get access WiFi manager service and activity service +allow factory_ota_app app_api_service:service_manager find; +# Allow Factory OTA to call Update Engine +binder_call(factory_ota_app, update_engine) +# Allow Update Engine to call the Factory OTA callback +binder_call(update_engine, factory_ota_app) +#For access update engine function +allow factory_ota_app update_engine_service:service_manager find; +#For disable NFC wake up device feature +allow factory_ota_app nfc_service:service_manager find; +#For get device IMEI +allow factory_ota_app radio_service:service_manager find; + +# For suppress more GPU service sepolicy error log. +dontaudit factory_ota_app gpuservice:binder call; diff --git a/sota_app/sepolicy/system_ext/property_contexts b/sota_app/sepolicy/system_ext/property_contexts new file mode 100644 index 0000000..deb34dc --- /dev/null +++ b/sota_app/sepolicy/system_ext/property_contexts @@ -0,0 +1,5 @@ +ro.boot.sota u:object_r:sota_prop:s0 +ro.boot.sota. u:object_r:sota_prop:s0 +persist.vendor.factoryota. u:object_r:sota_prop:s0 +persist.vendor.radio.bootwithlpm u:object_r:sota_prop:s0 +persist.vendor.nfc.factoryota. u:object_r:sota_prop:s0 diff --git a/sota_app/sepolicy/system_ext/seapp_contexts b/sota_app/sepolicy/system_ext/seapp_contexts new file mode 100644 index 0000000..673f451 --- /dev/null +++ b/sota_app/sepolicy/system_ext/seapp_contexts @@ -0,0 +1,2 @@ +# Factory OTA +user=_app seinfo=platform name=com.google.android.factoryota domain=factory_ota_app levelFrom=all diff --git a/sota_app/sepolicy/system_ext/vendor_init.te b/sota_app/sepolicy/system_ext/vendor_init.te new file mode 100644 index 0000000..11191e3 --- /dev/null +++ b/sota_app/sepolicy/system_ext/vendor_init.te @@ -0,0 +1 @@ +set_prop(vendor_init, sota_prop) diff --git a/storage/Android.bp b/storage/Android.bp index 54e097e..c8671d1 100644 --- a/storage/Android.bp +++ b/storage/Android.bp @@ -5,6 +5,7 @@ package { sh_binary { name: "dump_storage.sh", src: "dump_storage.sh", + init_rc: ["init.storage.rc"], vendor: true, sub_dir: "dump", } diff --git a/storage/init.storage.rc b/storage/init.storage.rc new file mode 100644 index 0000000..445f74b --- /dev/null +++ b/storage/init.storage.rc @@ -0,0 +1,2 @@ +on property:ro.build.type=userdebug + write /dev/sys/block/bootdevice/pixel/enable_pixel_ufs_logging 1 diff --git a/storage/sepolicy/file_contexts b/storage/sepolicy/file_contexts index eda4cf7..a0efd28 100644 --- a/storage/sepolicy/file_contexts +++ b/storage/sepolicy/file_contexts @@ -1 +1,2 @@ /vendor/bin/dump/dump_storage\.sh u:object_r:dump_storage_exec:s0 +/sys/devices/platform/[0-9]+\.ufs/pixel/enable_pixel_ufs_logging u:object_r:sysfs_scsi_devices_0000:s0 diff --git a/thermal/dump_thermal.sh b/thermal/dump_thermal.sh index 2b87da9..288d34d 100644 --- a/thermal/dump_thermal.sh +++ b/thermal/dump_thermal.sh @@ -1,46 +1,46 @@ #!/vendor/bin/sh -echo "Temperatures" +echo 'Temperatures' for f in /sys/class/thermal/thermal* ; do - printf "%s: %s\n" `cat $f/type` `cat $f/temp` + echo `cat $f/type`: `cat $f/temp` done -echo "Cooling Device Current State" +echo 'Cooling Device Current State' for f in /sys/class/thermal/cooling* ; do - printf "%s: %s\n" `cat $f/type` `cat $f/cur_state` + echo `cat $f/type`: `cat $f/cur_state` done -echo "Cooling Device User Vote State" +echo 'Cooling Device User Vote State' for f in /sys/class/thermal/cooling* ; do - if [ ! -f $f/user_vote ]; then continue; fi; - printf "%s: %s\n" `cat $f/type` `cat $f/user_vote` + if ! [ -r $f/user_vote ]; then continue; fi; + echo `cat $f/type`: `cat $f/user_vote` done -echo "Cooling Device Time in State" +echo 'Cooling Device Time in State' for f in /sys/class/thermal/cooling* ; do - printf "%s: %s\n" `cat $f/type` `cat $f/stats/time_in_state_ms` + echo `cat $f/type`: `cat $f/stats/time_in_state_ms` done -echo "Cooling Device Trans Table" +echo 'Cooling Device Trans Table' for f in /sys/class/thermal/cooling* ; do - printf "%s: %s\n" `cat $f/type` `cat $f/stats/trans_table` + echo `cat $f/type`: `cat $f/stats/trans_table` done -echo "Cooling Device State2Power Table" +echo 'Cooling Device State2Power Table' for f in /sys/class/thermal/cooling* ; do - if [ ! -f $f/state2power_table ]; then continue; fi; - printf "%s: %s\n" `cat $f/type` `cat $f/state2power_table` + if ! [ -r $f/state2power_table ]; then continue; fi; + echo `cat $f/type`: `cat $f/state2power_table` done -echo "TMU state:" +echo 'TMU state:' cat /sys/module/gs_thermal/parameters/tmu_reg_dump_state -echo "TMU current temperature:" +echo 'TMU current temperature:' cat /sys/module/gs_thermal/parameters/tmu_reg_dump_current_temp -echo "TMU_TOP rise thresholds:" +echo 'TMU_TOP rise thresholds:' cat /sys/module/gs_thermal/parameters/tmu_top_reg_dump_rise_thres -echo "TMU_TOP fall thresholds:" +echo 'TMU_TOP fall thresholds:' cat /sys/module/gs_thermal/parameters/tmu_top_reg_dump_fall_thres -echo "TMU_SUB rise thresholds:" +echo 'TMU_SUB rise thresholds:' cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_rise_thres -echo "TMU_SUB fall thresholds:" +echo 'TMU_SUB fall thresholds:' cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_fall_thres diff --git a/touch/gti/dump_gti0.sh b/touch/gti/dump_gti0.sh index 40886e0..a3af3d7 100644 --- a/touch/gti/dump_gti0.sh +++ b/touch/gti/dump_gti0.sh @@ -9,7 +9,26 @@ heatmap_path=$path fi echo "------ Force Touch Active ------" -echo 1 > $path/force_active +result=$( cat "$path/force_active" 2>&1 ) +if [ $? -eq 0 ]; then + state=$( echo "$result" |cut -d " " -f 2 ) + if [ "$state" = "locked" ]; then + echo "The force_active is already locked!" + else + echo 1 > $path/force_active + if [ $? -ne 0 ]; then + echo "Failed to active touch device" + exit 1 + fi + fi +else + if [[ $result == *Operation\ not\ supported* ]]; then + echo "force_active is not support, skip it" + else + echo "Failed to read the state of force_force" + exit 1 + fi +fi echo "------ Touch Firmware Version ------" cat $path/fw_ver @@ -41,5 +60,10 @@ cat $heatmap_path/ss_raw echo "------ Self Test ------" cat $path/self_test +if [[ -f "${procfs_path}/dump" ]]; then + echo "------ Dump ------" + cat ${procfs_path}/dump +fi + echo "------ Disable Force Touch Active ------" echo 0 > $path/force_active diff --git a/touch/gti/dump_gti1.sh b/touch/gti/dump_gti1.sh index 79aa5fb..297ad44 100644 --- a/touch/gti/dump_gti1.sh +++ b/touch/gti/dump_gti1.sh @@ -9,7 +9,26 @@ heatmap_path=$path fi echo "------ Force Touch Active ------" -echo 1 > $path/force_active +result=$( cat "$path/force_active" 2>&1 ) +if [ $? -eq 0 ]; then + state=$( echo "$result" |cut -d " " -f 2 ) + if [ "$state" = "locked" ]; then + echo "The force_active is already locked!" + else + echo 1 > $path/force_active + if [ $? -ne 0 ]; then + echo "Failed to active touch device" + exit 1 + fi + fi +else + if [[ $result == *Operation\ not\ supported* ]]; then + echo "force_active is not support, skip it" + else + echo "Failed to read the state of force_force" + exit 1 + fi +fi echo "------ Touch Firmware Version ------" cat $path/fw_ver @@ -41,5 +60,10 @@ cat $heatmap_path/ss_raw echo "------ Self Test ------" cat $path/self_test +if [[ -f "${procfs_path}/dump" ]]; then + echo "------ Dump ------" + cat ${procfs_path}/dump +fi + echo "------ Disable Force Touch Active ------" echo 0 > $path/force_active diff --git a/touch/gti/init.touch.gti0.rc b/touch/gti/init.touch.gti0.rc index 5489ff8..70c6ced 100644 --- a/touch/gti/init.touch.gti0.rc +++ b/touch/gti/init.touch.gti0.rc @@ -2,6 +2,8 @@ on property:vendor.device.modules.ready=1 # Sysfs chown system system /sys/devices/virtual/goog_touch_interface/gti.0/force_active chown system system /sys/devices/virtual/goog_touch_interface/gti.0/fw_ver + chown system system /sys/devices/virtual/goog_touch_interface/gti.0/interactive_calibrate + chmod 666 /sys/devices/virtual/goog_touch_interface/gti.0/interactive_calibrate chown system system /sys/devices/virtual/goog_touch_interface/gti.0/panel_id chown system system /sys/devices/virtual/goog_touch_interface/gti.0/offload_id chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ms_base @@ -15,6 +17,7 @@ on property:vendor.device.modules.ready=1 # Procfs chown system system /proc/goog_touch_interface chown system system /proc/goog_touch_interface/gti.0 + chown system system /proc/goog_touch_interface/gti.0/dump chown system system /proc/goog_touch_interface/gti.0/ms_base chown system system /proc/goog_touch_interface/gti.0/ms_diff chown system system /proc/goog_touch_interface/gti.0/ms_raw diff --git a/touch/gti/init.touch.gti1.rc b/touch/gti/init.touch.gti1.rc index 28c8204..15de6a1 100644 --- a/touch/gti/init.touch.gti1.rc +++ b/touch/gti/init.touch.gti1.rc @@ -2,6 +2,8 @@ on property:vendor.device.modules.ready=1 # Sysfs chown system system /sys/devices/virtual/goog_touch_interface/gti.1/force_active chown system system /sys/devices/virtual/goog_touch_interface/gti.1/fw_ver + chown system system /sys/devices/virtual/goog_touch_interface/gti.1/interactive_calibrate + chmod 666 /sys/devices/virtual/goog_touch_interface/gti.1/interactive_calibrate chown system system /sys/devices/virtual/goog_touch_interface/gti.1/panel_id chown system system /sys/devices/virtual/goog_touch_interface/gti.1/offload_id chown system system /sys/devices/virtual/goog_touch_interface/gti.1/ms_base @@ -15,6 +17,7 @@ on property:vendor.device.modules.ready=1 # Procfs chown system system /proc/goog_touch_interface chown system system /proc/goog_touch_interface/gti.1 + chown system system /proc/goog_touch_interface/gti.1/dump chown system system /proc/goog_touch_interface/gti.1/ms_base chown system system /proc/goog_touch_interface/gti.1/ms_diff chown system system /proc/goog_touch_interface/gti.1/ms_raw diff --git a/touch/syna/Android.bp b/touch/syna/Android.bp index faefb9b..769c76b 100644 --- a/touch/syna/Android.bp +++ b/touch/syna/Android.bp @@ -5,6 +5,7 @@ package { sh_binary { name: "dump_syna.sh", src: "dump_syna.sh", + init_rc: ["init.touch.syna20.rc"], vendor: true, sub_dir: "dump", } diff --git a/touch/syna/dump_syna.sh b/touch/syna/dump_syna.sh index d30ff36..d749eff 100644 --- a/touch/syna/dump_syna.sh +++ b/touch/syna/dump_syna.sh @@ -1,5 +1,5 @@ #!/vendor/bin/sh -path="/sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs" +path=`getprop ro.vendor.touch.dump.sys` echo "Enable Force Touch Active" echo 21 > $path/force_active diff --git a/touch/syna/init.touch.syna20.rc b/touch/syna/init.touch.syna20.rc new file mode 100644 index 0000000..7c83a6c --- /dev/null +++ b/touch/syna/init.touch.syna20.rc @@ -0,0 +1,3 @@ +on property:vendor.device.modules.ready=1 + chown system system /sys/class/spi_master/spi20/spi20.0/synaptics_tcm.0/sysfs/get_raw_data + chown system system /sys/class/spi_master/spi20/spi20.0/synaptics_tcm.0/sysfs/force_active diff --git a/touch/syna/sepolicy/dump_syna.te b/touch/syna/sepolicy/dump_syna.te index 38655e7..fb9705c 100644 --- a/touch/syna/sepolicy/dump_syna.te +++ b/touch/syna/sepolicy/dump_syna.te @@ -3,3 +3,6 @@ pixel_bugreport(dump_syna) allow dump_syna sysfs_touch:dir r_dir_perms; allow dump_syna sysfs_touch:file rw_file_perms; allow dump_syna vendor_toolbox_exec:file execute_no_trans; + +get_prop(dump_syna, vendor_touch_dump_path_prop) + diff --git a/touch/syna/sepolicy/genfs_contexts b/touch/syna/sepolicy/genfs_contexts index de55bf3..c34d93c 100644 --- a/touch/syna/sepolicy/genfs_contexts +++ b/touch/syna/sepolicy/genfs_contexts @@ -1,2 +1,3 @@ -genfscon sysfs /devices/platform/10d10000.spi/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs u:object_r:sysfs_touch:s0 - +genfscon sysfs /devices/platform/10d10000.spi/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs u:object_r:sysfs_touch:s0 +genfscon sysfs /devices/platform/111d0000.spi/spi_master/spi20/spi20.0/synaptics_tcm.0/sysfs u:object_r:sysfs_touch:s0 +genfscon sysfs /devices/platform/111d0000.spi/spi_master/spi20/spi20.0/synaptics_tcm.0/wakeup u:object_r:sysfs_wakeup:s0 diff --git a/touch/syna/sepolicy/property.te b/touch/syna/sepolicy/property.te new file mode 100644 index 0000000..5484690 --- /dev/null +++ b/touch/syna/sepolicy/property.te @@ -0,0 +1 @@ +vendor_internal_prop(vendor_touch_dump_path_prop) diff --git a/touch/syna/sepolicy/property_contexts b/touch/syna/sepolicy/property_contexts new file mode 100644 index 0000000..524cc8b --- /dev/null +++ b/touch/syna/sepolicy/property_contexts @@ -0,0 +1 @@ +ro.vendor.touch.dump. u:object_r:vendor_touch_dump_path_prop:s0 diff --git a/touch/syna/sepolicy/vendor_init.te b/touch/syna/sepolicy/vendor_init.te new file mode 100644 index 0000000..74a6666 --- /dev/null +++ b/touch/syna/sepolicy/vendor_init.te @@ -0,0 +1 @@ +set_prop(vendor_init, vendor_touch_dump_path_prop) diff --git a/touch/syna/syna.mk b/touch/syna/syna.mk deleted file mode 100644 index 7f137a0..0000000 --- a/touch/syna/syna.mk +++ /dev/null @@ -1,3 +0,0 @@ -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/syna/sepolicy - -PRODUCT_PACKAGES += dump_syna.sh diff --git a/touch/syna/syna0.mk b/touch/syna/syna0.mk new file mode 100644 index 0000000..fe2b0c5 --- /dev/null +++ b/touch/syna/syna0.mk @@ -0,0 +1,5 @@ +PRODUCT_VENDOR_PROPERTIES += ro.vendor.touch.dump.sys=/sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs + +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/syna/sepolicy + +PRODUCT_PACKAGES += dump_syna.sh diff --git a/touch/syna/syna20.mk b/touch/syna/syna20.mk new file mode 100644 index 0000000..600f1ff --- /dev/null +++ b/touch/syna/syna20.mk @@ -0,0 +1,5 @@ +PRODUCT_VENDOR_PROPERTIES += ro.vendor.touch.dump.sys=/sys/devices/platform/111d0000.spi/spi_master/spi20/spi20.0/synaptics_tcm.0/sysfs + +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/syna/sepolicy + +PRODUCT_PACKAGES += dump_syna.sh diff --git a/touch/touchinspector/sepolicy/file.te b/touch/touchinspector/sepolicy/file.te new file mode 100644 index 0000000..f9468a0 --- /dev/null +++ b/touch/touchinspector/sepolicy/file.te @@ -0,0 +1,3 @@ +userdebug_or_eng(` + typeattribute proc_touch mlstrustedobject; +') diff --git a/touch/touchinspector/sepolicy/google_touch_app.te b/touch/touchinspector/sepolicy/google_touch_app.te new file mode 100644 index 0000000..0c6928d --- /dev/null +++ b/touch/touchinspector/sepolicy/google_touch_app.te @@ -0,0 +1,9 @@ +type google_touch_app, domain; + +userdebug_or_eng(` + app_domain(google_touch_app) + + allow google_touch_app app_api_service:service_manager find; + + allow google_touch_app proc_touch:file rw_file_perms; +') diff --git a/touch/touchinspector/sepolicy/seapp_contexts b/touch/touchinspector/sepolicy/seapp_contexts new file mode 100644 index 0000000..659caf4 --- /dev/null +++ b/touch/touchinspector/sepolicy/seapp_contexts @@ -0,0 +1,2 @@ +# Touch app +user=_app seinfo=platform name=com.google.touch.touchinspector domain=google_touch_app type=app_data_file levelFrom=user diff --git a/touch/touchinspector/touchinspector.mk b/touch/touchinspector/touchinspector.mk new file mode 100644 index 0000000..d17d8dc --- /dev/null +++ b/touch/touchinspector/touchinspector.mk @@ -0,0 +1,3 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/touchinspector/sepolicy + +PRODUCT_PACKAGES_DEBUG += TouchInspector diff --git a/wireless_charger/compatibility_matrix.xml b/wireless_charger/compatibility_matrix.xml index d0adcde..85ee65a 100644 --- a/wireless_charger/compatibility_matrix.xml +++ b/wireless_charger/compatibility_matrix.xml @@ -1,4 +1,4 @@ - + vendor.google.wireless_charger 1