service: Let producers choose whether to enable SMB scraping
Adds a setting to ConnectProducer / ProducerIPCClient which allows a
producer to instruct the service to enable or disable SMB scraping for
the producer.
Bug: 133268735
Change-Id: I941c963edc901c7946db8f85abcc25b70d6bf59d
diff --git a/src/tracing/core/tracing_service_impl.h b/src/tracing/core/tracing_service_impl.h
index fbae3b6..10ca797 100644
--- a/src/tracing/core/tracing_service_impl.h
+++ b/src/tracing/core/tracing_service_impl.h
@@ -76,7 +76,8 @@
base::TaskRunner*,
Producer*,
const std::string& producer_name,
- bool in_process);
+ bool in_process,
+ bool smb_scraping_enabled);
~ProducerEndpointImpl() override;
// TracingService::ProducerEndpoint implementation.
@@ -118,6 +119,7 @@
private:
friend class TracingServiceImpl;
friend class TracingServiceImplTest;
+ friend class TracingIntegrationTest;
ProducerEndpointImpl(const ProducerEndpointImpl&) = delete;
ProducerEndpointImpl& operator=(const ProducerEndpointImpl&) = delete;
@@ -132,6 +134,7 @@
size_t shmem_size_hint_bytes_ = 0;
const std::string name_;
bool in_process_;
+ bool smb_scraping_enabled_;
// Set of the global target_buffer IDs that the producer is configured to
// write into in any active tracing session.
@@ -260,12 +263,16 @@
uid_t uid,
const std::string& producer_name,
size_t shared_memory_size_hint_bytes = 0,
- bool in_process = false) override;
+ bool in_process = false,
+ ProducerSMBScrapingMode smb_scraping_mode =
+ ProducerSMBScrapingMode::kDefault) override;
std::unique_ptr<TracingService::ConsumerEndpoint> ConnectConsumer(
Consumer*,
uid_t) override;
+ // Set whether SMB scraping should be enabled by default or not. Producers can
+ // override this setting for their own SMBs.
void SetSMBScrapingEnabled(bool enabled) override {
smb_scraping_enabled_ = enabled;
}
@@ -278,6 +285,7 @@
private:
friend class TracingServiceImplTest;
+ friend class TracingIntegrationTest;
struct RegisteredDataSource {
ProducerID producer_id;