GoogleAccountUtil

public class GoogleAccountUtil
extends Object

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


أداة مساعدة تتيح إعداد حسابات Google على جهاز

ملخّص

الثوابت

String ACCOUNT_PKG_NAME

String UTIL_APK_NAME

الحقول

public static final String CHECK_INSTRUMENTATION_CMD

الإنشاءات العامة

GoogleAccountUtil()

الطُرق العامة

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

محاولة ضبط إعدادات الجهاز قيد الاختبار باستخدام حساب Google المحدّد

static boolean hasAccount(ITestDevice device, int userId)

تحقَّق مما إذا كان هناك حساب على الجهاز.

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

تثبيت حزمة APK لأداة الحساب المضمّنة في ملف JAR إذا لزم الأمر

static boolean isAccountUtilInstalled(ITestDevice device)

التحقّق مما إذا كانت أداة الحساب مثبّتة حاليًا

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

إزالة الحساب الفردي المحدّد

static boolean removeAllAccountAttempt(ITestDevice device, int userId)

إزالة جميع الحسابات من الجهاز

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

يؤدي هذا الخيار إلى إيقاف المزامنة مع حساب Google المحدّد.

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

تفعيل المزامنة مع حساب Google المحدّد

static boolean uninstallUtil(ITestDevice device)

إلغاء تثبيت حزمة APK لأداة الحساب المتوفّرة في ملف JAR

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

انتظِر إلى أن يكمل الجهاز عملية المزامنة.

الثوابت

ACCOUNT_PKG_NAME

public static final String ACCOUNT_PKG_NAME

القيمة الثابتة: "com.google.android.tradefed.account"

UTIL_APK_NAME

public static final String UTIL_APK_NAME

Constant Value: "GoogleAccountUtil"

الحقول

CHECK_INSTRUMENTATION_CMD

public static final String CHECK_INSTRUMENTATION_CMD

الإنشاءات العامة

GoogleAccountUtil

public GoogleAccountUtil ()

الطُرق العامة

addAccountAttempt

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

محاولة ضبط إعدادات الجهاز قيد الاختبار باستخدام حساب Google المحدّد

يجب أن يكون الحساب متوفّرًا على الخادم.

يتم عرضه لاختبار الوحدات.

المعلمات
device ITestDevice: ITestDevice

userId int: رقم تعريف المستخدم الذي سيتمّ إضافة الحساب إليه

accountName String: الاسم الكامل لحساب Google الذي تريد إضافته

password String: كلمة مرور الحساب

sync boolean: true إذا كان يجب تفعيل المزامنة التلقائية لهذا الحساب

waitForCheckin boolean: true للانتظار حتى يتم تسجيل الوصول بعد إضافة الحساب

المرتجعات
boolean true إذا تم إنشاء الحساب بنجاح، أو false في حال عدم توفّرها

الرميات
DeviceNotAvailableException

hasAccount

public static boolean hasAccount (ITestDevice device, 
                int userId)

تحقَّق مما إذا كان هناك حساب على الجهاز.

المعلمات
device ITestDevice: ITestDevice الذي تم التحقّق منه بحثًا عن حساب

userId int: رقم تعريف المستخدم الذي سيتم التحقّق منه

المرتجعات
boolean

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

installUtil

public static boolean installUtil (ITestDevice device)

المعلمات
device ITestDevice

المرتجعات
boolean

الرميات
DeviceNotAvailableException

installUtil

public static boolean installUtil (ITestDevice device, 
                File altApk)

تثبيت حزمة APK لأداة الحساب المضمّنة في ملف JAR إذا لزم الأمر

المعلمات
device ITestDevice: لتثبيت الأداة المساعدة.

altApk File

المرتجعات
boolean

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

isAccountUtilInstalled

public static boolean isAccountUtilInstalled (ITestDevice device)

التحقّق مما إذا كانت أداة الحساب مثبّتة حاليًا

المعلمات
device ITestDevice: لتحديد ما إذا كانت أداة الحساب مثبّتة

المرتجعات
boolean

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

removeAccountAttempt

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

إزالة الحساب الفردي المحدّد

المعلمات
accountName String

المرتجعات
boolean تعرض القيمة "صحيح" إذا تمت الإزالة بنجاح، و"خطأ" في الحالات الأخرى.

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

removeAllAccountAttempt

public static boolean removeAllAccountAttempt (ITestDevice device, 
                int userId)

إزالة جميع الحسابات من الجهاز

المرتجعات
boolean تعرض القيمة "صحيح" إذا تمت الإزالة بنجاح، و"خطأ" في الحالات الأخرى.

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

syncAndOff

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

يؤدي هذا الخيار إلى إيقاف المزامنة مع حساب Google المحدّد. افترِض أنّ المزامنة مفعَّلة.

المعلمات
device ITestDevice: ITestDevice

userId int: رقم تعريف المستخدم الذي سيتم تنفيذ هذه العملية عليه

accountName String: الاسم الكامل لحساب Google الذي سيتم إيقاف المزامنة فيه

syncThenOff long: عدد الثواني التي يُسمح فيها بتشغيل المزامنة قبل إيقافها

المرتجعات
boolean true إذا تم إيقاف المزامنة بنجاح

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

syncOn

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

تفعيل المزامنة مع حساب Google المحدّد افترِض أنّ المزامنة غير صحيحة؛

المعلمات
device ITestDevice: ITestDevice

userId int: رقم تعريف المستخدم الذي سيتم تنفيذ هذه العملية عليه

accountName String: الاسم الكامل لحساب Google الذي تريد تفعيل المزامنة فيه

المرتجعات
boolean true إذا تم إيقاف المزامنة بنجاح

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uninstallUtil

public static boolean uninstallUtil (ITestDevice device)

إلغاء تثبيت حزمة APK لأداة الحساب المتوفّرة في ملف JAR

المعلمات
device ITestDevice: لإلغاء تثبيت أداة الحساب.

المرتجعات
boolean

الرميات
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

waitForAccountSync

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

انتظِر إلى أن يكمل الجهاز عملية المزامنة.

المعلمات
device ITestDevice

userId int

interval long

timeout long

forceSync boolean

المرتجعات
boolean

الرميات
DeviceNotAvailableException