27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
TF'de cihazlarla çalışma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Trade Federation, test çalıştırmak için ITestDevice
adlı bir soyutlama kullanır. Bu soyutlama, en düşük ortak payda Android cihazını nesneleştirir:
- Seri numarası olmalıdır.
- Durumu: Online, Kullanılabilir, Kurtarma veya Kullanılamıyor
- Güvenilirlik hakkında bir fikir vermelidir. Örneğin, bir komutu çalıştırdığımızda komutun henüz bitmediği, cihazın komut çalıştırmayı desteklemediği ve cihazın komutu çalıştırırken yanıt vermediği durumları birbirinden ayırt edebiliriz.
Cihaz sınıfları
ITestDevice
'ün üç ana uygulaması, üç yaygın kullanım alanını temsil eder.
Fiziksel cihaz
Bu, TF ana makinesine USB ile veya adb'nin TCP özelliği kullanılarak bağlanan gerçek bir donanım parçasıdır. TestDevice sınıfı, adb için Java arayüzü olan ddmlib kitaplığının üzerinde yer alır. Bu nedenle, adb devices
içinde listelenen tüm fiziksel cihazlar örneklendirilebilir ve TestDevice
olarak kullanılabilir.
Emülatör
Emülatörler başka bir işlemde bulunduğundan TF tarafından özel olarak ele alınır. Bir emülatörle etkileşim kurmak için komut için --emulator
bağımsız değişkenini belirtin. Daha fazla bilgi için LocalSdkBuildProvider ve SdkAvdPreparer'a bakın.
Cihaz seçilmedi
Bir cihazla hiç etkileşime geçmeyen bir testiniz olduğunu varsayalım. Örneğin, bir hizmetten dosya indirip dosyanın geçerli olduğunu doğrulayabilir. NullDevice, yalnızca bir taslak olan bir ITestDevice
öğesidir. null-device-N
gibi bir seri numarasına sahiptir ve çoğu deneme işlemi sessizce işlem yapmaz veya hata verir.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Work with devices in TF\n\nTrade Federation uses an abstraction called\n[ITestDevice](/reference/com/android/tradefed/device/ITestDevice) to\nrun tests. This abstraction objectifies the lowest-common-denominator Android device:\n\n- It has a serial number\n- It has a state: Online, Available, Recovery, or Not Available\n- It has some notion of reliability. For instance, if we run a command, we can differentiate between the case where the command hasn't finished yet, the case where the device doesn't support running commands, and the case where the device has become unresponsive while running the command.\n\nDevice classes\n--------------\n\nThe three primary implementations of `ITestDevice` represent three common\nusecases.\n\n### Physical device\n\nThis is an actual piece of hardware, connected to the TF host machine either by USB, or by using\nadb's TCP feature. The [TestDevice](/reference/com/android/tradefed/device/TestDevice) class sits atop the ddmlib library, which is a Java interface to adb. So any\nphysical device listed in `adb devices` can be instantiated and used as a\n`TestDevice`.\n\n### Emulator\n\nEmulators are handled specially by TF because they live in another process. To interact with an\nEmulator, specify the `--emulator` argument for the command. See\n[LocalSdkBuildProvider](/reference/com/android/tradefed/build/LocalSdkBuildProvider) and\n[SdkAvdPreparer](/reference/com/android/tradefed/targetprep/SdkAvdPreparer) for more info.\n\n### No device\n\nSuppose you have a test that doesn't interact with a device at all. For instance, it might just\ndownload a file from some service and verify that the file itself is valid. The\n[NullDevice](/reference/com/android/tradefed/device/NullDevice) is an `ITestDevice` that is just a stub. It has a serial number like\n`null-device-N`, and most attempted operations either no-op silently or throw."]]