diff options
author | bnarasimha <bnarasimha@cyngn.com> | 2016-11-18 10:29:38 -0800 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-01 23:10:32 +0200 |
commit | 76493b8dba73ba16d60559db182a16cfc1dbd700 (patch) | |
tree | c2476847ccd6e6e1fd4b5c90f1abfe79e43773d4 | |
parent | 91c17ab058b76351c8eea9f7dbaee3bb72dc73a0 (diff) | |
download | android_frameworks_opt_net_wifi-76493b8dba73ba16d60559db182a16cfc1dbd700.tar.gz android_frameworks_opt_net_wifi-76493b8dba73ba16d60559db182a16cfc1dbd700.tar.bz2 android_frameworks_opt_net_wifi-76493b8dba73ba16d60559db182a16cfc1dbd700.zip |
Tethering: Turn off wifi hotspot after inactivity(2/3)staging/cm-14.1-cafrebase
Turn off the Wi-Fi hotspot after a specified time of inactivity.
The hotspot is considered to be inactive when no clients are
connected to it.
Change-Id: I26ad7027a57df8109c87cc08b6887b5af108bbaf
-rw-r--r-- | service/java/com/android/server/wifi/WifiApConfigStore.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java index a0341d748..2f49586d5 100644 --- a/service/java/com/android/server/wifi/WifiApConfigStore.java +++ b/service/java/com/android/server/wifi/WifiApConfigStore.java @@ -160,6 +160,10 @@ public class WifiApConfigStore { if (authType != KeyMgmt.NONE) { config.preSharedKey = in.readUTF(); } + // read in wifiApInactivityTimeout if bytes are available from in + if (in.available() != 0) { + config.wifiApInactivityTimeout = in.readLong(); + } } catch (IOException e) { Log.e(TAG, "Error reading hotspot configuration " + e); config = null; @@ -194,6 +198,7 @@ public class WifiApConfigStore { if (authType != KeyMgmt.NONE) { out.writeUTF(config.preSharedKey); } + out.writeLong(config.wifiApInactivityTimeout); } catch (IOException e) { Log.e(TAG, "Error writing hotspot configuration" + e); } @@ -219,6 +224,7 @@ public class WifiApConfigStore { //first 12 chars from xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx config.preSharedKey = randomUUID.substring(0, 8) + randomUUID.substring(9,13); } + config.wifiApInactivityTimeout = 0; return config; } } |