TestAppInstallSetup
public class TestAppInstallSetup
extends BaseTargetPreparer
implements IAbiReceiver
java.lang.Object | ||
↳ | com.android.tradefed.targetprep.BaseTargetPreparer | |
↳ | com.android.tradefed.targetprep.TestAppInstallSetup |
Un ITargetPreparer
che installa una o più app da una IDeviceBuildInfo#getTestsDir()
sul dispositivo.
Questo preparatore cercherà in directory alternative se lo zip dei test non esiste o non contiene l'apk richiesto. La ricerca andrà in ordine dall'ultima directory alternativa specificata alla prima.
Sommario
Costruttori pubblici | |
---|---|
TestAppInstallSetup () |
Metodi pubblici | |
---|---|
void | addInstallArg (String arg) Aggiunge un argomento di installazione apk da utilizzare. |
void | addSplitApkFileNames (String fileNames) Aggiunge una serie di nomi di file divisi per "," in una stringa da installare come apk divisi |
void | addTestFile (File file) Aggiunge un file o una directory all'elenco degli apk da installare. |
void | addTestFileName (String fileName) Aggiunge un nome file all'elenco degli apk da installare. |
IAbi | getAbi () |
ITestDevice | getDevice () Restituisce il dispositivo a cui deve rivolgersi il preparatore. |
TestInformation | getTestInfo () |
getTestsFileName () Restituisce una copia dell'elenco dei nomi apk di prova specificati. | |
boolean | isCleanUpEnabled () Restituisce True se gli Apks verranno ripuliti durante lo smontaggio. |
final boolean | isInstantMode () Restituisce se l'installazione in modalità istantanea è stata abilitata o meno. |
void | setAaptVersion ( AaptParser.AaptVersion aaptVersion) Imposta la versione di AAPT per l'analisi dell'APK. |
void | setAbi (IAbi abi) |
void | setAltDir (File altDir) Imposta una directory alternativa. |
void | setAltDirBehavior ( AltDirBehavior altDirBehavior) Imposta comportamenti di directory alternativi. |
void | setCleanApk (boolean shouldClean) Imposta se l'apk installato deve essere pulito o meno al tearDown |
final void | setInstantMode (boolean mode) Imposta se usare o meno --instant durante l'installazione dell'apk. |
void | setShouldGrantPermission (boolean shouldGrant) Se viene fornito un ID utente, è possibile impostare grantPermission per l'installazione dell'apk. |
void | setUp (ITestDevice device, IBuildInfo buildInfo) Questo metodo è deprecato. Richiamata temporanea compatibile con le versioni precedenti. |
void | setUp (TestInformation testInfo) |
void | setUserId (int userId) Se l'apk deve essere installato per un particolare utente, imposta l'id dell'utente per cui installare. |
void | tearDown (TestInformation testInfo, Throwable e)
|
Metodi protetti | |
---|---|
File | getLocalPathForFilename (TestInformation testInfo, String apkFileName) Risolvi il percorso apk effettivo in base al test delle informazioni sugli artefatti all'interno delle informazioni sulla build. |
void | installer (TestInformation testInfo, appFilesAndPackages) installer (TestInformation testInfo, appFilesAndPackages) Tentare di installare un pacchetto o dividere il pacchetto sul dispositivo. |
String | parsePackageName (File testAppFile, DeviceDescriptor deviceDescriptor) Ottieni il nome del pacchetto dall'app di prova. |
resolveApkFiles (TestInformation testInfo, apkFiles) resolveApkFiles (TestInformation testInfo, apkFiles) Aiuto per risolvere alcuni apk nel loro file e pacchetto. | |
void | setTestInformation (TestInformation testInfo) |
void | uninstallPackage (ITestDevice device, String packageName) Tenta di rimuovere il pacchetto dal dispositivo. |
Costruttori pubblici
TestAppInstallSetup
public TestAppInstallSetup ()
Metodi pubblici
addInstallArg
public void addInstallArg (String arg)
Aggiunge un argomento di installazione apk da utilizzare.
Parametri | |
---|---|
arg | String |
addSplitApkFileNames
public void addSplitApkFileNames (String fileNames)
Aggiunge una serie di nomi di file divisi per "," in una stringa da installare come apk divisi
Parametri | |
---|---|
fileNames | String : una stringa di nomi di file divisa per "," |
addTestFile
public void addTestFile (File file)
Aggiunge un file o una directory all'elenco degli apk da installare.
Parametri | |
---|---|
file | File |
addTestFileName
public void addTestFileName (String fileName)
Aggiunge un nome file all'elenco degli apk da installare.
Parametri | |
---|---|
fileName | String |
getAbi
public IAbi getAbi ()
ritorna | |
---|---|
IAbi |
getDevice
public ITestDevice getDevice ()
Restituisce il dispositivo a cui deve rivolgersi il preparatore.
ritorna | |
---|---|
ITestDevice |
Lancia | |
---|---|
TargetSetupError |
getTestInfo
public TestInformation getTestInfo ()
ritorna | |
---|---|
TestInformation |
getTestsFileName
publicgetTestsFileName ()
Restituisce una copia dell'elenco dei nomi apk di prova specificati.
ritorna | |
---|---|
isCleanUpEnabled
public boolean isCleanUpEnabled ()
Restituisce True se gli Apks verranno ripuliti durante lo smontaggio.
ritorna | |
---|---|
boolean |
isInstantMode
public final boolean isInstantMode ()
Restituisce se l'installazione in modalità istantanea è stata abilitata o meno.
ritorna | |
---|---|
boolean |
setAaptVersion
public void setAaptVersion (AaptParser.AaptVersion aaptVersion)
Imposta la versione di AAPT per l'analisi dell'APK.
Parametri | |
---|---|
aaptVersion | AaptParser.AaptVersion |
setAbi
public void setAbi (IAbi abi)
Parametri | |
---|---|
abi | IAbi |
setAltDir
public void setAltDir (File altDir)
Imposta una directory alternativa.
Parametri | |
---|---|
altDir | File |
setAltDirBehavior
public void setAltDirBehavior (AltDirBehavior altDirBehavior)
Imposta comportamenti di directory alternativi.
Parametri | |
---|---|
altDirBehavior | AltDirBehavior |
setCleanApk
public void setCleanApk (boolean shouldClean)
Imposta se l'apk installato deve essere pulito o meno al tearDown
Parametri | |
---|---|
shouldClean | boolean |
setInstantMode
public final void setInstantMode (boolean mode)
Imposta se usare o meno --instant durante l'installazione dell'apk. Non avrà effetto se è impostata la modalità di installazione forzata.
Parametri | |
---|---|
mode | boolean |
setShouldGrantPermission
public void setShouldGrantPermission (boolean shouldGrant)
Se viene fornito un ID utente, è possibile impostare grantPermission per l'installazione dell'apk.
Parametri | |
---|---|
shouldGrant | boolean |
impostare
public void setUp (ITestDevice device, IBuildInfo buildInfo)
Questo metodo è deprecato.
Richiamata temporanea compatibile con le versioni precedenti.
Parametri | |
---|---|
device | ITestDevice |
buildInfo | IBuildInfo |
Lancia | |
---|---|
BuildError | |
DeviceNotAvailableException | |
TargetSetupError |
impostare
public void setUp (TestInformation testInfo)
Parametri | |
---|---|
testInfo | TestInformation |
Lancia | |
---|---|
BuildError | |
DeviceNotAvailableException | |
TargetSetupError |
setUserId
public void setUserId (int userId)
Se l'apk deve essere installato per un particolare utente, imposta l'id dell'utente per cui installare.
Parametri | |
---|---|
userId | int |
demolire
public void tearDown (TestInformation testInfo, Throwable e)
Parametri | |
---|---|
testInfo | TestInformation |
e | Throwable |
Lancia | |
---|---|
DeviceNotAvailableException |
Metodi protetti
getLocalPathForFilename
protected File getLocalPathForFilename (TestInformation testInfo, String apkFileName)
Risolvi il percorso apk effettivo in base al test delle informazioni sugli artefatti all'interno delle informazioni sulla build.
Parametri | |
---|---|
testInfo | TestInformation : TestInformation per l'invocazione. |
apkFileName | String : nome del file dell'apk da installare |
ritorna | |
---|---|
File | un ERROR(/File) rappresenta il file apk fisico sull'host o null se il file non esiste. |
Lancia | |
---|---|
TargetSetupError |
installatore
protected void installer (TestInformation testInfo,appFilesAndPackages)
Tentare di installare un pacchetto o dividere il pacchetto sul dispositivo.
Parametri | |
---|---|
testInfo | TestInformation : il TestInformation per l'invocazione |
appFilesAndPackages |
Lancia | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
parsePackageName
protected String parsePackageName (File testAppFile, DeviceDescriptor deviceDescriptor)
Ottieni il nome del pacchetto dall'app di prova.
Parametri | |
---|---|
testAppFile | File |
deviceDescriptor | DeviceDescriptor |
ritorna | |
---|---|
String |
Lancia | |
---|---|
TargetSetupError |
resolApkFiles
protectedresolveApkFiles (TestInformation testInfo, apkFiles)
Aiuto per risolvere alcuni apk nel loro file e pacchetto.
Parametri | |
---|---|
testInfo | TestInformation |
apkFiles |
ritorna | |
---|---|
Lancia | |
---|---|
TargetSetupError |
setTestInformation
protected void setTestInformation (TestInformation testInfo)
Parametri | |
---|---|
testInfo | TestInformation |
installPackage
protected void uninstallPackage (ITestDevice device, String packageName)
Tenta di rimuovere il pacchetto dal dispositivo.
Parametri | |
---|---|
device | ITestDevice |
packageName | String |
Lancia | |
---|---|
DeviceNotAvailableException |