The Blueberry Android server exposes the Blueberry test interfaces over gRPC implemented on top of the Android Bluetooth SDK.
Using Blueberry Android server requires to:
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:
acloud create --local-instance --local-image
(see documentation)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.
Each time when starting a new ADB server to communicate with your DUT, proceed with the following steps to setup the test environment:
adb root
then adb shell ./vendor/bin/hw/android.hardware.bluetooth@1.1-service.sim &
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.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.
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
You should now be fully set up to run your tests!
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)
./setup.sh --rootcanal
.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.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
.