Google 致力于为黑人社区推动种族平等。查看具体举措
此页面由 Cloud Translation API 翻译。
Switch to English

设备设置

public class DeviceSetup
extends BaseTargetPreparer implements ITargetCleaner

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

更改设备上的设置。

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 ( ITestDevice device, IBuildInfo buildInfo)

执行目标设置以进行测试。

void tearDown ( ITestDevice device, IBuildInfo buildInfo, 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)

公开进行单元测试

领域

mAirplaneMode

protected BinaryState mAirplaneMode

mAutoRotate

protected BinaryState mAutoRotate

mAutoUpdateTime

protected BinaryState mAutoUpdateTime

mAutoUpdateTimezone

protected BinaryState mAutoUpdateTimezone

mBatterySaver

protected BinaryState mBatterySaver

mBatterySaverTrigger

protected Integer mBatterySaverTrigger

蓝牙

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

mDisableAudio

protected boolean mDisableAudio

mDisableCwWifiMediator

protected BinaryState mDisableCwWifiMediator

mDisableDalvikVerifier

protected boolean mDisableDalvikVerifier

mDisableDialing

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

mLocalDataFile

protected File mLocalDataFile

mLocationGps

protected BinaryState mLocationGps

mLocationNetwork

protected BinaryState mLocationNetwork

mMinExternalStorageKb

protected long mMinExternalStorageKb

NFC

protected BinaryState mNfc

mNotificationLed

protected BinaryState mNotificationLed

mPreviousProperties

protected File mPreviousProperties

mRemoteDataPath

protected String mRemoteDataPath

mRestoreProperties

protected boolean mRestoreProperties

mRestoreSettings

protected boolean mRestoreSettings

mRunCommandAfterSettings

protected  mRunCommandAfterSettings

mRunCommandBeforeSettings

protected  mRunCommandBeforeSettings

mScreenAdaptiveBrightness

protected BinaryState mScreenAdaptiveBrightness

mScreenAlwaysOn

protected BinaryState mScreenAlwaysOn

mScreenAmbientMode

protected BinaryState mScreenAmbientMode

mScreenBrightness

protected Integer mScreenBrightness

屏幕保护程序

protected BinaryState mScreenSaver

mScreenTimeoutSecs

protected Long mScreenTimeoutSecs

mSecureSettings

protected MultiMap <String, String> mSecureSettings

mSetProps

protected  mSetProps

mSetTestHarness

protected boolean mSetTestHarness

mSystemSettings

protected MultiMap <String, String> mSystemSettings

m时区

protected String mTimezone

mTriggerMediaMounted

protected boolean mTriggerMediaMounted

mWakeGesture

protected BinaryState mWakeGesture

无线上网

protected BinaryState mWifi

无线上网

protected String mWifiPsk

mWifiScanAlwaysEnabled

protected BinaryState mWifiScanAlwaysEnabled

无线上网

protected String mWifiSsid

mWifiSsidToPsk

protected  mWifiSsidToPsk

无线上网看门狗

protected BinaryState mWifiWatchdog

公共建设者

设备设置

public DeviceSetup ()

公开方法

更改设置

public void changeSettings ( ITestDevice device)

更改设备上的设置。

公开,因此子类可以重写。

参量
device ITestDeviceITestDevice

投掷
DeviceNotAvailableException 如果设备不可用
TargetSetupError 如果设置失败

processDeprecatedOptions

public void processDeprecatedOptions ( ITestDevice device)

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

此方法应在任何其他处理方法之前运行。如果不推荐使用的选项会覆盖指定的不推荐使用的选项,则将抛出TargetSetupError

参量
device ITestDevice

投掷
TargetSetupError 如果有冲突

processOptions

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 :如果为ON,则运行的命令。如果命令为null忽略

offCommand String :关闭时运行的命令。如果命令为null忽略

setGlobalSetting

public void setGlobalSetting (String key, 
                String value)

公开进行单元测试

参量
key String

value String

setSecureSetting

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 :值,如果为OFF

setSystemSetting

public void setSystemSetting (String key, 
                String value)

公开进行单元测试

参量
key String

value String

建立

public void setUp ( ITestDevice device, 
                IBuildInfo buildInfo)

执行目标设置以进行测试。

参量
device ITestDevice :准备的ITestDevice

buildInfo IBuildInfo :有关测试中的构建的数据。

投掷
DeviceNotAvailableException
TargetSetupError

拆除

public void tearDown ( ITestDevice device, 
                IBuildInfo buildInfo, 
                Throwable e)

测试后执行目标清理/拆卸。

参量
device ITestDevice :准备的ITestDevice

buildInfo IBuildInfo :有关测试中的构建的数据。

e Throwable :如果调用以异常结束,则这将是在调用级别捕获的异常。否则,将为null

投掷
DeviceNotAvailableException

受保护的方法

setAirplaneMode

protected void setAirplaneMode ( BinaryState airplaneMode)

公开进行单元测试

参量
airplaneMode BinaryState

setAutoRotate

protected void setAutoRotate ( BinaryState autoRotate)

公开进行单元测试

参量
autoRotate BinaryState

setAutoUpdateTime

protected void setAutoUpdateTime ( BinaryState autoUpdateTime)

公开进行单元测试

参量
autoUpdateTime BinaryState

setAutoUpdateTimezone

protected void setAutoUpdateTimezone ( BinaryState autoUpdateTimezone)

公开进行单元测试

参量
autoUpdateTimezone BinaryState

setBatterySaver

protected void setBatterySaver ( BinaryState batterySaver)

公开进行单元测试

参量
batterySaver BinaryState

setBatterySaverTrigger

protected void setBatterySaverTrigger (Integer batterySaverTrigger)

公开进行单元测试

参量
batterySaverTrigger Integer

setBluetooth

protected void setBluetooth ( BinaryState bluetooth)

公开进行单元测试

参量
bluetooth BinaryState

setCell

protected void setCell ( BinaryState cell)

参量
cell BinaryState

setCellAutoSetting

protected void setCellAutoSetting ( BinaryState cellAutoSetting)

参量
cellAutoSetting BinaryState

setData

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

setDisableAudio

protected void setDisableAudio (boolean disable)

公开进行单元测试

参量
disable boolean

setDisableCwWifiMediator

protected void setDisableCwWifiMediator ( BinaryState disableCwWifiMediator)

参量
disableCwWifiMediator BinaryState

setDisableDalvikVerifier

protected void setDisableDalvikVerifier (boolean disableDalvikVerifier)

公开进行单元测试

参量
disableDalvikVerifier boolean

setDisableDialing

protected void setDisableDialing (boolean disableDialing)

公开进行单元测试

参量
disableDialing boolean

setDisableDoze

protected void setDisableDoze (boolean disableDoze)

公开进行单元测试

参量
disableDoze boolean

setEnableFullBatteryStatsHistory

protected void setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory)

公开进行单元测试

参量
enableFullBatteryStatsHistory boolean

setEthernet

protected void setEthernet ( BinaryState ethernet)

公开进行单元测试

参量
ethernet BinaryState

setForceSkipSystemProps

protected void setForceSkipSystemProps (boolean force)

公开进行单元测试

参量
force boolean

setInstallNonMarketApps

protected void setInstallNonMarketApps ( BinaryState installNonMarketApps)

公开进行单元测试

参量
installNonMarketApps BinaryState

setLocalDataPath

protected void setLocalDataPath (File path)

公开进行单元测试

参量
path File

setLocationGps

protected void setLocationGps ( BinaryState locationGps)

公开进行单元测试

参量
locationGps BinaryState

setLocationNetwork

protected void setLocationNetwork ( BinaryState locationNetwork)

公开进行单元测试

参量
locationNetwork BinaryState

setMinExternalStorageKb

protected void setMinExternalStorageKb (long storageKb)

公开进行单元测试

参量
storageKb long

setNfc

protected void setNfc ( BinaryState nfc)

公开进行单元测试

参量
nfc BinaryState

setNotificationLed

protected void setNotificationLed ( BinaryState notificationLed)

公开进行单元测试

参量
notificationLed BinaryState

setProperty

protected void setProperty (String key, 
                String value)

公开进行单元测试

参量
key String

value String

setRestoreProperties

protected void setRestoreProperties (boolean restoreProperties)

公开进行单元测试

参量
restoreProperties boolean

setRestoreSettings

protected void setRestoreSettings (boolean restoreSettings)

公开进行单元测试

参量
restoreSettings boolean

setScreenAdaptiveBrightness

protected void setScreenAdaptiveBrightness ( BinaryState screenAdaptiveBrightness)

公开进行单元测试

参量
screenAdaptiveBrightness BinaryState

setScreenAlwaysOn

protected void setScreenAlwaysOn ( BinaryState screenAlwaysOn)

公开进行单元测试

参量
screenAlwaysOn BinaryState

setScreenAmbientMode

protected void setScreenAmbientMode ( BinaryState screenAmbientMode)

公开进行单元测试

参量
screenAmbientMode BinaryState

setScreenBrightness

protected void setScreenBrightness (Integer screenBrightness)

公开进行单元测试

参量
screenBrightness Integer

setScreenSaver

protected void setScreenSaver ( BinaryState screenSaver)

公开进行单元测试

参量
screenSaver BinaryState

setScreenTimeoutSecs

protected void setScreenTimeoutSecs (Long screenTimeoutSecs)

公开进行单元测试

参量
screenTimeoutSecs Long

setTestHarness

protected void setTestHarness (boolean setTestHarness)

公开进行单元测试

参量
setTestHarness boolean

setTimezone

protected void setTimezone (String timezone)

公开进行单元测试

参量
timezone String

setTriggerMediaMounted

protected void setTriggerMediaMounted (boolean triggerMediaMounted)

公开进行单元测试

参量
triggerMediaMounted boolean

setWakeGesture

protected void setWakeGesture ( BinaryState wakeGesture)

公开进行单元测试

参量
wakeGesture BinaryState

setWifi

protected void setWifi ( BinaryState wifi)

公开进行单元测试

参量
wifi BinaryState

setWifiNetwork

protected void setWifiNetwork (String wifiNetwork)

公开进行单元测试

参量
wifiNetwork String

setWifiPsk

protected void setWifiPsk (String wifiPsk)

参量
wifiPsk String

setWifiScanAlwaysEnabled

protected void setWifiScanAlwaysEnabled ( BinaryState wifiScanAlwaysEnabled)

公开进行单元测试

参量
wifiScanAlwaysEnabled BinaryState

setWifiSsidToPsk

protected void setWifiSsidToPsk ( wifiSssidToPsk)

参量
wifiSssidToPsk

setWifiWatchdog

protected void setWifiWatchdog ( BinaryState wifiWatchdog)

公开进行单元测试

参量
wifiWatchdog BinaryState