设备设置

public class DeviceSetup
extends BaseTargetPreparer

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 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)

更改设备上的设置。

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)

暴露于单元测试

字段

飞行模式

protected BinaryState mAirplaneMode

m自动旋转

protected BinaryState mAutoRotate

mAutoUpdateTime

protected BinaryState mAutoUpdateTime

mAutoUpdateTimezone

protected BinaryState mAutoUpdateTimezone

mBatterySaver

protected BinaryState mBatterySaver

mBatterySaverTrigger

protected Integer mBatterySaverTrigger

m蓝牙

protected BinaryState mBluetooth

细胞

protected BinaryState mCell

mCellAutoSetting

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

mForceSkipSettings

protected boolean mForceSkipSettings

mForceSkipSystemProps

protected boolean mForceSkipSystemProps

mGlobalSettings

protected MultiMap<String, String> mGlobalSettings

mInstallNonMarketApps

protected BinaryState mInstallNonMarketApps

本地数据文件

protected File mLocalDataFile

mLocationGps

protected BinaryState mLocationGps

位置网络

protected BinaryState mLocationNetwork

mminExternalStorageKb

protected long mMinExternalStorageKb

mNfc

protected BinaryState mNfc

mNotificationLed

protected BinaryState mNotificationLed

mOptimizedPropertySetting

protected boolean mOptimizedPropertySetting

mPreviousProperties

protected File mPreviousProperties

mRemoteDataPath

protected String mRemoteDataPath

mRestoreProperties

protected boolean mRestoreProperties

mRestoreSettings

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

mScreenTimeoutSecs

protected Long mScreenTimeoutSecs

安全设置

protected MultiMap<String, String> mSecureSettings

mSetProps

protected  mSetProps

mSetTestHarness

protected boolean mSetTestHarness

m系统设置

protected MultiMap<String, String> mSystemSettings

mTimezone

protected String mTimezone

mTriggerMediaMounted

protected boolean mTriggerMediaMounted

mWakeGesture

protected BinaryState mWakeGesture

无线上网

protected BinaryState mWifi

mWifiPsk

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 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并将它们变成系统道具、设置或运行命令。此时不在设备上运行任何命令。

暴露,以便子类可以覆盖它。

参数
device ITestDevice : ITestDevice

投掷
DeviceNotAvailableException如果设备不可用
TargetSetupError如果Option冲突

setCommandForBinaryState

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

添加要在设备上执行的 ON/OFF 运行命令的辅助方法。

参数
state BinaryState : BinaryState

commands :要添加 on 或 off 命令的命令列表。

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)

将 ON/OFF 设​​置添加到设置映射的辅助方法。

参数
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

setAutoUpdateTimezone

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

setCellAutoSetting

protected void setCellAutoSetting (BinaryState cellAutoSetting)

参数
cellAutoSetting BinaryState

设置数据

protected void setData (BinaryState data)

参数
data BinaryState

setDefaultSimData

protected void setDefaultSimData (Integer defaultSimData)

暴露于单元测试

参数
defaultSimData Integer

setDefaultSimSms

protected void setDefaultSimSms (Integer defaultSimSms)

暴露于单元测试

参数
defaultSimSms Integer

setDefaultSimVoice

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

setLocationGps

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

setNotificationLed

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

setScreenTimeoutSecs

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

setWakeGesture

protected void setWakeGesture (BinaryState wakeGesture)

暴露于单元测试

参数
wakeGesture BinaryState

设置Wifi

protected void setWifi (BinaryState wifi)

暴露于单元测试

参数
wifi BinaryState

设置Wifi网络

protected void setWifiNetwork (String wifiNetwork)

暴露于单元测试

参数
wifiNetwork String

设置WifiPsk

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