設備設定
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 | setForceRootSetup (boolean force) |
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) 暴露用於單元測試 |
領域
mBatterySaverTrigger
protected Integer mBatterySaverTrigger
藍牙
protected BinaryState mBluetooth
mCell自動設定
protected BinaryState mCellAutoSetting
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 File mLocalDataFile
mMin外部儲存Kb
protected long mMinExternalStorageKb
m優化屬性設定
protected boolean mOptimizedPropertySetting
m上一個屬性
protected File mPreviousProperties
遠端資料路徑
protected String mRemoteDataPath
mRestore屬性
protected boolean mRestoreProperties
mRestore設定
protected boolean mRestoreSettings
mRunCommandAfterSettings
protectedmRunCommandAfterSettings
mRunCommandBeforeSettings
protectedmRunCommandBeforeSettings
m螢幕亮度
protected Integer mScreenBrightness
mScreenTimeoutSecs
protected Long mScreenTimeoutSecs
mSetProps
protectedmSetProps
mSetTestHarness
protected boolean mSetTestHarness
時區
protected String mTimezone
mTriggerMediaMounted
protected boolean mTriggerMediaMounted
m喚醒手勢
protected BinaryState mWakeGesture
移動Wifi Psk
protected String mWifiPsk
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 |
設定強制根設定
protected void setForceRootSetup (boolean force)
參數 | |
---|---|
force | 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 |