summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaisuke Niwa <daisuke.x.niwa@sonymobile.com>2017-09-15 18:40:20 +0900
committerNingyuan Wang <nywang@google.com>2017-10-04 16:36:52 -0700
commit8be6b8283d1eb058cbbb3024217c60e93ccc59c7 (patch)
tree8483f7fcb6bd6d2c4480153c035631864af21a9b
parent7ce813a6129ab0c0b812b27e332730a8a2165d43 (diff)
downloadandroid_frameworks_opt_net_wifi-8be6b8283d1eb058cbbb3024217c60e93ccc59c7.tar.gz
android_frameworks_opt_net_wifi-8be6b8283d1eb058cbbb3024217c60e93ccc59c7.tar.bz2
android_frameworks_opt_net_wifi-8be6b8283d1eb058cbbb3024217c60e93ccc59c7.zip
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
-rw-r--r--libwifi_system/hostapd_manager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp
index 68184e901..658eecdd8 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::StopHostapd() {
}
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)) {