2 package com.android.settings;
4 import android.content.BroadcastReceiver;
5 import android.content.Context;
6 import android.content.Intent;
7 import android.net.wifi.WifiManager;
10 * This receiver catches when quick settings turns off the hotspot, so we can
11 * cancel the alarm in that case. All other cancels are handled in tethersettings.
13 public class HotspotOffReceiver extends BroadcastReceiver {
16 public void onReceive(Context context, Intent intent) {
17 if (WifiManager.WIFI_AP_STATE_CHANGED_ACTION.equals(intent.getAction())) {
18 WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
19 if (wifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_DISABLED) {
20 // The hotspot has been turned off, we don't need to recheck tethering.
21 TetherService.cancelRecheckAlarmIfNecessary(context, TetherSettings.WIFI_TETHERING);