1 /**
2  * Copyright (c) 2008, 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 android.net.wifi;
18 
19 import android.content.pm.ParceledListSlice;
20 
21 import android.net.wifi.hotspot2.OsuProvider;
22 import android.net.wifi.hotspot2.PasspointConfiguration;
23 import android.net.wifi.hotspot2.IProvisioningCallback;
24 
25 import android.net.DhcpInfo;
26 import android.net.Network;
27 import android.net.wifi.IActionListener;
28 import android.net.wifi.IDppCallback;
29 import android.net.wifi.ILocalOnlyHotspotCallback;
30 import android.net.wifi.INetworkRequestMatchCallback;
31 import android.net.wifi.IOnWifiActivityEnergyInfoListener;
32 import android.net.wifi.IOnWifiUsabilityStatsListener;
33 import android.net.wifi.IScanResultsCallback;
34 import android.net.wifi.ISoftApCallback;
35 import android.net.wifi.ISuggestionConnectionStatusListener;
36 import android.net.wifi.ITrafficStateCallback;
37 import android.net.wifi.IWifiConnectedNetworkScorer;
38 import android.net.wifi.ScanResult;
39 import android.net.wifi.SoftApConfiguration;
40 import android.net.wifi.WifiConfiguration;
41 import android.net.wifi.WifiInfo;
42 import android.net.wifi.WifiNetworkSuggestion;
43 
44 import android.os.Messenger;
45 import android.os.ResultReceiver;
46 import android.os.WorkSource;
47 
48 /**
49  * Interface that allows controlling and querying Wi-Fi connectivity.
50  *
51  * {@hide}
52  */
53 interface IWifiManager
54 {
getSupportedFeatures()55     long getSupportedFeatures();
56 
getWifiActivityEnergyInfoAsync(in IOnWifiActivityEnergyInfoListener listener)57     oneway void getWifiActivityEnergyInfoAsync(in IOnWifiActivityEnergyInfoListener listener);
58 
getConfiguredNetworks(String packageName, String featureId)59     ParceledListSlice getConfiguredNetworks(String packageName, String featureId);
60 
getPrivilegedConfiguredNetworks(String packageName, String featureId)61     ParceledListSlice getPrivilegedConfiguredNetworks(String packageName, String featureId);
62 
getAllMatchingFqdnsForScanResults(in List<ScanResult> scanResult)63     Map getAllMatchingFqdnsForScanResults(in List<ScanResult> scanResult);
64 
getMatchingOsuProviders(in List<ScanResult> scanResult)65     Map getMatchingOsuProviders(in List<ScanResult> scanResult);
66 
getMatchingPasspointConfigsForOsuProviders(in List<OsuProvider> osuProviders)67     Map getMatchingPasspointConfigsForOsuProviders(in List<OsuProvider> osuProviders);
68 
addOrUpdateNetwork(in WifiConfiguration config, String packageName)69     int addOrUpdateNetwork(in WifiConfiguration config, String packageName);
70 
addOrUpdatePasspointConfiguration(in PasspointConfiguration config, String packageName)71     boolean addOrUpdatePasspointConfiguration(in PasspointConfiguration config, String packageName);
72 
removePasspointConfiguration(in String fqdn, String packageName)73     boolean removePasspointConfiguration(in String fqdn, String packageName);
74 
getPasspointConfigurations(in String packageName)75     List<PasspointConfiguration> getPasspointConfigurations(in String packageName);
76 
getWifiConfigsForPasspointProfiles(in List<String> fqdnList)77     List<WifiConfiguration> getWifiConfigsForPasspointProfiles(in List<String> fqdnList);
78 
queryPasspointIcon(long bssid, String fileName)79     void queryPasspointIcon(long bssid, String fileName);
80 
matchProviderWithCurrentNetwork(String fqdn)81     int matchProviderWithCurrentNetwork(String fqdn);
82 
deauthenticateNetwork(long holdoff, boolean ess)83     void deauthenticateNetwork(long holdoff, boolean ess);
84 
removeNetwork(int netId, String packageName)85     boolean removeNetwork(int netId, String packageName);
86 
enableNetwork(int netId, boolean disableOthers, String packageName)87     boolean enableNetwork(int netId, boolean disableOthers, String packageName);
88 
disableNetwork(int netId, String packageName)89     boolean disableNetwork(int netId, String packageName);
90 
allowAutojoinGlobal(boolean choice)91     void allowAutojoinGlobal(boolean choice);
92 
allowAutojoin(int netId, boolean choice)93     void allowAutojoin(int netId, boolean choice);
94 
allowAutojoinPasspoint(String fqdn, boolean enableAutoJoin)95     void allowAutojoinPasspoint(String fqdn, boolean enableAutoJoin);
96 
setMacRandomizationSettingPasspointEnabled(String fqdn, boolean enable)97     void setMacRandomizationSettingPasspointEnabled(String fqdn, boolean enable);
98 
setPasspointMeteredOverride(String fqdn, int meteredOverride)99     void setPasspointMeteredOverride(String fqdn, int meteredOverride);
100 
startScan(String packageName, String featureId)101     boolean startScan(String packageName, String featureId);
102 
getScanResults(String callingPackage, String callingFeatureId)103     List<ScanResult> getScanResults(String callingPackage, String callingFeatureId);
104 
disconnect(String packageName)105     boolean disconnect(String packageName);
106 
reconnect(String packageName)107     boolean reconnect(String packageName);
108 
reassociate(String packageName)109     boolean reassociate(String packageName);
110 
getConnectionInfo(String callingPackage, String callingFeatureId)111     WifiInfo getConnectionInfo(String callingPackage, String callingFeatureId);
112 
setWifiEnabled(String packageName, boolean enable)113     boolean setWifiEnabled(String packageName, boolean enable);
114 
getWifiEnabledState()115     int getWifiEnabledState();
116 
getCountryCode()117     String getCountryCode();
118 
is5GHzBandSupported()119     boolean is5GHzBandSupported();
120 
is6GHzBandSupported()121     boolean is6GHzBandSupported();
122 
isWifiStandardSupported(int standard)123     boolean isWifiStandardSupported(int standard);
124 
getDhcpInfo()125     DhcpInfo getDhcpInfo();
126 
setScanAlwaysAvailable(boolean isAvailable)127     void setScanAlwaysAvailable(boolean isAvailable);
128 
isScanAlwaysAvailable()129     boolean isScanAlwaysAvailable();
130 
acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws)131     boolean acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws);
132 
updateWifiLockWorkSource(IBinder lock, in WorkSource ws)133     void updateWifiLockWorkSource(IBinder lock, in WorkSource ws);
134 
releaseWifiLock(IBinder lock)135     boolean releaseWifiLock(IBinder lock);
136 
initializeMulticastFiltering()137     void initializeMulticastFiltering();
138 
isMulticastEnabled()139     boolean isMulticastEnabled();
140 
acquireMulticastLock(IBinder binder, String tag)141     void acquireMulticastLock(IBinder binder, String tag);
142 
releaseMulticastLock(String tag)143     void releaseMulticastLock(String tag);
144 
updateInterfaceIpState(String ifaceName, int mode)145     void updateInterfaceIpState(String ifaceName, int mode);
146 
startSoftAp(in WifiConfiguration wifiConfig)147     boolean startSoftAp(in WifiConfiguration wifiConfig);
148 
startTetheredHotspot(in SoftApConfiguration softApConfig)149     boolean startTetheredHotspot(in SoftApConfiguration softApConfig);
150 
stopSoftAp()151     boolean stopSoftAp();
152 
startLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback, String packageName, String featureId, in SoftApConfiguration customConfig)153     int startLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback, String packageName,
154                               String featureId, in SoftApConfiguration customConfig);
155 
stopLocalOnlyHotspot()156     void stopLocalOnlyHotspot();
157 
startWatchLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback)158     void startWatchLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback);
159 
stopWatchLocalOnlyHotspot()160     void stopWatchLocalOnlyHotspot();
161 
162     @UnsupportedAppUsage
getWifiApEnabledState()163     int getWifiApEnabledState();
164 
165     @UnsupportedAppUsage
getWifiApConfiguration()166     WifiConfiguration getWifiApConfiguration();
167 
getSoftApConfiguration()168     SoftApConfiguration getSoftApConfiguration();
169 
setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName)170     boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName);
171 
setSoftApConfiguration(in SoftApConfiguration softApConfig, String packageName)172     boolean setSoftApConfiguration(in SoftApConfiguration softApConfig, String packageName);
173 
notifyUserOfApBandConversion(String packageName)174     void notifyUserOfApBandConversion(String packageName);
175 
enableTdls(String remoteIPAddress, boolean enable)176     void enableTdls(String remoteIPAddress, boolean enable);
177 
enableTdlsWithMacAddress(String remoteMacAddress, boolean enable)178     void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable);
179 
getCurrentNetworkWpsNfcConfigurationToken()180     String getCurrentNetworkWpsNfcConfigurationToken();
181 
enableVerboseLogging(int verbose)182     void enableVerboseLogging(int verbose);
183 
getVerboseLoggingLevel()184     int getVerboseLoggingLevel();
185 
disableEphemeralNetwork(String SSID, String packageName)186     void disableEphemeralNetwork(String SSID, String packageName);
187 
factoryReset(String packageName)188     void factoryReset(String packageName);
189 
190     @UnsupportedAppUsage
getCurrentNetwork()191     Network getCurrentNetwork();
192 
retrieveBackupData()193     byte[] retrieveBackupData();
194 
restoreBackupData(in byte[] data)195     void restoreBackupData(in byte[] data);
196 
retrieveSoftApBackupData()197     byte[] retrieveSoftApBackupData();
198 
restoreSoftApBackupData(in byte[] data)199     SoftApConfiguration restoreSoftApBackupData(in byte[] data);
200 
restoreSupplicantBackupData(in byte[] supplicantData, in byte[] ipConfigData)201     void restoreSupplicantBackupData(in byte[] supplicantData, in byte[] ipConfigData);
202 
startSubscriptionProvisioning(in OsuProvider provider, in IProvisioningCallback callback)203     void startSubscriptionProvisioning(in OsuProvider provider, in IProvisioningCallback callback);
204 
registerSoftApCallback(in IBinder binder, in ISoftApCallback callback, int callbackIdentifier)205     void registerSoftApCallback(in IBinder binder, in ISoftApCallback callback, int callbackIdentifier);
206 
unregisterSoftApCallback(int callbackIdentifier)207     void unregisterSoftApCallback(int callbackIdentifier);
208 
addOnWifiUsabilityStatsListener(in IBinder binder, in IOnWifiUsabilityStatsListener listener, int listenerIdentifier)209     void addOnWifiUsabilityStatsListener(in IBinder binder, in IOnWifiUsabilityStatsListener listener, int listenerIdentifier);
210 
removeOnWifiUsabilityStatsListener(int listenerIdentifier)211     void removeOnWifiUsabilityStatsListener(int listenerIdentifier);
212 
registerTrafficStateCallback(in IBinder binder, in ITrafficStateCallback callback, int callbackIdentifier)213     void registerTrafficStateCallback(in IBinder binder, in ITrafficStateCallback callback, int callbackIdentifier);
214 
unregisterTrafficStateCallback(int callbackIdentifier)215     void unregisterTrafficStateCallback(int callbackIdentifier);
216 
registerNetworkRequestMatchCallback(in IBinder binder, in INetworkRequestMatchCallback callback, int callbackIdentifier)217     void registerNetworkRequestMatchCallback(in IBinder binder, in INetworkRequestMatchCallback callback, int callbackIdentifier);
218 
unregisterNetworkRequestMatchCallback(int callbackIdentifier)219     void unregisterNetworkRequestMatchCallback(int callbackIdentifier);
220 
addNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName, in String featureId)221     int addNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName,
222         in String featureId);
223 
removeNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName)224     int removeNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName);
225 
getNetworkSuggestions(in String packageName)226     List<WifiNetworkSuggestion> getNetworkSuggestions(in String packageName);
227 
getFactoryMacAddresses()228     String[] getFactoryMacAddresses();
229 
setDeviceMobilityState(int state)230     void setDeviceMobilityState(int state);
231 
startDppAsConfiguratorInitiator(in IBinder binder, in String enrolleeUri, int selectedNetworkId, int netRole, in IDppCallback callback)232     void startDppAsConfiguratorInitiator(in IBinder binder, in String enrolleeUri,
233         int selectedNetworkId, int netRole, in IDppCallback callback);
234 
startDppAsEnrolleeInitiator(in IBinder binder, in String configuratorUri, in IDppCallback callback)235     void startDppAsEnrolleeInitiator(in IBinder binder, in String configuratorUri,
236         in IDppCallback callback);
237 
stopDppSession()238     void stopDppSession();
239 
updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec)240     void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec);
241 
connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier)242     oneway void connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);
243 
save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier)244     oneway void save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier);
245 
forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier)246     oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);
247 
registerScanResultsCallback(in IScanResultsCallback callback)248     void registerScanResultsCallback(in IScanResultsCallback callback);
249 
unregisterScanResultsCallback(in IScanResultsCallback callback)250     void unregisterScanResultsCallback(in IScanResultsCallback callback);
251 
registerSuggestionConnectionStatusListener(in IBinder binder, in ISuggestionConnectionStatusListener listener, int listenerIdentifier, String packageName, String featureId)252     void registerSuggestionConnectionStatusListener(in IBinder binder, in ISuggestionConnectionStatusListener listener, int listenerIdentifier, String packageName, String featureId);
253 
unregisterSuggestionConnectionStatusListener(int listenerIdentifier, String packageName)254     void unregisterSuggestionConnectionStatusListener(int listenerIdentifier, String packageName);
255 
calculateSignalLevel(int rssi)256     int calculateSignalLevel(int rssi);
257 
getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(in List<ScanResult> scanResults)258     List<WifiConfiguration> getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(in List<ScanResult> scanResults);
259 
setWifiConnectedNetworkScorer(in IBinder binder, in IWifiConnectedNetworkScorer scorer)260     boolean setWifiConnectedNetworkScorer(in IBinder binder, in IWifiConnectedNetworkScorer scorer);
261 
clearWifiConnectedNetworkScorer()262     void clearWifiConnectedNetworkScorer();
263 
264     /**
265      * Return the Map of {@link WifiNetworkSuggestion} and the list of <ScanResult>
266      */
getMatchingScanResults(in List<WifiNetworkSuggestion> networkSuggestions, in List<ScanResult> scanResults, String callingPackage, String callingFeatureId)267     Map getMatchingScanResults(in List<WifiNetworkSuggestion> networkSuggestions, in List<ScanResult> scanResults, String callingPackage, String callingFeatureId);
268 
setScanThrottleEnabled(boolean enable)269     void setScanThrottleEnabled(boolean enable);
270 
isScanThrottleEnabled()271     boolean isScanThrottleEnabled();
272 
getAllMatchingPasspointProfilesForScanResults(in List<ScanResult> scanResult)273     Map getAllMatchingPasspointProfilesForScanResults(in List<ScanResult> scanResult);
274 
setAutoWakeupEnabled(boolean enable)275     void setAutoWakeupEnabled(boolean enable);
276 
isAutoWakeupEnabled()277     boolean isAutoWakeupEnabled();
278 }
279