diff options
author | Jason Monk <jmonk@google.com> | 2014-12-10 17:21:51 -0500 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2014-12-11 15:07:45 -0500 |
commit | 37832d661a164c63d8c50c70619a4159376baaf3 (patch) | |
tree | f03bae9d7363d79fd5b4a7536cc62f66774afe6c /src/com/android/settings/HotspotOffReceiver.java | |
parent | f84c6ee01c09b25d78c48cdf6bde5be4e334758c (diff) | |
download | packages_apps_Settings-37832d661a164c63d8c50c70619a4159376baaf3.tar.gz packages_apps_Settings-37832d661a164c63d8c50c70619a4159376baaf3.tar.bz2 packages_apps_Settings-37832d661a164c63d8c50c70619a4159376baaf3.zip |
Add a periodic check of the tethering provisioning
Add a service that handles the check through broadcasts which are
defined through configs, similar to the previous configs for the
activity.
Depends on I1f6e2d954562c5a16a0de60dac625005ec3e5c50
Bug: 18453076
Change-Id: I515d72706e9ca37877e67c44427af1b75b146390
Diffstat (limited to 'src/com/android/settings/HotspotOffReceiver.java')
-rw-r--r-- | src/com/android/settings/HotspotOffReceiver.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/settings/HotspotOffReceiver.java b/src/com/android/settings/HotspotOffReceiver.java new file mode 100644 index 000000000..3ab3f9d8e --- /dev/null +++ b/src/com/android/settings/HotspotOffReceiver.java @@ -0,0 +1,25 @@ + +package com.android.settings; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.wifi.WifiManager; + +/** + * This receiver catches when quick settings turns off the hotspot, so we can + * cancel the alarm in that case. All other cancels are handled in tethersettings. + */ +public class HotspotOffReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + if (WifiManager.WIFI_AP_STATE_CHANGED_ACTION.equals(intent.getAction())) { + WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + if (wifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_DISABLED) { + // The hotspot has been turned off, we don't need to recheck tethering. + TetherService.cancelRecheckAlarmIfNecessary(context, TetherSettings.WIFI_TETHERING); + } + } + } +} |