thermal: remove redundant cdev_to_watch registration

cdev_to_watch fd causes pollOnce function return immediatly.
Because thermalhal does not monitor cdev status now,
so remove cdev_to_watch fd to avoid threadLoop busy problem.

Bug: 151897840
Test: Verified thermalhal notifythrottling via emul_temp
      thermalhal will not keep busy.
Signed-off-by: TeYuan Wang <kamewang@google.com>

(cherry picked from commit b59c54e95b6bca8a765f8940d477101f8acbd949)
Change-Id: If6234b43a82d61c36fddff4c66be6eb4434fdb7d
diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp
index 732d181..f41cb74 100644
--- a/thermal/thermal-helper.cpp
+++ b/thermal/thermal-helper.cpp
@@ -198,17 +198,6 @@
     if (!is_initialized_) {
         LOG(FATAL) << "ThermalHAL could not be initialized properly.";
     }
-    std::set<std::string> cdev_paths;
-    std::transform(cooling_device_info_map_.cbegin(), cooling_device_info_map_.cend(),
-                   std::inserter(cdev_paths, cdev_paths.begin()),
-                   [this](std::pair<std::string, const CoolingType> const &cdev) {
-                       std::string path =
-                               cooling_devices_.getThermalFilePath(std::string_view(cdev.first));
-                       if (!path.empty())
-                           return path;
-                       else
-                           return std::string();
-                   });
     std::set<std::string> monitored_sensors;
     std::transform(sensor_info_map_.cbegin(), sensor_info_map_.cend(),
                    std::inserter(monitored_sensors, monitored_sensors.begin()),
@@ -219,7 +208,7 @@
                            return std::string();
                    });
 
-    thermal_watcher_->registerFilesToWatch(monitored_sensors, cdev_paths, initializeTrip(tz_map));
+    thermal_watcher_->registerFilesToWatch(monitored_sensors, initializeTrip(tz_map));
 
     // Need start watching after status map initialized
     is_initialized_ = thermal_watcher_->startWatchingDeviceFiles();
diff --git a/thermal/utils/thermal_watcher.cpp b/thermal/utils/thermal_watcher.cpp
index e0ebfbb..9bdda2a 100644
--- a/thermal/utils/thermal_watcher.cpp
+++ b/thermal/utils/thermal_watcher.cpp
@@ -36,20 +36,7 @@
 using std::chrono_literals::operator""ms;
 
 void ThermalWatcher::registerFilesToWatch(const std::set<std::string> &sensors_to_watch,
-                                          const std::set<std::string> &cdev_to_watch,
                                           bool uevent_monitor) {
-    int flags = O_RDONLY | O_CLOEXEC | O_BINARY;
-
-    for (const auto &path : cdev_to_watch) {
-        android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags)));
-        if (fd == -1) {
-            PLOG(ERROR) << "failed to watch: " << path;
-            continue;
-        }
-        watch_to_file_path_map_.emplace(fd.get(), path);
-        looper_->addFd(fd.get(), 0, Looper::EVENT_INPUT, nullptr, nullptr);
-        fds_.emplace_back(std::move(fd));
-    }
     monitored_sensors_.insert(sensors_to_watch.begin(), sensors_to_watch.end());
     if (!uevent_monitor) {
         is_polling_ = true;
diff --git a/thermal/utils/thermal_watcher.h b/thermal/utils/thermal_watcher.h
index 45c2a73..0499e9a 100644
--- a/thermal/utils/thermal_watcher.h
+++ b/thermal/utils/thermal_watcher.h
@@ -56,8 +56,7 @@
     // Give the file watcher a list of files to start watching. This helper
     // class will by default wait for modifications to the file with a looper.
     // This should be called before starting watcher thread.
-    void registerFilesToWatch(const std::set<std::string> &sensors_to_watch,
-                              const std::set<std::string> &cdev_to_watch, bool uevent_monitor);
+    void registerFilesToWatch(const std::set<std::string> &sensors_to_watch, bool uevent_monitor);
     // Wake up the looper thus the worker thread, immediately. This can be called
     // in any thread.
     void wake();
@@ -74,7 +73,6 @@
 
     // Maps watcher filer descriptor to watched file path.
     std::unordered_map<int, std::string> watch_to_file_path_map_;
-    std::vector<android::base::unique_fd> fds_;
 
     // The callback function. Called whenever thermal uevent is seen.
     // The function passed in should expect a string in the form (type).