OSDN Git Service

am 4fedc0fd: (-s ours) Import translations. DO NOT MERGE
[android-x86/packages-apps-Settings.git] / src / com / android / settings / HotspotOffReceiver.java
1
2 package com.android.settings;
3
4 import android.content.BroadcastReceiver;
5 import android.content.Context;
6 import android.content.Intent;
7 import android.net.wifi.WifiManager;
8
9 /**
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.
12  */
13 public class HotspotOffReceiver extends BroadcastReceiver {
14
15     @Override
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);
22             }
23         }
24     }
25 }