ueventd: require opt-in for modalias handling
Some devices have modules.alias and modules.dep for modprobe and other
purposes but do not want to opt into ueventd auto loading their
modules. Therefore we add a flag that can be added to ueventd
configuration files to opt into this behavior.
Bug: 111916071
Bug: 112048758
Test: check that modules are loaded with this opt-in
Test: check that modules are not loaded without this opt-in
Change-Id: Ifb281b273059b4671eea1ca5bc726c9e79f3adfb
diff --git a/init/modalias_handler.h b/init/modalias_handler.h
index e79da32..3247c86 100644
--- a/init/modalias_handler.h
+++ b/init/modalias_handler.h
@@ -16,22 +16,23 @@
#pragma once
-#include "result.h"
-#include "uevent.h"
-
#include <string>
#include <unordered_map>
#include <vector>
+#include "result.h"
+#include "uevent.h"
+#include "uevent_handler.h"
+
namespace android {
namespace init {
-class ModaliasHandler {
+class ModaliasHandler : public UeventHandler {
public:
ModaliasHandler();
- ~ModaliasHandler(){};
+ virtual ~ModaliasHandler() = default;
- void HandleModaliasEvent(const Uevent& uevent);
+ void HandleUevent(const Uevent& uevent) override;
private:
Result<Success> InsmodWithDeps(const std::string& module_name, const std::string& args);