From 7424539825a0ae7a6529c26a696a64896bab32c5 Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Wed, 28 Feb 2024 13:32:39 -0800 Subject: [PATCH] Trace Redaction - Clean-up includes Some files had unused includes. Some files were indirectly using includes (using an include that was included in another file). And some files were not using the full path to the include. This CL goes through those files and addresses each case. Change-Id: I494a9a68363f05e9113d8b45122a5f4a7a656404 Bug: 318576499 --- src/trace_redaction/find_package_uid.cc | 4 +++- src/trace_redaction/find_package_uid.h | 3 ++- src/trace_redaction/find_package_uid_unittest.cc | 8 ++++---- src/trace_redaction/prune_package_list.cc | 5 +++++ src/trace_redaction/prune_package_list.h | 1 + src/trace_redaction/prune_package_list_unittest.cc | 6 ++++-- src/trace_redaction/scrub_trace_packet.cc | 4 ++++ src/trace_redaction/scrub_trace_packet.h | 2 -- src/trace_redaction/scrub_trace_packet_unittest.cc | 1 + src/trace_redaction/trace_redaction_framework.h | 3 +-- src/trace_redaction/trace_redactor.h | 4 ++++ src/trace_redaction/trace_redactor_integrationtest.cc | 5 +++++ 12 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/trace_redaction/find_package_uid.cc b/src/trace_redaction/find_package_uid.cc index d069fe2902..0c46ff5240 100644 --- a/src/trace_redaction/find_package_uid.cc +++ b/src/trace_redaction/find_package_uid.cc @@ -17,7 +17,9 @@ #include "src/trace_redaction/find_package_uid.h" #include "perfetto/ext/base/status_or.h" -#include "perfetto/ext/base/string_utils.h" +#include "perfetto/ext/base/string_view.h" +#include "src/trace_redaction/trace_redaction_framework.h" + #include "protos/perfetto/trace/android/packages_list.pbzero.h" #include "protos/perfetto/trace/trace_packet.pbzero.h" diff --git a/src/trace_redaction/find_package_uid.h b/src/trace_redaction/find_package_uid.h index 4ae34d4094..d43b2af611 100644 --- a/src/trace_redaction/find_package_uid.h +++ b/src/trace_redaction/find_package_uid.h @@ -18,9 +18,10 @@ #define SRC_TRACE_REDACTION_FIND_PACKAGE_UID_H_ #include "perfetto/ext/base/status_or.h" -#include "protos/perfetto/trace/trace_packet.pbzero.h" #include "src/trace_redaction/trace_redaction_framework.h" +#include "protos/perfetto/trace/trace_packet.pbzero.h" + namespace perfetto::trace_redaction { // Writes the uid for the package matching `Context.package_name`. Returns diff --git a/src/trace_redaction/find_package_uid_unittest.cc b/src/trace_redaction/find_package_uid_unittest.cc index 44f0a4577f..5f390ab575 100644 --- a/src/trace_redaction/find_package_uid_unittest.cc +++ b/src/trace_redaction/find_package_uid_unittest.cc @@ -15,17 +15,17 @@ * limitations under the License. */ -#include "find_package_uid.h" +#include "src/trace_redaction/find_package_uid.h" #include #include +#include "src/base/test/status_matchers.h" +#include "test/gtest_and_gmock.h" + #include "protos/perfetto/trace/android/packages_list.gen.h" #include "protos/perfetto/trace/ps/process_tree.gen.h" -#include "protos/perfetto/trace/ps/process_tree.pbzero.h" #include "protos/perfetto/trace/trace_packet.gen.h" -#include "src/base/test/status_matchers.h" -#include "test/gtest_and_gmock.h" namespace perfetto::trace_redaction { diff --git a/src/trace_redaction/prune_package_list.cc b/src/trace_redaction/prune_package_list.cc index 52c1394233..83d2355e1c 100644 --- a/src/trace_redaction/prune_package_list.cc +++ b/src/trace_redaction/prune_package_list.cc @@ -16,7 +16,12 @@ #include "src/trace_redaction/prune_package_list.h" +#include + +#include "perfetto/base/status.h" + #include "protos/perfetto/trace/android/packages_list.gen.h" +#include "protos/perfetto/trace/trace_packet.gen.h" namespace perfetto::trace_redaction { diff --git a/src/trace_redaction/prune_package_list.h b/src/trace_redaction/prune_package_list.h index cf1298feca..24d9ec2240 100644 --- a/src/trace_redaction/prune_package_list.h +++ b/src/trace_redaction/prune_package_list.h @@ -19,6 +19,7 @@ #include +#include "perfetto/base/status.h" #include "src/trace_redaction/trace_redaction_framework.h" namespace perfetto::trace_redaction { diff --git a/src/trace_redaction/prune_package_list_unittest.cc b/src/trace_redaction/prune_package_list_unittest.cc index 6a9af6cac3..0f78cba0ff 100644 --- a/src/trace_redaction/prune_package_list_unittest.cc +++ b/src/trace_redaction/prune_package_list_unittest.cc @@ -16,13 +16,15 @@ */ #include +#include #include +#include "src/trace_redaction/prune_package_list.h" +#include "test/gtest_and_gmock.h" + #include "protos/perfetto/trace/android/packages_list.gen.h" #include "protos/perfetto/trace/ps/process_tree.gen.h" #include "protos/perfetto/trace/trace_packet.gen.h" -#include "src/trace_redaction/prune_package_list.h" -#include "test/gtest_and_gmock.h" namespace perfetto::trace_redaction { diff --git a/src/trace_redaction/scrub_trace_packet.cc b/src/trace_redaction/scrub_trace_packet.cc index e4f03cfe4a..e56acf908a 100644 --- a/src/trace_redaction/scrub_trace_packet.cc +++ b/src/trace_redaction/scrub_trace_packet.cc @@ -14,8 +14,12 @@ * limitations under the License. */ +#include + #include "src/trace_redaction/scrub_trace_packet.h" +#include "perfetto/base/status.h" + namespace perfetto::trace_redaction { // The TracePacket message has a simple structure. At its core its one sub // message (e.g. ProcessTree) and some additional context (e.g. timestamp). diff --git a/src/trace_redaction/scrub_trace_packet.h b/src/trace_redaction/scrub_trace_packet.h index 06710d3185..fbf89cab24 100644 --- a/src/trace_redaction/scrub_trace_packet.h +++ b/src/trace_redaction/scrub_trace_packet.h @@ -19,8 +19,6 @@ #include "src/trace_redaction/trace_redaction_framework.h" -#include "protos/perfetto/trace/trace_packet.pbzero.h" - namespace perfetto::trace_redaction { // Drops whole trace packets based on an allow-list (e.g. retain ProcessTree diff --git a/src/trace_redaction/scrub_trace_packet_unittest.cc b/src/trace_redaction/scrub_trace_packet_unittest.cc index 82b99d4eba..f2031657f1 100644 --- a/src/trace_redaction/scrub_trace_packet_unittest.cc +++ b/src/trace_redaction/scrub_trace_packet_unittest.cc @@ -21,6 +21,7 @@ #include "test/gtest_and_gmock.h" #include "protos/perfetto/trace/ps/process_tree.gen.h" +#include "protos/perfetto/trace/trace_packet.gen.h" #include "protos/perfetto/trace/trace_packet.pbzero.h" namespace perfetto::trace_redaction { diff --git a/src/trace_redaction/trace_redaction_framework.h b/src/trace_redaction/trace_redaction_framework.h index b481961bbc..76b859471b 100644 --- a/src/trace_redaction/trace_redaction_framework.h +++ b/src/trace_redaction/trace_redaction_framework.h @@ -20,12 +20,11 @@ #include #include #include -#include #include "perfetto/base/flat_set.h" +#include "perfetto/base/status.h" #include "perfetto/ext/base/status_or.h" -#include "protos/perfetto/trace/trace_packet.gen.h" #include "protos/perfetto/trace/trace_packet.pbzero.h" namespace perfetto::trace_redaction { diff --git a/src/trace_redaction/trace_redactor.h b/src/trace_redaction/trace_redactor.h index 99a8832231..82ec37183d 100644 --- a/src/trace_redaction/trace_redactor.h +++ b/src/trace_redaction/trace_redactor.h @@ -17,8 +17,12 @@ #ifndef SRC_TRACE_REDACTION_TRACE_REDACTOR_H_ #define SRC_TRACE_REDACTION_TRACE_REDACTOR_H_ +#include +#include #include +#include +#include "perfetto/base/status.h" #include "perfetto/trace_processor/trace_blob_view.h" #include "src/trace_redaction/trace_redaction_framework.h" diff --git a/src/trace_redaction/trace_redactor_integrationtest.cc b/src/trace_redaction/trace_redactor_integrationtest.cc index 8e10095041..def99db900 100644 --- a/src/trace_redaction/trace_redactor_integrationtest.cc +++ b/src/trace_redaction/trace_redactor_integrationtest.cc @@ -14,6 +14,11 @@ * limitations under the License. */ +#include +#include +#include +#include + #include "perfetto/ext/base/file_utils.h" #include "perfetto/ext/base/temp_file.h" #include "src/base/test/utils.h"