1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wifi;
18 
19 import android.net.wifi.WifiContext;
20 import android.os.Looper;
21 import android.provider.Settings;
22 
23 import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
24 import com.android.server.wifi.proto.nano.WifiMetricsProto;
25 import com.android.server.wifi.util.WifiPermissionsUtil;
26 
27 /**
28  * This class handles the "open wi-fi network available" notification
29  *
30  * NOTE: These API's are not thread safe and should only be used from the main Wifi thread.
31  */
32 public class OpenNetworkNotifier extends AvailableNetworkNotifier {
33     public static final String TAG = "WifiOpenNetworkNotifier";
34     private static final String STORE_DATA_IDENTIFIER = "OpenNetworkNotifierBlacklist";
35     private static final String TOGGLE_SETTINGS_NAME =
36             Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
37 
OpenNetworkNotifier( WifiContext context, Looper looper, FrameworkFacade framework, Clock clock, WifiMetrics wifiMetrics, WifiConfigManager wifiConfigManager, WifiConfigStore wifiConfigStore, ConnectHelper connectHelper, ConnectToNetworkNotificationBuilder connectToNetworkNotificationBuilder, MakeBeforeBreakManager makeBeforeBreakManager, WifiNotificationManager wifiNotificationManager, WifiPermissionsUtil wifiPermissionsUtil)38     public OpenNetworkNotifier(
39             WifiContext context,
40             Looper looper,
41             FrameworkFacade framework,
42             Clock clock,
43             WifiMetrics wifiMetrics,
44             WifiConfigManager wifiConfigManager,
45             WifiConfigStore wifiConfigStore,
46             ConnectHelper connectHelper,
47             ConnectToNetworkNotificationBuilder connectToNetworkNotificationBuilder,
48             MakeBeforeBreakManager makeBeforeBreakManager,
49             WifiNotificationManager wifiNotificationManager,
50             WifiPermissionsUtil wifiPermissionsUtil) {
51         super(TAG, STORE_DATA_IDENTIFIER, TOGGLE_SETTINGS_NAME,
52                 SystemMessage.NOTE_NETWORK_AVAILABLE,
53                 WifiMetricsProto.ConnectionEvent.NOMINATOR_OPEN_NETWORK_AVAILABLE,
54                 context, looper, framework, clock,
55                 wifiMetrics, wifiConfigManager, wifiConfigStore, connectHelper,
56                 connectToNetworkNotificationBuilder, makeBeforeBreakManager,
57                 wifiNotificationManager, wifiPermissionsUtil);
58     }
59 }
60