Remove hostapd.conf before starting Tethering

It fails to start Wi-Fi Tethering at first boot
after OS version up from Android N to O.

It is caused by permission.
Owner of hostapd.conf is "system" on Android N.
However, it is "wifi" on Android O.

hostapd.conf doesn't need to be handed over
because it is created again when Tethering is started.

Bug: 67351973
Test: manually run tethering

Change-Id: Ia7c87ab1f2040434963f6e0670ccd02cdd84bee7
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp
index 68184e9..658eecd 100644
--- a/libwifi_system/hostapd_manager.cpp
+++ b/libwifi_system/hostapd_manager.cpp
@@ -34,6 +34,7 @@
 
 using android::base::ParseInt;
 using android::base::ReadFileToString;
+using android::base::RemoveFileIfExists;
 using android::base::StringPrintf;
 using android::base::WriteStringToFile;
 using std::string;
@@ -103,6 +104,9 @@
 }
 
 bool HostapdManager::WriteHostapdConfig(const string& config) {
+  // Remove hostapd.conf because its file owner might be system
+  // in previous OS and chmod fails in that case.
+  RemoveFileIfExists(kHostapdConfigFilePath);
   if (!WriteStringToFile(config, kHostapdConfigFilePath,
                          S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
                          AID_WIFI, AID_WIFI)) {