設備設置

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 構建類型。

應在刷新新構建執行。

注意:此準備器適用於連續測試實驗室,並假定被測設備將在下一次運行之前進行閃爍和擦除。因此,它在拆解期間進行的清理工作最少,不應在測試模塊中使用。

概括

字段

protected BinaryState mAirplaneMode

protected BinaryState mAutoRotate

protected BinaryState mAutoUpdateTime

protected BinaryState mAutoUpdateTimezone

protected BinaryState mBatterySaver

protected Integer mBatterySaverTrigger

protected BinaryState mBluetooth

protected BinaryState mCell

protected BinaryState mCellAutoSetting

protected BinaryState mData

protected Integer mDefaultSimData

protected Integer mDefaultSimSms

protected Integer mDefaultSimVoice

protected boolean mDisableAudio

protected BinaryState mDisableCwWifiMediator

protected boolean mDisableDalvikVerifier

protected boolean mDisableDialing

protected boolean mDisableDoze

protected boolean mEnableFullBatteryStatsHistory

protected BinaryState mEthernet

protected boolean mForceSkipRunCommands

protected boolean mForceSkipSettings

protected boolean mForceSkipSystemProps

protected MultiMap <String, String> mGlobalSettings

protected BinaryState mInstallNonMarketApps

protected File mLocalDataFile

protected BinaryState mLocationGps

protected BinaryState mLocationNetwork

protected long mMinExternalStorageKb

protected BinaryState mNfc

protected BinaryState mNotificationLed

protected boolean mOptimizedPropertySetting

protected File mPreviousProperties

protected String mRemoteDataPath

protected boolean mRestoreProperties

protected boolean mRestoreSettings

protected mRunCommandAfterSettings

protected mRunCommandBeforeSettings

protected BinaryState mScreenAdaptiveBrightness

protected BinaryState mScreenAlwaysOn

protected BinaryState mScreenAmbientMode

protected Integer mScreenBrightness

protected BinaryState mScreenSaver

protected Long mScreenTimeoutSecs

protected MultiMap <String, String> mSecureSettings

protected mSetProps

protected boolean mSetTestHarness

protected BinaryState mSyncTimezoneWithHost

protected MultiMap <String, String> mSystemSettings

protected String mTimezone

protected boolean mTriggerMediaMounted

protected BinaryState mWakeGesture

protected BinaryState mWifi

protected String mWifiPsk

protected BinaryState mWifiScanAlwaysEnabled

protected String mWifiSsid

protected mWifiSsidToPsk

protected BinaryState mWifiWatchdog

公共構造函數

DeviceSetup ()

公共方法

void changeSettings ( ITestDevice device)

更改設備上的設置。

getDependencies ()
ITestDevice getDevice ( TestInformation testInfo)
boolean isForceSkipSystemProps ()
void processDeprecatedOptions ( ITestDevice device)

處理已棄用的選項,將它們轉換為當前使用的選項。

void processOptions ( ITestDevice device)

處理所有Option並將它們變成系統屬性、設置或運行命令。

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)

將 ON/OFF 設置添加到設置映射的輔助方法。

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)

此方法已棄用。使用setDisableAudio(boolean)代替。

void setDeprecatedMinExternalStoreSpace (long storeSpace)

此方法已棄用。請改用setMinExternalStorageKb(long)

void setDeprecatedSetProp (String prop)

此方法已棄用。請改用setProperty(String, String)

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

mAutoUpdateTimezone

protected BinaryState mAutoUpdateTimezone

mBatterySaver

protected BinaryState mBatterySaver

mBatterySaver觸發器

protected Integer mBatterySaverTrigger

移動藍牙

protected BinaryState mBluetooth

細胞

protected BinaryState mCell

mCell自動設置

protected BinaryState mCellAutoSetting

移動數據

protected BinaryState mData

mDefaultSimData

protected Integer mDefaultSimData

mDefaultSimSms

protected Integer mDefaultSimSms

mDefaultSimVoice

protected Integer mDefaultSimVoice

m禁用音頻

protected boolean mDisableAudio

mDisableCwWifiMediator

protected BinaryState mDisableCwWifiMediator

mDisableDalvikVerifier

protected boolean mDisableDalvikVerifier

m禁用撥號

protected boolean mDisableDialing

mDisableDoze

protected boolean mDisableDoze

mEnableFullBatteryStatsHistory

protected boolean mEnableFullBatteryStatsHistory

以太網

protected BinaryState mEthernet

mForceSkipRunCommands

protected boolean mForceSkipRunCommands

mForceSkip設置

protected boolean mForceSkipSettings

mForceSkipSystemProps

protected boolean mForceSkipSystemProps

m全局設置

protected MultiMap<String, String> mGlobalSettings

mInstallNonMarketApps

protected BinaryState mInstallNonMarketApps

本地數據文件

protected File mLocalDataFile

mLocationGps

protected BinaryState mLocationGps

移動位置網絡

protected BinaryState mLocationNetwork

mMin外部存儲Kb

protected long mMinExternalStorageKb

mNfc

protected BinaryState mNfc

mNotificationLed

protected BinaryState mNotificationLed

mOptimizedPropertySetting

protected boolean mOptimizedPropertySetting

mPreviousProperties

protected File mPreviousProperties

遠程數據路徑

protected String mRemoteDataPath

mRestoreProperties

protected boolean mRestoreProperties

mRestore設置

protected boolean mRestoreSettings

mRunCommandAfterSettings

protected  mRunCommandAfterSettings

mRunCommandBeforeSettings

protected  mRunCommandBeforeSettings

mScreen自適應亮度

protected BinaryState mScreenAdaptiveBrightness

mScreenAlwaysOn

protected BinaryState mScreenAlwaysOn

mScreenAmbientMode

protected BinaryState mScreenAmbientMode

m屏幕亮度

protected Integer mScreenBrightness

屏幕保護程序

protected BinaryState mScreenSaver

毫秒屏幕超時秒數

protected Long mScreenTimeoutSecs

安全設置

protected MultiMap<String, String> mSecureSettings

mSetProps

protected  mSetProps

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

無線上網

protected BinaryState mWifi

無線上網

protected String mWifiPsk

mWifiScanAlwaysEnabled

protected BinaryState mWifiScanAlwaysEnabled

無線上網

protected String mWifiSsid

mWifiSsidToPsk

protected  mWifiSsidToPsk

mWifi看門狗

protected BinaryState mWifiWatchdog

公共構造函數

設備設置

public DeviceSetup ()

公共方法

更改設置

public void changeSettings (ITestDevice device)

更改設備上的設置。

公開,因此子類可能會覆蓋。

參數
device ITestDeviceITestDevice

投擲
DeviceNotAvailableException如果設備不可用
TargetSetupError如果設置失敗

獲取依賴項

public  getDependencies ()

退貨

獲取設備

public ITestDevice getDevice (TestInformation testInfo)

參數
testInfo TestInformation

退貨
ITestDevice

isForceSkipSystemProps

public boolean isForceSkipSystemProps ()

退貨
boolean

processDeprecated選項

public void processDeprecatedOptions (ITestDevice device)

處理已棄用的選項,將它們轉換為當前使用的選項。

此方法應在任何其他處理方法之前運行。如果棄用的選項覆蓋指定的非棄用選項,將拋出TargetSetupError

參數
device ITestDevice

投擲
TargetSetupError如果有衝突

流程選項

public void processOptions (ITestDevice device)

處理所有Option並將它們變成系統屬性、設置或運行命令。此時不在設備上運行任何命令。

公開以便子類可以覆蓋它。

參數
device ITestDeviceITestDevice

投擲
DeviceNotAvailableException如果設備不可用
TargetSetupError如果Option衝突

setCommandForBinaryState

public static void setCommandForBinaryState (BinaryState state, 
                 commands, 
                String onCommand, 
                String offCommand)

添加要在設備上執行的 ON/OFF 運行命令的輔助方法。

參數
state BinaryStateBinaryState

commands :要添加開或關命令的命令列表。

onCommand String :打開時要運行的命令。如果命令為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)

將 ON/OFF 設置添加到設置映射的輔助方法。

參數
state BinaryStateBinaryState

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 setAirplaneMode (BinaryState airplaneMode)

公開進行單元測試

參數
airplaneMode BinaryState

設置自動旋轉

protected void setAutoRotate (BinaryState autoRotate)

公開進行單元測試

參數
autoRotate BinaryState

設置自動更新時間

protected void setAutoUpdateTime (BinaryState autoUpdateTime)

公開進行單元測試

參數
autoUpdateTime BinaryState

設置自動更新時區

protected void setAutoUpdateTimezone (BinaryState autoUpdateTimezone)

公開進行單元測試

參數
autoUpdateTimezone BinaryState

設置省電模式

protected void setBatterySaver (BinaryState batterySaver)

公開進行單元測試

參數
batterySaver BinaryState

setBatterySaverTrigger

protected void setBatterySaverTrigger (Integer batterySaverTrigger)

公開進行單元測試

參數
batterySaverTrigger Integer

設置藍牙

protected void setBluetooth (BinaryState bluetooth)

公開進行單元測試

參數
bluetooth BinaryState

設置單元格

protected void setCell (BinaryState cell)

參數
cell BinaryState

設置單元格自動設置

protected void setCellAutoSetting (BinaryState cellAutoSetting)

參數
cellAutoSetting BinaryState

設置數據

protected void setData (BinaryState data)

參數
data BinaryState

設置默認模擬數據

protected void setDefaultSimData (Integer defaultSimData)

公開進行單元測試

參數
defaultSimData Integer

設置默認模擬短信

protected void setDefaultSimSms (Integer defaultSimSms)

公開進行單元測試

參數
defaultSimSms Integer

設置默認模擬語音

protected void setDefaultSimVoice (Integer defaultSimVoice)

公開進行單元測試

參數
defaultSimVoice Integer

setDeprecatedAudioSilent

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

setDisableCwWifiMediator

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

setEnableFullBatteryStatsHistory

protected void setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory)

公開進行單元測試

參數
enableFullBatteryStatsHistory boolean

設置以太網

protected void setEthernet (BinaryState ethernet)

公開進行單元測試

參數
ethernet BinaryState

setForceSkipSystemProps

protected void setForceSkipSystemProps (boolean force)

公開進行單元測試

參數
force boolean

setInstallNonMarketApps

protected void setInstallNonMarketApps (BinaryState installNonMarketApps)

公開進行單元測試

參數
installNonMarketApps BinaryState

設置本地數據路徑

protected void setLocalDataPath (File path)

公開進行單元測試

參數
path File

設置位置GPS

protected void setLocationGps (BinaryState locationGps)

公開進行單元測試

參數
locationGps BinaryState

設置位置網絡

protected void setLocationNetwork (BinaryState locationNetwork)

公開進行單元測試

參數
locationNetwork BinaryState

setMinExternalStorageKb

protected void setMinExternalStorageKb (long storageKb)

公開進行單元測試

參數
storageKb long

設置Nfc

protected void setNfc (BinaryState nfc)

公開進行單元測試

參數
nfc BinaryState

設置通知指示燈

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

setScreenAlwaysOn

protected void setScreenAlwaysOn (BinaryState screenAlwaysOn)

公開進行單元測試

參數
screenAlwaysOn BinaryState

設置屏幕環境模式

protected void setScreenAmbientMode (BinaryState screenAmbientMode)

公開進行單元測試

參數
screenAmbientMode BinaryState

設置屏幕亮度

protected void setScreenBrightness (Integer screenBrightness)

公開進行單元測試

參數
screenBrightness Integer

設置屏保

protected void setScreenSaver (BinaryState screenSaver)

公開進行單元測試

參數
screenSaver BinaryState

設置屏幕超時秒數

protected void setScreenTimeoutSecs (Long screenTimeoutSecs)

公開進行單元測試

參數
screenTimeoutSecs Long

設置測試工具

protected void setTestHarness (boolean setTestHarness)

公開進行單元測試

參數
setTestHarness boolean

設置時區

protected void setTimezone (String timezone)

公開進行單元測試

參數
timezone String

setTriggerMediaMounted

protected void setTriggerMediaMounted (boolean triggerMediaMounted)

公開進行單元測試

參數
triggerMediaMounted boolean

設置喚醒手勢

protected void setWakeGesture (BinaryState wakeGesture)

公開進行單元測試

參數
wakeGesture BinaryState

設置無線網絡

protected void setWifi (BinaryState wifi)

公開進行單元測試

參數
wifi BinaryState

設置Wifi網絡

protected void setWifiNetwork (String wifiNetwork)

公開進行單元測試

參數
wifiNetwork String

設置WifiPsk

protected void setWifiPsk (String wifiPsk)

參數
wifiPsk String

setWifiScanAlwaysEnabled

protected void setWifiScanAlwaysEnabled (BinaryState wifiScanAlwaysEnabled)

公開進行單元測試

參數
wifiScanAlwaysEnabled BinaryState

設置 WifiSsidToPsk

protected void setWifiSsidToPsk ( wifiSssidToPsk)

參數
wifiSssidToPsk

設置Wifi看門狗

protected void setWifiWatchdog (BinaryState wifiWatchdog)

公開進行單元測試

參數
wifiWatchdog BinaryState