自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
WifiHelper
public
class
WifiHelper
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.device.WifiHelper
|
用於在裝置上操控 Wi-Fi 服務的輔助類別。
摘要
公用建構函式 |
WifiHelper(ITestDevice device)
|
WifiHelper(ITestDevice device, String wifiUtilApkPath)
|
WifiHelper(ITestDevice device, String wifiUtilApkPath, boolean doSetup)
可略過 Wi-Fi APK 設定的替代建構函式。
|
公用方法 |
boolean
|
addOpenNetwork(String ssid)
|
boolean
|
addOpenNetwork(String ssid, boolean scanSsid)
|
boolean
|
addWpaPskNetwork(String ssid, String psk)
|
boolean
|
addWpaPskNetwork(String ssid, String psk, boolean scanSsid)
|
boolean
|
checkConnectivity(String urlToCheck)
|
void
|
cleanUp()
|
boolean
|
connectToNetwork(String ssid, String psk, String urlToCheck)
|
boolean
|
connectToNetwork(String ssid, String psk, String urlToCheck, boolean scanSsid)
|
boolean
|
disableWifi()
|
boolean
|
disconnectFromNetwork()
|
boolean
|
enableWifi()
|
static
File
|
extractWifiUtilApk()
輔助方法,可從類別路徑中擷取 wifi util apk
|
String
|
getBSSID()
|
String
|
getIpAddress()
|
String
|
getSSID()
|
|
getWifiInfo()
|
boolean
|
hasValidIp()
|
boolean
|
isWifiEnabled()
|
boolean
|
removeAllNetworks()
|
boolean
|
startMonitor(long interval, String urlToCheck)
|
|
stopMonitor()
|
boolean
|
waitForIp(long timeout)
|
boolean
|
waitForWifiDisabled(long timeout)
|
boolean
|
waitForWifiDisabled()
|
boolean
|
waitForWifiEnabled(long timeout)
|
boolean
|
waitForWifiEnabled()
|
boolean
|
waitForWifiState(WifiState... expectedStates)
|
欄位
INSTRUMENTATION_PKG
public static final String INSTRUMENTATION_PKG
公用建構函式
WifiHelper
public WifiHelper (ITestDevice device)
擲回 |
DeviceNotAvailableException |
|
WifiHelper
public WifiHelper (ITestDevice device,
String wifiUtilApkPath)
參數 |
device |
ITestDevice |
wifiUtilApkPath |
String |
擲回 |
DeviceNotAvailableException |
|
WifiHelper
public WifiHelper (ITestDevice device,
String wifiUtilApkPath,
boolean doSetup)
可略過 Wi-Fi APK 設定的替代建構函式。
參數 |
device |
ITestDevice |
wifiUtilApkPath |
String |
doSetup |
boolean |
擲回 |
DeviceNotAvailableException |
|
公用方法
addOpenNetwork
public boolean addOpenNetwork (String ssid)
擲回 |
DeviceNotAvailableException |
|
addOpenNetwork
public boolean addOpenNetwork (String ssid,
boolean scanSsid)
參數 |
ssid |
String |
scanSsid |
boolean |
擲回 |
DeviceNotAvailableException |
|
addWpaPskNetwork
public boolean addWpaPskNetwork (String ssid,
String psk)
參數 |
ssid |
String |
psk |
String |
擲回 |
DeviceNotAvailableException |
|
addWpaPskNetwork
public boolean addWpaPskNetwork (String ssid,
String psk,
boolean scanSsid)
參數 |
ssid |
String |
psk |
String |
scanSsid |
boolean |
擲回 |
DeviceNotAvailableException |
|
checkConnectivity
public boolean checkConnectivity (String urlToCheck)
擲回 |
DeviceNotAvailableException |
|
cleanUp
public void cleanUp ()
擲回 |
DeviceNotAvailableException |
|
connectToNetwork
public boolean connectToNetwork (String ssid,
String psk,
String urlToCheck)
參數 |
ssid |
String |
psk |
String |
urlToCheck |
String |
擲回 |
DeviceNotAvailableException |
|
connectToNetwork
public boolean connectToNetwork (String ssid,
String psk,
String urlToCheck,
boolean scanSsid)
參數 |
ssid |
String |
psk |
String |
urlToCheck |
String |
scanSsid |
boolean |
擲回 |
DeviceNotAvailableException |
|
disableWifi
public boolean disableWifi ()
擲回 |
DeviceNotAvailableException |
|
disconnectFromNetwork
public boolean disconnectFromNetwork ()
擲回 |
DeviceNotAvailableException |
|
enableWifi
public boolean enableWifi ()
擲回 |
DeviceNotAvailableException |
|
public static File extractWifiUtilApk ()
輔助方法,可從 classpath 中擷取 wifi util apk
getBSSID
public String getBSSID ()
擲回 |
DeviceNotAvailableException |
|
getIpAddress
public String getIpAddress ()
擲回 |
DeviceNotAvailableException |
|
getSSID
public String getSSID ()
擲回 |
DeviceNotAvailableException |
|
getWifiInfo
public getWifiInfo ()
擲回 |
DeviceNotAvailableException |
|
hasValidIp
public boolean hasValidIp ()
擲回 |
DeviceNotAvailableException |
|
isWifiEnabled
public boolean isWifiEnabled ()
擲回 |
DeviceNotAvailableException |
|
removeAllNetworks
public boolean removeAllNetworks ()
擲回 |
DeviceNotAvailableException |
|
startMonitor
public boolean startMonitor (long interval,
String urlToCheck)
參數 |
interval |
long |
urlToCheck |
String |
擲回 |
DeviceNotAvailableException |
|
stopMonitor
public stopMonitor ()
擲回 |
DeviceNotAvailableException |
|
waitForIp
public boolean waitForIp (long timeout)
擲回 |
DeviceNotAvailableException |
|
waitForWifiDisabled
public boolean waitForWifiDisabled (long timeout)
擲回 |
DeviceNotAvailableException |
|
waitForWifiDisabled
public boolean waitForWifiDisabled ()
擲回 |
DeviceNotAvailableException |
|
waitForWifiEnabled
public boolean waitForWifiEnabled (long timeout)
擲回 |
DeviceNotAvailableException |
|
waitForWifiEnabled
public boolean waitForWifiEnabled ()
擲回 |
DeviceNotAvailableException |
|
waitForWifiState
public boolean waitForWifiState (WifiState... expectedStates)
參數 |
expectedStates |
WifiState |
擲回 |
DeviceNotAvailableException |
|
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-03-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-03-26 (世界標準時間)。"],[],[]]