設備設定

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