Thiết lập thiết bị
public class DeviceSetup
extends BaseTargetPreparer
implements IExternalDependency
java.lang.Object | ||
↳ | com.android.tradefed.targetprep.BaseTargetPreparer | |
↳ | com.android.tradefed.targetprep.DeviceSetup |
ITargetPreparer
định cấu hình thiết bị để thử nghiệm dựa trên Option
được cung cấp.
Yêu cầu một thiết bị có thể 'root adb', thường là loại bản dựng userdebug.
Nên được thực hiện sau khi bản dựng mới được flash.
Lưu ý: trình chuẩn bị này dành cho các phòng thí nghiệm thử nghiệm liên tục và giả định rằng thiết bị được thử nghiệm sẽ được flash và xóa sạch trước lần chạy tiếp theo. Do đó, nó chỉ dọn dẹp ở mức tối thiểu trong quá trình tháo dỡ và không nên sử dụng trong mô-đun thử nghiệm.
Bản tóm tắt
Nhà thầu xây dựng công cộng | |
---|---|
DeviceSetup () |
Phương pháp công cộng | |
---|---|
void | changeSettings ( ITestDevice device) Thay đổi cài đặt trên thiết bị. |
getDependencies () | |
ITestDevice | getDevice ( TestInformation testInfo) |
boolean | isForceSkipSystemProps () |
void | processDeprecatedOptions ( ITestDevice device) Xử lý các tùy chọn không được dùng nữa, chuyển đổi chúng thành các tùy chọn hiện đang được sử dụng. |
void | processOptions ( ITestDevice device) Xử lý tất cả các |
static void | setCommandForBinaryState ( BinaryState state, commands, String onCommand, String offCommand) setCommandForBinaryState ( BinaryState state, commands, String onCommand, String offCommand) Phương thức trợ giúp để thêm lệnh chạy BẬT/TẮT để thực thi trên thiết bị. |
void | setGlobalSetting (String key, String value) Tiếp xúc để thử nghiệm đơn vị |
void | setSecureSetting (String key, String value) Tiếp xúc để thử nghiệm đơn vị |
static void | setSettingForBinaryState ( BinaryState state, MultiMap <String, String> settingsMap, String setting, String onValue, String offValue) Phương pháp trợ giúp để thêm cài đặt BẬT/TẮT vào sơ đồ cài đặt. |
void | setSystemSetting (String key, String value) Tiếp xúc để thử nghiệm đơn vị |
void | setUp ( TestInformation testInfo) |
void | tearDown ( TestInformation testInfo, Throwable e)
|
Phương pháp được bảo vệ | |
---|---|
void | setAirplaneMode ( BinaryState airplaneMode) Tiếp xúc để thử nghiệm đơn vị |
void | setAutoRotate ( BinaryState autoRotate) Tiếp xúc để thử nghiệm đơn vị |
void | setAutoUpdateTime ( BinaryState autoUpdateTime) Tiếp xúc để thử nghiệm đơn vị |
void | setAutoUpdateTimezone ( BinaryState autoUpdateTimezone) Tiếp xúc để thử nghiệm đơn vị |
void | setBatterySaver ( BinaryState batterySaver) Tiếp xúc để thử nghiệm đơn vị |
void | setBatterySaverTrigger (Integer batterySaverTrigger) Tiếp xúc để thử nghiệm đơn vị |
void | setBluetooth ( BinaryState bluetooth) Tiếp xúc để thử nghiệm đơn vị |
void | setCell ( BinaryState cell) |
void | setCellAutoSetting ( BinaryState cellAutoSetting) |
void | setData ( BinaryState data) |
void | setDefaultSimData (Integer defaultSimData) Tiếp xúc để thử nghiệm đơn vị |
void | setDefaultSimSms (Integer defaultSimSms) Tiếp xúc để thử nghiệm đơn vị |
void | setDefaultSimVoice (Integer defaultSimVoice) Tiếp xúc để thử nghiệm đơn vị |
void | setDeprecatedAudioSilent (boolean silent) Phương pháp này không được dùng nữa. thay vào đó hãy sử dụng |
void | setDeprecatedMinExternalStoreSpace (long storeSpace) Phương pháp này không được dùng nữa. thay vào đó hãy sử dụng |
void | setDeprecatedSetProp (String prop) Phương pháp này không được dùng nữa. thay vào đó hãy sử dụng |
void | setDisableAudio (boolean disable) Tiếp xúc để thử nghiệm đơn vị |
void | setDisableCwWifiMediator ( BinaryState disableCwWifiMediator) |
void | setDisableDalvikVerifier (boolean disableDalvikVerifier) Tiếp xúc để thử nghiệm đơn vị |
void | setDisableDialing (boolean disableDialing) Tiếp xúc để thử nghiệm đơn vị |
void | setDisableDoze (boolean disableDoze) Tiếp xúc để thử nghiệm đơn vị |
void | setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory) Tiếp xúc để thử nghiệm đơn vị |
void | setEthernet ( BinaryState ethernet) Tiếp xúc để thử nghiệm đơn vị |
void | setForceSkipSystemProps (boolean force) Tiếp xúc để thử nghiệm đơn vị |
void | setInstallNonMarketApps ( BinaryState installNonMarketApps) Tiếp xúc để thử nghiệm đơn vị |
void | setLocalDataPath (File path) Tiếp xúc để thử nghiệm đơn vị |
void | setLocationGps ( BinaryState locationGps) Tiếp xúc để thử nghiệm đơn vị |
void | setLocationNetwork ( BinaryState locationNetwork) Tiếp xúc để thử nghiệm đơn vị |
void | setMinExternalStorageKb (long storageKb) Tiếp xúc để thử nghiệm đơn vị |
void | setNfc ( BinaryState nfc) Tiếp xúc để thử nghiệm đơn vị |
void | setNotificationLed ( BinaryState notificationLed) Tiếp xúc để thử nghiệm đơn vị |
void | setProperty (String key, String value) Tiếp xúc để thử nghiệm đơn vị |
void | setRestoreProperties (boolean restoreProperties) Tiếp xúc để thử nghiệm đơn vị |
void | setRestoreSettings (boolean restoreSettings) Tiếp xúc để thử nghiệm đơn vị |
void | setScreenAdaptiveBrightness ( BinaryState screenAdaptiveBrightness) Tiếp xúc để thử nghiệm đơn vị |
void | setScreenAlwaysOn ( BinaryState screenAlwaysOn) Tiếp xúc để thử nghiệm đơn vị |
void | setScreenAmbientMode ( BinaryState screenAmbientMode) Tiếp xúc để thử nghiệm đơn vị |
void | setScreenBrightness (Integer screenBrightness) Tiếp xúc để thử nghiệm đơn vị |
void | setScreenSaver ( BinaryState screenSaver) Tiếp xúc để thử nghiệm đơn vị |
void | setScreenTimeoutSecs (Long screenTimeoutSecs) Tiếp xúc để thử nghiệm đơn vị |
void | setTestHarness (boolean setTestHarness) Tiếp xúc để thử nghiệm đơn vị |
void | setTimezone (String timezone) Tiếp xúc để thử nghiệm đơn vị |
void | setTriggerMediaMounted (boolean triggerMediaMounted) Tiếp xúc để thử nghiệm đơn vị |
void | setWakeGesture ( BinaryState wakeGesture) Tiếp xúc để thử nghiệm đơn vị |
void | setWifi ( BinaryState wifi) Tiếp xúc để thử nghiệm đơn vị |
void | setWifiNetwork (String wifiNetwork) Tiếp xúc để thử nghiệm đơn vị |
void | setWifiPsk (String wifiPsk) |
void | setWifiScanAlwaysEnabled ( BinaryState wifiScanAlwaysEnabled) Tiếp xúc để thử nghiệm đơn vị |
void | setWifiSsidToPsk ( wifiSssidToPsk) setWifiSsidToPsk ( wifiSssidToPsk) |
void | setWifiWatchdog ( BinaryState wifiWatchdog) Tiếp xúc để thử nghiệm đơn vị |
Lĩnh vực
mBatterySaverTrigger
protected Integer mBatterySaverTrigger
mBluetooth
protected BinaryState mBluetooth
mCellAutoSetting
protected BinaryState mCellAutoSetting
mDefaultSimData
protected Integer mDefaultSimData
mDefaultSimSms
protected Integer mDefaultSimSms
mDefaultSimVoice
protected Integer mDefaultSimVoice
mDisableAudio
protected boolean mDisableAudio
mDisableDalvikTrình xác minh
protected boolean mDisableDalvikVerifier
mDisableDialing
protected boolean mDisableDialing
mDisableDoze
protected boolean mDisableDoze
mEnableFullBatteryStatsLịch sử
protected boolean mEnableFullBatteryStatsHistory
mForceSkipRunLệnh
protected boolean mForceSkipRunCommands
mForceSkipCài đặt
protected boolean mForceSkipSettings
mForceSkipSystemProps
protected boolean mForceSkipSystemProps
mLocalDataFile
protected File mLocalDataFile
mMinExternalStorageKb
protected long mMinExternalStorageKb
mOptimizedPropertySetting
protected boolean mOptimizedPropertySetting
mPreviousProperties
protected File mPreviousProperties
mRemoteDataPath
protected String mRemoteDataPath
mRestoreProperties
protected boolean mRestoreProperties
mRestoreSettings
protected boolean mRestoreSettings
mRunCommandAfterSettings
protectedmRunCommandAfterSettings
mRunCommandBeforeSettings
protectedmRunCommandBeforeSettings
mScreenBrightness
protected Integer mScreenBrightness
mScreenTimeoutGiây
protected Long mScreenTimeoutSecs
mSetProps
protectedmSetProps
mSetTestHarness
protected boolean mSetTestHarness
mMúi giờ
protected String mTimezone
mTriggerMediaMounted
protected boolean mTriggerMediaMounted
mWakeGesture
protected BinaryState mWakeGesture
mWifiPsk
protected String mWifiPsk
mWifiSsid
protected String mWifiSsid
mWifiSsidToPsk
protectedmWifiSsidToPsk
Nhà thầu xây dựng công cộng
Thiết lập thiết bị
public DeviceSetup ()
Phương pháp công cộng
thay đổi cài đặt
public void changeSettings (ITestDevice device)
Thay đổi cài đặt trên thiết bị.
Tiếp xúc để các lớp trẻ em có thể ghi đè.
Thông số | |
---|---|
device | ITestDevice : Thiết ITestDevice |
Ném | |
---|---|
DeviceNotAvailableException | nếu thiết bị không có sẵn |
TargetSetupError | nếu có lỗi cài đặt cài đặt |
nhận được sự phụ thuộc
publicgetDependencies ()
Trả lại | |
---|---|
lấy thiết bị
public ITestDevice getDevice (TestInformation testInfo)
Thông số | |
---|---|
testInfo | TestInformation |
Trả lại | |
---|---|
ITestDevice |
isForceSkipSystemProps
public boolean isForceSkipSystemProps ()
Trả lại | |
---|---|
boolean |
quá trìnhTùy chọn không dùng nữa
public void processDeprecatedOptions (ITestDevice device)
Xử lý các tùy chọn không được dùng nữa, chuyển đổi chúng thành các tùy chọn hiện đang được sử dụng.
Phương pháp này nên được chạy trước bất kỳ phương pháp xử lý nào khác. Sẽ đưa ra TargetSetupError
nếu tùy chọn không dùng nữa ghi đè tùy chọn không dùng nữa được chỉ định.
Thông số | |
---|---|
device | ITestDevice |
Ném | |
---|---|
TargetSetupError | nếu có xung đột |
quá trìnhTùy chọn
public void processOptions (ITestDevice device)
Xử lý tất cả các Option
và biến chúng thành đạo cụ hệ thống, cài đặt hoặc lệnh chạy. Không chạy bất kỳ lệnh nào trên thiết bị tại thời điểm này.
Tiếp xúc để các lớp trẻ em có thể ghi đè lên điều này.
Thông số | |
---|---|
device | ITestDevice : Thiết ITestDevice |
Ném | |
---|---|
DeviceNotAvailableException | nếu thiết bị không có sẵn |
TargetSetupError | nếu xung đột của Option |
setCommandForBinaryState
public static void setCommandForBinaryState (BinaryState state,commands, String onCommand, String offCommand)
Phương thức trợ giúp để thêm lệnh chạy BẬT/TẮT để thực thi trên thiết bị.
Thông số | |
---|---|
state | BinaryState : BinaryState |
commands | |
onCommand | String : Lệnh chạy nếu BẬT. Bỏ qua nếu lệnh là null |
offCommand | String : Lệnh chạy nếu TẮT. Bỏ qua nếu lệnh là null |
setGlobalSetting
public void setGlobalSetting (String key, String value)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
key | String |
value | String |
setSecureSetting
public void setSecureSetting (String key, String value)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
key | String |
value | String |
setSettingForBinaryState
public static void setSettingForBinaryState (BinaryState state, MultiMap<String, String> settingsMap, String setting, String onValue, String offValue)
Phương pháp trợ giúp để thêm cài đặt BẬT/TẮT vào sơ đồ cài đặt.
Thông số | |
---|---|
state | BinaryState : BinaryState |
settingsMap | MultiMap : MultiMap được sử dụng để lưu trữ các cài đặt. |
setting | String : Phím cài đặt |
onValue | String : Giá trị nếu BẬT |
offValue | String : Giá trị nếu TẮT |
setSystemSetting
public void setSystemSetting (String key, String value)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
key | String |
value | String |
cài đặt
public void setUp (TestInformation testInfo)
Thông số | |
---|---|
testInfo | TestInformation |
Ném | |
---|---|
BuildError | |
DeviceNotAvailableException | |
TargetSetupError |
phá bỏ
public void tearDown (TestInformation testInfo, Throwable e)
Thông số | |
---|---|
testInfo | TestInformation |
e | Throwable |
Ném | |
---|---|
DeviceNotAvailableException |
Phương pháp được bảo vệ
bộChế độ máy bay
protected void setAirplaneMode (BinaryState airplaneMode)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
airplaneMode | BinaryState |
setAutoRotate
protected void setAutoRotate (BinaryState autoRotate)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
autoRotate | BinaryState |
setAutoUpdateTime
protected void setAutoUpdateTime (BinaryState autoUpdateTime)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
autoUpdateTime | BinaryState |
setAutoUpdateMúi giờ
protected void setAutoUpdateTimezone (BinaryState autoUpdateTimezone)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
autoUpdateTimezone | BinaryState |
bộTiết kiệm pin
protected void setBatterySaver (BinaryState batterySaver)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
batterySaver | BinaryState |
setBatterySaverTrigger
protected void setBatterySaverTrigger (Integer batterySaverTrigger)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
batterySaverTrigger | Integer |
đặtBluetooth
protected void setBluetooth (BinaryState bluetooth)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
bluetooth | BinaryState |
setCellAutoSetting
protected void setCellAutoSetting (BinaryState cellAutoSetting)
Thông số | |
---|---|
cellAutoSetting | BinaryState |
setDefaultSimData
protected void setDefaultSimData (Integer defaultSimData)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
defaultSimData | Integer |
setDefaultSimSms
protected void setDefaultSimSms (Integer defaultSimSms)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
defaultSimSms | Integer |
setDefaultSimVoice
protected void setDefaultSimVoice (Integer defaultSimVoice)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
defaultSimVoice | Integer |
setDeprecatedAudioIm lặng
protected void setDeprecatedAudioSilent (boolean silent)
Phương pháp này không được dùng nữa.
thay vào đó hãy sử dụng setDisableAudio(boolean)
.
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
silent | boolean |
setDeprecatedMinExternalStoreSpace
protected void setDeprecatedMinExternalStoreSpace (long storeSpace)
Phương pháp này không được dùng nữa.
thay vào đó hãy sử dụng setMinExternalStorageKb(long)
.
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
storeSpace | long |
setDeprecatedSetProp
protected void setDeprecatedSetProp (String prop)
Phương pháp này không được dùng nữa.
thay vào đó hãy sử dụng setProperty(String, String)
.
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
prop | String |
setDisableAudio
protected void setDisableAudio (boolean disable)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
disable | boolean |
setDisableCwWifiMediator
protected void setDisableCwWifiMediator (BinaryState disableCwWifiMediator)
Thông số | |
---|---|
disableCwWifiMediator | BinaryState |
setDisableDalvikTrình xác minh
protected void setDisableDalvikVerifier (boolean disableDalvikVerifier)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
disableDalvikVerifier | boolean |
setDisableQuay số
protected void setDisableDialing (boolean disableDialing)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
disableDialing | boolean |
setDisableDoze
protected void setDisableDoze (boolean disableDoze)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
disableDoze | boolean |
setEnableFullBatteryStatsHistory
protected void setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
enableFullBatteryStatsHistory | boolean |
bộEthernet
protected void setEthernet (BinaryState ethernet)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
ethernet | BinaryState |
setForceSkipSystemProps
protected void setForceSkipSystemProps (boolean force)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
force | boolean |
setInstallNonMarketApps
protected void setInstallNonMarketApps (BinaryState installNonMarketApps)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
installNonMarketApps | BinaryState |
setLocalDataPath
protected void setLocalDataPath (File path)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
path | File |
setLocationGps
protected void setLocationGps (BinaryState locationGps)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
locationGps | BinaryState |
setLocationMạng
protected void setLocationNetwork (BinaryState locationNetwork)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
locationNetwork | BinaryState |
setMinExternalStorageKb
protected void setMinExternalStorageKb (long storageKb)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
storageKb | long |
setNfc
protected void setNfc (BinaryState nfc)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
nfc | BinaryState |
setNotificationLed
protected void setNotificationLed (BinaryState notificationLed)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
notificationLed | BinaryState |
setProperty
protected void setProperty (String key, String value)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
key | String |
value | String |
setRestoreProperties
protected void setRestoreProperties (boolean restoreProperties)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
restoreProperties | boolean |
setRestoreCài đặt
protected void setRestoreSettings (boolean restoreSettings)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
restoreSettings | boolean |
setScreenAdaptiveBrightness
protected void setScreenAdaptiveBrightness (BinaryState screenAdaptiveBrightness)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
screenAdaptiveBrightness | BinaryState |
setScreenAlwaysOn
protected void setScreenAlwaysOn (BinaryState screenAlwaysOn)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
screenAlwaysOn | BinaryState |
setScreenAmbientMode
protected void setScreenAmbientMode (BinaryState screenAmbientMode)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
screenAmbientMode | BinaryState |
setScreenBrightness
protected void setScreenBrightness (Integer screenBrightness)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
screenBrightness | Integer |
setScreenSaver
protected void setScreenSaver (BinaryState screenSaver)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
screenSaver | BinaryState |
setScreenTimeoutSecs
protected void setScreenTimeoutSecs (Long screenTimeoutSecs)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
screenTimeoutSecs | Long |
setTestKhai thác
protected void setTestHarness (boolean setTestHarness)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
setTestHarness | boolean |
setMúi giờ
protected void setTimezone (String timezone)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
timezone | String |
setTriggerMediaMounted
protected void setTriggerMediaMounted (boolean triggerMediaMounted)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
triggerMediaMounted | boolean |
setWakeGesture
protected void setWakeGesture (BinaryState wakeGesture)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
wakeGesture | BinaryState |
setWifi
protected void setWifi (BinaryState wifi)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
wifi | BinaryState |
setWifiMạng
protected void setWifiNetwork (String wifiNetwork)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
wifiNetwork | String |
setWifiPsk
protected void setWifiPsk (String wifiPsk)
Thông số | |
---|---|
wifiPsk | String |
setWifiScanLuôn được bật
protected void setWifiScanAlwaysEnabled (BinaryState wifiScanAlwaysEnabled)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
wifiScanAlwaysEnabled | BinaryState |
setWifiSsidToPsk
protected void setWifiSsidToPsk (wifiSssidToPsk)
Thông số | |
---|---|
wifiSssidToPsk |
setWifiCơ quan giám sát
protected void setWifiWatchdog (BinaryState wifiWatchdog)
Tiếp xúc để thử nghiệm đơn vị
Thông số | |
---|---|
wifiWatchdog | BinaryState |