设备设置

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 mHideErrorDialogs

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并将其转化为系统 props、设置或运行命令。

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)

此方法已被弃用。使用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 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)

暴露用于单元测试

领域

m飞行模式

protected BinaryState mAirplaneMode

m自动旋转

protected BinaryState mAutoRotate

m自动更新时间

protected BinaryState mAutoUpdateTime

m自动更新时区

protected BinaryState mAutoUpdateTimezone

省电模式

protected BinaryState mBatterySaver

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

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

mForceSkipSettings

protected boolean mForceSkipSettings

mForceSkipSystemProps

protected boolean mForceSkipSystemProps

m全局设置

protected MultiMap<String, String> mGlobalSettings

mHideErrorDialogs

protected BinaryState mHideErrorDialogs

mInstallNonMarketApps

protected BinaryState mInstallNonMarketApps

m本地数据文件

protected File mLocalDataFile

移动位置GPS

protected BinaryState mLocationGps

移动位置网络

protected BinaryState mLocationNetwork

mMin外部存储Kb

protected long mMinExternalStorageKb

微核功能

protected BinaryState mNfc

mNotificationLed

protected BinaryState mNotificationLed

m优化属性设置

protected boolean mOptimizedPropertySetting

m上一个属性

protected File mPreviousProperties

远程数据路径

protected String mRemoteDataPath

mRestore属性

protected boolean mRestoreProperties

mRestore设置

protected boolean mRestoreSettings

mRunCommandAfterSettings

protected  mRunCommandAfterSettings

mRunCommandBeforeSettings

protected  mRunCommandBeforeSettings

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

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

移动Wifi

protected BinaryState mWifi

移动Wifi Psk

protected String mWifiPsk

mWifiScanAlwaysEnabled

protected BinaryState mWifiScanAlwaysEnabled

mWifiSSid

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

进程已弃用的选项

public void processDeprecatedOptions (ITestDevice device)

处理已弃用的选项,将其转换为当前使用的选项。

此方法应在任何其他处理方法之前运行。如果已弃用的选项覆盖指定的未弃用的选项,将引发TargetSetupError

参数
device ITestDevice

投掷
TargetSetupError如果有冲突

处理选项

public void processOptions (ITestDevice device)

处理所有Option并将其转化为系统 props、设置或运行命令。此时不在设备上运行任何命令。

暴露出来以便孩子们的班级可以覆盖这一点。

参数
device ITestDeviceITestDevice

投掷
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 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

设置BatterySaverTrigger

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

设置默认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 setEthernet (BinaryState ethernet)

暴露用于单元测试

参数
ethernet BinaryState

设置强制根设置

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

设置位置GPS

protected void setLocationGps (BinaryState locationGps)

暴露用于单元测试

参数
locationGps BinaryState

设置位置网络

protected void setLocationNetwork (BinaryState locationNetwork)

暴露用于单元测试

参数
locationNetwork BinaryState

设置MinExternalStorageKb

protected void setMinExternalStorageKb (long storageKb)

暴露用于单元测试

参数
storageKb long

设置NFC

protected void setNfc (BinaryState nfc)

暴露用于单元测试

参数
nfc BinaryState

设置通知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 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

设置触发媒体安装

protected void setTriggerMediaMounted (boolean triggerMediaMounted)

暴露用于单元测试

参数
triggerMediaMounted boolean

设置唤醒手势

protected void setWakeGesture (BinaryState wakeGesture)

暴露用于单元测试

参数
wakeGesture BinaryState

设置Wifi

protected void setWifi (BinaryState wifi)

暴露用于单元测试

参数
wifi BinaryState

设置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