Merge 10952656

Merged-In: I1cffc53e765a0531109e4c04b72605a1c879973f
Change-Id: I251d7da3b70e6d06dd1a4530ec1cac6cdc7b0f52
This commit is contained in:
Xin Li 2023-10-17 10:06:29 -07:00
commit 2a0e587b2e
143 changed files with 1360 additions and 14576 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
<compatibility-matrix version="1.0" type="framework" level="7">
<compatibility-matrix version="1.0" type="framework">
<hal format="hidl">
<name>vendor.google.audiometricext</name>
<version>1.0</version>
@ -7,4 +7,12 @@
<instance>default</instance>
</interface>
</hal>
<hal format="aidl">
<name>vendor.google.whitechapel.audio.extension</name>
<version>1</version>
<interface>
<name>IAudioExtension</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@ -1,4 +1,4 @@
<manifest version="1.0" type="device" target-level="7">
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.google.audiometricext</name>
<transport>hwbinder</transport>

View File

@ -1,4 +1,4 @@
<compatibility-matrix version="1.0" type="framework" level="7">
<compatibility-matrix version="1.0" type="framework">
<hal format="hidl">
<name>vendor.google.whitechapel.audio.audioext</name>
<version>4.0</version>

View File

@ -1,4 +1,4 @@
<manifest version="1.0" type="device" target-level="7">
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.audio</name>
<transport>hwbinder</transport>

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,2 @@
allow radio hal_audio_ext_service:service_manager find;
binder_call(radio, hal_audio_default)

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1 @@
genfscon sysfs /devices/platform/drmdp-adma/extcon/hdmi_audio u:object_r:sysfs_extcon:s0

View File

@ -0,0 +1,2 @@
allow radio hal_audio_ext_hwservice:hwservice_manager find;
binder_call(radio, hal_audio_default)

View File

@ -19,6 +19,8 @@
#include <battery_mitigation/BatteryMitigation.h>
#include <android/binder_process.h>
#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();
}

View File

@ -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

View File

@ -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)
')

View File

@ -0,0 +1 @@
type brownout_detection_app, domain;

View File

@ -0,0 +1,3 @@
userdebug_or_eng(`
get_prop(brownout_detection_app, vendor_brownout_reason_prop)
')

View File

@ -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

View File

@ -1,39 +1,28 @@
<compatibility-matrix version="1.0" type="framework" level="7">
<hal format="hidl">
<name>hardware.google.bluetooth.ccc</name>
<version>1.1</version>
<compatibility-matrix version="1.0" type="framework">
<hal format="aidl" optional="true">
<name>vendor.google.bluetooth_ext</name>
<version>1</version>
<interface>
<name>IBluetoothFinder</name>
<instance>default</instance>
</interface>
<fqname>IBluetoothFinder/default</fqname>
<interface>
<name>IBluetoothCcc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.bt_channel_avoidance</name>
<version>1.0</version>
<interface>
<name>IBTChannelAvoidance</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.sar</name>
<version>1.1</version>
<interface>
<name>IBluetoothSar</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>hardware.google.bluetooth.ext</name>
<version>1.0</version>
<interface>
<name>IBluetoothExt</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>hardware.google.bluetooth.ewp</name>
<version>1.0</version>
<interface>
<name>IBluetoothEwp</name>
<instance>default</instance>

20
bcmbt/dump/Android.bp Normal file
View File

@ -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",
}

37
bcmbt/dump/dump_bcmbt.cpp Normal file
View File

@ -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 <dump/pixel_dump.h>
//#include <android-base/properties.h>
#include <android-base/file.h>
#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;
}

3
bcmbt/dump/dumplog.mk Normal file
View File

@ -0,0 +1,3 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/bcmbt/dump/sepolicy/
PRODUCT_PACKAGES_DEBUG += dump_bcmbt

View File

@ -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;
')

View File

@ -0,0 +1 @@
/vendor/bin/dump/dump_bcmbt u:object_r:dump_bcmbt_exec:s0

View File

@ -1,56 +1,17 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<hal format="aidl">
<name>android.hardware.bluetooth</name>
<transport>hwbinder</transport>
<version>1.1</version>
<interface>
<name>IBluetoothHci</name>
<instance>default</instance>
</interface>
<version>1</version>
<fqname>IBluetoothHci/default</fqname>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.bt_channel_avoidance</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IBTChannelAvoidance</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.sar</name>
<transport>hwbinder</transport>
<version>1.1</version>
<interface>
<name>IBluetoothSar</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.ext</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IBluetoothExt</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.ccc</name>
<transport>hwbinder</transport>
<version>1.1</version>
<interface>
<name>IBluetoothCcc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>hardware.google.bluetooth.ewp</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IBluetoothEwp</name>
<instance>default</instance>
</interface>
<hal format="aidl">
<name>vendor.google.bluetooth_ext</name>
<version>1</version>
<fqname>IBTChannelAvoidance/default</fqname>
<fqname>IBluetoothCcc/default</fqname>
<fqname>IBluetoothEwp/default</fqname>
<fqname>IBluetoothExt/default</fqname>
<fqname>IBluetoothFinder/default</fqname>
<fqname>IBluetoothSar/default</fqname>
</hal>
</manifest>

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,2 @@
# Bluetooth HAL extension
type hal_bluetooth_coexistence_service, hal_service_type, service_manager_type;

View File

@ -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

View File

@ -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",
}

2
camera/OWNERS Normal file
View File

@ -0,0 +1,2 @@
krzysio@google.com
yromanenko@google.com

View File

@ -0,0 +1,13 @@
<compatibility-matrix version="1.0" type="device">
<hal format="aidl" optional="true">
<name>com.google.pixel.camera.services.binder</name>
<version>1</version>
<interface>
<name>IServiceBinder</name>
<instance>default</instance>
</interface>
</hal>
<vndk>
<version>0.0.0</version>
</vndk>
</compatibility-matrix>

View File

@ -0,0 +1,10 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="aidl" optional="true">
<name>com.google.pixel.camera.connectivity.hal.provider</name>
<version>1</version>
<interface>
<name>ICameraProvider</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@ -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

60
camera/lyric.mk Normal file
View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1 @@
type vendor_pbcs_app, domain;

View File

@ -0,0 +1 @@
type vendor_pcs_app, domain;

View File

@ -1,2 +0,0 @@
vendor_internal_prop(vendor_camera_debug_prop)

View File

@ -1,2 +0,0 @@
vendor.camera.debug. u:object_r:vendor_camera_debug_prop:s0

View File

@ -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

View File

@ -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)

View File

@ -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 };

3
camera/sepolicy/vendor/property.te vendored Normal file
View File

@ -0,0 +1,3 @@
vendor_internal_prop(vendor_camera_debug_prop)
system_vendor_config_prop(vendor_camera_pbcs_debug_prop)

View File

@ -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

9
camera/sepolicy/vendor/service.te vendored Normal file
View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This is to advertise that the camera device supports preview digital image stabilization
in both front and back cameras-->
<permissions>
<feature name="vendor.android.hardware.camera.preview-dis.front" />
<feature name="vendor.android.hardware.camera.preview-dis.back" />
</permissions>

View File

@ -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 += \

View File

@ -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

View File

@ -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"
],
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.gnss</name>
<version>3</version>
<fqname>IGnss/default</fqname>
</hal>
</manifest>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <unistd.h>
#include <dump/pixel_dump.h>
#include <android-base/properties.h>
#include <android-base/file.h>
@ -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;
}

View File

@ -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;
}

8
gyotaku_app/gyotaku.mk Normal file
View File

@ -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

View File

@ -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);
')

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,4 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/misc_writer
PRODUCT_PACKAGES += \
misc_writer

View File

@ -0,0 +1 @@
get_prop(vendor_misc_writer, sota_prop)

View File

@ -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,
}

View File

@ -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

View File

@ -13,52 +13,61 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dump/pixel_dump.h>
#include <android-base/properties.h>
#include <log/log.h>
#include <dump/pixel_dump.h>
#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;
}

View File

@ -0,0 +1,21 @@
#pragma once
#include <string>
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

71
modem/include/dumper.h Normal file
View File

@ -0,0 +1,71 @@
#pragma once
#include <ostream>
#include <string_view>
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

View File

@ -0,0 +1,56 @@
#pragma once
#include <string>
#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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More