设备设置
public class DeviceSetup
extends BaseTargetPreparer
对象 | ||
↳ | com.android.tradefed.targetprep.BaseTargetPreparer | |
↳ | com.android.tradefed.targetprep.DeviceSetup |
甲ITargetPreparer
用于配置用于测试基于所提供的设备Option
秒。
需要可以使用“adb root”的设备,通常是 userdebug 构建类型。
新构建的快擦写后应进行。
概括
公共构造函数 | |
---|---|
DeviceSetup () |
公共方法 | |
---|---|
void | changeSettings (ITestDevice device) 更改设备上的设置。 |
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) 将 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) 此方法已弃用。使用 |
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) 暴露用于单元测试 |
字段
飞行模式
protected BinaryState mAirplaneMode
自动旋转
protected BinaryState mAutoRotate
自动更新时间
protected BinaryState mAutoUpdateTime
自动更新时区
protected BinaryState mAutoUpdateTimezone
mBatterySaver触发器
protected Integer mBatterySaverTrigger
蓝牙
protected BinaryState mBluetooth
细胞
protected BinaryState mCell
mCell自动设置
protected BinaryState mCellAutoSetting
移动数据
protected BinaryState mData
默认模拟数据
protected Integer mDefaultSimData
默认短信短信
protected Integer mDefaultSimSms
mDefaultSimVoice
protected Integer mDefaultSimVoice
禁用音频
protected boolean mDisableAudio
mDisableDalvik验证器
protected boolean mDisableDalvikVerifier
禁用拨号
protected boolean mDisableDialing
禁用打瞌睡
protected boolean mDisableDoze
mEnableFullBatteryStatsHistory
protected boolean mEnableFullBatteryStatsHistory
mForceSkipRun 命令
protected boolean mForceSkipRunCommands
mForceSkipSettings
protected boolean mForceSkipSettings
mForceSkipSystemProps
protected boolean mForceSkipSystemProps
全局设置
protected MultiMap<String, String> mGlobalSettings
mInstallNonMarketApps
protected BinaryState mInstallNonMarketApps
本地数据文件
protected File mLocalDataFile
定位GPS
protected BinaryState mLocationGps
最小外部存储Kb
protected long mMinExternalStorageKb
纳米纤维
protected BinaryState mNfc
mOptimizedPropertySetting
protected boolean mOptimizedPropertySetting
mPreviousProperties
protected File mPreviousProperties
远程数据路径
protected String mRemoteDataPath
恢复属性
protected boolean mRestoreProperties
恢复设置
protected boolean mRestoreSettings
mRunCommandAfterSettings
protectedmRunCommandAfterSettings
mRunCommandBeforeSettings
protectedmRunCommandBeforeSettings
屏幕自适应亮度
protected BinaryState mScreenAdaptiveBrightness
mScreenAlwaysOn
protected BinaryState mScreenAlwaysOn
屏幕环境模式
protected BinaryState mScreenAmbientMode
屏幕亮度
protected Integer mScreenBrightness
屏幕保护程序
protected BinaryState mScreenSaver
屏幕超时秒数
protected Long mScreenTimeoutSecs
安全设置
protected MultiMap<String, String> mSecureSettings
设置道具
protectedmSetProps
mSetTestHarness
protected boolean mSetTestHarness
系统设置
protected MultiMap<String, String> mSystemSettings
时区
protected String mTimezone
mTriggerMediaMounted
protected boolean mTriggerMediaMounted
唤醒手势
protected BinaryState mWakeGesture
无线上网
protected BinaryState mWifi
无线上网
protected String mWifiPsk
mWifiScanAlwaysEnabled
protected BinaryState mWifiScanAlwaysEnabled
无线上网
protected String mWifiSsid
无线上网
protectedmWifiSsidToPsk
公共构造函数
设备设置
public DeviceSetup ()
公共方法
更改设置
public void changeSettings (ITestDevice device)
更改设备上的设置。
暴露以便子类可以覆盖。
参数 | |
---|---|
device | ITestDevice :该ITestDevice |
投掷 | |
---|---|
DeviceNotAvailableException | 如果设备不可用 |
TargetSetupError | 如果设置设置失败 |
获取设备
public ITestDevice getDevice (TestInformation testInfo)
参数 | |
---|---|
testInfo | TestInformation |
退货 | |
---|---|
ITestDevice |
isForceSkipSystemProps
public boolean isForceSkipSystemProps ()
退货 | |
---|---|
boolean |
processDeprecatedOptions
public void processDeprecatedOptions (ITestDevice device)
处理已弃用的选项,将它们转换为当前使用的选项。
此方法应在任何其他处理方法之前运行。将抛出一个TargetSetupError
如果过时的选项将覆盖指定的非过时的选项。
参数 | |
---|---|
device | ITestDevice |
投掷 | |
---|---|
TargetSetupError | 如果有冲突 |
进程选项
public void processOptions (ITestDevice device)
处理所有的Option
S和把它们变成系统道具,设置或运行命令。此时不在设备上运行任何命令。
公开以便子类可以覆盖它。
参数 | |
---|---|
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 :如果要运行的命令。忽略如果命令是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 | BinaryState :该BinaryState |
settingsMap | MultiMap :在MultiMap 用来保存设置。 |
setting | String :设置键值 |
onValue | String :如果该值ON |
offValue | String :如果该值OFF |
设置系统设置
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 |
setBatterySaverTrigger
protected void setBatterySaverTrigger (Integer batterySaverTrigger)
暴露用于单元测试
参数 | |
---|---|
batterySaverTrigger | Integer |
设置单元自动设置
protected void setCellAutoSetting (BinaryState cellAutoSetting)
参数 | |
---|---|
cellAutoSetting | BinaryState |
设置默认模拟数据
protected void setDefaultSimData (Integer defaultSimData)
暴露用于单元测试
参数 | |
---|---|
defaultSimData | Integer |
设置默认SimSms
protected void setDefaultSimSms (Integer defaultSimSms)
暴露用于单元测试
参数 | |
---|---|
defaultSimSms | Integer |
设置默认 SimVoice
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 |
setDisableDalvik验证器
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 |
setForceSkipSystemProps
protected void setForceSkipSystemProps (boolean force)
暴露用于单元测试
参数 | |
---|---|
force | boolean |
setInstallNonMarketApps
protected void setInstallNonMarketApps (BinaryState installNonMarketApps)
暴露用于单元测试
参数 | |
---|---|
installNonMarketApps | BinaryState |
设置本地数据路径
protected void setLocalDataPath (File path)
暴露用于单元测试
参数 | |
---|---|
path | File |
设置位置网络
protected void setLocationNetwork (BinaryState locationNetwork)
暴露用于单元测试
参数 | |
---|---|
locationNetwork | BinaryState |
setMinExternalStorageKb
protected void setMinExternalStorageKb (long storageKb)
暴露用于单元测试
参数 | |
---|---|
storageKb | long |
设置通知
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 |
setTriggerMediaMounted
protected void setTriggerMediaMounted (boolean triggerMediaMounted)
暴露用于单元测试
参数 | |
---|---|
triggerMediaMounted | boolean |
设置无线网络
protected void setWifiNetwork (String wifiNetwork)
暴露用于单元测试
参数 | |
---|---|
wifiNetwork | String |
设置无线上网
protected void setWifiPsk (String wifiPsk)
参数 | |
---|---|
wifiPsk | String |
setWifiScanAlwaysEnabled
protected void setWifiScanAlwaysEnabled (BinaryState wifiScanAlwaysEnabled)
暴露用于单元测试
参数 | |
---|---|
wifiScanAlwaysEnabled | BinaryState |
setWifiSsidToPsk
protected void setWifiSsidToPsk (wifiSssidToPsk)
参数 | |
---|---|
wifiSssidToPsk |
设置Wifi看门狗
protected void setWifiWatchdog (BinaryState wifiWatchdog)
暴露用于单元测试
参数 | |
---|---|
wifiWatchdog | BinaryState |