From 32b37d33a71f1e31ef44f9ef4083154a4ee89813 Mon Sep 17 00:00:00 2001 From: Adam Shih Date: Tue, 7 Mar 2023 12:54:34 +0800 Subject: [PATCH] create second panel dump Bug: 269212897 Test: adb bugreport Change-Id: I281e716a943abf64d5d36ecf2a256db8e32a041a --- display/Android.bp | 15 +++++++++++ display/dump_second_display.cpp | 25 +++++++++++++++++++ display/dump_second_display.mk | 3 +++ .../dump_second_display.te | 9 +++++++ display/sepolicy_second_display/file_contexts | 2 ++ 5 files changed, 54 insertions(+) create mode 100644 display/dump_second_display.cpp create mode 100644 display/dump_second_display.mk create mode 100644 display/sepolicy_second_display/dump_second_display.te create mode 100644 display/sepolicy_second_display/file_contexts diff --git a/display/Android.bp b/display/Android.bp index c3b346b..63dd76e 100644 --- a/display/Android.bp +++ b/display/Android.bp @@ -25,3 +25,18 @@ cc_binary { relative_install_path: "dump", } +cc_binary { + name: "dump_second_display", + srcs: ["dump_second_display.cpp"], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + shared_libs: [ + "libdump", + ], + vendor: true, + relative_install_path: "dump", +} + diff --git a/display/dump_second_display.cpp b/display/dump_second_display.cpp new file mode 100644 index 0000000..a6f2665 --- /dev/null +++ b/display/dump_second_display.cpp @@ -0,0 +1,25 @@ +/* + * Copyright 2022 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 + +int main() { + dumpFileContent("DECON-1 counters /sys/class/drm/card0/device/decon1/counters", "/sys/class/drm/card0/device/decon1/counters"); + dumpFileContent("CRTC-1 event log", "/sys/kernel/debug/dri/0/crtc-1/event"); + dumpFileContent("Secondary panel name", "/sys/devices/platform/exynos-drm/secondary-panel/panel_name"); + dumpFileContent("Secondary panel extra info", "/sys/devices/platform/exynos-drm/secondary-panel/panel_extinfo"); + return 0; +} + diff --git a/display/dump_second_display.mk b/display/dump_second_display.mk new file mode 100644 index 0000000..dfab73e --- /dev/null +++ b/display/dump_second_display.mk @@ -0,0 +1,3 @@ +PRODUCT_PACKAGES += dump_second_display +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy_second_display + diff --git a/display/sepolicy_second_display/dump_second_display.te b/display/sepolicy_second_display/dump_second_display.te new file mode 100644 index 0000000..62d9c2d --- /dev/null +++ b/display/sepolicy_second_display/dump_second_display.te @@ -0,0 +1,9 @@ +pixel_bugreport(dump_second_display) + +allow dump_second_display sysfs_display:file r_file_perms; + +userdebug_or_eng(` + allow dump_second_display vendor_dri_debugfs:dir r_dir_perms; + allow dump_second_display vendor_dri_debugfs:file r_file_perms; +') + diff --git a/display/sepolicy_second_display/file_contexts b/display/sepolicy_second_display/file_contexts new file mode 100644 index 0000000..d9bb31c --- /dev/null +++ b/display/sepolicy_second_display/file_contexts @@ -0,0 +1,2 @@ +/vendor/bin/dump/dump_second_display u:object_r:dump_second_display_exec:s0 +