Configurazione dispositivo

public class DeviceSetup
extends BaseTargetPreparer implements IExternalDependency

java.lang.Object
com.android.tradefed.targetprep.BaseTargetPreparer
com.android.tradefed.targetprep.DeviceSetup


Un ITargetPreparer che configura un dispositivo per il test in base alle Option fornite.

Richiede un dispositivo in cui sia possibile "adb root", in genere un tipo di build userdebug.

Dovrebbe essere eseguito dopo il flashing di una nuova build.

Nota: questo preparatore è pensato per laboratori di test continui e presuppone che il dispositivo in prova verrà flashato e cancellato prima dell'esecuzione successiva. Pertanto, esegue una pulizia minima durante lo smontaggio e non dovrebbe essere utilizzato in un modulo di test.

Riepilogo

Campi

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

Costruttori pubblici

DeviceSetup ()

Metodi pubblici

void changeSettings ( ITestDevice device)

Modificare le impostazioni sul dispositivo.

getDependencies ()
ITestDevice getDevice ( TestInformation testInfo)
boolean isForceSkipSystemProps ()
void processDeprecatedOptions ( ITestDevice device)

Elabora le opzioni deprecate convertendole nelle opzioni attualmente utilizzate.

void processOptions ( ITestDevice device)

Elabora tutte le Option e trasformale in oggetti di scena, impostazioni o comandi di esecuzione del sistema.

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

Metodo di supporto per aggiungere un comando di esecuzione ON/OFF da eseguire sul dispositivo.

void setGlobalSetting (String key, String value)

Esposto per test unitari

void setSecureSetting (String key, String value)

Esposto per test unitari

static void setSettingForBinaryState ( BinaryState state, MultiMap <String, String> settingsMap, String setting, String onValue, String offValue)

Metodo di supporto per aggiungere un'impostazione ON/OFF a una mappa delle impostazioni.

void setSystemSetting (String key, String value)

Esposto per test unitari

void setUp ( TestInformation testInfo)

void tearDown ( TestInformation testInfo, Throwable e)

Metodi protetti

void setAirplaneMode ( BinaryState airplaneMode)

Esposto per test unitari

void setAutoRotate ( BinaryState autoRotate)

Esposto per test unitari

void setAutoUpdateTime ( BinaryState autoUpdateTime)

Esposto per test unitari

void setAutoUpdateTimezone ( BinaryState autoUpdateTimezone)

Esposto per test unitari

void setBatterySaver ( BinaryState batterySaver)

Esposto per test unitari

void setBatterySaverTrigger (Integer batterySaverTrigger)

Esposto per test unitari

void setBluetooth ( BinaryState bluetooth)

Esposto per test unitari

void setCell ( BinaryState cell)
void setCellAutoSetting ( BinaryState cellAutoSetting)
void setData ( BinaryState data)
void setDefaultSimData (Integer defaultSimData)

Esposto per test unitari

void setDefaultSimSms (Integer defaultSimSms)

Esposto per test unitari

void setDefaultSimVoice (Integer defaultSimVoice)

Esposto per test unitari

void setDeprecatedAudioSilent (boolean silent)

Questo metodo è deprecato. utilizzare invece setDisableAudio(boolean) .

void setDeprecatedMinExternalStoreSpace (long storeSpace)

Questo metodo è deprecato. utilizzare invece setMinExternalStorageKb(long) .

void setDeprecatedSetProp (String prop)

Questo metodo è deprecato. utilizzare invece setProperty(String, String) .

void setDisableAudio (boolean disable)

Esposto per test unitari

void setDisableCwWifiMediator ( BinaryState disableCwWifiMediator)
void setDisableDalvikVerifier (boolean disableDalvikVerifier)

Esposto per test unitari

void setDisableDialing (boolean disableDialing)

Esposto per test unitari

void setDisableDoze (boolean disableDoze)

Esposto per test unitari

void setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory)

Esposto per test unitari

void setEthernet ( BinaryState ethernet)

Esposto per test unitari

void setForceRootSetup (boolean force)
void setForceSkipSystemProps (boolean force)

Esposto per test unitari

void setInstallNonMarketApps ( BinaryState installNonMarketApps)

Esposto per test unitari

void setLocalDataPath (File path)

Esposto per test unitari

void setLocationGps ( BinaryState locationGps)

Esposto per test unitari

void setLocationNetwork ( BinaryState locationNetwork)

Esposto per test unitari

void setMinExternalStorageKb (long storageKb)

Esposto per test unitari

void setNfc ( BinaryState nfc)

Esposto per test unitari

void setNotificationLed ( BinaryState notificationLed)

Esposto per test unitari

void setProperty (String key, String value)

Esposto per test unitari

void setRestoreProperties (boolean restoreProperties)

Esposto per test unitari

void setRestoreSettings (boolean restoreSettings)

Esposto per test unitari

void setScreenAdaptiveBrightness ( BinaryState screenAdaptiveBrightness)

Esposto per test unitari

void setScreenAlwaysOn ( BinaryState screenAlwaysOn)

Esposto per test unitari

void setScreenAmbientMode ( BinaryState screenAmbientMode)

Esposto per test unitari

void setScreenBrightness (Integer screenBrightness)

Esposto per test unitari

void setScreenSaver ( BinaryState screenSaver)

Esposto per test unitari

void setScreenTimeoutSecs (Long screenTimeoutSecs)

Esposto per test unitari

void setTestHarness (boolean setTestHarness)

Esposto per test unitari

void setTimezone (String timezone)

Esposto per test unitari

void setTriggerMediaMounted (boolean triggerMediaMounted)

Esposto per test unitari

void setWakeGesture ( BinaryState wakeGesture)

Esposto per test unitari

void setWifi ( BinaryState wifi)

Esposto per test unitari

void setWifiNetwork (String wifiNetwork)

Esposto per test unitari

void setWifiPsk (String wifiPsk)
void setWifiScanAlwaysEnabled ( BinaryState wifiScanAlwaysEnabled)

Esposto per test unitari

void setWifiSsidToPsk ( wifiSssidToPsk) setWifiSsidToPsk ( wifiSssidToPsk)
void setWifiWatchdog ( BinaryState wifiWatchdog)

Esposto per test unitari

Campi

mModalità aereo

protected BinaryState mAirplaneMode

mRotazione automatica

protected BinaryState mAutoRotate

mAutoUpdateTime

protected BinaryState mAutoUpdateTime

mAutoUpdateTimezone

protected BinaryState mAutoUpdateTimezone

mBatterySaver

protected BinaryState mBatterySaver

mBatterySaverTrigger

protected Integer mBatterySaverTrigger

mBluetooth

protected BinaryState mBluetooth

mCell

protected BinaryState mCell

mCellAutoSetting

protected BinaryState mCellAutoSetting

mData

protected BinaryState mData

mDefaultSimData

protected Integer mDefaultSimData

mDefaultSimSms

protected Integer mDefaultSimSms

mDefaultSimVoice

protected Integer mDefaultSimVoice

mDisabilita audio

protected boolean mDisableAudio

mDisableCwWifiMediator

protected BinaryState mDisableCwWifiMediator

mDisableDalvikVerifier

protected boolean mDisableDalvikVerifier

mDisabilita composizione

protected boolean mDisableDialing

mDisabilitaDoze

protected boolean mDisableDoze

mAbilita cronologia statistiche batteria completa

protected boolean mEnableFullBatteryStatsHistory

rete Ethernet

protected BinaryState mEthernet

mForceSkipRunCommands

protected boolean mForceSkipRunCommands

mForceSkipSettings

protected boolean mForceSkipSettings

mForceSkipSystemProps

protected boolean mForceSkipSystemProps

mGlobalSettings

protected MultiMap<String, String> mGlobalSettings

mHideErrorDialogs

protected BinaryState mHideErrorDialogs

mInstallNonMarketApps

protected BinaryState mInstallNonMarketApps

mLocalDataFile

protected File mLocalDataFile

mLocationGps

protected BinaryState mLocationGps

mLocationNetwork

protected BinaryState mLocationNetwork

mMinArchiviazione esternaKb

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

mScreenAdaptiveBrightness

protected BinaryState mScreenAdaptiveBrightness

mScreenAlwaysOn

protected BinaryState mScreenAlwaysOn

mScreenAmbientMode

protected BinaryState mScreenAmbientMode

mLuminositàschermo

protected Integer mScreenBrightness

mScreenSaver

protected BinaryState mScreenSaver

mScreenTimeoutSec

protected Long mScreenTimeoutSecs

mSecureSettings

protected MultiMap<String, String> mSecureSettings

mSetProps

protected  mSetProps

mSetTestHarness

protected boolean mSetTestHarness

mSyncTimezoneWithHost

protected BinaryState mSyncTimezoneWithHost

mImpostazioni di sistema

protected MultiMap<String, String> mSystemSettings

mTimezone

protected String mTimezone

mTriggerMediaMounted

protected boolean mTriggerMediaMounted

mWakeGesture

protected BinaryState mWakeGesture

mWiFi

protected BinaryState mWifi

mWifiPsk

protected String mWifiPsk

mWifiScanAlwaysEnabled

protected BinaryState mWifiScanAlwaysEnabled

mWifiSsid

protected String mWifiSsid

mWifiSsidToPsk

protected  mWifiSsidToPsk

mWiFiWatchdog

protected BinaryState mWifiWatchdog

Costruttori pubblici

Configurazione dispositivo

public DeviceSetup ()

Metodi pubblici

cambia impostazioni

public void changeSettings (ITestDevice device)

Modificare le impostazioni sul dispositivo.

Esposto in modo che le lezioni per bambini possano sovrascrivere.

Parametri
device ITestDevice : ITestDevice

Lancia
DeviceNotAvailableException se il dispositivo non è disponibile
TargetSetupError se si è verificato un errore durante la configurazione delle impostazioni

getDependencies

public  getDependencies ()

ritorna

getDevice

public ITestDevice getDevice (TestInformation testInfo)

Parametri
testInfo TestInformation

ritorna
ITestDevice

isForceSkipSystemProps

public boolean isForceSkipSystemProps ()

ritorna
boolean

processDeprecatedOptions

public void processDeprecatedOptions (ITestDevice device)

Elabora le opzioni deprecate convertendole nelle opzioni attualmente utilizzate.

Questo metodo deve essere eseguito prima di qualsiasi altro metodo di elaborazione. Genera un TargetSetupError se l'opzione deprecata sovrascrive un'opzione non deprecata specificata.

Parametri
device ITestDevice

Lancia
TargetSetupError se c'è un conflitto

processOptions

public void processOptions (ITestDevice device)

Elabora tutte le Option e trasformale in oggetti di scena, impostazioni o comandi di esecuzione del sistema. Al momento non esegue alcun comando sul dispositivo.

Esposto in modo che le classi per bambini possano prevalere su questo.

Parametri
device ITestDevice : ITestDevice

Lancia
DeviceNotAvailableException se il dispositivo non è disponibile
TargetSetupError se l' Option è in conflitto

setCommandForBinaryState

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

Metodo di supporto per aggiungere un comando di esecuzione ON/OFF da eseguire sul dispositivo.

Parametri
state BinaryState : Lo BinaryState

commands : l'elenco dei comandi a cui aggiungere il comando di attivazione o disattivazione.

onCommand String : il comando da eseguire se attivo. Ignorato se il comando è null

offCommand String : il comando da eseguire se OFF. Ignorato se il comando è null

setGlobalSetting

public void setGlobalSetting (String key, 
                String value)

Esposto per test unitari

Parametri
key String

value String

setSecureSetting

public void setSecureSetting (String key, 
                String value)

Esposto per test unitari

Parametri
key String

value String

setSettingForBinaryState

public static void setSettingForBinaryState (BinaryState state, 
                MultiMap<String, String> settingsMap, 
                String setting, 
                String onValue, 
                String offValue)

Metodo di supporto per aggiungere un'impostazione ON/OFF a una mappa delle impostazioni.

Parametri
state BinaryState : Lo BinaryState

settingsMap MultiMap : la MultiMap utilizzata per memorizzare le impostazioni.

setting String : la chiave di impostazione

onValue String : il valore se ON

offValue String : il valore se OFF

setImpostazionesistema

public void setSystemSetting (String key, 
                String value)

Esposto per test unitari

Parametri
key String

value String

impostare

public void setUp (TestInformation testInfo)

Parametri
testInfo TestInformation

Lancia
BuildError
DeviceNotAvailableException
TargetSetupError

demolire

public void tearDown (TestInformation testInfo, 
                Throwable e)

Parametri
testInfo TestInformation

e Throwable

Lancia
DeviceNotAvailableException

Metodi protetti

setModalitàaereo

protected void setAirplaneMode (BinaryState airplaneMode)

Esposto per test unitari

Parametri
airplaneMode BinaryState

setAutoRotate

protected void setAutoRotate (BinaryState autoRotate)

Esposto per test unitari

Parametri
autoRotate BinaryState

setAutoUpdateTime

protected void setAutoUpdateTime (BinaryState autoUpdateTime)

Esposto per test unitari

Parametri
autoUpdateTime BinaryState

setAutoUpdateTimezone

protected void setAutoUpdateTimezone (BinaryState autoUpdateTimezone)

Esposto per test unitari

Parametri
autoUpdateTimezone BinaryState

setBatterySaver

protected void setBatterySaver (BinaryState batterySaver)

Esposto per test unitari

Parametri
batterySaver BinaryState

setBatterySaverTrigger

protected void setBatterySaverTrigger (Integer batterySaverTrigger)

Esposto per test unitari

Parametri
batterySaverTrigger Integer

setBluetooth

protected void setBluetooth (BinaryState bluetooth)

Esposto per test unitari

Parametri
bluetooth BinaryState

setCell

protected void setCell (BinaryState cell)

Parametri
cell BinaryState

setCellAutoSetting

protected void setCellAutoSetting (BinaryState cellAutoSetting)

Parametri
cellAutoSetting BinaryState

setData

protected void setData (BinaryState data)

Parametri
data BinaryState

setDefaultSimData

protected void setDefaultSimData (Integer defaultSimData)

Esposto per test unitari

Parametri
defaultSimData Integer

setDefaultSimSms

protected void setDefaultSimSms (Integer defaultSimSms)

Esposto per test unitari

Parametri
defaultSimSms Integer

setDefaultSimVoice

protected void setDefaultSimVoice (Integer defaultSimVoice)

Esposto per test unitari

Parametri
defaultSimVoice Integer

setDeprecatedAudioSilent

protected void setDeprecatedAudioSilent (boolean silent)

Questo metodo è deprecato.
utilizzare invece setDisableAudio(boolean) .

Esposto per test unitari

Parametri
silent boolean

setDeprecatedMinExternalStoreSpace

protected void setDeprecatedMinExternalStoreSpace (long storeSpace)

Questo metodo è deprecato.
utilizzare invece setMinExternalStorageKb(long) .

Esposto per test unitari

Parametri
storeSpace long

setDeprecatedSetProp

protected void setDeprecatedSetProp (String prop)

Questo metodo è deprecato.
utilizzare invece setProperty(String, String) .

Esposto per test unitari

Parametri
prop String

setDisableAudio

protected void setDisableAudio (boolean disable)

Esposto per test unitari

Parametri
disable boolean

setDisableCwWifiMediator

protected void setDisableCwWifiMediator (BinaryState disableCwWifiMediator)

Parametri
disableCwWifiMediator BinaryState

setDisableDalvikVerifier

protected void setDisableDalvikVerifier (boolean disableDalvikVerifier)

Esposto per test unitari

Parametri
disableDalvikVerifier boolean

setDisableDialing

protected void setDisableDialing (boolean disableDialing)

Esposto per test unitari

Parametri
disableDialing boolean

setDisableDoze

protected void setDisableDoze (boolean disableDoze)

Esposto per test unitari

Parametri
disableDoze boolean

setEnableFullBatteryStatsHistory

protected void setEnableFullBatteryStatsHistory (boolean enableFullBatteryStatsHistory)

Esposto per test unitari

Parametri
enableFullBatteryStatsHistory boolean

setEthernet

protected void setEthernet (BinaryState ethernet)

Esposto per test unitari

Parametri
ethernet BinaryState

setForceRootSetup

protected void setForceRootSetup (boolean force)

Parametri
force boolean

setForceSkipSystemProps

protected void setForceSkipSystemProps (boolean force)

Esposto per test unitari

Parametri
force boolean

setInstallNonMarketApps

protected void setInstallNonMarketApps (BinaryState installNonMarketApps)

Esposto per test unitari

Parametri
installNonMarketApps BinaryState

setLocalDataPath

protected void setLocalDataPath (File path)

Esposto per test unitari

Parametri
path File

setLocationGps

protected void setLocationGps (BinaryState locationGps)

Esposto per test unitari

Parametri
locationGps BinaryState

setLocationNetwork

protected void setLocationNetwork (BinaryState locationNetwork)

Esposto per test unitari

Parametri
locationNetwork BinaryState

setMinExternalStorageKb

protected void setMinExternalStorageKb (long storageKb)

Esposto per test unitari

Parametri
storageKb long

setNfc

protected void setNfc (BinaryState nfc)

Esposto per test unitari

Parametri
nfc BinaryState

setNotificationLed

protected void setNotificationLed (BinaryState notificationLed)

Esposto per test unitari

Parametri
notificationLed BinaryState

setProperty

protected void setProperty (String key, 
                String value)

Esposto per test unitari

Parametri
key String

value String

setRestoreProperties

protected void setRestoreProperties (boolean restoreProperties)

Esposto per test unitari

Parametri
restoreProperties boolean

setRestoreSettings

protected void setRestoreSettings (boolean restoreSettings)

Esposto per test unitari

Parametri
restoreSettings boolean

setScreenAdaptiveBrightness

protected void setScreenAdaptiveBrightness (BinaryState screenAdaptiveBrightness)

Esposto per test unitari

Parametri
screenAdaptiveBrightness BinaryState

setScreenAlwaysOn

protected void setScreenAlwaysOn (BinaryState screenAlwaysOn)

Esposto per test unitari

Parametri
screenAlwaysOn BinaryState

setScreenAmbientMode

protected void setScreenAmbientMode (BinaryState screenAmbientMode)

Esposto per test unitari

Parametri
screenAmbientMode BinaryState

setLuminositàschermo

protected void setScreenBrightness (Integer screenBrightness)

Esposto per test unitari

Parametri
screenBrightness Integer

setScreenSaver

protected void setScreenSaver (BinaryState screenSaver)

Esposto per test unitari

Parametri
screenSaver BinaryState

setScreenTimeoutSec

protected void setScreenTimeoutSecs (Long screenTimeoutSecs)

Esposto per test unitari

Parametri
screenTimeoutSecs Long

setTestHarness

protected void setTestHarness (boolean setTestHarness)

Esposto per test unitari

Parametri
setTestHarness boolean

setTimezone

protected void setTimezone (String timezone)

Esposto per test unitari

Parametri
timezone String

setTriggerMediaMounted

protected void setTriggerMediaMounted (boolean triggerMediaMounted)

Esposto per test unitari

Parametri
triggerMediaMounted boolean

setWakeGesture

protected void setWakeGesture (BinaryState wakeGesture)

Esposto per test unitari

Parametri
wakeGesture BinaryState

setWifi

protected void setWifi (BinaryState wifi)

Esposto per test unitari

Parametri
wifi BinaryState

setWiFiNetwork

protected void setWifiNetwork (String wifiNetwork)

Esposto per test unitari

Parametri
wifiNetwork String

setWifiPsk

protected void setWifiPsk (String wifiPsk)

Parametri
wifiPsk String

setWifiScanAlwaysEnabled

protected void setWifiScanAlwaysEnabled (BinaryState wifiScanAlwaysEnabled)

Esposto per test unitari

Parametri
wifiScanAlwaysEnabled BinaryState

setWifiSsidToPsk

protected void setWifiSsidToPsk ( wifiSssidToPsk)

Parametri
wifiSssidToPsk

setWiFiWatchdog

protected void setWifiWatchdog (BinaryState wifiWatchdog)

Esposto per test unitari

Parametri
wifiWatchdog BinaryState