設備設置

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