tree: d8dbbf3eb15e1d9e8a7c5f0cc26ac6abdb50300c [path history] [tgz]
  1. configs/
  2. proto/
  3. scripts/
  4. src/
  5. Android.bp
  6. AndroidManifest.xml
  7. README.md
android/blueberry/server/README.md

Blueberry Android server

The Blueberry Android server exposes the Blueberry test interfaces over gRPC implemented on top of the Android Bluetooth SDK.

Getting started

Using Blueberry Android server requires to:

  • Build AOSP for your DUT, which can be either a physical device or an Android Virtual Device (AVD).
  • [Only for virtual tests] Build Rootcanal, the Android virtual Bluetooth Controller.
  • Setup your test environment.
  • Build, install, and run Blueberry server.
  • Run your tests.

1. Build and run AOSP code

Refer to the AOSP documentation to initialize and sync AOSP code, and build it for your DUT (aosp_cf_x86_64_phone-userdebug for the emulator).

If your DUT is a physical device, flash the built image on it. You may need to use Remote Device Proxy if you are using a remote instance to build. If you are also using adb on your local machine, you may need to force kill the local adb server (adb kill-server before using Remote Device Proxy.

If your DUT is a Cuttlefish virtual device, then proceed with the following steps:

  • Connect to your Chrome Remote Desktop.
  • Create a local Cuttlefish instance using your locally built image with the command acloud create --local-instance --local-image (see documentation)

2. Build Rootcanal [only for virtual tests on a physical device]

Rootcanal is a virtual Bluetooth Controller that allows emulating Bluetooth communications. It is used by default within Cuttlefish when running it using the acloud command (and thus this step is not needed) and is required for all virtual tests. However, it does not come preinstalled on a build for a physical device.

Proceed with the following instructions to build and install Rootcanal on your DUT.

3. Setup your test environment

Each time when starting a new ADB server to communicate with your DUT, proceed with the following steps to setup the test environment:

  • If running virtual tests (such as PTS-bot) on a physical device:
    • Run Rootcanal: adb root then adb shell ./vendor/bin/hw/android.hardware.bluetooth@1.1-service.sim &
    • Forward Rootcanal port through ADB: adb forward tcp:<rootcanal-port> tcp:<rootcanal-port>. Rootcanal port number may differ depending on its configuration. It is 7200 for the AVD, and generally 6211 for physical devices.
  • Forward Blueberry Android server port through ADB: adb forward tcp:8999 tcp:8999.

The above steps can be done by executing the setup.sh helper script (the -rootcanal option must be used for virtual tests on a physical device).

Finally, you must also make sure that the machine on which tests are executed can access the ports of the Blueberry Android server, Rootcanal (if required), and ADB (if required).

You can also check the usage examples provided below.

4. Build, install, and run Blueberry Android server

  • m BlueberryServer

  • adb install -r -g out/target/product/<device>/testcases/Blueberry/arm64/Blueberry.apk

  • Start the instrumented app:

  • adb shell am instrument -w -e Debug false com.android.blueberry/.Server

5. Run your tests

You should now be fully set up to run your tests!

Usage examples

Here are some usage examples:

  • DUT: physical Test type: virtual Test executer: remote instance (for instance a Cloudtop) accessed via SSH Blueberry Android server repository location: local machine (typically using Android Studio)

    • On your local machine: ./setup.sh --rootcanal.
    • On your local machine: build and install the app on your DUT.
    • Log on your remote instance, and forward Rootcanal port (6211, may change depending on your build) and Blueberry Android server (8999) port: ssh -R 6211:localhost:6211 -R 8999:localhost:8999 <remote-instance>. Optionnally, you can also share ADB port to your remote instance (if needed) by adding -R 5037:localhost:5037 to the command.
    • On your remote instance: execute your tests.
  • DUT: virtual (running in remote instance) Test type: virtual Test executer: remote instance Blueberry Android server repository location: remote instance

    On your remote instance:

    • ./setup.sh.
    • Build and install the app on the AVD.
    • Execute your tests.