[[["容易理解","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-07-27 (世界標準時間)。"],[],[],null,["# Run CTS Verifier multidevice tests\n\nThis page contains instructions for using CTS\nVerifier (CTS-V) multidevice tests for Android 16 and\nhigher.\n\nSet up host-side multidevice tests\n----------------------------------\n\nThis section explains how to set up multidevice tests.\n\n1. Ensure that your desktop machine meets the [operating system requirements](/docs/compatibility/cts/setup#os-reqt) for CTS.\n2. Follow steps 2 and 5 of [Install desktop software](/docs/compatibility/cts/setup#install-software) to ensure that adb, AAPT2, and Python are correctly installed on your desktop.\n3. Prepare two matching devices under test (DUTs), each with CTS-V set up.\n\n - For information on setting up a DUT, see [Set up the DUT](/docs/compatibility/cts/setup#device-setup).\n - For instructions on setting up CTS-V, see [Setup](/docs/compatibility/cts/verifier#setup).\n4. If you are testing a module other than NFC, follow\n [Set up standard two-device tests](#setup-standard).\n\n - For NFC tests, follow [Set up NFC tests](#setup-nfc).\n5. If you are testing the CDM module, follow [Set up CDM tests](#setup-cdm) in\n addition to the standard two-device setup.\n\n### Set up standard two-device tests\n\nFor the default two-device setup:\n\n1. Place two matching Android DUTs approximately 20 cm apart.\n2. To ensure a clean environment, place both devices in a shield box.\n\n | **Note:** If you have issues with these tests and require help, ensure tests have been run with both devices in a shield box.\n3. (optional) Set up an OTA sniffer for Wi-Fi debugging.\n\n### Set up NFC tests\n\nNFC tests use **one** DUT and a PN532 NFC chip.\n\nTo set up NFC tests:\n\n1. Purchase a PN532 NFC chip. We recommend the [All-In-One PN532](https://shop.mtoolstec.com/product/mtools-all-in-one-pn532).\n2. On the DUT, navigate to the **Settings** app.\n\n3. Enable **NFC**.\n\n4. Position the NFC chip:\n\n - For phones, position the DUT's NFC reader as shown in figure 1:\n\n **Figure 1.** NFC chip positioning.\n - For other device types, position the chip next to the device's NFC antenna.\n\n5. Attach the PN532 NFC chip to your testing workstation using a USB cable.\n\n### Set up CDM tests\n\nThe `test_permissions_sync()` test case has different behavior depending on the\nbuild type of the devices on which the test is executed. It is critical that\n**both** debuggable (userdebug or eng) and non-debuggable (user) builds are\ntested by OEMs and that tests pass for both.\n\n#### Exemption\n\nThe CDD clause for the permissions sync API implementation only requires it to\nbe able to successfully transfer data between devices over a secure channel.\nSince the secure channel implementation isn't a CDD compliance requirement, this\ntest can be skipped on non-debuggable (user) builds, but only if you want to opt\nout of supporting the CDM permissions sync feature.\n\nThe tests must pass on debuggable builds without exception.\n\n#### Prerequisites for testing on non-debuggable builds\n\nIf you aren't exempt by the previous exemption clauses, ensure the following\nprerequisites are met.\n\nThe secure channel uses AVF (`AttestationVerificationFramework`) to verify the\ntrustworthiness of hardware. Attestations generated by both parties contain\nseveral pieces of information about themselves to ensure that there hasn't been\nany unauthorized alteration in their system. AVF checks for the following states\nduring the verification process:\n\n- Device has access to internet\n- Device uses verified boot and the build must be signed with a release-key, not a dev-key\n- Device is bootloader locked. For detailed instructions, see [locking the bootloader](/docs/core/architecture/bootloader/locking_unlocking#locking-bootloader)\n- OS, key boot, and key vendor patch levels are within 12 months. Don't use a build older than a year\n- Device attestation is backed by one of the vendor-approved root\n certificates. Specify your trusted root certificates in the\n `vendor_required_attestation_certificates.xml` resource overlay.\n\n \u003cbr /\u003e\n\nRun host-side multidevice tests (AOSP 16 or later)\n--------------------------------------------------\n\nCTS Verifier 16 introduces the support for host-side\nmultidevice tests.\nThese tests can be executed using automated scripts on the host, instead of the\nmanual test operation on the device. After each test is completed, results are\nautomatically uploaded to the DUT and displayed in the CTS Verifier app.\n\nThis section explains how to run the host-side multidevice tests.\n\n### Run multidevice tests\n\nTo run a multidevice test:\n\n1. On your test workstation, launch the `cts-v-host` console\n from the directory where the CTS-V zip package was unzipped:\n\n ./android-cts-verifier/android-cts-v-host/tools/cts-v-host-tradefed\n\n2. From within the CTS Verifier app on the DUT, click **Host-side Tests**.\n Figure 2 shows the host-side tests in the CTS Verifier app:\n\n **Figure 2.** Host-side multidevice tests in CTS Verifier app.\n\n A list of test host-side multidevice test modules is displayed.\n3. Identify the name of the test module that you want to run. For example, the\n CompanionDeviceManager module is listed as\n **CtsCompanionDeviceManagerMultiDeviceTestCases**.\n\n4. In the cts-v-host console, run the following command:\n Note: If you tap on a host-side module in the CTS Verifier app, you won't see\n a\n list of individual test cases. Instead the UI automatically populates with the\n test case results after the module has been executed on the host.\n\n5. In the xTS console, run the following command:\n\n run cts-v-host -m \u003cvar translate=\"no\"\u003etest_module_name\u003c/var\u003e\n\n For example: \n\n run cts-v-host -m CtsCompanionDeviceManagerMultiDeviceTestCases\n\n | **Note:** If you run `cts-v-host` without using the `-m `\u003cvar translate=\"no\"\u003etest_module_name\u003c/var\u003e, the command attempts to run all test modules, ignoring deviations in device and hardware requirements. Instead, execute the `run cts-v-host-default-devices` command to run the tests with the [standard setup](#setup-standard) as a single subplan.\n | **Note:** You can indicate the specific DUTs to test using their serial numbers: `run cts-v-host -m `\u003cvar translate=\"no\"\u003etest_module_name\u003c/var\u003e` -s `\u003cvar translate=\"no\"\u003edevice1_serial\u003c/var\u003e` -s `\u003cvar translate=\"no\"\u003edevice2_serial\u003c/var\u003e` ...`\n\n After the xTS console finishes running the tests, the\n results appear in the CTS Verifier app. Tests marked green have passed. Tests\n marked red have failed. Figure 3 shows example results for the\n CtsCompanionDeviceManager tests:\n\n **Figure 3.** Host-side multidevice test results in CTS Verifier app.\n | **Note:** Host-side results are automatically added to the overall CTS-V test report.\n\n \u003cbr /\u003e\n\nTroubleshoot multidevice tests\n------------------------------\n\nThis section provides troubleshooting help for possible issues.\n\n### Fix No response for GetFirmwareVersion during NFC tests\n\nIf you receive the message `verify_firmware_version RuntimeError: No response\nfor GetFirmwareVersion` while running the multidevice tests, the tests\ncan't access the PN532 NFC board.\n\nTo fix this issue, identify the serial path used by the PN532 NFC board on\nyour host, such as `dev/ttyUSB1`, then manually specify it using the\n`--module-arg` argument in the console: \n\n run cts-v-host -m CtsNfcHceMultiDeviceTestCases --module-arg CtsNfcHceMultiDeviceTestCases:pn532_serial_path:/dev/ttyUSB1\n\n### Fix Transaction failed error message during NFC tests\n\nIf you receive the message `Transaction failed, check device logs for more\ninformation.` for all NFC test cases, it is likely because the DUT's NFC chip\ncan't detect the PN532.\n\nIf you have multiple devices connected to the host, and some of them don't have\na PN532 placed on top, the wrong DUT may have been selected. For more\ninformation, see [Set up NFC tests](#setup-nfc).\n\nTo fix this problem, do one of the following:\n\n- Set the correct DUT's serial in your host-side test command using the `-s`\n flag.\n\n- Disconnect all non-DUT devices from the host.\n\n### CDM test case `test_permissions_sync` is ignored\n\nIf the test is being run on non-debuggable devices, then see if you are\n[exempted](#cdm-exemption). Otherwise, ensure that both devices meet the\n[prerequisites](#cdm-prerequisites)."]]