Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
WifiHelper
public
class
WifiHelper
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.device.WifiHelper
|
Lớp trợ giúp để thao tác với các dịch vụ Wi-Fi trên thiết bị.
Tóm tắt
Phương thức công khai |
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)
|
IWifiHelper.WifiConnectionResult
|
connectToNetwork(String ssid, String psk, String urlToCheck, boolean scanSsid, String defaultType)
|
IWifiHelper.WifiConnectionResult
|
connectToNetwork(String ssid, String psk, String urlToCheck, boolean scanSsid)
|
boolean
|
disableWifi()
|
boolean
|
disconnectFromNetwork()
|
boolean
|
enableWifi()
|
static
File
|
extractWifiUtilApk()
Phương thức trợ giúp để trích xuất tệp apk util wifi từ đường dẫn lớp
|
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)
|
Trường
INSTRUMENTATION_PKG
public static final String INSTRUMENTATION_PKG
Hàm khởi tạo công khai
WifiHelper
public WifiHelper (ITestDevice device)
Tham số |
device |
ITestDevice |
WifiHelper
public WifiHelper (ITestDevice device,
String wifiUtilApkPath)
Tham số |
device |
ITestDevice |
wifiUtilApkPath |
String |
WifiHelper
public WifiHelper (ITestDevice device,
String wifiUtilApkPath,
boolean doSetup)
Hàm khởi tạo thay thế có thể bỏ qua bước thiết lập apk wifi.
Tham số |
device |
ITestDevice |
wifiUtilApkPath |
String |
doSetup |
boolean |
WifiHelper
public WifiHelper (ITestDevice device,
String wifiUtilApkPath,
boolean doSetup,
boolean useV2)
Hàm khởi tạo để chỉ định xem có sử dụng trình trợ giúp wifi mới v2 hay không. Các thao tác v2 không cần cài đặt wifi util apk.
Tham số |
device |
ITestDevice |
wifiUtilApkPath |
String |
doSetup |
boolean |
useV2 |
boolean |
Phương thức công khai
addOpenNetwork
public boolean addOpenNetwork (String ssid)
addOpenNetwork
public boolean addOpenNetwork (String ssid,
boolean scanSsid)
Tham số |
ssid |
String |
scanSsid |
boolean |
addWpaPskNetwork
public boolean addWpaPskNetwork (String ssid,
String psk)
Tham số |
ssid |
String |
psk |
String |
addWpaPskNetwork
public boolean addWpaPskNetwork (String ssid,
String psk,
boolean scanSsid)
Tham số |
ssid |
String |
psk |
String |
scanSsid |
boolean |
checkConnectivity
public boolean checkConnectivity (String urlToCheck)
Tham số |
urlToCheck |
String |
cleanUp
public void cleanUp ()
connectToNetwork
public boolean connectToNetwork (String ssid,
String psk,
String urlToCheck)
Tham số |
ssid |
String |
psk |
String |
urlToCheck |
String |
connectToNetwork
public IWifiHelper.WifiConnectionResult connectToNetwork (String ssid,
String psk,
String urlToCheck,
boolean scanSsid,
String defaultType)
Tham số |
ssid |
String |
psk |
String |
urlToCheck |
String |
scanSsid |
boolean |
defaultType |
String |
Giá trị trả về |
IWifiHelper.WifiConnectionResult |
|
connectToNetwork
public IWifiHelper.WifiConnectionResult connectToNetwork (String ssid,
String psk,
String urlToCheck,
boolean scanSsid)
Tham số |
ssid |
String |
psk |
String |
urlToCheck |
String |
scanSsid |
boolean |
Giá trị trả về |
IWifiHelper.WifiConnectionResult |
|
disableWifi
public boolean disableWifi ()
disconnectFromNetwork
public boolean disconnectFromNetwork ()
enableWifi
public boolean enableWifi ()
public static File extractWifiUtilApk ()
Phương thức trợ giúp để trích xuất tệp apk util wifi từ đường dẫn lớp
getBSSID
public String getBSSID ()
getIpAddress
public String getIpAddress ()
getSSID
public String getSSID ()
getWifiInfo
public getWifiInfo ()
hasValidIp
public boolean hasValidIp ()
isWifiEnabled
public boolean isWifiEnabled ()
removeAllNetworks
public boolean removeAllNetworks ()
startMonitor
public boolean startMonitor (long interval,
String urlToCheck)
Tham số |
interval |
long |
urlToCheck |
String |
stopMonitor
public stopMonitor ()
waitForIp
public boolean waitForIp (long timeout)
waitForWifiDisabled
public boolean waitForWifiDisabled (long timeout)
waitForWifiDisabled
public boolean waitForWifiDisabled ()
waitForWifiEnabled
public boolean waitForWifiEnabled (long timeout)
waitForWifiEnabled
public boolean waitForWifiEnabled ()
waitForWifiState
public boolean waitForWifiState (WifiState... expectedStates)
Tham số |
expectedStates |
WifiState |
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-03-26 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-03-26 UTC."],[],[]]