Merge "Introduce Pixel mailbox module" into main

This commit is contained in:
Treehugger Robot 2024-11-13 08:49:49 +00:00 committed by Android (Google) Code Review
commit cad0ccbb94
8 changed files with 76 additions and 0 deletions

21
mailbox/Android.bp Normal file
View file

@ -0,0 +1,21 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_binary {
name: "dump_mailbox",
srcs: ["dump/dump_mailbox.cpp"],
init_rc: ["init.mailbox.rc"],
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
shared_libs: [
"libbase",
"libdump",
"liblog",
],
vendor: true,
relative_install_path: "dump",
}

View file

@ -0,0 +1,32 @@
/*
* Copyright 2024 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/file.h>
int main() {
std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "mailbox");
if (mkdir(outputDir.c_str(), 0777) == -1) {
printf("Unable to create folder: %s\n", outputDir.c_str());
return 0;
}
copyFile("/sys/kernel/tracing/instances/goog_cpm_mailbox/trace",
concatenatePath(outputDir.c_str(), "goog_cpm_mailbox_trace").c_str());
copyFile("/sys/kernel/tracing/instances/goog_nq_mailbox/trace",
concatenatePath(outputDir.c_str(), "goog_nq_mailbox_trace").c_str());
return 0;
}

View file

@ -0,0 +1,7 @@
#
pixel_bugreport(dump_mailbox)
allow dump_mailbox radio_vendor_data_file:dir create_dir_perms;
allow dump_mailbox radio_vendor_data_file:file create_file_perms;
allow dump_mailbox debugfs_tracing_instances:file r_file_perms;
allow dump_mailbox debugfs_tracing_instances:dir search;
allow dump_mailbox debugfs_tracing_instances_mailbox:file r_file_perms;

View file

@ -0,0 +1,2 @@
#
type debugfs_tracing_instances_mailbox, sysfs_type, fs_type;

View file

@ -0,0 +1 @@
/vendor/bin/dump/dump_mailbox u:object_r:dump_mailbox_exec:s0

View file

@ -0,0 +1,2 @@
genfscon tracefs /instances/goog_cpm_mailbox/trace u:object_r:debugfs_tracing_instances_mailbox:s0
genfscon tracefs /instances/goog_nq_mailbox/trace u:object_r:debugfs_tracing_instances_mailbox:s0

8
mailbox/init.mailbox.rc Normal file
View file

@ -0,0 +1,8 @@
on property:sys.boot_completed=1
chown system system /sys/kernel/tracing/instances/goog_cpm_mailbox
chown system system /sys/kernel/tracing/instances/goog_cpm_mailbox/trace
write /sys/kernel/tracing/instances/goog_cpm_mailbox/buffer_size_kb 512
chown system system /sys/kernel/tracing/instances/goog_nq_mailbox
chown system system /sys/kernel/tracing/instances/goog_nq_mailbox/trace
write /sys/kernel/tracing/instances/goog_nq_mailbox/buffer_size_kb 512

3
mailbox/mailbox.mk Normal file
View file

@ -0,0 +1,3 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/mailbox/dump/sepolicy
PRODUCT_PACKAGES += dump_mailbox