NativeCihaz

public class NativeDevice
extends Object implements IManagedTestDevice , IConfigurationReceiver , ITestLoggerReceiver

java.lang.Object
com.android.tradefed.device.NativeDevice


ITestDevice Tam yığın olmayan android cihazların varsayılan uygulaması.

Özet

İç içe sınıflar

class NativeDevice.AdbAction

Bir işletim sistemi 'adb ....' komutunu çalıştırmak için bir ERROR(DeviceAction/com.android.tradefed.device.NativeDevice.DeviceAction DeviceAction) .

class NativeDevice.AdbShellAction

class NativeDevice.RebootDeviceAction

Bir cihazı yeniden başlatmak için ERROR(DeviceAction/com.android.tradefed.device.NativeDevice.DeviceAction DeviceAction) .

sabitler

int INVALID_USER_ID

Herhangi bir geçersiz/bulunamayan kullanıcı kimliği için döndürülen değer: UserHandle, -10000 değerini tanımladı

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

gerçekleştirmek için varsayılan komut yeniden deneme denemesi sayısı

alanlar

protected static final String SD_CARD

protected static final String STORAGE_EMULATED

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

kamu inşaatçılar

NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Bir TestDevice oluşturur.

Genel yöntemler

void batchPrefetchStartupBuildProps ()

Her biri için 'adb getprop' demek yerine ihtiyacımız olan tüm donanımları önceden getirerek mikro optimizasyon (yaklaşık 400 milyon).

boolean canSwitchToHeadlessSystemUser ()

Başsız SYSTEM kullanıcısına geçişe izin verilip verilmediğini döndürür.

boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Asgari düzeyde desteklenen bir özelliğin şu anda desteklenip desteklenmediğini kontrol edin.

boolean checkConnectivity ()

Cihazın ağ bağlantısına sahip olduğunu kontrol edin.

boolean clearErrorDialogs ()

Şu anda cihaz kullanıcı arayüzünde görüntülenen tüm hata iletişim kutularını kapatmayı deneyin.

void clearLastConnectedWifiNetwork ()

Son bağlanan wifi ağını temizler.

void clearLogcat ()

Birikmiş tüm logcat verilerini siler.

boolean connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid)

Bir wifi ağına bağlanır.

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)

Bir wifi ağına bağlanır.

boolean connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk)

Bir wifi ağına bağlanır.f

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)

Bir wifi ağına bağlanır.

boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)

Yalnızca cihazın şu anda ağ bağlantısı yoksa bağlanan bir connectToWifiNetwork(String, String) çeşidi.

boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)

Yalnızca cihazın şu anda ağ bağlantısı yoksa bağlanan bir connectToWifiNetwork(String, String) çeşidi.

int createUser (String name, boolean guest, boolean ephemeral)

Belirli bir ada ve sağlanan bayraklara sahip bir kullanıcı oluşturun

int createUser (String name, boolean guest, boolean ephemeral, boolean forTesting)

Belirli bir ada ve sağlanan bayraklara sahip bir kullanıcı oluşturun

int createUser (String name)

Belirli bir ada ve varsayılan bayraklara 0 sahip bir kullanıcı oluşturun.

int createUserNoThrow (String name)

Belirli bir ada ve varsayılan bayraklara 0 sahip bir kullanıcı oluşturun.

void deleteFile (String deviceFilePath)

Cihazdaki bir dosya veya dizini silmek için yardımcı yöntem.

void deregisterDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver)

Kayıtlı IDeviceActionReceiver öğesini kaldırır.

boolean deviceSoftRestarted ( ProcessInfo prevSystemServerProcess)

Geçerli system_server ile önceki system_server ProcessInfo karşılaştırarak aygıtın yazılımsal olarak yeniden başlatılıp başlatılmadığını kontrol etmek için yardımcı yöntem.

boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

Cihazın UTC zamanından beri cihazdan ve ERROR(/TimeUnit) cihazından yeniden başlatılıp başlatılmadığını kontrol etmek için yardımcı yöntem.

boolean disableAdbRoot ()

Adb kökünü kapatır.

void disableKeyguard ()

Tuş kilidini devre dışı bırakma girişimleri.

boolean disableNetworkMonitor ()

Cihazda ağ izlemeyi devre dışı bırakır.

boolean disconnectFromWifi ()

Bir wifi ağından bağlantıyı keser.

boolean doesFileExist (String deviceFilePath, int userId)

Belirli bir kullanıcı için aygıtta dosya olup olmadığını belirlemek için yardımcı yöntem.

boolean doesFileExist (String deviceFilePath)

Aygıtta dosya olup olmadığını belirlemek için yardımcı yöntem.

File dumpHeap (String process, String devicePath)

Yığını system_server'dan boşaltmayı deneyin.

boolean enableAdbRoot ()

Adb kökünü açar.

boolean enableNetworkMonitor ()

Cihazda ağ izlemeyi etkinleştirir.

String executeAdbCommand (long timeout, String... cmdArgs)

Bir adb komutunu belirtilen bir zaman aşımına sahip bir sistem komutu olarak yürüten yardımcı yöntem.

String executeAdbCommand (long timeout, envMap, String... cmdArgs) executeAdbCommand (long timeout, envMap, String... cmdArgs)

Bir adb komutunu belirtilen bir zaman aşımına sahip bir sistem komutu olarak yürüten yardımcı yöntem.

String executeAdbCommand (String... cmdArgs)

Adb komutunu sistem komutu olarak yürüten yardımcı yöntem.

CommandResult executeFastbootCommand (String... cmdArgs)

Fastboot komutunu, varsayılan 2 dakikalık zaman aşımı süresiyle sistem komutu olarak yürüten yardımcı yöntem.

CommandResult executeFastbootCommand (long timeout, String... cmdArgs)

Bir fastboot komutunu bir sistem komutu olarak yürüten yardımcı yöntem.

CommandResult executeLongFastbootCommand (String... cmdArgs)

Uzun süre çalışan bir fastboot komutunu bir sistem komutu olarak yürüten yardımcı yöntem.

CommandResult executeLongFastbootCommand ( envVarMap, String... cmdArgs) executeLongFastbootCommand ( envVarMap, String... cmdArgs)

Uzun süre çalışan bir fastboot komutunu, sistem ortamı değişkenleriyle bir sistem komutu olarak yürüten yardımcı yöntem.

String executeShellCommand (String command)

Bir adb Shell komutunu yürüten ve çıktıyı String olarak döndüren yardımcı yöntem.

void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

Komut davranışını kontrol etmek için daha fazla parametre içeren bir adb kabuğu komutu yürütür.

void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

Komut davranışını kontrol etmek için daha fazla parametre içeren bir adb kabuğu komutu yürütür.

void executeShellCommand (String command, IShellOutputReceiver receiver)

Verilen adb shell komutunu yürütür, komut başarısız olursa birden çok kez yeniden dener.

CommandResult executeShellV2Command (String cmd)

Bir adb kabuk komutunu yürüten ve sonuçları, komut durum çıktısı, stdout ve stderr ile uygun şekilde doldurulmuş bir CommandResult olarak döndüren yardımcı yöntem.

CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)

Bir adb kabuk komutunu yürüten ve sonuçları, komut durumu çıktısı ve stderr ile uygun şekilde doldurulmuş bir CommandResult olarak döndüren yardımcı yöntem.

CommandResult executeShellV2Command (String cmd, File pipeAsInput)

Bir adb kabuk komutunu yürüten ve sonuçları, komut durumu çıktısı, stdout ve stderr ile uygun şekilde doldurulmuş bir CommandResult olarak döndüren yardımcı yöntem.

CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

Komut davranışını kontrol etmek için daha fazla parametre içeren bir adb kabuğu komutu yürütür.

CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)

Komut davranışını kontrol etmek için daha fazla parametre içeren bir adb kabuğu komutu yürütür.

CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

Komut davranışını kontrol etmek için daha fazla parametre içeren bir adb kabuğu komutu yürütür.

CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

Komut davranışını kontrol etmek için daha fazla parametre içeren bir adb kabuğu komutu yürütür.

CommandResult fastbootWipePartition (String partition)

Aygıt için bir bölümü silen yardımcı yöntem.

getActiveApexes ()

Cihazda etkinleştirilen APEX'ler hakkındaki bilgileri getirin.

getAllSettings (String namespace)

İstenen ad alanının anahtar değer çiftlerini döndürür.

DeviceAllocationState getAllocationState ()

Cihazın mevcut tahsis durumunu döndür

String getAndroidId (int userId)

Bir userId ile ilişkilendirilmiş android kimliğini bulun ve bulunmazsa null değerini döndürün.

getAndroidIds ()

Eşleşen kullanıcı kimlikleri bulunan android kimliklerinin bir Haritası oluşturun.

int getApiLevel ()

Cihaz API Düzeyini edinin.

PackageInfo getAppPackageInfo (String packageName)

Cihazda yüklü bir paket hakkında bilgi alın.

getAppPackageInfos ()

Cihazda yüklü olan paketlerin bilgilerini alın.

String getBasebandVersion ()

Bu cihazın temel bant (radyo) sürümünü almak için kolaylık yöntemi.

Integer getBattery ()

Bir cihazın mevcut pil seviyesini veya pil seviyesi mevcut değilse Null değerini döndürür.

boolean getBooleanProperty (String name, boolean defaultValue)

Verilen özelliğin boole değerini döndürür.

getBootHistory ()

Yardımcı yöntem, önyükleme geçmişi haritasını önyükleme zamanı ve önyükleme nedeni ile toplar.

getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

Yardımcı yöntem, önyükleme geçmişi haritasını, önyükleme zamanı ve önyükleme nedeni ile cihazdan çağdan bu yana verilen süre ve belirtilen zaman birimini toplar.

String getBootloaderVersion ()

Bu cihazın önyükleyici sürümünü almak için kolaylık yöntemi.

InputStreamSource getBugreport ()

Cihazdan bir hata raporu alır.

InputStreamSource getBugreportz ()

Cihazdan bir hata raporu alır.

String getBuildAlias ()

Cihazın şu anda çalışmakta olduğu yapının diğer adını alın.

String getBuildFlavor ()

Cihaz için yapı lezzetini alın.

String getBuildId ()

Cihazın şu anda çalışmakta olduğu yapıyı alın.

String getBuildSigningKeys ()

Cihaz görüntüsünü imzalamak için kullanılan anahtar tipini döndürür

Tipik olarak Android cihazlar, test anahtarlarıyla (AOSP'deki gibi) veya serbest bırakma anahtarlarıyla (bireysel cihaz üreticileri tarafından kontrol edilir) imzalanabilir.

DeviceDescriptor getCachedDeviceDescriptor ()

Aygıt ayrılmışsa önbelleğe alınmış bir DeviceDescriptor döndürür, aksi takdirde geçerli DeviceDescriptor döndürür.

DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Aygıt ayrılmışsa önbelleğe alınmış bir DeviceDescriptor döndürür, aksi takdirde geçerli DeviceDescriptor döndürür.

String[] getChildren (String path)

Bazen izinler nedeniyle çalışmayan IFileEntry kullanmaya alternatif.

AbstractConnection getConnection ()

Cihazla ilişkili geçerli bağlantı.

DeviceFoldableState getCurrentFoldableState ()

Cihazın mevcut katlanabilir durumunu veya bazı sorunlar meydana geldiyse null değerini döndürür.

int getCurrentUser ()

Geçerli çalışan kullanıcının kimliğini döndürür.

String getDeviceClass ()

Cihaz sınıfını alın.

long getDeviceDate ()

Epoch'tan bu yana aygıtın tarihini milisaniye cinsinden döndürür.

DeviceDescriptor getDeviceDescriptor ()

Gerçek cihaz nesnesini geçirmeden hakkında bilgi almak için cihaz bilgisinden bir DeviceDescriptor döndürün.

DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Gerçek cihaz nesnesini geçirmeden hakkında bilgi almak için cihaz bilgisinden bir DeviceDescriptor döndürün.

TestDeviceState getDeviceState ()

Cihazın durumunu alın.

long getDeviceTimeOffset (Date date)

Cihaz ile belirli bir ERROR(/Date) arasındaki zaman farkını almak için yardımcı.

InputStreamSource getEmulatorOutput ()

Öykünücü stdout ve stderr akışını alın

Process getEmulatorProcess ()

Bu öykünücüye karşılık gelen Process döndürün.

final File getExecuteShellCommandLog ()

Tüm executeShellCommand(String) günlüklerini içeren günlük.

long getExternalStoreFreeSpace ()

Cihazın harici depolama alanındaki boş alan miktarını belirlemek için yardımcı yöntem.

String getFastbootPath ()

Kullanılan fastboot ikili dosyasının yolunu döndürür.

String getFastbootProductType ()

Fastboot modundayken bu cihazın ürün tipini almanın kolaylık yöntemi.

String getFastbootProductVariant ()

Fastboot modundayken bu cihazın ürün tipini almanın kolaylık yöntemi.

String getFastbootSerialNumber ()

Fastboot modu seri numarasını döndürür.

String getFastbootVariable (String variableName)

Verilen fastboot değişken değerini cihazdan alın.

String getFastbootVersion ()

Kullanılan fastboot ikili dosyasının sürüm dizesini döndürür.

IFileEntry getFileEntry (String path)

Cihazdaki uzak bir dosyaya referans alın.

IFileEntry getFileEntry (FileListingService.FileEntry entry)

Kök olmayan bir yoldan FileEntry almak için resmi olmayan yardımcı.

getFoldableStates ()

Cihazdaki katlanabilir durumların listesini döndürür.

IDevice getIDevice ()

İlişkili ddmlib IDevice başvurusunu döndürür.

getInstalledPackageNames ()

Cihazda bulunan uygulama paketi adlarını getirin.

long getIntProperty (String name, long defaultValue)

Cihazdan verilen özelliğin tamsayı değerini döndürür.

String getIpAddress ()

Cihazın IP adresini alır.

KeyguardControllerState getKeyguardState ()

Tuş kilidinin mevcut durumunu almak için bir nesne veya desteklenmiyorsa null döndürün.

long getLastExpectedRebootTimeMillis ()

System.currentTimeMillis() tarafından döndürülen EPOCH'tan bu yana Tradefed API'lerinin milisaniye cinsinden en son ne zaman yeniden başlatmayı tetiklediğini döndürür.

int getLaunchApiLevel ()

Cihazın ilk başlatılan API Düzeyini edinin.

InputStreamSource getLogcat ()

Logcat verilerinin anlık görüntü akışını yakalar.

InputStreamSource getLogcat (int maxBytes)

Yakalanan logcat verilerinin son maxBytes anlık görüntü akışını yakalar.

InputStreamSource getLogcatDump ()

Cihaz için geçerli logcat dökümünü alın.

InputStreamSource getLogcatSince (long date)

Sağlanan tarihten başlayarak yakalanan logcat verilerinin anlık görüntü akışını yakalar.

String getMacAddress ()

Aygıttan sorgulama başarısız olursa, aygıtın MAC adresini null olarak döndürür.

Integer getMainUserId ()

Ana kullanıcı kimliğini döndürür.

getMainlineModuleInfo ()

Cihazda yüklü olan ana hat modülleri hakkında bilgi alın.

int getMaxNumberOfRunningUsersSupported ()

Desteklenen maksimum eşzamanlı çalışan kullanıcı sayısını elde edin.

int getMaxNumberOfUsersSupported ()

Desteklenen maksimum kullanıcı sayısını elde edin.

Process getMicrodroidProcess ()
IDeviceStateMonitor getMonitor ()

Cihazla ilişkili IDeviceStateMonitor döndürün.

String getMountPoint (String mountName)

Bir bağlama noktası döndürür.

ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

Belirtilen bağlama noktası yoluna karşılık gelen bir MountPointInfo döndürür veya bu yolda bağlı hiçbir şey yoksa veya /proc/mounts içinde bir bağlama noktası olarak görünmüyorsa null döndürür.

getMountPointInfo ()

Cihazdaki /proc/mounts içindeki bilgilerin ayrıştırılmış bir sürümünü döndürür

TestDeviceOptions getOptions ()

Cihaz için test seçeneklerini getirin.

long getPartitionFreeSpace (String partition)

Aygıt bölümündeki boş alan miktarını belirlemek için yardımcı yöntem.

Integer getPrimaryUserId ()

Birincil kullanıcı kimliğini döndürür.

ProcessInfo getProcessByName (String processName)

Helper method "pidof" ve "stat" komutunu çalıştırır ve PID ile ProcessInfo nesnesini ve verilen işlemin işlem başlama saatini döndürür.

String getProcessPid (String process)

Hizmetin pid'ini veya bir şeyler ters giderse boş değeri döndürür.

String getProductType ()

Bu cihazın ürün tipini elde etmek için kolaylık yöntemi.

String getProductVariant ()

Bu cihazın ürün varyantını elde etmek için kolaylık yöntemi.

String getProperty (String name)

Verilen özellik değerini cihazdan alın.

ITestDevice.RecoveryMode getRecoveryMode ()

Cihaz için kullanılan geçerli kurtarma modunu edinin.

InputStreamSource getScreenshot (String format)

Cihazdan bir ekran görüntüsü alır.

InputStreamSource getScreenshot (long displayId)

Ekran kimliği verilen cihazdan bir ekran görüntüsü alır.

InputStreamSource getScreenshot (String format, boolean rescale)

Cihazdan bir ekran görüntüsü alır.

InputStreamSource getScreenshot ()

Cihazdan bir ekran görüntüsü alır.

String getSerialNumber ()

Bu cihazın seri numarasını almak için kolaylık yöntemi.

String getSetting (int userId, String namespace, String key)

İstenen ayarın değerini döndürün.

String getSetting (String namespace, String key)

getSetting(int, String, String) bakın ve sistem kullanıcısı üzerinde gerçekleştirilir.

String getSimOperator ()

SIM kart operatörünü iade edin veya mevcut değilse veya cihaz mevcut değilse boş bırakın.

String getSimState ()

Mevcut değilse veya cihaz mevcut değilse, SIM kart durumunu veya null değerini döndürün.

getTombstones ()

Cihazlardan mezar taşları listesini getirin ve iade edin.

long getTotalMemory ()

Dahili hata durumunda toplam fiziksel bellek boyutunu bayt veya -1 olarak verir

getUninstallablePackageNames ()

Kaldırılabilecek uygulama paketi adlarını getirin.

boolean getUseFastbootErase ()

Cihazdaki bir bölümü silmek için hızlı önyükleme silme veya hızlı önyükleme formatını kullanıp kullanmayacağınızı öğrenin.

int getUserFlags (int userId)

Belirli bir kullanıcının bayraklarını bulun ve döndürün.

getUserInfos ()

Cihazdaki useId to UserInfo haritasını alır.

int getUserSerialNumber (int userId)

Bulunursa userId ile ilişkili seri numarasını, diğer durumlarda -10000'i döndürün.

IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

Verilen DeviceEvent'i işleyin.

Bu cihazı yeni bir ayırma durumuna geçirebilen veya geçirmeyebilen DeviceEvent'i işleyin.

boolean hasFeature (String feature)

Bir özelliğin bir cihazda olup olmadığını kontrol edin.

String installPackage (File packageFile, boolean reinstall, String... extraArgs)

Cihaza bir Android paketi kurun.

String installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)

Cihaza bir Android paketi kurun.

String installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs)

Belirli bir kullanıcı için cihaza bir Android paketi yükleyin.

String installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)

Belirli bir kullanıcı için cihaza bir Android paketi yükleyin.

void invalidatePropertyCache ()
boolean isAdbRoot ()

boolean isAdbTcp ()
boolean isAppEnumerationSupported ()

Cihazdaki platformun uygulama numaralandırmayı destekleyip desteklemediğini kontrol edin

boolean isBypassLowTargetSdkBlockSupported ()

Cihazdaki platformun, uygulama yüklemelerinde düşük hedef sdk bloğunu atlamayı destekleyip desteklemediğini kontrol edin

boolean isDeviceEncrypted ()

Cihaz şifreliyse döndürür.

boolean isDirectory (String path)

Aygıttaki yol bir dizin ise True, aksi takdirde false döndürür.

boolean isEnableAdbRoot ()
boolean isEncryptionSupported ()

Cihazda şifrelemenin desteklenip desteklenmediğini döndürür.

boolean isExecutable (String fullPath)

Aygıttaki dosya yolu yürütülebilir bir dosyaysa True, aksi takdirde false döndürür.

boolean isFastbootEnabled ()

Cihaz için fastboot varsa geri dönün.

boolean isHeadless ()

Aygıt başsızsa (ekran yoksa) true, aksi takdirde false döndürün.

boolean isHeadlessSystemUserMode ()

Cihazın başsız sistem kullanıcı modunu kullanıp kullanmadığını döndürür.

boolean isMainUserPermanentAdmin ()

Ana kullanıcının kalıcı bir yönetici olup olmadığını ve silinip silinemeyeceğini veya yönetici olmayan bir duruma düşürülüp düşürülemeyeceğini döndürür.

boolean isMultiUserSupported ()

Çoklu kullanıcının desteklenip desteklenmediğini belirler.

boolean isPackageInstalled (String packageName, String userId)

Belirli bir paket adı ve kullanıcı kimliği için cihazı sorgulayarak o kullanıcı için şu anda kurulu olup olmadığını kontrol edin.

boolean isPackageInstalled (String packageName)

Şu anda kurulu olup olmadığını kontrol etmek için cihazı belirli bir paket adı için sorgulayın.

boolean isRuntimePermissionSupported ()

Cihazdaki platformun çalışma zamanı izni vermeyi destekleyip desteklemediğini kontrol edin

boolean isStateBootloaderOrFastbootd ()

Cihaz TestDeviceState#FASTBOOT veya TestDeviceState.FASTBOOTD konumundaysa true değerini döndürür.

boolean isUserRunning (int userId)

Belirli bir kullanıcının çalışıp çalışmadığını kontrol edin.

boolean isUserSecondary (int userId)

İşaretlerine göre belirtilen kullanıcının ikincil kullanıcı olup olmadığını döndürür.

boolean isUserVisible (int userId)

Belirtilen kullanıcının görünür olup olmadığını kontrol eder.

boolean isUserVisibleOnDisplay (int userId, int displayId)

Belirtilen kullanıcının belirtilen ekranda görünüp görünmediğini kontrol eder.

boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()

Cihazın, kullanıcıların arka planda ERROR(/java.android.view.Display#DEFAULT_DISPLAY) görünür şekilde başlatılmasına izin verip vermediğini döndürür.

boolean isVisibleBackgroundUsersSupported ()

Cihazın, kullanıcıların arka planda görünür şekilde başlatılmasına izin verip vermediğini döndürür.

boolean isWifiEnabled ()

Wi-Fi'nin etkin olup olmadığını test edin.

listDisplayIds ()

"dumpsys SurfaceFlinger" tarafından bildirildiği üzere cihazdaki kullanılabilir ekran kimliğinin listesini toplayın.

listDisplayIdsForStartingVisibleBackgroundUsers ()

start a user visible in the background için kullanılabilecek ekranların listesini alır.

listUsers ()

Cihazdaki kullanıcıların listesini alır.

boolean logAnrs ( ITestLogger logger)

ANR'leri cihazdan toplar ve günlüğe kaydeder.

boolean logBugreport (String dataName, ITestLogger listener)

Bir hata raporu almak ve muhabirlere günlüğe kaydetmek için yardımcı yöntem.

void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)

Cihazın logcat'ine bir mesaj kaydedin.

void nonBlockingReboot ()

Aygıtı yeniden başlatmak için bir komut verir ve komut tamamlandığında ve aygıt artık adb tarafından görülmediğinde geri döner.

void postAdbRootAction ()

Cihazın adb root'tan sonra ve cihaz tekrar çevrimiçi olmadan önce bazı özel eylemlerin yapılması gerekiyorsa geçersiz kıl.

void postAdbUnrootAction ()

Adb unroot'tan sonra ve cihaz tekrar çevrimiçi olmadan önce, cihazın bazı özel eylemler gerçekleştirmesi gerekiyorsa geçersiz kılın.

void postBootSetup ()

Her önyüklemeden sonra bunu test etmek için cihazı yapılandırma talimatlarını uygulayın.

void postInvocationTearDown (Throwable exception)

Çağırma tamamlandıktan sonra yürütülecek olan, cihaza özel gerekli temizleme için ekstra adımlar.

void preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes)

Çağırma akışından önce cihazda yürütülecek olan cihaza özel gerekli kurulum için ekstra adımlar.

boolean pullDir (String deviceFilePath, File localDir)

Dizin içeriğini cihazdan yinelemeli olarak çekin.

boolean pullFile (String remoteFilePath, File localFile)

Cihazdan bir dosya alır.

File pullFile (String remoteFilePath, int userId)

Aygıttan bir dosya alır, onu yerel bir geçici ERROR(/File) içinde saklar ve bu File döndürür.

File pullFile (String remoteFilePath)

Aygıttan bir dosya alır, onu yerel bir geçici ERROR(/File) içinde saklar ve bu File döndürür.

boolean pullFile (String remoteFilePath, File localFile, int userId)

Cihazdan bir dosya alır.

String pullFileContents (String remoteFilePath)

Aygıttan bir dosya alır ve içeriğini döndürür.

File pullFileFromExternal (String remoteFilePath)

Bir dosyayı aygıtın harici deposundan almak, onu yerel bir geçici ERROR(/File) içinde depolamak ve bu File bir referans döndürmek için uygun bir yöntem.

boolean pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, String deviceFilePath, excludedDirectories)

Filtrelenen bazı dizinleri hariç tutarken dizin içeriklerini tekrar tekrar cihaza gönderin.

boolean pushDir (File localFileDir, String deviceFilePath)

Dizin içeriğini tekrar tekrar cihaza aktarın.

boolean pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)

İsteğe bağlı olarak içerik sağlayıcı ihtiyacını değerlendirmeyi düşünebilen pushFile(File, String) varyantı.

boolean pushFile (File localFile, String remoteFilePath)

Bir dosyayı cihaza itin.

boolean pushString (String contents, String remoteFilePath)

Bir diziden oluşturulan dosyayı cihaza aktar

void reboot (String reason)

Yeniden başlatma sırasında kalıcı olması için belirli bir reason cihazı adb moduna yeniden başlatır.

void reboot ()

Cihazı adb modunda yeniden başlatır.

void rebootIntoBootloader ()

Cihazı önyükleyici modunda yeniden başlatır.

void rebootIntoFastbootd ()

Cihazı fastbootd modunda yeniden başlatır.

void rebootIntoRecovery ()

Cihazı adb kurtarma modunda yeniden başlatır.

void rebootIntoSideload ()

Cihazı adb yan yükleme modunda yeniden başlatır (bunun kurtarma sırasında özel bir mod olduğunu unutmayın)

Cihaz yan yük moduna girene kadar engeller

void rebootIntoSideload (boolean autoReboot)

Cihazı adb yan yükleme modunda yeniden başlatır (bunun kurtarma sırasında özel bir mod olduğunu unutmayın)

Cihaz yan yük moduna girene kadar engeller

void rebootUntilOnline ()

Yalnızca cihaz çevrimiçi olana, yani adb tarafından görünene kadar engelleyen, reboot() bir alternatifi.

void rebootUntilOnline (String reason)

Yalnızca cihaz çevrimiçi olana, yani adb tarafından görünene kadar engelleyen, reboot() bir alternatifi.

void rebootUserspace ()

Cihazın yalnızca kullanıcı alanı bölümünü yeniden başlatır.

void rebootUserspaceUntilOnline ()

Yalnızca cihaz çevrimiçi olana, yani adb tarafından görünene kadar engelleyen bir rebootUserspace() ()} alternatifi.

boolean recoverDevice ()

Cihaz iletişimini kurtarma girişimleri.

void registerDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver)

Bu cihaz için bir IDeviceActionReceiver kaydeder.

void remountSystemReadOnly ()

Cihazdaki sistem bölümünü salt okunur yapın.

void remountSystemWritable ()

Cihazdaki sistem bölümünü yazılabilir yapın.

void remountVendorReadOnly ()

Cihazdaki satıcı bölümünü salt okunur yapın.

void remountVendorWritable ()

Cihazdaki satıcı bölümünü yazılabilir yapın.

boolean removeAdmin (String componentName, int userId)

Verilen kullanıcıda verilen cihaz yöneticisini kaldırın ve başarılıysa true , aksi takdirde false döndürün.

void removeOwners ()

Mevcut tüm cihaz profili sahiplerini en iyi çabayla kaldırın.

boolean removeUser (int userId)

Belirli bir kullanıcıyı cihazdan kaldırın.

void resetContentProviderSetup ()

Tekrar tetiklemek için içerik sağlayıcı kurulumu bayrağını sıfırlayın.

boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

Parametre olarak geçirilen bir veya daha fazla dinleyiciyle ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) gerçekleştirmek için kullanışlı yöntem.

boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners)

Enstrümantasyon testlerini çalıştırır ve cihaz kurtarma sağlar.

boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners)

ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) ancak testi çalıştırıyor verilen kullanıcı için.

boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) ile aynıdır, ancak testi belirli bir kullanıcı için çalıştırır.

void setConfiguration ( IConfiguration configuration)

Kullanımdaki IConfiguration enjekte eder.

final void setConnectionAvdInfo ( GceAvdInfo avdInfo)
void setDate (Date date)

Cihazdaki tarihi ayarlar

Not: cihazda tarih ayarı root gerektirir

boolean setDeviceOwner (String componentName, int userId)

Belirli bir kullanıcıda bir cihaz yöneticisi bileşenini cihaz sahibi olarak ayarlayın.

void setDeviceState ( TestDeviceState deviceState)

Cihazın durumunu güncelleyin.

void setEmulatorOutputStream ( SizeLimitedOutputStream output)

Öykünücü için SizeLimitedOutputStream çıktıyı günlüğe kaydetmeye ayarlayın

void setEmulatorProcess (Process p)

Bu aygıt bir öykünücü olduğunda Process ayarlar.

void setFastbootEnabled (boolean fastbootEnabled)

Cihaz için fastboot seçeneğini ayarlayın.

void setFastbootPath (String fastbootPath)

Kullanılması gereken fastboot ikili dosyasına giden yolu ayarlar.

void setIDevice (IDevice newDevice)

Bu ITestDevice ile ilişkili IDevice'i güncelleyin.

void setLogStartDelay (int delay)

Çevrimiçi bir cihaz için logcat yakalamaya başlamadan önce beklenecek süreyi ms cinsinden ayarlar.

void setOptions ( TestDeviceOptions options)

Cihaz için TestDeviceOptions ayarlayın

boolean setProperty (String propKey, String propValue)

Cihazda verilen özellik değerini ayarlar.

void setRecovery ( IDeviceRecovery recovery)

Bu cihaz için kullanılacak IDeviceRecovery ayarlayın.

void setRecoveryMode ( ITestDevice.RecoveryMode mode)

Cihaz için kullanılacak mevcut kurtarma modunu ayarlayın.

void setSetting (String namespace, String key, String value)

setSetting(int, String, String, String) bakın ve sistem kullanıcısında gerçekleştirilir.

void setSetting (int userId, String namespace, String key, String value)

Belirli bir kullanıcının ad alanına bir ayar değeri ekleyin.

void setTestLogger ( ITestLogger testLogger)

ITestLogger örneğini enjekte eder

void setUseFastbootErase (boolean useFastbootErase)

Cihazdaki bir bölümü silmek için hızlı önyükleme silme veya hızlı önyükleme formatının kullanılıp kullanılmayacağını ayarlayın.

void startLogcat ()

Arka planda cihazdan logcat çıktısını yakalamaya başlayın.

boolean startUser (int userId)

Şu anda durdurulmuşsa, belirli bir kullanıcıyı arka planda başlatır.

boolean startUser (int userId, boolean waitFlag)

Şu anda durdurulmuşsa, belirli bir kullanıcıyı arka planda başlatır.

boolean startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag)

Belirli bir ekranda belirli bir kullanıcıyı arka planda başlatır (yani, kullanıcının o ekranda etkinlikleri başlatmasına izin verir).

void stopEmulatorOutput ()

Öykünücü çıktısını kapatın ve silin.

void stopLogcat ()

Aygıttan logcat çıktısını almayı durdurun ve şu anda kayıtlı olan logcat verilerini atın.

boolean stopUser (int userId)

Belirli bir kullanıcıyı durdurur.

boolean stopUser (int userId, boolean waitFlag, boolean forceFlag)

Belirli bir kullanıcıyı durdurun.

String switchToAdbTcp ()

Cihazı adb-over-tcp moduna geçirin.

boolean switchToAdbUsb ()

Cihazı usb üzerinden adb moduna geçirin.

boolean switchUser (int userId)

Varsayılan zaman aşımına sahip başka bir kullanıcı kimliğine geçin.

boolean switchUser (int userId, long timeout)

Son tarih olarak sağlanan zaman aşımı ile başka bir kullanıcı kimliğine geçin.

boolean syncFiles (File localFileDir, String deviceFilePath)

Yerel bir dosya dizininin içeriğini cihaza artımlı olarak eşitler.

Bugreport takeBugreport ()

Bir hata raporu alın ve onu işlemek için bir Bugreport nesnesinin içinde döndürür.

String uninstallPackage (String packageName)

Cihazdan bir Android paketini kaldırın.

String uninstallPackageForUser (String packageName, int userId)

Belirli bir kullanıcı için cihazdan bir Android paketini kaldırın.

boolean unlockDevice ()

Cihaz şifreli durumdaysa cihazın kilidini açar.

boolean waitForBootComplete (long timeOut)

Aygıtın önyükleme tamamlandı bayrağı ayarlanana kadar engeller.

boolean waitForDeviceAvailable ()

Cihazın yanıt vermesini ve test için hazır olmasını bekler.

boolean waitForDeviceAvailable (long waitTime)

Cihazın yanıt vermesini ve test için hazır olmasını bekler.

boolean waitForDeviceAvailableInRecoverPath (long waitTime)

Kurtarma yolunu dikkate almadan cihazın yanıt vermesini ve kullanılabilir olmasını bekler.

void waitForDeviceBootloader ()

Cihaz fastboot aracılığıyla görünene kadar engeller.

boolean waitForDeviceInRecovery (long waitTime)

Cihazın "adb kurtarma" durumunda olmasını engeller (bunun IDeviceRecovery durumundan farklı olduğunu unutmayın).

boolean waitForDeviceInSideload (long waitTime)

Cihazın 'adb sideload' durumunda olması için bloklar

boolean waitForDeviceNotAvailable (long waitTime)

Cihazın kullanılamaması, yani adb'den eksik olması için bloklar

void waitForDeviceOnline ()

Cihaz adb aracılığıyla görünene kadar engeller.

void waitForDeviceOnline (long waitTime)

Cihaz adb aracılığıyla görünene kadar engeller.

boolean waitForDeviceShell (long waitTime)

Cihazın temel bir adb kabuk komutuna yanıt vermesini bekler.

Korumalı yöntemler

void addExtraConnectionBuilderArgs ( DefaultConnection.ConnectionBuilder builder)
String[] buildAdbShellCommand (String command, boolean forceExitStatusDetection)

Verilen adb shell komut oturumu ve args için işletim sistemi komutunu oluşturur

void checkApiLevelAgainst (String feature, int strictMinLevel)
NativeDevice.RebootDeviceAction createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason)

Yeniden başlatma eylemi gerçekleştirirken kullanılacak bir RebootDeviceAction oluşturun.

IRunUtil createRunUtil ()
void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

Bir adb yeniden başlatma gerçekleştirin.

void ensureRuntimePermissionSupported ()

çalışma zamanı izni desteklenmiyorsa istisna oluşturmak için yardımcı yöntem

int getApiLevelSafe ()
ITestLogger getLogger ()
IRunUtil getRunUtil ()

Kullanılacak RunUtil örneğini alın.

void initializeConnection ( IBuildInfo info, MultiMap <String, String> attributes)
String internalGetProperty (String propName, String fastbootVar, String description)

Varsayılan olarak ddmlib önbelleğinden bir aygıt özelliği getirin ve aygıtın Fastboot'ta olup olmamasına bağlı olarak "adb shell getprop" veya "fastboot getvar" olarak geri dönün.

boolean isInRebootCallback ()

Yeniden başlatma geri aramalarının şu anda yürütülüp yürütülmediğini döndürür.

boolean isNewer (File localFile, IFileEntry entry)

Yerel dosya uzak dosyadan daha yeniyse true değerini döndürür.

void notifyRebootEnded ()

Yeniden başlatma bitiş olayı hakkında tüm IDeviceActionReceiver bilgilendirir.

void notifyRebootStarted ()

Yeniden başlama olayı hakkında tüm IDeviceActionReceiver bilgilendirir.

boolean performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts)

Bu cihazda bir eylem gerçekleştirir.

void postAdbReboot ()

Yeniden başlatmanın ardından alınabilecek olası ekstra eylemler.

void prePostBootSetup ()

Her cihaz türünün (AndroidNativeDevice, TestDevice) belirli önyükleme sonrası kurulumu için bu yöntemi geçersiz kılmasına izin verir.

boolean pullFileInternal (String remoteFilePath, File localFile)
void setClock (Clock clock)

Kullanılacak Saat örneğini ayarlayın.

void setMicrodroidProcess (Process process)

TestDevice'i mikrodroid olarak işaretler ve CID'sini ayarlar.

void setTestDeviceOptions ( deviceOptions) setTestDeviceOptions ( deviceOptions)
CommandResult simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd)

Ortam değişkenleriyle basit bir fastboot komutu yürütür ve komutun durumunu bildirir.

CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)

Basit bir fastboot komutunu yürütür ve komutun durumunu bildirir.

boolean waitForDeviceNotAvailable (String operationDesc, long time)

Cihazın kullanılamayacağını görmek için bekleyin (adb'ye bildirmeyi durdurun).

sabitler

GEÇERSİZ KULLANICI KİMLİĞİ

public static final int INVALID_USER_ID

Herhangi bir geçersiz/bulunamayan kullanıcı kimliği için döndürülen değer: UserHandle, -10000 değerini tanımladı

Sabit Değer: -10000 (0xffffd8f0)

MAX_HOST_DEVICE_TIME_OFFSET

protected static final long MAX_HOST_DEVICE_TIME_OFFSET

Sabit Değer: 5000 (0x0000000000001388)

MAX_RETRY_ATTEMPTS

protected static final int MAX_RETRY_ATTEMPTS

gerçekleştirmek için varsayılan komut yeniden deneme denemesi sayısı

Sabit Değer: 2 (0x00000002)

alanlar

HAFIZA KARTI

protected static final String SD_CARD

STORAGE_EMULATED

protected static final String STORAGE_EMULATED

mSeçenekler

protected TestDeviceOptions mOptions

mStateMonitor

protected final IDeviceStateMonitor mStateMonitor

kamu inşaatçılar

NativeCihaz

public NativeDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

Bir TestDevice oluşturur.

parametreler
device IDevice : ilişkili IDevice

stateMonitor IDeviceStateMonitor : kullanılacak IDeviceStateMonitor mekanizması

allocationMonitor IDeviceMonitor : tahsis durumu değişikliklerini bildirmek için IDeviceMonitor . boş olabilir

Genel yöntemler

toplu PrefetchStartupBuildProps

public void batchPrefetchStartupBuildProps ()

Her biri için 'adb getprop' demek yerine ihtiyacımız olan tüm donanımları önceden getirerek mikro optimizasyon (yaklaşık 400 milyon). yani, tüm özellikleri getirmek, bir tanesini getirmek kadar hızlıdır. device.getApiLevel(), checkApiLevelAgainstNextRelease ve getBuildAlias ​​gibi şeylerin tümü, başlık altında "adb getprop" olarak adlandırılır. Bunları tek bir aramada getiriyoruz ve NativeDevice.setProperty'i çağırıyoruz. Bunu yapmasak bile, NativeDevice setProperty'yi kendisi çağıracak ve gelecekteki çağrılar için sonucu önbelleğe alacaktır. Sadece biraz daha erken yapıyoruz. Cihaz kurtarılıyorsa veya donanımları getirirken başka hatalar varsa, bunları yok sayarız.

canSwitchToHeadlessSystemUser

public boolean canSwitchToHeadlessSystemUser ()

Başsız SYSTEM kullanıcısına geçişe izin verilip verilmediğini döndürür.

İadeler
boolean

Atar
DeviceNotAvailableException

checkApiLevelAgainstNextRelease

public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Asgari düzeyde desteklenen bir özelliğin şu anda desteklenip desteklenmediğini kontrol edin. Bu yöntem, API seviyesi yükseltilmeden önce henüz yayınlanmamış özellikleri hesaba katar.

parametreler
strictMinLevel int : Özelliği destekleyen kesin minimum olası düzey.

İadeler
boolean Düzey destekleniyorsa doğrudur. Aksi takdirde yanlış.

Atar
DeviceNotAvailableException

checkConnectivity

public boolean checkConnectivity ()

Cihazın ağ bağlantısına sahip olduğunu kontrol edin.

İadeler
boolean cihazın çalışan bir ağ bağlantısı varsa true , fazladan false .

Atar
DeviceNotAvailableException

clearErrorDialogs

public boolean clearErrorDialogs ()

Şu anda cihaz kullanıcı arayüzünde görüntülenen tüm hata iletişim kutularını kapatmayı deneyin.

İadeler
boolean true hiçbir iletişim kutusu yoksa veya iletişim kutuları başarıyla temizlendiyse. Aksi takdirde false .

Atar
DeviceNotAvailableException

clearLastConnectedWifiNetwork

public void clearLastConnectedWifiNetwork ()

Son bağlanan wifi ağını temizler. Bu, cihaz yeniden başlatıldıktan sonra önceki testte kullanılan wifi ağına bağlanmaktan kaçınmak için yeni bir çağrı başlatırken çağrılmalıdır.

temizleLogcat

public void clearLogcat ()

Birikmiş tüm logcat verilerini siler.

Bu, ITestDevice#getLogcat() öğesinin yalnızca belirli bir noktadan sonra üretilen günlük verilerini döndürmesini istediğiniz durumlar için kullanışlıdır (örneğin, yeni bir aygıt yapısının yanıp sönmesinden sonra vb.).

WiFiAğına bağlan

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

Bir wifi ağına bağlanır.

Wifi'yi açar ve wifiSsidToPsk haritasında verilen wifi ağlarından biriyle başarılı bir bağlantı kurulana kadar engeller. Bir bağlantı yapıldıktan sonra, örnek ITestDevice#disconnectFromWifi() veya ITestDevice#clearLastConnectedWifiNetwork() çağrılana kadar her yeniden başlatmanın ardından bağlantıyı geri yüklemeye çalışır.

parametreler
wifiSsidToPsk : Wi-Fi SSID'lerinin şifrelere haritası.

scanSsid boolean : bu ağ için gizli SSID'lerin taranıp taranmayacağı.

İadeler
boolean true wifi ağına başarıyla bağlanırsa. Aksi takdirde false

Atar
DeviceNotAvailableException

WiFiAğına bağlan

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

Bir wifi ağına bağlanır.

Wi-Fi'yi açar ve belirtilen Wi-Fi ağına başarılı bir bağlantı kurulana kadar bloke eder. Bir bağlantı yapıldıktan sonra, örnek ITestDevice#disconnectFromWifi() veya ITestDevice#clearLastConnectedWifiNetwork() çağrılana kadar her yeniden başlatmanın ardından bağlantıyı geri yüklemeye çalışır.

parametreler
wifiSsid String : bağlanmak için wifi ssid

wifiPsk String : PSK parolası veya şifrelenmemişse boş

İadeler
boolean true wifi ağına başarıyla bağlanırsa. Aksi takdirde false

Atar
DeviceNotAvailableException

WiFiAğına bağlan

public boolean connectToWifiNetwork ( wifiSsidToPsk)

Bir wifi ağına bağlanır.

Wifi'yi açar ve wifiSsidToPsk haritasında verilen wifi ağlarından biriyle başarılı bir bağlantı kurulana kadar engeller. Bir bağlantı yapıldıktan sonra, örnek ITestDevice#disconnectFromWifi() veya ITestDevice#clearLastConnectedWifiNetwork() çağrılana kadar her yeniden başlatmanın ardından bağlantıyı geri yüklemeye çalışır.f

parametreler
wifiSsidToPsk : Wi-Fi SSID'lerinin şifrelere haritası.

İadeler
boolean true wifi ağına başarıyla bağlanırsa. Aksi takdirde false

Atar
DeviceNotAvailableException

WiFiAğına bağlan

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Bir wifi ağına bağlanır.

Wi-Fi'yi açar ve belirtilen Wi-Fi ağına başarılı bir bağlantı kurulana kadar bloke eder. Bir bağlantı yapıldıktan sonra, örnek ITestDevice#disconnectFromWifi() veya ITestDevice#clearLastConnectedWifiNetwork() çağrılana kadar her yeniden başlatmanın ardından bağlantıyı geri yüklemeye çalışır.

parametreler
wifiSsid String : bağlanmak için wifi ssid

wifiPsk String : PSK parolası veya şifrelenmemişse boş

scanSsid boolean : bu ağ için gizli SSID'nin taranıp taranmayacağı.

İadeler
boolean true wifi ağına başarıyla bağlanırsa. Aksi takdirde false

Atar
DeviceNotAvailableException

connectToWifiNetworkGerekirse

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Yalnızca cihazın şu anda ağ bağlantısı yoksa bağlanan bir connectToWifiNetwork(String, String) çeşidi.

parametreler
scanSsid boolean : bu ağ için gizli SSID'nin taranıp taranmayacağı

İadeler
boolean true wifi ağına başarıyla bağlanırsa. Aksi takdirde false

Atar
DeviceNotAvailableException

connectToWifiNetworkGerekirse

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

Yalnızca cihazın şu anda ağ bağlantısı yoksa bağlanan bir connectToWifiNetwork(String, String) çeşidi.

İadeler
boolean true wifi ağına başarıyla bağlanırsa. Aksi takdirde false

Atar
DeviceNotAvailableException

Kullanıcı oluştur

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral)

Belirli bir ada ve sağlanan bayraklara sahip bir kullanıcı oluşturun

parametreler
name String : cihazda oluşturulacak kullanıcının

guest boolean : oluşturma sırasında --guest kullanıcı bayrağını etkinleştir

ephemeral boolean : oluşturma sırasında --ephemeral kullanıcı bayrağını etkinleştir

İadeler
int oluşturulan kullanıcının kimliği

Atar
DeviceNotAvailableException

Kullanıcı oluştur

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral, 
                boolean forTesting)

Belirli bir ada ve sağlanan bayraklara sahip bir kullanıcı oluşturun

parametreler
name String : cihazda oluşturulacak kullanıcının

guest boolean : oluşturma sırasında --guest kullanıcı bayrağını etkinleştir

ephemeral boolean : oluşturma sırasında --ephemeral kullanıcı bayrağını etkinleştir

forTesting boolean : test işaretini etkinleştirin ---oluşturma sırasında test için

İadeler
int oluşturulan kullanıcının kimliği

Atar
DeviceNotAvailableException

Kullanıcı oluştur

public int createUser (String name)

Belirli bir ada ve varsayılan bayraklara 0 sahip bir kullanıcı oluşturun.

parametreler
name String : cihazda oluşturulacak kullanıcının

İadeler
int oluşturulan kullanıcı kimliği için tamsayı

Atar
DeviceNotAvailableException

KullanıcıNoThrow oluştur

public int createUserNoThrow (String name)

Belirli bir ada ve varsayılan bayraklara 0 sahip bir kullanıcı oluşturun.

parametreler
name String : cihazda oluşturulacak kullanıcının

İadeler
int oluşturulan kullanıcı kimliği için tamsayı veya hata için -1.

Atar
DeviceNotAvailableException

dosyayı sil

public void deleteFile (String deviceFilePath)

Cihazdaki bir dosya veya dizini silmek için yardımcı yöntem.

parametreler
deviceFilePath String : Cihazdaki dosyanın mutlak yolu.

Atar
DeviceNotAvailableException

deviceActionReceiver'ın kaydını sil

public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)

Kayıtlı IDeviceActionReceiver öğesini kaldırır.

parametreler
deviceActionReceiver IDeviceActionReceiver : Kaldırılacak bir IDeviceActionReceiver .

deviceSoftYeniden Başlatıldı

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

Geçerli system_server ile önceki system_server ProcessInfo karşılaştırarak aygıtın yazılımsal olarak yeniden başlatılıp başlatılmadığını kontrol etmek için yardımcı yöntem. ProcessInfo almak için getProcessByName(String) kullanın.

parametreler
prevSystemServerProcess ProcessInfo : önceki system_server işlemi ProcessInfo .

İadeler
boolean cihaz geçici olarak yeniden başlatılırsa true

Atar
DeviceNotAvailableException

deviceSoftRestartedSince

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

Cihazın UTC zamanından beri cihazdan ve ERROR(/TimeUnit) cihazından yeniden başlatılıp başlatılmadığını kontrol etmek için yardımcı yöntem. Yazılımla Yeniden Başlatma, sistem_sunucusunun bir aygıtın yeniden başlatılması dışında yeniden başlatılması anlamına gelir (örneğin: yeniden başlatma istendi). Milisaniye cinsinden geçerli aygıt utcEpochTime, getDeviceDate() yöntemiyle elde edilebilir.

parametreler
utcEpochTime long : çağdan bu yana saniye cinsinden cihaz süresi.

timeUnit TimeUnit : verilen utcEpochTime için TimeUnit zaman birimi.

İadeler
boolean cihaz geçici olarak yeniden başlatılırsa true

Atar
DeviceNotAvailableException

AdbRoot'u devre dışı bırak

public boolean disableAdbRoot ()

Adb kökünü kapatır.

Adb kökünün devre dışı bırakılması, cihazın adb ile bağlantısının kesilmesine neden olabilir. Bu yöntem, cihaz kullanılabilir olana kadar engelleyecektir.

İadeler
boolean başarılıysa true .

Atar
DeviceNotAvailableException

Tuş korumasını devre dışı bırak

public void disableKeyguard ()

Tuş kilidini devre dışı bırakma girişimleri.

İlk önce giriş gönderiminin hazır olmasını bekleyin, bu, cihazın BOOT_COMPLETE'i görünüşte eşzamansız olarak bildirdiği zaman gerçekleşir, çünkü mevcut çerçeve uygulamasının ara sıra yarış durumu vardır. Ardından, tuş kilidini kapatmak için komut gönderilir (yalnızca güvenli olmayanlarda çalışır)

Atar
DeviceNotAvailableException

Ağ Monitörünü devre dışı bırak

public boolean disableNetworkMonitor ()

Cihazda ağ izlemeyi devre dışı bırakır.

İadeler
boolean true izleme başarıyla devre dışı bırakılırsa. başarısız olursa false .

Atar
DeviceNotAvailableException

Wifi bağlantısını kes

public boolean disconnectFromWifi ()

Bir wifi ağından bağlantıyı keser.

Tüm ağları bilinen ağlar listesinden kaldırır ve wifi'yi devre dışı bırakır.

İadeler
boolean kablosuz ağ bağlantısı başarıyla kesilirse true . bağlantı başarısız olursa false .

Atar
DeviceNotAvailableException

dosya var mı

public boolean doesFileExist (String deviceFilePath, 
                int userId)

Belirli bir kullanıcı için aygıtta dosya olup olmadığını belirlemek için yardımcı yöntem.

parametreler
deviceFilePath String : kontrol edilecek cihazdaki dosyanın mutlak yolu

userId int : Dosya varlığının kontrol edileceği kullanıcı kimliği

İadeler
boolean dosya varsa true , aksi takdirde false .

Atar
DeviceNotAvailableException

dosya var mı

public boolean doesFileExist (String deviceFilePath)

Aygıtta dosya olup olmadığını belirlemek için yardımcı yöntem.

parametreler
deviceFilePath String : kontrol edilecek cihazdaki dosyanın mutlak yolu

İadeler
boolean dosya varsa true , aksi takdirde false .

Atar
DeviceNotAvailableException

çöp yığını

public File dumpHeap (String process, 
                String devicePath)

Yığını system_server'dan boşaltmayı deneyin. Dökülen dosyayı temizlemek arayanın sorumluluğundadır.

parametreler
process String : dökümü yapılacak aygıt işleminin adı.

devicePath String : dökümün yerleştirileceği cihazdaki yol. Bu, izinlerin izin verdiği bir konum olmalıdır.

İadeler
File raporu içeren ERROR(/File) . Bir şey başarısız olursa boş.

Atar
DeviceNotAvailableException

etkinleştirAdbRoot

public boolean enableAdbRoot ()

Adb kökünü açar. "enable-root" ayarı "false" ise, bir mesaj günlüğe kaydeder ve root'u etkinleştirmeden geri döner.

Adb kökünün etkinleştirilmesi, cihazın adb ile bağlantısının kesilmesine neden olabilir. Bu yöntem, cihaz kullanılabilir olana kadar engelleyecektir.

İadeler
boolean başarılıysa true .

Atar
DeviceNotAvailableException

Ağ Monitörünü etkinleştir

public boolean enableNetworkMonitor ()

Cihazda ağ izlemeyi etkinleştirir.

İadeler
boolean true izleme başarıyla etkinleştirilirse. başarısız olursa false .

Atar
DeviceNotAvailableException

yürütmeAdbKomutu

public String executeAdbCommand (long timeout, 
                String... cmdArgs)

Bir adb komutunu belirtilen bir zaman aşımına sahip bir sistem komutu olarak yürüten yardımcı yöntem.

Bunun yerine, mümkün olan her yerde, daha iyi hata algılaması ve performansı sağladığından, bunun yerine executeShellCommand(String) kullanılmalıdır.

parametreler
timeout long : cihazın yanıt vermediği kabul edilmesinden önceki milisaniye cinsinden süre, zaman aşımı olmadığı için 0L

cmdArgs String : adb komutu ve çalıştırılacak bağımsız değişkenler

İadeler
String komuttan stdout. komut yürütülemezse null .

Atar
DeviceNotAvailableException

yürütmeAdbKomutu

public String executeAdbCommand (long timeout, 
                 envMap, 
                String... cmdArgs)

Bir adb komutunu belirtilen bir zaman aşımına sahip bir sistem komutu olarak yürüten yardımcı yöntem.

Bunun yerine, mümkün olan her yerde, daha iyi hata algılaması ve performansı sağladığından, bunun yerine executeShellCommand(String) kullanılmalıdır.

parametreler
timeout long : cihazın yanıt vermediği kabul edilmesinden önceki milisaniye cinsinden süre, zaman aşımı olmadığı için 0L

envMap : komut için ayarlanacak ortam

cmdArgs String : adb komutu ve çalıştırılacak bağımsız değişkenler

İadeler
String komuttan stdout. komut yürütülemezse null .

Atar
DeviceNotAvailableException

yürütmeAdbKomutu

public String executeAdbCommand (String... cmdArgs)

Adb komutunu sistem komutu olarak yürüten yardımcı yöntem.

Bunun yerine, mümkün olan her yerde, daha iyi hata algılaması ve performansı sağladığından, bunun yerine executeShellCommand(String) kullanılmalıdır.

parametreler
cmdArgs String : adb komutu ve çalıştırılacak bağımsız değişkenler

İadeler
String komuttan stdout. komut yürütülemezse null .

Atar
DeviceNotAvailableException

YürütFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

Fastboot komutunu, varsayılan 2 dakikalık zaman aşımı süresiyle sistem komutu olarak yürüten yardımcı yöntem.

Cihaz zaten fastboot modundayken kullanılması bekleniyor.

parametreler
cmdArgs String : fastboot komutu ve çalıştırılacak bağımsız değişkenler

İadeler
CommandResult komutun çıktısını içeren CommandResult

Atar
DeviceNotAvailableException

YürütFastbootCommand

public CommandResult executeFastbootCommand (long timeout, 
                String... cmdArgs)

Bir fastboot komutunu bir sistem komutu olarak yürüten yardımcı yöntem.

Cihaz zaten fastboot modundayken kullanılması bekleniyor.

parametreler
timeout long : komutun sona ermesinden önceki milisaniye cinsinden süre

cmdArgs String : fastboot komutu ve çalıştırılacak bağımsız değişkenler

İadeler
CommandResult komutun çıktısını içeren CommandResult

Atar
DeviceNotAvailableException

ExecutLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

Uzun süre çalışan bir fastboot komutunu bir sistem komutu olarak yürüten yardımcı yöntem.

Identical to executeFastbootCommand(String) except uses a longer timeout.

parametreler
cmdArgs String : the fastboot command and arguments to run

İadeler
CommandResult the CommandResult containing output of command

Atar
DeviceNotAvailableException

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand ( envVarMap, 
                String... cmdArgs)

Helper method which executes a long running fastboot command as a system command with system environment variables.

Identical to executeFastbootCommand(String) except uses a longer timeout.

parametreler
envVarMap : the system environment variables that the fastboot command run with

cmdArgs String : the fastboot command and arguments to run

İadeler
CommandResult the CommandResult containing output of command

Atar
DeviceNotAvailableException

executeShellCommand

public String executeShellCommand (String command)

Helper method which executes a adb shell command and returns output as a String .

parametreler
command String : the adb shell command to run

İadeler
String the shell output

Atar
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

parametreler
command String : the adb shell command to run

receiver IShellOutputReceiver : the IShellOutputReceiver to direct shell output to.

maxTimeToOutputShellResponse long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

Atar
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeoutForCommand, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

parametreler
command String : the adb shell command to run

receiver IShellOutputReceiver : the IShellOutputReceiver to direct shell output to.

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

maxTimeToOutputShellResponse long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

Atar
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

Executes the given adb shell command, retrying multiple times if command fails.

A simpler form of executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int) with default values.

parametreler
command String : the adb shell command to run

receiver IShellOutputReceiver : the IShellOutputReceiver to direct shell output to.

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd)

Helper method which executes a adb shell command and returns the results as a CommandResult properly populated with the command status output, stdout and stderr.

parametreler
cmd String : The command that should be run.

İadeler
CommandResult The result in CommandResult .

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

Helper method which executes an adb shell command and returns the results as a CommandResult properly populated with the command status output and stderr. stdout is directed to the specified stream.

parametreler
cmd String : The command that should be run.

pipeToOutput OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null.

İadeler
CommandResult The result in CommandResult .

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

Helper method which executes an adb shell command and returns the results as a CommandResult properly populated with the command status output, stdout and stderr.

parametreler
cmd String : The command that should be run.

pipeAsInput File : A ERROR(/File) that will be piped as input to the command, or null.

İadeler
CommandResult The result in CommandResult .

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

parametreler
cmd String : the adb shell command to run

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

İadeler
CommandResult

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

Executes a adb shell command, with more parameters to control command behavior.

parametreler
cmd String : the adb shell command to run

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

İadeler
CommandResult

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

parametreler
cmd String : the adb shell command to run

pipeAsInput File : A ERROR(/File) that will be piped as input to the command, or null.

pipeToOutput OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null.

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

İadeler
CommandResult

Atar
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                OutputStream pipeToError, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

parametreler
cmd String : the adb shell command to run

pipeAsInput File : A ERROR(/File) that will be piped as input to the command, or null.

pipeToOutput OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null.

pipeToError OutputStream : ERROR(/OutputStream) where the std error will be redirected, or null.

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

İadeler
CommandResult

Atar
DeviceNotAvailableException

fastbootWipePartition

public CommandResult fastbootWipePartition (String partition)

Helper method which wipes a partition for the device.

If getUseFastbootErase() is true , then fastboot erase will be used to wipe the partition. The device must then create a filesystem the next time the device boots. Otherwise, fastboot format is used which will create a new filesystem on the device.

Expected to be used when device is already in fastboot mode.

parametreler
partition String : the partition to wipe

İadeler
CommandResult the CommandResult containing output of command

Atar
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Fetch the information about APEXes activated on the device.

İadeler
ERROR(/Set) of ApexInfo currently activated on the device

Atar
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Return key value pairs of requested namespace.

parametreler
namespace String : must be one of {"system", "secure", "global"}

İadeler
the map of key value pairs. Null if namespace is not supported.

Atar
DeviceNotAvailableException

getAllocationState

public DeviceAllocationState getAllocationState ()

Return the current allocation state of device

İadeler
DeviceAllocationState

getAndroidId

public String getAndroidId (int userId)

Find and return the android-id associated to a userId, null if not found.

parametreler
userId int

İadeler
String

Atar
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Create a Map of android ids found matching user ids. There is no insurance that each user id will found an android id associated in this function so some user ids may match null.

İadeler
Map of android ids found matching user ids.

Atar
DeviceNotAvailableException

getApiLevel

public int getApiLevel ()

Get the device API Level. Defaults to UNKNOWN_API_LEVEL .

İadeler
int an integer indicating the API Level of device

Atar
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Fetch information about a package installed on device.

parametreler
packageName String

İadeler
PackageInfo the PackageInfo or null if information could not be retrieved

Atar
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Fetch information of packages installed on the device.

İadeler
ERROR(/List) of PackageInfo s installed on the device.

Atar
DeviceNotAvailableException

getBasebandVersion

public String getBasebandVersion ()

Convenience method to get baseband (radio) version of this device. Getting the radio version is device specific, so it might not return the correct information for all devices. This method relies on the gsm.version.baseband propery to return the correct version information. This is not accurate for some CDMA devices and the version returned here might not match the version reported from fastboot and might not return the version for the CDMA radio. TL;DR this method only reports accurate version if the gsm.version.baseband property is the same as the version returned by fastboot getvar version-baseband .

İadeler
String the String baseband version or null if it cannot be determined (device has no radio or version string cannot be read)

Atar
DeviceNotAvailableException

getBattery

public Integer getBattery ()

Returns the current battery level of a device or Null if battery level unavailable.

İadeler
Integer

getBooleanProperty

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

Returns boolean value of the given property.

parametreler
name String : the property name

defaultValue boolean : default value to return if property is empty or doesn't exist.

İadeler
boolean true if the property has value "1" , "y" , "yes" , "on" , or "true" , false if the property has value of "0" , "n" , "no" , "off" , "false" , or defaultValue otherwise.

Atar
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

Helper method collects the boot history map with boot time and boot reason.

İadeler
Map of boot time (UTC time in second since Epoch) and boot reason

Atar
DeviceNotAvailableException

getBootHistorySince

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. The current device utcEpochTime in Millisecond can be obtained by method getDeviceDate() .

parametreler
utcEpochTime long : the device time since Epoch.

timeUnit TimeUnit : the time unit TimeUnit .

İadeler
Map of boot time (UTC time in second since Epoch) and boot reason

Atar
DeviceNotAvailableException

getBootloaderVersion

public String getBootloaderVersion ()

Convenience method to get the bootloader version of this device.

Will attempt to retrieve bootloader version from the device's current state. (ie if device is in fastboot mode, it will attempt to retrieve version from fastboot)

İadeler
String the String bootloader version or null if it cannot be found

Atar
DeviceNotAvailableException

getBugreport

public InputStreamSource getBugreport ()

Retrieves a bugreport from the device.

The implementation of this is guaranteed to continue to work on a device without an sdcard (or where the sdcard is not yet mounted).

İadeler
InputStreamSource An InputStreamSource which will produce the bugreport contents on demand. In case of failure, the InputStreamSource will produce an empty ERROR(/InputStream) .

getBugreportz

public InputStreamSource getBugreportz ()

Retrieves a bugreportz from the device. Zip format bugreport contains the main bugreport and other log files that are useful for debugging.

Only supported for 'adb version' > 1.0.36

İadeler
InputStreamSource a InputStreamSource of the zip file containing the bugreportz, return null in case of failure.

getBuildAlias

public String getBuildAlias ()

Retrieve the alias of the build that the device is currently running.

Build alias is usually a more readable string than build id (typically a number for Nexus builds). For example, final Android 4.2 release has build alias JDQ39, and build id 573038

İadeler
String the build alias or fall back to build id if it could not be retrieved

Atar
DeviceNotAvailableException

getBuildFlavor

public String getBuildFlavor ()

Retrieve the build flavor for the device.

İadeler
String the build flavor or null if it could not be retrieved

Atar
DeviceNotAvailableException

getBuildId

public String getBuildId ()

Retrieve the build the device is currently running.

İadeler
String the build id or IBuildInfo#UNKNOWN_BUILD_ID if it could not be retrieved

Atar
DeviceNotAvailableException

getBuildSigningKeys

public String getBuildSigningKeys ()

Returns the key type used to sign the device image

Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers)

İadeler
String The signing key if found, null otherwise.

Atar
DeviceNotAvailableException

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor ()

Returns a cached DeviceDescriptor if the device is allocated, otherwise returns the current DeviceDescriptor .

İadeler
DeviceDescriptor

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Returns a cached DeviceDescriptor if the device is allocated, otherwise returns the current DeviceDescriptor .

parametreler
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

İadeler
DeviceDescriptor

getChildren

public String[] getChildren (String path)

Alternative to using IFileEntry that sometimes won't work because of permissions.

parametreler
path String : is the path on the device where to do the search

İadeler
String[] Array of string containing all the file in a path on the device.

Atar
DeviceNotAvailableException

getConnection

public AbstractConnection getConnection ()

The current connection associated with the device.

İadeler
AbstractConnection

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Returns the current foldable state of the device or null if some issues occurred.

İadeler
DeviceFoldableState

Atar
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Return the id of the current running user. In case of error, return -10000.

İadeler
int

Atar
DeviceNotAvailableException

getDeviceClass

public String getDeviceClass ()

Get the device class.

İadeler
String the String device class.

getDeviceDate

public long getDeviceDate ()

Return the date of the device in millisecond since epoch.

İadeler
long the date of the device in epoch format.

Atar
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

İadeler
DeviceDescriptor

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

parametreler
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

İadeler
DeviceDescriptor

getDeviceState

public TestDeviceState getDeviceState ()

Get the device's state.

İadeler
TestDeviceState

getDeviceTimeOffset

public long getDeviceTimeOffset (Date date)

Helper to get the time difference between the device and a given ERROR(/Date) . Use Epoch time internally.

parametreler
date Date

İadeler
long the difference in milliseconds

Atar
DeviceNotAvailableException

getEmulatorOutput

public InputStreamSource getEmulatorOutput ()

Get the stream of emulator stdout and stderr

İadeler
InputStreamSource emulator output

getEmulatorProcess

public Process getEmulatorProcess ()

Return the Process corresponding to this emulator.

İadeler
Process the Process or null

getExecuteShellCommandLog

public final File getExecuteShellCommandLog ()

The log that contains all the executeShellCommand(String) logs.

İadeler
File

getExternalStoreFreeSpace

public long getExternalStoreFreeSpace ()

Helper method to determine amount of free space on device external storage.

İadeler
long the amount of free space in KB

Atar
DeviceNotAvailableException

getFastbootPath

public String getFastbootPath ()

Returns the path of the fastboot binary being used. Still requires isFastbootEnabled() to be true, to have fastboot functions enabled.

İadeler
String

getFastbootProductType

public String getFastbootProductType ()

Convenience method to get the product type of this device when its in fastboot mode.

This method should only be used if device should be in fastboot. Its a bit safer variant than the generic getProductType() method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.

İadeler
String the String product type name or null if it cannot be determined

Atar
DeviceNotAvailableException

getFastbootProductVariant

public String getFastbootProductVariant ()

Convenience method to get the product type of this device when its in fastboot mode.

This method should only be used if device should be in fastboot. Its a bit safer variant than the generic getProductType() method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.

İadeler
String the String product type name or null if it cannot be determined

Atar
DeviceNotAvailableException

getFastbootSerialNumber

public String getFastbootSerialNumber ()

Returns the fastboot mode serial number.

İadeler
String

getFastbootVariable

public String getFastbootVariable (String variableName)

Retrieve the given fastboot variable value from the device.

parametreler
variableName String : the variable name

İadeler
String the property value or null if it does not exist

Atar
DeviceNotAvailableException

getFastbootVersion

public String getFastbootVersion ()

Returns the version string of the fastboot binary being used. Or null if something goes wrong.

İadeler
String

getFileEntry

public IFileEntry getFileEntry (String path)

Retrieve a reference to a remote file on device.

parametreler
path String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported)

İadeler
IFileEntry the IFileEntry or null if file at given path cannot be found

Atar
DeviceNotAvailableException

getFileEntry

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

Unofficial helper to get a FileEntry from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).

parametreler
entry FileListingService.FileEntry : a FileEntry not necessarily root as Ddmlib requires.

İadeler
IFileEntry a FileEntryWrapper representing the FileEntry.

Atar
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Returns the list of foldable states on the device. Can be obtained with "cmd device_state print-states".

İadeler

Atar
DeviceNotAvailableException

getIDevice

public IDevice getIDevice ()

Returns a reference to the associated ddmlib IDevice .

A new IDevice may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice , because that reference may become stale.

İadeler
IDevice the IDevice

getInstalledPackageNames

public  getInstalledPackageNames ()

Fetch the application package names present on the device.

İadeler
ERROR(/Set) of String package names currently installed on the device.

Atar
DeviceNotAvailableException

getIntProperty

public long getIntProperty (String name, 
                long defaultValue)

Returns integer value of the given property from the device.

parametreler
name String : the property name

defaultValue long : default value to return if property is empty or doesn't exist.

İadeler
long the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value.

Atar
DeviceNotAvailableException

getIpAddress

public String getIpAddress ()

Gets the device's IP address.

İadeler
String the device's IP address, or null if device has no IP address

Atar
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Return an object to get the current state of the keyguard or null if not supported.

İadeler
KeyguardControllerState a KeyguardControllerState containing a snapshot of the state of the keyguard and returns Null if the Keyguard query is not supported.

Atar
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis() .

İadeler
long

getLaunchApiLevel

public int getLaunchApiLevel ()

Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL .

İadeler
int an integer indicating the first launched API Level of device

Atar
DeviceNotAvailableException

getLogcat

public InputStreamSource getLogcat ()

Grabs a snapshot stream of the logcat data.

Works in two modes:

  • If the logcat is currently being captured in the background, will return up to TestDeviceOptions.getMaxLogcatDataSize() bytes of the current contents of the background logcat capture
  • Otherwise, will return a static dump of the logcat data if device is currently responding

    İadeler
    InputStreamSource

  • getLogcat

    public InputStreamSource getLogcat (int maxBytes)

    Grabs a snapshot stream of the last maxBytes of captured logcat data.

    Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat() snapshot.

    parametreler
    maxBytes int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory

    İadeler
    InputStreamSource

    getLogcatDump

    public InputStreamSource getLogcatDump ()

    Get a dump of the current logcat for device. Unlike getLogcat() , this method will always return a static dump of the logcat.

    Has the disadvantage that nothing will be returned if device is not reachable.

    İadeler
    InputStreamSource a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data.

    getLogcatSince

    public InputStreamSource getLogcatSince (long date)

    Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate() .

    parametreler
    date long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s')

    İadeler
    InputStreamSource

    getMacAddress

    public String getMacAddress ()

    Returns the MAC address of the device, null if it fails to query from the device.

    İadeler
    String

    getMainUserId

    public Integer getMainUserId ()

    Returns the main user id.

    İadeler
    Integer the userId of the main user if there is one, and null if there is no main user.

    Atar
    DeviceNotAvailableException

    getMainlineModuleInfo

    public  getMainlineModuleInfo ()

    Get the information about the mainline modules installed on the device.

    İadeler
    ERROR(/Set) of String mainline modules currently installed on the device.

    Atar
    DeviceNotAvailableException

    getMaxNumberOfRunningUsersSupported

    public int getMaxNumberOfRunningUsersSupported ()

    Get the maximum number of supported simultaneously running users. Defaults to 0.

    İadeler
    int an integer indicating the number of simultaneously running users

    Atar
    DeviceNotAvailableException

    getMaxNumberOfUsersSupported

    public int getMaxNumberOfUsersSupported ()

    Get the maximum number of supported users. Defaults to 0.

    İadeler
    int an integer indicating the number of supported users

    Atar
    DeviceNotAvailableException

    getMicrodroidProcess

    public Process getMicrodroidProcess ()

    İadeler
    Process Returns the Process of the Microdroid VM. If TestDevice is not a Microdroid, returns null.

    getMonitor

    public IDeviceStateMonitor getMonitor ()

    Return the IDeviceStateMonitor associated with device.

    İadeler
    IDeviceStateMonitor

    getMountPoint

    public String getMountPoint (String mountName)

    Returns a mount point.

    Queries the device directly if the cached info in IDevice is not available.

    TODO: move this behavior to IDevice#getMountPoint(String)

    parametreler
    mountName String : the name of the mount point

    İadeler
    String the mount point or null

    getMountPointInfo

    public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    Returns a MountPointInfo corresponding to the specified mountpoint path, or null if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.

    parametreler
    mountpoint String

    İadeler
    ITestDevice.MountPointInfo A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    Atar
    DeviceNotAvailableException

    getMountPointInfo

    public  getMountPointInfo ()

    Returns a parsed version of the information in /proc/mounts on the device

    İadeler
    A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    Atar
    DeviceNotAvailableException

    getOptions

    public TestDeviceOptions getOptions ()

    Fetch the test options for the device.

    İadeler
    TestDeviceOptions TestDeviceOptions related to the device under test.

    getPartitionFreeSpace

    public long getPartitionFreeSpace (String partition)

    Helper method to determine amount of free space on device partition.

    parametreler
    partition String

    İadeler
    long the amount of free space in KB

    Atar
    DeviceNotAvailableException

    getPrimaryUserId

    public Integer getPrimaryUserId ()

    Returns the primary user id.

    İadeler
    Integer the userId of the primary user if there is one, and null if there is no primary user.

    Atar
    DeviceNotAvailableException

    getProcessByName

    public ProcessInfo getProcessByName (String processName)

    Helper method runs the "pidof" and "stat" command and returns ProcessInfo object with PID and process start time of the given process.

    parametreler
    processName String : the proces name String.

    İadeler
    ProcessInfo ProcessInfo of given processName

    Atar
    DeviceNotAvailableException

    getProcessPid

    public String getProcessPid (String process)

    Returns the pid of the service or null if something went wrong.

    parametreler
    process String : The proces name String.

    İadeler
    String

    Atar
    DeviceNotAvailableException

    getProductType

    public String getProductType ()

    Convenience method to get the product type of this device.

    This method will work if device is in either adb or fastboot mode.

    İadeler
    String the String product type name. Will not be null

    Atar
    DeviceNotAvailableException

    getProductVariant

    public String getProductVariant ()

    Convenience method to get the product variant of this device.

    This method will work if device is in either adb or fastboot mode.

    İadeler
    String the String product variant name or null if it cannot be determined

    Atar
    DeviceNotAvailableException

    getProperty

    public String getProperty (String name)

    Retrieve the given property value from the device.

    parametreler
    name String : the property name

    İadeler
    String the property value or null if it does not exist

    Atar
    DeviceNotAvailableException

    getRecoveryMode

    public ITestDevice.RecoveryMode getRecoveryMode ()

    Get the current recovery mode used for the device.

    İadeler
    ITestDevice.RecoveryMode the current recovery mode used for the device.

    getScreenshot

    public InputStreamSource getScreenshot (String format)

    Grabs a screenshot from the device. Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size

    parametreler
    format String : supported PNG, JPEG

    İadeler
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    Atar
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (long displayId)

    Grabs a screenshot from the device given display id. Format is PNG.

    TODO: extend the implementations above to support 'format' and 'rescale'

    parametreler
    displayId long : the display id of the screen to get screenshot from.

    İadeler
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    Atar
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (String format, 
                    boolean rescale)

    Grabs a screenshot from the device. Recommended to use getScreenshot(String) instead with JPEG encoding for smaller size.

    parametreler
    format String : supported PNG, JPEG

    rescale boolean : if screenshot should be rescaled to reduce the size of resulting image

    İadeler
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    Atar
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot ()

    Grabs a screenshot from the device.

    İadeler
    InputStreamSource a InputStreamSource of the screenshot in png format, or null if the screenshot was not successful.

    Atar
    DeviceNotAvailableException

    getSerialNumber

    public String getSerialNumber ()

    Convenience method to get serial number of this device.

    İadeler
    String the String serial number

    getSetting

    public String getSetting (int userId, 
                    String namespace, 
                    String key)

    Return the value of the requested setting. namespace must be one of: {"system", "secure", "global"}

    parametreler
    userId int

    namespace String

    key String

    İadeler
    String the value associated with the namespace:key of a user. Null if not found.

    Atar
    DeviceNotAvailableException

    getSetting

    public String getSetting (String namespace, 
                    String key)

    See getSetting(int, String, String) and performed on system user.

    parametreler
    namespace String

    key String

    İadeler
    String

    Atar
    DeviceNotAvailableException

    getSimOperator

    public String getSimOperator ()

    Return the SIM card operator or null if not available or if device is not available.

    İadeler
    String

    getSimState

    public String getSimState ()

    Return the SIM card state or null if not available or device is not available.

    İadeler
    String

    getTombstones

    public  getTombstones ()

    Fetch and return the list of tombstones from the devices. Requires root.

    method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException will terminate the method early.

    İadeler
    A list of tombstone files, empty if no tombstone.

    Atar
    DeviceNotAvailableException

    getTotalMemory

    public long getTotalMemory ()

    Returns total physical memory size in bytes or -1 in case of internal error

    İadeler
    long

    getUninstallablePackageNames

    public  getUninstallablePackageNames ()

    Fetch the application package names that can be uninstalled. This is presently defined as non-system packages, and updated system packages.

    İadeler
    ERROR(/Set) of uninstallable String package names currently installed on the device.

    Atar
    DeviceNotAvailableException

    getUseFastbootErase

    public boolean getUseFastbootErase ()

    Get whether to use fastboot erase or fastboot format to wipe a partition on the device.

    İadeler
    boolean true if fastboot erase will be used or false if fastboot format will be used.

    getUserFlags

    public int getUserFlags (int userId)

    Find and return the flags of a given user. Flags are defined in "android.content.pm.UserInfo" class in Android Open Source Project.

    parametreler
    userId int

    İadeler
    int the flags associated with the userId provided if found, -10000 in any other cases.

    Atar
    DeviceNotAvailableException

    getUserInfos

    public  getUserInfos ()

    Gets the Map of useId to UserInfo on the device. Will throw DeviceRuntimeException if output from device is not as expected.

    İadeler
    the list of UserInfo objects.

    Atar
    DeviceNotAvailableException

    getUserSerialNumber

    public int getUserSerialNumber (int userId)

    Return the serial number associated to the userId if found, -10000 in any other cases.

    parametreler
    userId int

    İadeler
    int

    Atar
    DeviceNotAvailableException

    handleAllocationEvent

    public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

    Process the given DeviceEvent. May transition device to new state. Will inform the IDeviceMonitor of any state transitions.

    Process the DeviceEvent, which may or may not transition this device to a new allocation state.

    parametreler
    event DeviceEvent

    İadeler
    IManagedTestDevice.DeviceEventResponse

    hasFeature

    public boolean hasFeature (String feature)

    Check if a feature is available on a device.

    parametreler
    feature String : which format should be "feature: " or " " directly.

    İadeler
    boolean True if feature is found, false otherwise.

    Atar
    DeviceNotAvailableException

    installPackage

    public String installPackage (File packageFile, 
                    boolean reinstall, 
                    String... extraArgs)

    Install an Android package on device.

    parametreler
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    İadeler
    String a String with an error code, or null if success.

    Atar
    DeviceNotAvailableException

    installPackage

    public String installPackage (File packageFile, 
                    boolean reinstall, 
                    boolean grantPermissions, 
                    String... extraArgs)

    Install an Android package on device.

    Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.

    parametreler
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    grantPermissions boolean : if all runtime permissions should be granted at install time

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    İadeler
    String a String with an error code, or null if success.

    Atar
    DeviceNotAvailableException

    installPackageForUser

    public String installPackageForUser (File packageFile, 
                    boolean reinstall, 
                    int userId, 
                    String... extraArgs)

    Install an Android package on device for a given user.

    parametreler
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    userId int : the integer user id to install for.

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    İadeler
    String a String with an error code, or null if success.

    Atar
    DeviceNotAvailableException

    installPackageForUser

    public String installPackageForUser (File packageFile, 
                    boolean reinstall, 
                    boolean grantPermissions, 
                    int userId, 
                    String... extraArgs)

    Install an Android package on device for a given user.

    Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.

    parametreler
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    grantPermissions boolean : if all runtime permissions should be granted at install time

    userId int : the integer user id to install for.

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    İadeler
    String a String with an error code, or null if success.

    Atar
    DeviceNotAvailableException

    invalidatePropertyCache

    public void invalidatePropertyCache ()

    isAdbRoot

    public boolean isAdbRoot ()

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isAdbTcp

    public boolean isAdbTcp ()

    İadeler
    boolean

    isAppEnumerationSupported

    public boolean isAppEnumerationSupported ()

    Check whether platform on device supports app enumeration

    İadeler
    boolean True if app enumeration is supported, false otherwise

    Atar
    DeviceNotAvailableException

    isBypassLowTargetSdkBlockSupported

    public boolean isBypassLowTargetSdkBlockSupported ()

    Check whether platform on device supports bypassing low target sdk block on app installs

    İadeler
    boolean True if bypass low target sdk block is supported, false otherwise

    Atar
    DeviceNotAvailableException

    isDeviceEncrypted

    public boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    İadeler
    boolean true if the device is encrypted.

    Atar
    DeviceNotAvailableException

    isDirectory

    public boolean isDirectory (String path)

    Return True if the path on the device is a directory, false otherwise.

    parametreler
    path String

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isEnableAdbRoot

    public boolean isEnableAdbRoot ()

    İadeler
    boolean true if adb root should be enabled on device

    isEncryptionSupported

    public boolean isEncryptionSupported ()

    Returns if encryption is supported on the device.

    İadeler
    boolean true if the device supports encryption.

    Atar
    DeviceNotAvailableException

    isExecutable

    public boolean isExecutable (String fullPath)

    Returns True if the file path on the device is an executable file, false otherwise.

    parametreler
    fullPath String

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isFastbootEnabled

    public boolean isFastbootEnabled ()

    Return if fastboot is available for the device.

    İadeler
    boolean

    isHeadless

    public boolean isHeadless ()

    Return true if the device is headless (no screen), false otherwise.

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isHeadlessSystemUserMode

    public boolean isHeadlessSystemUserMode ()

    Returns whether the device uses headless system user mode.

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isMainUserPermanentAdmin

    public boolean isMainUserPermanentAdmin ()

    Returns whether the main user is a permanent admin and can't be deleted or downgraded to non-admin status.

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isMultiUserSupported

    public boolean isMultiUserSupported ()

    Determines if multi user is supported.

    İadeler
    boolean true if multi user is supported, false otherwise

    Atar
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName, 
                    String userId)

    Query the device for a given package name and given user id to check if it's currently installed or not for that user.

    parametreler
    packageName String : the package we are checking if it's installed.

    userId String : The user id we are checking the package is installed for. If null, primary user zero will be used.

    İadeler
    boolean True if the package is reported as installed. False otherwise.

    Atar
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName)

    Query the device for a given package name to check if it's currently installed or not.

    parametreler
    packageName String

    İadeler
    boolean True if the package is reported as installed. False otherwise.

    Atar
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public boolean isRuntimePermissionSupported ()

    Check whether platform on device supports runtime permission granting

    İadeler
    boolean True if runtime permission are supported, false otherwise.

    Atar
    DeviceNotAvailableException

    isStateBootloaderOrFastbootd

    public boolean isStateBootloaderOrFastbootd ()

    Returns true if device is in TestDeviceState#FASTBOOT or TestDeviceState.FASTBOOTD .

    İadeler
    boolean

    isUserRunning

    public boolean isUserRunning (int userId)

    Check if a given user is running.

    parametreler
    userId int

    İadeler
    boolean True if the user is running, false in every other cases.

    Atar
    DeviceNotAvailableException

    isUserSecondary

    public boolean isUserSecondary (int userId)

    Return whether the specified user is a secondary user according to it's flags.

    parametreler
    userId int

    İadeler
    boolean true if the user is secondary, false otherwise.

    Atar
    DeviceNotAvailableException

    isUserVisible

    public boolean isUserVisible (int userId)

    Checks if the given user is visible.

    A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities (typically in the default display).

    parametreler
    userId int

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isUserVisibleOnDisplay

    public boolean isUserVisibleOnDisplay (int userId, 
                    int displayId)

    Checks if the given user is visible in the given display.

    A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities in that display.

    parametreler
    userId int

    displayId int

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isVisibleBackgroundUsersOnDefaultDisplaySupported

    public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()

    Returns whether the device allow users to be started visible in the background in the ERROR(/java.android.view.Display#DEFAULT_DISPLAY) .

    If it does, you could call startVisibleBackgroundUser(int, int, boolean) , passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers() (which should include ERROR(/java.android.view.Display#DEFAULT_DISPLAY) ).

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isVisibleBackgroundUsersSupported

    public boolean isVisibleBackgroundUsersSupported ()

    Returns whether the device allow users to be started visible in the background.

    If it does, you could call startVisibleBackgroundUser(int, int, boolean) , passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers() .

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    isWifiEnabled

    public boolean isWifiEnabled ()

    Test if wifi is enabled.

    Checks if wifi is enabled on device. Useful for asserting wifi status before tests that shouldn't run with wifi, eg mobile data tests.

    İadeler
    boolean true if wifi is enabled. false if disabled

    Atar
    DeviceNotAvailableException

    listDisplayIds

    public  listDisplayIds ()

    Collect the list of available displays id on the device as reported by "dumpsys SurfaceFlinger".

    İadeler
    The list of displays. Default always returns the default display 0.

    Atar
    DeviceNotAvailableException

    listDisplayIdsForStartingVisibleBackgroundUsers

    public  listDisplayIdsForStartingVisibleBackgroundUsers ()

    Gets the list of displays that can be used to start a user visible in the background .

    İadeler

    Atar
    DeviceNotAvailableException

    listUsers

    public  listUsers ()

    Gets the list of users on the device. Will throw DeviceRuntimeException if output from device is not as expected.

    İadeler
    the list of user ids.

    Atar
    DeviceNotAvailableException

    logAnrs

    public boolean logAnrs (ITestLogger logger)

    Collects and log ANRs from the device.

    parametreler
    logger ITestLogger : an ITestLogger to log the ANRs.

    İadeler
    boolean True if the logging was successful, false otherwise.

    Atar
    DeviceNotAvailableException

    logBugreport

    public boolean logBugreport (String dataName, 
                    ITestLogger listener)

    Helper method to take a bugreport and log it to the reporters.

    parametreler
    dataName String : name under which the bugreport will be reported.

    listener ITestLogger : an ITestLogger to log the bugreport.

    İadeler
    boolean True if the logging was successful, false otherwise.

    logOnDevice

    public void logOnDevice (String tag, 
                    Log.LogLevel level, 
                    String format, 
                    Object... args)

    Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.

    parametreler
    tag String : The tag under which we log our message in the logcat.

    level Log.LogLevel : The debug level of the message in the logcat.

    format String : The message format.

    args Object : the args to be replaced via String.format().

    nonBlockingReboot

    public void nonBlockingReboot ()

    Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.

    Atar
    DeviceNotAvailableException

    postAdbRootAction

    public void postAdbRootAction ()

    Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    postAdbUnrootAction

    public void postAdbUnrootAction ()

    Override if the device needs some specific actions to be taken after adb unroot and before the device is back online. Default implementation doesn't include any additional actions. adb root is not guaranteed to be disabled at this stage.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    postBootSetup

    public void postBootSetup ()

    Perform instructions to configure device for testing that after every boot.

    Should be called after device is fully booted/available

    In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot.

    Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)

    Atar
    DeviceNotAvailableException

    postInvocationTearDown

    public void postInvocationTearDown (Throwable exception)

    Extra steps for device specific required clean up that will be executed after the invocation is done.

    parametreler
    exception Throwable : if any, the final exception raised by the invocation failure.

    preInvocationSetup

    public void preInvocationSetup (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.

    parametreler
    info IBuildInfo : The IBuildInfo of the device.

    attributes MultiMap : The attributes stored in the invocation context

    Atar
    DeviceNotAvailableException
    TargetSetupError

    pullDir

    public boolean pullDir (String deviceFilePath, 
                    File localDir)

    Recursively pull directory contents from device.

    parametreler
    deviceFilePath String : the absolute file path of the remote source

    localDir File : the local directory to pull files into

    İadeler
    boolean true if file was pulled successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pullFile

    public boolean pullFile (String remoteFilePath, 
                    File localFile)

    Retrieves a file off device.

    parametreler
    remoteFilePath String : the absolute path to file on device.

    localFile File : the local file to store contents in. If non-empty, contents will be replaced.

    İadeler
    boolean true if file was retrieved successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pullFile

    public File pullFile (String remoteFilePath, 
                    int userId)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    parametreler
    remoteFilePath String : the absolute path to file on device.

    userId int : The user id to pull from

    İadeler
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Atar
    DeviceNotAvailableException

    pullFile

    public File pullFile (String remoteFilePath)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    parametreler
    remoteFilePath String : the absolute path to file on device.

    İadeler
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Atar
    DeviceNotAvailableException

    pullFile

    public boolean pullFile (String remoteFilePath, 
                    File localFile, 
                    int userId)

    Retrieves a file off device.

    parametreler
    remoteFilePath String : the absolute path to file on device.

    localFile File : the local file to store contents in. If non-empty, contents will be replaced.

    userId int : The user id to pull from

    İadeler
    boolean true if file was retrieved successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pullFileContents

    public String pullFileContents (String remoteFilePath)

    Retrieves a file off device, and returns the contents.

    parametreler
    remoteFilePath String : the absolute path to file on device.

    İadeler
    String A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Atar
    DeviceNotAvailableException

    pullFileFromExternal

    public File pullFileFromExternal (String remoteFilePath)

    A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File) , and return a reference to that File .

    parametreler
    remoteFilePath String : the path to file on device, relative to the device's external storage mountpoint

    İadeler
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Atar
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath, 
                     excludedDirectories)

    Recursively push directory contents to device while excluding some directories that are filtered.

    parametreler
    localFileDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    excludedDirectories : Set of excluded directories names that shouldn't be pushed.

    İadeler
    boolean true if file was pushed successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath)

    Recursively push directory contents to device.

    parametreler
    localFileDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    İadeler
    boolean true if file was pushed successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath, 
                    boolean evaluateContentProviderNeeded)

    Variant of pushFile(File, String) which can optionally consider evaluating the need for the content provider.

    parametreler
    localFile File : the local file to push

    remoteFilePath String : the remote destination absolute file path

    evaluateContentProviderNeeded boolean : whether to check if we need the content provider

    İadeler
    boolean true if file was pushed successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath)

    Push a file to device. By default using a content provider.

    parametreler
    localFile File : the local file to push

    remoteFilePath String : the remote destination absolute file path

    İadeler
    boolean true if file was pushed successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    pushString

    public boolean pushString (String contents, 
                    String remoteFilePath)

    Push file created from a string to device

    parametreler
    contents String : the contents of the file to push

    remoteFilePath String : the remote destination absolute file path

    İadeler
    boolean true if string was pushed successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    reboot

    public void reboot (String reason)

    Reboots the device into adb mode with given reason to be persisted across reboot.

    Blocks until device becomes available.

    Last reboot reason can be obtained by querying sys.boot.reason propety.

    parametreler
    reason String : a reason for this reboot, or null if no reason is specified.

    Atar
    DeviceNotAvailableException

    reboot

    public void reboot ()

    Reboots the device into adb mode.

    Blocks until device becomes available.

    Atar
    DeviceNotAvailableException

    rebootIntoBootloader

    public void rebootIntoBootloader ()

    Reboots the device into bootloader mode.

    Blocks until device is in bootloader mode.

    Atar
    DeviceNotAvailableException

    rebootIntoFastbootd

    public void rebootIntoFastbootd ()

    Reboots the device into fastbootd mode.

    Blocks until device is in fastbootd mode.

    Atar
    DeviceNotAvailableException

    rebootIntoRecovery

    public void rebootIntoRecovery ()

    Reboots the device into adb recovery mode.

    Blocks until device enters recovery

    Atar
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload ()

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    Atar
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload (boolean autoReboot)

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    parametreler
    autoReboot boolean : whether to automatically reboot the device after sideload

    Atar
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline ()

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    Atar
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline (String reason)

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    parametreler
    reason String : a reason for this reboot, or null if no reason is specified.

    Atar
    DeviceNotAvailableException

    rebootUserspace

    public void rebootUserspace ()

    Reboots only userspace part of device.

    Blocks until device becomes available.

    WARNING. Userspace reboot is currently under active development, use it on your own risk.

    Atar
    DeviceNotAvailableException

    rebootUserspaceUntilOnline

    public void rebootUserspaceUntilOnline ()

    An alternate to rebootUserspace() ()} that only blocks until device is online ie visible to adb.

    Atar
    DeviceNotAvailableException

    recoverDevice

    public boolean recoverDevice ()

    Attempts to recover device communication.

    İadeler
    boolean True if recovery attempted and successful, returns False if recovery was skipped

    Atar
    DeviceNotAvailableException if device is no longer available

    registerDeviceActionReceiver

    public void registerDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)

    Registers a IDeviceActionReceiver for this device.

    All registered IDeviceActionReceiver s will be notified before a device action starts and after the device action ends.

    parametreler
    deviceActionReceiver IDeviceActionReceiver : A IDeviceActionReceiver which will be registered.

    remountSystemReadOnly

    public void remountSystemReadOnly ()

    Make the system partition on the device read-only. May reboot the device.

    Atar
    DeviceNotAvailableException

    remountSystemWritable

    public void remountSystemWritable ()

    Make the system partition on the device writable. May reboot the device.

    Atar
    DeviceNotAvailableException

    remountVendorReadOnly

    public void remountVendorReadOnly ()

    Make the vendor partition on the device read-only. May reboot the device.

    Atar
    DeviceNotAvailableException

    remountVendorWritable

    public void remountVendorWritable ()

    Make the vendor partition on the device writable. May reboot the device.

    Atar
    DeviceNotAvailableException

    removeAdmin

    public boolean removeAdmin (String componentName, 
                    int userId)

    Remove given device admin in given user and return true if it is successful, false otherwise.

    parametreler
    componentName String : of device admin to be removed.

    userId int : of user that the device admin lives in.

    İadeler
    boolean True if it is successful, false otherwise.

    Atar
    DeviceNotAvailableException

    removeOwners

    public void removeOwners ()

    Remove all existing device profile owners with the best effort.

    Atar
    DeviceNotAvailableException

    removeUser

    public boolean removeUser (int userId)

    Remove a given user from the device.

    parametreler
    userId int : of the user to remove

    İadeler
    boolean true if we were successful in removing the user, false otherwise.

    Atar
    DeviceNotAvailableException

    resetContentProviderSetup

    public void resetContentProviderSetup ()

    Reset the flag for content provider setup in order to trigger it again.

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                    ITestLifeCycleReceiver... listeners)

    Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) with one or more listeners passed as parameters.

    parametreler
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners ITestLifeCycleReceiver : the test result listener(s)

    İadeler
    boolean true if test command completed. false if it failed to complete, but recovery succeeded

    Atar
    DeviceNotAvailableException

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    Runs instrumentation tests, and provides device recovery.

    If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.

    If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.

    parametreler
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners : the test result listeners

    İadeler
    boolean true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded

    Atar
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

    public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                    int userId, 
                     listeners)

    Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) but runs the test for the given user.

    parametreler
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

    public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                    int userId, 
                    ITestLifeCycleReceiver... listeners)

    Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) but runs the test for a given user.

    parametreler
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    setConfiguration

    public void setConfiguration (IConfiguration configuration)

    Injects the IConfiguration in use.

    parametreler
    configuration IConfiguration

    setConnectionAvdInfo

    public final void setConnectionAvdInfo (GceAvdInfo avdInfo)

    parametreler
    avdInfo GceAvdInfo

    setDate

    public void setDate (Date date)

    Sets the date on device

    Note: setting date on device requires root

    parametreler
    date Date : specify a particular date; will use host date if null

    Atar
    DeviceNotAvailableException

    setDeviceOwner

    public boolean setDeviceOwner (String componentName, 
                    int userId)

    Set a device admin component as device owner in given user.

    parametreler
    componentName String : of device admin to be device owner.

    userId int : of the user that the device owner lives in.

    İadeler
    boolean True if it is successful, false otherwise.

    Atar
    DeviceNotAvailableException

    setDeviceState

    public void setDeviceState (TestDeviceState deviceState)

    Update the device's state.

    parametreler
    deviceState TestDeviceState : the TestDeviceState

    setEmulatorOutputStream

    public void setEmulatorOutputStream (SizeLimitedOutputStream output)

    For emulator set SizeLimitedOutputStream to log output

    parametreler
    output SizeLimitedOutputStream : to log the output

    setEmulatorProcess

    public void setEmulatorProcess (Process p)

    Sets the Process , when this device is an emulator.

    parametreler
    p Process

    setFastbootEnabled

    public void setFastbootEnabled (boolean fastbootEnabled)

    Set the fastboot option for the device. Should be set when device is first allocated.

    parametreler
    fastbootEnabled boolean : whether fastboot is available for the device or not

    setFastbootPath

    public void setFastbootPath (String fastbootPath)

    Sets the path to the fastboot binary that should be used. Still requires isFastbootEnabled() to be true, to have fastboot functions enabled.

    parametreler
    fastbootPath String

    setIDevice

    public void setIDevice (IDevice newDevice)

    Update the IDevice associated with this ITestDevice.

    The new IDevice must refer the same physical device as the current reference. This method will be called if DDMS has allocated a new IDevice

    parametreler
    newDevice IDevice : the IDevice

    setLogStartDelay

    public void setLogStartDelay (int delay)

    Sets the time in ms to wait before starting logcat capture for a online device.

    parametreler
    delay int : the delay in ms

    setOptions

    public void setOptions (TestDeviceOptions options)

    Set the TestDeviceOptions for the device

    parametreler
    options TestDeviceOptions

    setProperty

    public boolean setProperty (String propKey, 
                    String propValue)

    Sets the given property value on the device. Requires adb root is true.

    parametreler
    propKey String : The key targeted to be set.

    propValue String : The property value to be set.

    İadeler
    boolean returns True if the setprop command was successful, False otherwise.

    Atar
    DeviceNotAvailableException

    setRecovery

    public void setRecovery (IDeviceRecovery recovery)

    Set the IDeviceRecovery to use for this device. Should be set when device is first allocated.

    parametreler
    recovery IDeviceRecovery : the IDeviceRecovery

    setRecoveryMode

    public void setRecoveryMode (ITestDevice.RecoveryMode mode)

    Set the current recovery mode to use for the device.

    Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc

    parametreler
    mode ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not.

    setSetting

    public void setSetting (String namespace, 
                    String key, 
                    String value)

    See setSetting(int, String, String, String) and performed on system user.

    parametreler
    namespace String

    key String

    value String

    Atar
    DeviceNotAvailableException

    setSetting

    public void setSetting (int userId, 
                    String namespace, 
                    String key, 
                    String value)

    Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}

    parametreler
    userId int

    namespace String

    key String

    value String

    Atar
    DeviceNotAvailableException

    setTestLogger

    public void setTestLogger (ITestLogger testLogger)

    Injects the ITestLogger instance

    parametreler
    testLogger ITestLogger

    setUseFastbootErase

    public void setUseFastbootErase (boolean useFastbootErase)

    Set whether to use fastboot erase or fastboot format to wipe a partition on the device.

    parametreler
    useFastbootErase boolean : true if fastboot erase should be used or false if fastboot format should be used.

    startLogcat

    public void startLogcat ()

    Start capturing logcat output from device in the background.

    Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat.

    When the device is no longer in use, stopLogcat() must be called.

    startLogcat() and stopLogcat() do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.

    startUser

    public boolean startUser (int userId)

    Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.

    parametreler
    userId int : of the user to start in the background

    İadeler
    boolean true if the user was successfully started in the background.

    Atar
    DeviceNotAvailableException

    startUser

    public boolean startUser (int userId, 
                    boolean waitFlag)

    Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.

    parametreler
    userId int : of the user to start in the background

    waitFlag boolean : will make the command wait until user is started and unlocked.

    İadeler
    boolean true if the user was successfully started in the background.

    Atar
    DeviceNotAvailableException

    startVisibleBackgroundUser

    public boolean startVisibleBackgroundUser (int userId, 
                    int displayId, 
                    boolean waitFlag)

    Starts a given user in the background, visible in the given display (ie, allowing the user to launch activities in that display).

    NOTE: this command doesn't check if the user exists, display is available, device supports such feature , etc.

    parametreler
    userId int : of the user to start in the background

    displayId int : display to start user visible on

    waitFlag boolean : will make the command wait until user is started and unlocked.

    İadeler
    boolean true if the user was successfully started visible in the background.

    Atar
    DeviceNotAvailableException

    stopEmulatorOutput

    public void stopEmulatorOutput ()

    Close and delete the emulator output.

    stopLogcat

    public void stopLogcat ()

    Stop capturing logcat output from device, and discard currently saved logcat data.

    Will have no effect if logcat output is not being captured.

    stopUser

    public boolean stopUser (int userId)

    Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.

    parametreler
    userId int : of the user to stop.

    İadeler
    boolean true if the user was successfully stopped.

    Atar
    DeviceNotAvailableException

    stopUser

    public boolean stopUser (int userId, 
                    boolean waitFlag, 
                    boolean forceFlag)

    Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.

    parametreler
    userId int : of the user to stop.

    waitFlag boolean : will make the command wait until user is stopped.

    forceFlag boolean : will force stop the user.

    İadeler
    boolean true if the user was successfully stopped.

    Atar
    DeviceNotAvailableException

    switchToAdbTcp

    public String switchToAdbTcp ()

    Switch device to adb-over-tcp mode.

    İadeler
    String the tcp serial number or null if device could not be switched

    Atar
    DeviceNotAvailableException

    switchToAdbUsb

    public boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    İadeler
    boolean true if switch was successful, false otherwise.

    Atar
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId)

    Switch to another userId with a default timeout. switchUser(int, long) .

    parametreler
    userId int

    İadeler
    boolean True if the new userId matches the userId provider. False otherwise.

    Atar
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId, 
                    long timeout)

    Switch to another userId with the provided timeout as deadline. Attempt to disable keyguard after user change is successful.

    parametreler
    userId int

    timeout long : to wait before returning false for switch-user failed.

    İadeler
    boolean True if the new userId matches the userId provider. False otherwise.

    Atar
    DeviceNotAvailableException

    syncFiles

    public boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    Incrementally syncs the contents of a local file directory to device.

    Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date.

    Hidden files (with names starting with ".") will be ignored.

    Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.

    parametreler
    localFileDir File : the local file directory containing files to recursively push.

    deviceFilePath String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail

    İadeler
    boolean true if files were synced successfully. false otherwise.

    Atar
    DeviceNotAvailableException

    takeBugreport

    public Bugreport takeBugreport ()

    Take a bugreport and returns it inside a Bugreport object to handle it. Return null in case of issue. File referenced in the Bugreport object need to be cleaned via Bugreport.close() .

    İadeler
    Bugreport

    uninstallPackage

    public String uninstallPackage (String packageName)

    Uninstall an Android package from device.

    parametreler
    packageName String : the Android package to uninstall

    İadeler
    String a String with an error code, or null if success.

    Atar
    DeviceNotAvailableException

    uninstallPackageForUser

    public String uninstallPackageForUser (String packageName, 
                    int userId)

    Uninstall an Android package from device for a given user.

    parametreler
    packageName String : the Android package to uninstall

    userId int : the integer user id to uninstall for.

    İadeler
    String a String with an error code, or null if success.

    Atar
    DeviceNotAvailableException

    unlockDevice

    public boolean unlockDevice ()

    Unlocks the device if the device is in an encrypted state.

    This method may restart the framework but will not call postBootSetup() . Therefore, the device might not be fully ready to be tested when this method returns.

    İadeler
    boolean true if successful or if the device is unencrypted.

    Atar
    DeviceNotAvailableException

    waitForBootComplete

    public boolean waitForBootComplete (long timeOut)

    Blocks until the device's boot complete flag is set.

    parametreler
    timeOut long : time in msecs to wait for the flag to be set

    İadeler
    boolean true if device's boot complete flag is set within the timeout

    Atar
    DeviceNotAvailableException

    waitForDeviceAvailable

    public boolean waitForDeviceAvailable ()

    Waits for the device to be responsive and available for testing. Uses default timeout.

    İadeler
    boolean True if device is available, False if recovery is disabled and unavailable.

    Atar
    DeviceNotAvailableException

    waitForDeviceAvailable

    public boolean waitForDeviceAvailable (long waitTime)

    Waits for the device to be responsive and available for testing.

    parametreler
    waitTime long : the time in ms to wait

    İadeler
    boolean True if device is available, False if recovery is disabled and unavailable.

    Atar
    DeviceNotAvailableException

    waitForDeviceAvailableInRecoverPath

    public boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    Waits for the device to be responsive and available without considering recovery path.

    parametreler
    waitTime long

    İadeler
    boolean True if device is available, False if unavailable.

    Atar
    DeviceNotAvailableException

    waitForDeviceBootloader

    public void waitForDeviceBootloader ()

    Blocks until device is visible via fastboot. Use default timeout.

    Atar
    DeviceNotAvailableException

    waitForDeviceInRecovery

    public boolean waitForDeviceInRecovery (long waitTime)

    Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery ).

    parametreler
    waitTime long : the time in ms to wait

    İadeler
    boolean true if device boots into recovery before time expires. false otherwise

    waitForDeviceInSideload

    public boolean waitForDeviceInSideload (long waitTime)

    Blocks for the device to be in the 'adb sideload' state

    parametreler
    waitTime long : the time in ms to wait

    İadeler
    boolean true if device boots into sideload before time expires. false otherwise

    waitForDeviceNotAvailable

    public boolean waitForDeviceNotAvailable (long waitTime)

    Blocks for the device to be not available ie missing from adb

    parametreler
    waitTime long : the time in ms to wait

    İadeler
    boolean true if device becomes not available before time expires. false otherwise

    waitForDeviceOnline

    public void waitForDeviceOnline ()

    Blocks until device is visible via adb. Uses default timeout

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    Atar
    DeviceNotAvailableException

    waitForDeviceOnline

    public void waitForDeviceOnline (long waitTime)

    Blocks until device is visible via adb.

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    parametreler
    waitTime long : the time in ms to wait

    Atar
    DeviceNotAvailableException

    waitForDeviceShell

    public boolean waitForDeviceShell (long waitTime)

    Waits for device to be responsive to a basic adb shell command.

    parametreler
    waitTime long : the time in ms to wait

    İadeler
    boolean true if device becomes responsive before waitTime elapses.

    Protected methods

    addExtraConnectionBuilderArgs

    protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)

    parametreler
    builder DefaultConnection.ConnectionBuilder

    buildAdbShellCommand

    protected String[] buildAdbShellCommand (String command, 
                    boolean forceExitStatusDetection)

    Builds the OS command for the given adb shell command session and args

    parametreler
    command String

    forceExitStatusDetection boolean

    İadeler
    String[]

    checkApiLevelAgainst

    protected void checkApiLevelAgainst (String feature, 
                    int strictMinLevel)

    parametreler
    feature String

    strictMinLevel int

    createRebootDeviceAction

    protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, 
                    String reason)

    Create a RebootDeviceAction to be used when performing a reboot action.

    parametreler
    rebootMode NativeDevice.RebootMode : a mode of this reboot.

    reason String : for this reboot.

    İadeler
    NativeDevice.RebootDeviceAction the created RebootDeviceAction .

    createRunUtil

    protected IRunUtil createRunUtil ()

    İadeler
    IRunUtil

    doAdbReboot

    protected void doAdbReboot (NativeDevice.RebootMode rebootMode, 
                    String reason)

    Perform a adb reboot.

    parametreler
    rebootMode NativeDevice.RebootMode : a mode of this reboot.

    reason String : for this reboot.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    ensureRuntimePermissionSupported

    protected void ensureRuntimePermissionSupported ()

    helper method to throw exception if runtime permission isn't supported

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    getApiLevelSafe

    protected int getApiLevelSafe ()

    İadeler
    int

    getLogger

    protected ITestLogger getLogger ()

    İadeler
    ITestLogger

    getRunUtil

    protected IRunUtil getRunUtil ()

    Get the RunUtil instance to use.

    İadeler
    IRunUtil

    initializeConnection

    protected void initializeConnection (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    parametreler
    info IBuildInfo

    attributes MultiMap

    Atar
    DeviceNotAvailableException
    TargetSetupError

    internalGetProperty

    protected String internalGetProperty (String propName, 
                    String fastbootVar, 
                    String description)

    Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.

    parametreler
    propName String : The name of the device property as returned by `adb shell getprop`

    fastbootVar String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted

    description String : A simple description of the variable. First letter should be capitalized.

    İadeler
    String A string, possibly null or empty, containing the value of the given property

    Atar
    DeviceNotAvailableException

    isInRebootCallback

    protected boolean isInRebootCallback ()

    Returns whether reboot callbacks is currently being executed or not. All public api's for reboot should be disabled if true.

    İadeler
    boolean

    isNewer

    protected boolean isNewer (File localFile, 
                    IFileEntry entry)

    Return true if local file is newer than remote file. IFileEntry being accurate to the minute, in case of equal times, the file will be considered newer.

    parametreler
    localFile File

    entry IFileEntry

    İadeler
    boolean

    notifyRebootEnded

    protected void notifyRebootEnded ()

    Notifies all IDeviceActionReceiver about reboot end event.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    notifyRebootStarted

    protected void notifyRebootStarted ()

    Notifies all IDeviceActionReceiver about reboot start event.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    performDeviceAction

    protected boolean performDeviceAction (String actionDescription, 
                    NativeDevice.DeviceAction action, 
                    int retryAttempts)

    Performs an action on this device. Attempts to recover device and optionally retry command if action fails.

    parametreler
    actionDescription String : a short description of action to be performed. Used for logging purposes only.

    action NativeDevice.DeviceAction : the action to be performed

    retryAttempts int : the retry attempts to make for action if it fails but recovery succeeds

    İadeler
    boolean true if action was performed successfully

    Atar
    DeviceNotAvailableException if recovery attempt fails or max attempts done without success

    postAdbReboot

    protected void postAdbReboot ()

    Possible extra actions that can be taken after a reboot.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    prePostBootSetup

    protected void prePostBootSetup ()

    Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.

    Atar
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    pullFileInternal

    protected boolean pullFileInternal (String remoteFilePath, 
                    File localFile)

    parametreler
    remoteFilePath String

    localFile File

    İadeler
    boolean

    Atar
    DeviceNotAvailableException

    setClock

    protected void setClock (Clock clock)

    Set the Clock instance to use.

    parametreler
    clock Clock

    setMicrodroidProcess

    protected void setMicrodroidProcess (Process process)

    Marks the TestDevice as microdroid and sets its CID.

    parametreler
    process Process : Process of the Microdroid VM.

    setTestDeviceOptions

    protected void setTestDeviceOptions ( deviceOptions)

    parametreler
    deviceOptions

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                     envVarMap, 
                    String[] fullCmd)

    Executes a simple fastboot command with environment variables and report the status of the command.

    parametreler
    timeout long

    envVarMap

    fullCmd String

    İadeler
    CommandResult

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                    String[] fullCmd)

    Executes a simple fastboot command and report the status of the command.

    parametreler
    timeout long

    fullCmd String

    İadeler
    CommandResult

    waitForDeviceNotAvailable

    protected boolean waitForDeviceNotAvailable (String operationDesc, 
                    long time)

    Wait to see the device going unavailable (stop reporting to adb).

    parametreler
    operationDesc String : The name of the operation that is waiting for unavailable.

    time long : The time to wait for unavailable to occur.

    İadeler
    boolean True if device did become unavailable.