Add startSkDestroyListener flag to native_init
This CL prepares for upcoming CL.
Upcoming CL will add SkDestroyListener with Java BpfMap and switch
current C SkDestroyListener and new Java SkDestroyListener based on the
experiment flag.
Bug: 217624062
Test: atest SkDestroyListenerTest
Change-Id: I5ebb319d1b2262199d4ef6a3549894fee24c4ccf
diff --git a/service/native/TrafficController.cpp b/service/native/TrafficController.cpp
index a26d1e6..7fb1b34 100644
--- a/service/native/TrafficController.cpp
+++ b/service/native/TrafficController.cpp
@@ -181,9 +181,13 @@
return netdutils::status::ok;
}
-Status TrafficController::start() {
+Status TrafficController::start(bool startSkDestroyListener) {
RETURN_IF_NOT_OK(initMaps());
+ if (!startSkDestroyListener) {
+ return netdutils::status::ok;
+ }
+
auto result = makeSkDestroyListener();
if (!isOk(result)) {
ALOGE("Unable to create SkDestroyListener: %s", toString(result).c_str());
diff --git a/service/native/include/TrafficController.h b/service/native/include/TrafficController.h
index 8512929..b44d795 100644
--- a/service/native/include/TrafficController.h
+++ b/service/native/include/TrafficController.h
@@ -38,7 +38,7 @@
/*
* Initialize the whole controller
*/
- netdutils::Status start();
+ netdutils::Status start(bool startSkDestroyListener);
/*
* Swap the stats map config from current active stats map to the idle one.