設備設置
public class DeviceSetup
extends BaseTargetPreparer
implements IExternalDependency
java.lang.Object | ||
↳ | com.android.tradefed.targetprep.BaseTargetPreparer | |
↳ | com.android.tradefed.targetprep.DeviceSetup |
一個ITargetPreparer
,根據提供的Option
配置設備進行測試。
需要可以使用“adb root”的設備,通常是 userdebug 構建類型。
應在刷新新版本後執行。
注意:此準備器適用於連續測試實驗室,並假設被測設備將在下次運行之前進行刷新和擦除。因此,它在拆卸過程中進行的清理工作最少,並且不應該在測試模塊中使用。
概括
公共構造函數 | |
---|---|
DeviceSetup () |
公共方法 | |
---|---|
void | changeSettings ( ITestDevice device) 更改設備上的設置。 |
getDependencies () | |
ITestDevice | getDevice ( TestInformation testInfo) |
boolean | isForceSkipSystemProps () |
void | processDeprecatedOptions ( ITestDevice device) 處理已棄用的選項,將其轉換為當前使用的選項。 |
void | processOptions ( ITestDevice device) 處理所有 |
static void | setCommandForBinaryState ( BinaryState state, commands, String onCommand, String offCommand) setCommandForBinaryState ( BinaryState state, commands, String onCommand, String offCommand) 添加要在設備上執行的 ON/OFF 運行命令的幫助程序方法。 |
void | setGlobalSetting (String key, String value) 暴露用於單元測試 |
void | setSecureSetting (String key, String value) 暴露用於單元測試 |
static void | setSettingForBinaryState ( BinaryState state, MultiMap <String, String> settingsMap, String setting, String onValue, String offValue) 將開/關設置添加到設置映射的輔助方法。 |
void | setSystemSetting (String key, String value) 暴露用於單元測試 |
void | setUp ( TestInformation testInfo) |
void | tearDown ( TestInformation testInfo, Throwable e)
|
受保護的方法 | |
---|---|
void | setAirplaneMode ( BinaryState airplaneMode) 暴露用於單元測試 |
void | setAutoRotate ( BinaryState autoRotate) 暴露用於單元測試 |
void | setAutoUpdateTime ( BinaryState autoUpdateTime) 暴露用於單元測試 |
void | setAutoUpdateTimezone ( BinaryState autoUpdateTimezone) 暴露用於單元測試 |
void | setBatterySaver ( BinaryState batterySaver) 暴露用於單元測試 |
void | setBatterySaverTrigger (Integer batterySaverTrigger) 暴露用於單元測試 |
void | setBluetooth ( BinaryState bluetooth) 暴露用於單元測試 |
void | setCell ( BinaryState cell) |
void | setCellAutoSetting ( BinaryState cellAutoSetting) |
void | setData ( BinaryState data) |
void | setDefaultSimData (Integer defaultSimData) 暴露用於單元測試 |
void | setDefaultSimSms (Integer defaultSimSms) 暴露用於單元測試 |
void | setDefaultSimVoice (Integer defaultSimVoice) 暴露用於單元測試 |
void | setDeprecatedAudioSilent (boolean silent) 此方法已被棄用。使用 |
void | setDeprecatedMinExternalStoreSpace (long storeSpace) 此方法已被棄用。使用 |
void | setDeprecatedSetProp (String prop) 此方法已被棄用。使用 |
void | setDisableAudio (boolean disable) 暴露用於單元測試 |
void | setDisableCwWifiMediator ( BinaryState disableCwWifiMediator) |
void | setDisableDalvikVerifier (boolean disableDalvikVerifier) 暴露用於單元測試 |
void | setDisableDialing (boolean disableDialing) 暴露用於單元測試 |
void | setDisableDoze (boolean disableDoze) 暴露用於單元測試 |
void | setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory) 暴露用於單元測試 |
void | setEthernet ( BinaryState ethernet) 暴露用於單元測試 |
void | setForceSkipSystemProps (boolean force) 暴露用於單元測試 |
void | setInstallNonMarketApps ( BinaryState installNonMarketApps) 暴露用於單元測試 |
void | setLocalDataPath (File path) 暴露用於單元測試 |
void | setLocationGps ( BinaryState locationGps) 暴露用於單元測試 |
void | setLocationNetwork ( BinaryState locationNetwork) 暴露用於單元測試 |
void | setMinExternalStorageKb (long storageKb) 暴露用於單元測試 |
void | setNfc ( BinaryState nfc) 暴露用於單元測試 |
void | setNotificationLed ( BinaryState notificationLed) 暴露用於單元測試 |
void | setProperty (String key, String value) 暴露用於單元測試 |
void | setRestoreProperties (boolean restoreProperties) 暴露用於單元測試 |
void | setRestoreSettings (boolean restoreSettings) 暴露用於單元測試 |
void | setScreenAdaptiveBrightness ( BinaryState screenAdaptiveBrightness) 暴露用於單元測試 |
void | setScreenAlwaysOn ( BinaryState screenAlwaysOn) 暴露用於單元測試 |
void | setScreenAmbientMode ( BinaryState screenAmbientMode) 暴露用於單元測試 |
void | setScreenBrightness (Integer screenBrightness) 暴露用於單元測試 |
void | setScreenSaver ( BinaryState screenSaver) 暴露用於單元測試 |
void | setScreenTimeoutSecs (Long screenTimeoutSecs) 暴露用於單元測試 |
void | setTestHarness (boolean setTestHarness) 暴露用於單元測試 |
void | setTimezone (String timezone) 暴露用於單元測試 |
void | setTriggerMediaMounted (boolean triggerMediaMounted) 暴露用於單元測試 |
void | setWakeGesture ( BinaryState wakeGesture) 暴露用於單元測試 |
void | setWifi ( BinaryState wifi) 暴露用於單元測試 |
void | setWifiNetwork (String wifiNetwork) 暴露用於單元測試 |
void | setWifiPsk (String wifiPsk) |
void | setWifiScanAlwaysEnabled ( BinaryState wifiScanAlwaysEnabled) 暴露用於單元測試 |
void | setWifiSsidToPsk ( wifiSssidToPsk) setWifiSsidToPsk ( wifiSssidToPsk) |
void | setWifiWatchdog ( BinaryState wifiWatchdog) 暴露用於單元測試 |
領域
m飛行模式
protected BinaryState mAirplaneMode
m自動旋轉
protected BinaryState mAutoRotate
m自動更新時間
protected BinaryState mAutoUpdateTime
m自動更新時區
protected BinaryState mAutoUpdateTimezone
mBatterySaverTrigger
protected Integer mBatterySaverTrigger
藍牙
protected BinaryState mBluetooth
移動細胞
protected BinaryState mCell
mCell自動設置
protected BinaryState mCellAutoSetting
移動數據
protected BinaryState mData
mDefaultSimData
protected Integer mDefaultSimData
mDefaultSim短信
protected Integer mDefaultSimSms
mDefaultSimVoice
protected Integer mDefaultSimVoice
m禁用音頻
protected boolean mDisableAudio
mDisableDalvikVerifier
protected boolean mDisableDalvikVerifier
m禁用撥號
protected boolean mDisableDialing
mDisableDoze
protected boolean mDisableDoze
mEnableFullBatteryStatsHistory
protected boolean mEnableFullBatteryStatsHistory
mForceSkipRunCommands
protected boolean mForceSkipRunCommands
mForceSkipSettings
protected boolean mForceSkipSettings
mForceSkipSystemProps
protected boolean mForceSkipSystemProps
m全局設置
protected MultiMap<String, String> mGlobalSettings
mInstallNonMarketApps
protected BinaryState mInstallNonMarketApps
m本地數據文件
protected File mLocalDataFile
移動位置GPS
protected BinaryState mLocationGps
mMin外部存儲Kb
protected long mMinExternalStorageKb
微核功能
protected BinaryState mNfc
m優化屬性設置
protected boolean mOptimizedPropertySetting
m上一個屬性
protected File mPreviousProperties
遠程數據路徑
protected String mRemoteDataPath
mRestore屬性
protected boolean mRestoreProperties
mRestore設置
protected boolean mRestoreSettings
mRunCommandAfterSettings
protectedmRunCommandAfterSettings
mRunCommandBeforeSettings
protectedmRunCommandBeforeSettings
mScreen自適應亮度
protected BinaryState mScreenAdaptiveBrightness
屏幕常亮
protected BinaryState mScreenAlwaysOn
m屏幕環境模式
protected BinaryState mScreenAmbientMode
m屏幕亮度
protected Integer mScreenBrightness
屏幕保護程序
protected BinaryState mScreenSaver
mScreenTimeoutSecs
protected Long mScreenTimeoutSecs
安全設置
protected MultiMap<String, String> mSecureSettings
mSetProps
protectedmSetProps
mSetTestHarness
protected boolean mSetTestHarness
mSyncTimezoneWithHost
protected BinaryState mSyncTimezoneWithHost
m系統設置
protected MultiMap<String, String> mSystemSettings
時區
protected String mTimezone
mTriggerMediaMounted
protected boolean mTriggerMediaMounted
m喚醒手勢
protected BinaryState mWakeGesture
移動Wifi
protected BinaryState mWifi
移動Wifi Psk
protected String mWifiPsk
mWifiScanAlwaysEnabled
protected BinaryState mWifiScanAlwaysEnabled
mWifiSSid
protected String mWifiSsid
mWifiSsidToPsk
protectedmWifiSsidToPsk
公共構造函數
設備設置
public DeviceSetup ()
公共方法
更改設置
public void changeSettings (ITestDevice device)
更改設備上的設置。
暴露出來以便孩子們的班級可以覆蓋。
參數 | |
---|---|
device | ITestDevice : ITestDevice |
投擲 | |
---|---|
DeviceNotAvailableException | 如果設備不可用 |
TargetSetupError | 如果設置失敗 |
獲取依賴關係
publicgetDependencies ()
退貨 | |
---|---|
isForceSkipSystemProps
public boolean isForceSkipSystemProps ()
退貨 | |
---|---|
boolean |
進程已棄用的選項
public void processDeprecatedOptions (ITestDevice device)
處理已棄用的選項,將其轉換為當前使用的選項。
此方法應在任何其他處理方法之前運行。如果已棄用的選項覆蓋指定的未棄用的選項,將引發TargetSetupError
。
參數 | |
---|---|
device | ITestDevice |
投擲 | |
---|---|
TargetSetupError | 如果有衝突 |
處理選項
public void processOptions (ITestDevice device)
處理所有Option
並將其轉化為系統 props、設置或運行命令。此時不在設備上運行任何命令。
暴露出來以便孩子們的班級可以覆蓋這一點。
參數 | |
---|---|
device | ITestDevice : ITestDevice |
投擲 | |
---|---|
DeviceNotAvailableException | 如果設備不可用 |
TargetSetupError | 如果Option 衝突 |
setCommandForBinaryState
public static void setCommandForBinaryState (BinaryState state,commands, String onCommand, String offCommand)
添加要在設備上執行的 ON/OFF 運行命令的幫助程序方法。
參數 | |
---|---|
state | BinaryState : BinaryState |
commands | |
onCommand | String :ON 時運行的命令。如果命令為null 則忽略 |
offCommand | String :關閉時運行的命令。如果命令為null 則忽略 |
設置全局設置
public void setGlobalSetting (String key, String value)
暴露用於單元測試
參數 | |
---|---|
key | String |
value | String |
設置安全設置
public void setSecureSetting (String key, String value)
暴露用於單元測試
參數 | |
---|---|
key | String |
value | String |
setSettingForBinaryState
public static void setSettingForBinaryState (BinaryState state, MultiMap<String, String> settingsMap, String setting, String onValue, String offValue)
將開/關設置添加到設置映射的輔助方法。
參數 | |
---|---|
state | BinaryState : BinaryState |
settingsMap | MultiMap :用於存儲設置的MultiMap 。 |
setting | String : 設置鍵 |
onValue | String : ON 時的值 |
offValue | String : 關閉時的值 |
設置系統設置
public void setSystemSetting (String key, String value)
暴露用於單元測試
參數 | |
---|---|
key | String |
value | String |
設置
public void setUp (TestInformation testInfo)
參數 | |
---|---|
testInfo | TestInformation |
投擲 | |
---|---|
BuildError | |
DeviceNotAvailableException | |
TargetSetupError |
拆除
public void tearDown (TestInformation testInfo, Throwable e)
參數 | |
---|---|
testInfo | TestInformation |
e | Throwable |
投擲 | |
---|---|
DeviceNotAvailableException |
受保護的方法
設置自動更新時間
protected void setAutoUpdateTime (BinaryState autoUpdateTime)
暴露用於單元測試
參數 | |
---|---|
autoUpdateTime | BinaryState |
設置自動更新時區
protected void setAutoUpdateTimezone (BinaryState autoUpdateTimezone)
暴露用於單元測試
參數 | |
---|---|
autoUpdateTimezone | BinaryState |
設置BatterySaverTrigger
protected void setBatterySaverTrigger (Integer batterySaverTrigger)
暴露用於單元測試
參數 | |
---|---|
batterySaverTrigger | Integer |
設置單元格自動設置
protected void setCellAutoSetting (BinaryState cellAutoSetting)
參數 | |
---|---|
cellAutoSetting | BinaryState |
設置默認模擬數據
protected void setDefaultSimData (Integer defaultSimData)
暴露用於單元測試
參數 | |
---|---|
defaultSimData | Integer |
設置默認Sim短信
protected void setDefaultSimSms (Integer defaultSimSms)
暴露用於單元測試
參數 | |
---|---|
defaultSimSms | Integer |
設置默認SimVoice
protected void setDefaultSimVoice (Integer defaultSimVoice)
暴露用於單元測試
參數 | |
---|---|
defaultSimVoice | Integer |
設置DeprecatedAudioSilent
protected void setDeprecatedAudioSilent (boolean silent)
此方法已被棄用。
使用setDisableAudio(boolean)
代替。
暴露用於單元測試
參數 | |
---|---|
silent | boolean |
setDeprecatedMinExternalStoreSpace
protected void setDeprecatedMinExternalStoreSpace (long storeSpace)
此方法已被棄用。
使用setMinExternalStorageKb(long)
代替。
暴露用於單元測試
參數 | |
---|---|
storeSpace | long |
setDeprecatedSetProp
protected void setDeprecatedSetProp (String prop)
此方法已被棄用。
使用setProperty(String, String)
代替。
暴露用於單元測試
參數 | |
---|---|
prop | String |
設置禁用音頻
protected void setDisableAudio (boolean disable)
暴露用於單元測試
參數 | |
---|---|
disable | boolean |
設置禁用CwWifiMediator
protected void setDisableCwWifiMediator (BinaryState disableCwWifiMediator)
參數 | |
---|---|
disableCwWifiMediator | BinaryState |
setDisableDalvikVerifier
protected void setDisableDalvikVerifier (boolean disableDalvikVerifier)
暴露用於單元測試
參數 | |
---|---|
disableDalvikVerifier | boolean |
設置禁用撥號
protected void setDisableDialing (boolean disableDialing)
暴露用於單元測試
參數 | |
---|---|
disableDialing | boolean |
設置禁用打瞌睡
protected void setDisableDoze (boolean disableDoze)
暴露用於單元測試
參數 | |
---|---|
disableDoze | boolean |
設置啟用FullBatteryStatsHistory
protected void setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory)
暴露用於單元測試
參數 | |
---|---|
enableFullBatteryStatsHistory | boolean |
設置ForceSkipSystemProps
protected void setForceSkipSystemProps (boolean force)
暴露用於單元測試
參數 | |
---|---|
force | boolean |
設置安裝非市場應用程序
protected void setInstallNonMarketApps (BinaryState installNonMarketApps)
暴露用於單元測試
參數 | |
---|---|
installNonMarketApps | BinaryState |
設置本地數據路徑
protected void setLocalDataPath (File path)
暴露用於單元測試
參數 | |
---|---|
path | File |
設置位置網絡
protected void setLocationNetwork (BinaryState locationNetwork)
暴露用於單元測試
參數 | |
---|---|
locationNetwork | BinaryState |
設置MinExternalStorageKb
protected void setMinExternalStorageKb (long storageKb)
暴露用於單元測試
參數 | |
---|---|
storageKb | long |
設置通知LED
protected void setNotificationLed (BinaryState notificationLed)
暴露用於單元測試
參數 | |
---|---|
notificationLed | BinaryState |
設置屬性
protected void setProperty (String key, String value)
暴露用於單元測試
參數 | |
---|---|
key | String |
value | String |
設置恢復屬性
protected void setRestoreProperties (boolean restoreProperties)
暴露用於單元測試
參數 | |
---|---|
restoreProperties | boolean |
設置恢復設置
protected void setRestoreSettings (boolean restoreSettings)
暴露用於單元測試
參數 | |
---|---|
restoreSettings | boolean |
設置屏幕自適應亮度
protected void setScreenAdaptiveBrightness (BinaryState screenAdaptiveBrightness)
暴露用於單元測試
參數 | |
---|---|
screenAdaptiveBrightness | BinaryState |
設置屏幕常亮
protected void setScreenAlwaysOn (BinaryState screenAlwaysOn)
暴露用於單元測試
參數 | |
---|---|
screenAlwaysOn | BinaryState |
設置屏幕環境模式
protected void setScreenAmbientMode (BinaryState screenAmbientMode)
暴露用於單元測試
參數 | |
---|---|
screenAmbientMode | BinaryState |
設置屏幕亮度
protected void setScreenBrightness (Integer screenBrightness)
暴露用於單元測試
參數 | |
---|---|
screenBrightness | Integer |
設置屏幕超時秒數
protected void setScreenTimeoutSecs (Long screenTimeoutSecs)
暴露用於單元測試
參數 | |
---|---|
screenTimeoutSecs | Long |
設置測試框架
protected void setTestHarness (boolean setTestHarness)
暴露用於單元測試
參數 | |
---|---|
setTestHarness | boolean |
設置時區
protected void setTimezone (String timezone)
暴露用於單元測試
參數 | |
---|---|
timezone | String |
設置觸發媒體安裝
protected void setTriggerMediaMounted (boolean triggerMediaMounted)
暴露用於單元測試
參數 | |
---|---|
triggerMediaMounted | boolean |
設置Wifi網絡
protected void setWifiNetwork (String wifiNetwork)
暴露用於單元測試
參數 | |
---|---|
wifiNetwork | String |
設置Wifi Psk
protected void setWifiPsk (String wifiPsk)
參數 | |
---|---|
wifiPsk | String |
設置 WifiScanAlwaysEnabled
protected void setWifiScanAlwaysEnabled (BinaryState wifiScanAlwaysEnabled)
暴露用於單元測試
參數 | |
---|---|
wifiScanAlwaysEnabled | BinaryState |
設置WifiSsidToPsk
protected void setWifiSsidToPsk (wifiSssidToPsk)
參數 | |
---|---|
wifiSssidToPsk |
設置Wifi看門狗
protected void setWifiWatchdog (BinaryState wifiWatchdog)
暴露用於單元測試
參數 | |
---|---|
wifiWatchdog | BinaryState |