2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
Tradefed でのデバイス割り当て
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
テスト(インストルメンテーション テストなど)を開始する際は、正しく実行できるよう、デバイスが必要になる場合があります。一部のテスト(Java 単体テストなど)では、デバイスが不要な場合もあります。テストによっては、複数のデバイスが必要な場合もあります(スマートフォンとスマートウォッチの両方を使用するテストなど)。上記のすべてのケースでは、テストが正しく実行されるよう、デバイス マネージャーによって必要なデバイスがテストに割り当てられます。このフェーズをデバイス割り当てまたはデバイス選択ステップと呼びます。
割り当ては DeviceSelectionOptions を通じて行われ、次のような、テストで必要となるデバイスのプロパティを宣言できます。
- 電池残量
- デバイスのタイプ
- 製品のタイプ
- シリアル番号
実際のデバイスを使用する
これは、デバイスのプロパティを指定しないテストに割り当てられるデフォルト設定です。AVAILABLE とマークされている物理デバイスがランダムに選択され、テストに割り当てられます。
デバイスを使用しない
テストでデバイスが不要な場合は、コマンドラインで --null-device
または -n
を指定するか、構成 XML で <option name="null-device" value="true" />
を指定できます。これにより、割り当てられたデバイスがないことを表すスタブ プレースホルダ NullDevice が割り当てられます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# Device allocation in Tradefed\n\nWhen starting a test (for example, an instrumentation test), it might need a\ndevice to be able to run properly. Or the test (such as some Java unit tests)\nmight not need a device at all. Still others or might even need multi-devices\n(like phone + watch tests). In all those cases, the Device Manager is\nresponsible for allocating the required devices to the test so it runs\nproperly. We call this phase the *device allocation* or *device selection* step.\n\nThe allocation is driven by\n[DeviceSelectionOptions](https://android.googlesource.com/platform/tools/tradefederation/+/refs/heads/android16-release/src/com/android/tradefed/device/DeviceSelectionOptions.java)\nthat allow a test to declare any properties it needs from a device, including:\n\n- Battery level\n- Device type\n- Product type\n- Serial number\n\nUse real devices\n----------------\n\nThis is the default setting that will be allocated to all tests that don't\nspecify any device properties. A physical random device marked\n[AVAILABLE](/docs/core/tests/tradefed/architecture/device-manager#allocation_states)\nwill be picked and assigned to the test.\n\nUse no devices\n--------------\n\nWhen no devices are needed by the test, it can specify `--null-device` or `-n`\non its command line, or `\u003coption name=\"null-device\" value=\"true\" /\u003e` in its\nconfiguration XML. This allocates a stub placeholder NullDevice that\nrepresents no device was allocated."]]