GoogleAccountUtil

public class GoogleAccountUtil
extends Object

java.lang.Object
   ↳ com.google.android.tradefed.util.GoogleAccountUtil


Ein Dienstprogramm, das die Konfiguration von Google-Konten auf einem Gerät unterstützt

Zusammenfassung

Konstanten

String ACCOUNT_PKG_NAME

String UTIL_APK_NAME

Felder

public static final String CHECK_INSTRUMENTATION_CMD

Öffentliche Konstruktoren

GoogleAccountUtil()

Öffentliche Methoden

static boolean addAccountAttempt(ITestDevice device, int userId, String accountName, String password, boolean sync, boolean waitForCheckin)

Versucht, das zu testende Gerät mit dem angegebenen Google-Konto zu konfigurieren.

static boolean hasAccount(ITestDevice device, int userId)

Prüfen Sie, ob auf dem Gerät ein Konto vorhanden ist.

static boolean installUtil(ITestDevice device)
static boolean installUtil(ITestDevice device, File altApk)

Installieren Sie bei Bedarf die im JAR enthaltene APK für das Konto-Dienstprogramm.

static boolean isAccountUtilInstalled(ITestDevice device)

Prüfen, ob das Konto-Dienstprogramm derzeit installiert ist

static boolean removeAccountAttempt(ITestDevice device, int userId, String accountName)

Das angegebene Konto entfernen

static boolean removeAllAccountAttempt(ITestDevice device, int userId)

Alle Konten vom Gerät entfernen

static boolean syncAndOff(ITestDevice device, int userId, String accountName, long syncThenOff)

Deaktiviert die Synchronisierung mit dem angegebenen Google-Konto.

static boolean syncOn(ITestDevice device, int userId, String accountName)

Aktiviert die Synchronisierung mit dem angegebenen Google-Konto.

static boolean uninstallUtil(ITestDevice device)

Deinstallieren Sie die APK-Datei für das Konto-Dienstprogramm, die in der JAR-Datei enthalten ist.

static boolean waitForAccountSync(ITestDevice device, int userId, long interval, long timeout, boolean forceSync)

Warte, bis die Synchronisierung abgeschlossen ist.

Konstanten

ACCOUNT_PKG_NAME

public static final String ACCOUNT_PKG_NAME

Constant Value: "com.google.android.tradefed.account"

UTIL_APK_NAME

public static final String UTIL_APK_NAME

Constant Value: "GoogleAccountUtil"

Felder

CHECK_INSTRUMENTATION_CMD

public static final String CHECK_INSTRUMENTATION_CMD

Öffentliche Konstruktoren

GoogleAccountUtil

public GoogleAccountUtil ()

Öffentliche Methoden

addAccountAttempt

public static boolean addAccountAttempt (ITestDevice device, 
                int userId, 
                String accountName, 
                String password, 
                boolean sync, 
                boolean waitForCheckin)

Versucht, das zu testende Gerät mit dem angegebenen Google-Konto zu konfigurieren.

Das Konto muss bereits auf dem Server vorhanden sein.

Für Einheitentests verfügbar gemacht.

Parameter
device ITestDevice: die ITestDevice

userId int: die ID des Nutzers, dem das Konto hinzugefügt wird

accountName String: Vollständiger Name des hinzuzufügenden Google-Kontos

password String: Passwort des Kontos

sync boolean: true, wenn die automatische Synchronisierung für dieses Konto aktiviert werden soll

waitForCheckin boolean: true, um nach dem Hinzufügen des Kontos auf den Check-in zu warten

Returns
boolean true, wenn das Konto erfolgreich erstellt wurde, andernfalls false

Ausgabe
DeviceNotAvailableException

hasAccount

public static boolean hasAccount (ITestDevice device, 
                int userId)

Prüfen Sie, ob auf dem Gerät ein Konto vorhanden ist.

Parameter
device ITestDevice: die ITestDevice, die für ein Konto geprüft wurde

userId int: die zu prüfende Nutzer-ID

Returns
boolean

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

installUtil

public static boolean installUtil (ITestDevice device)

Parameter
device ITestDevice

Returns
boolean

Ausgabe
DeviceNotAvailableException

installUtil

public static boolean installUtil (ITestDevice device, 
                File altApk)

Installieren Sie bei Bedarf die im JAR enthaltene APK für das Konto-Dienstprogramm.

Parameter
device ITestDevice: Das Betriebssystem, auf dem das Dienstprogramm installiert werden soll.

altApk File

Returns
boolean

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

isAccountUtilInstalled

public static boolean isAccountUtilInstalled (ITestDevice device)

Prüfen, ob das Konto-Dienstprogramm derzeit installiert ist

Parameter
device ITestDevice: auf dem geprüft werden soll, ob das Konto-Dienstprogramm installiert ist

Returns
boolean

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

removeAccountAttempt

public static boolean removeAccountAttempt (ITestDevice device, 
                int userId, 
                String accountName)

Das angegebene Konto entfernen

Parameter
accountName String

Returns
boolean „true“, wenn das Entfernen erfolgreich war, andernfalls „false“.

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

removeAllAccountAttempt

public static boolean removeAllAccountAttempt (ITestDevice device, 
                int userId)

Alle Konten vom Gerät entfernen

Returns
boolean „true“, wenn das Entfernen erfolgreich war, andernfalls „false“.

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

syncAndOff

public static boolean syncAndOff (ITestDevice device, 
                int userId, 
                String accountName, 
                long syncThenOff)

Deaktiviert die Synchronisierung mit dem angegebenen Google-Konto. Die Synchronisierung ist aktiviert.

Parameter
device ITestDevice: die ITestDevice

userId int: die ID des Nutzers, für den dieser Vorgang ausgeführt werden soll

accountName String: Vollständiger Name des Google-Kontos, für das die Synchronisierung deaktiviert werden soll

syncThenOff long: Anzahl der Sekunden, die für die Synchronisierung zur Verfügung stehen, bevor sie deaktiviert wird

Returns
boolean true, wenn die Synchronisierung erfolgreich deaktiviert wurde

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

syncOn

public static boolean syncOn (ITestDevice device, 
                int userId, 
                String accountName)

Aktiviert die Synchronisierung mit dem angegebenen Google-Konto. Angenommen, die Synchronisierung ist falsch.

Parameter
device ITestDevice: die ITestDevice

userId int: die ID des Nutzers, für den dieser Vorgang ausgeführt werden soll

accountName String: Vollständiger Name des Google-Kontos, für das die Synchronisierung aktiviert werden soll

Returns
boolean true, wenn die Synchronisierung erfolgreich deaktiviert wurde

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uninstallUtil

public static boolean uninstallUtil (ITestDevice device)

Deinstallieren Sie die APK-Datei für das Konto-Dienstprogramm, die in der JAR-Datei enthalten ist.

Parameter
device ITestDevice: Das Konto-Dienstprogramm, das deinstalliert werden soll.

Returns
boolean

Ausgabe
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

waitForAccountSync

public static boolean waitForAccountSync (ITestDevice device, 
                int userId, 
                long interval, 
                long timeout, 
                boolean forceSync)

Warte, bis die Synchronisierung abgeschlossen ist.

Parameter
device ITestDevice

userId int

interval long

timeout long

forceSync boolean

Returns
boolean

Ausgabe
DeviceNotAvailableException