Skip to content

Latest commit

 

History

History
100 lines (82 loc) · 2.74 KB

testing.adoc

File metadata and controls

100 lines (82 loc) · 2.74 KB

Testing Environment Setup

1. Overview

Below you may find instructions on how to setup testing environment for applications using the Android Emulator.

2. Creating an Android Virtual Device

To learn more about Android Virtual Devices (AVD) please refer to Create and manage virtual devices

  • Navigate to Tools in Android Studio, then select Device Manager.

  • Use the "+" button to create a Virtual Device.

  • Pick a device profile, such as "Pixel C" from the "Tablet" category, and proceed by clicking "Next".

  • In the "Select a system image" window, go to the "x86 images" tab.

  • Click on the small download button next to "Tiramisu" with Target as "Android 13.0" (ensure the selected system image doesn’t have "Google APIs") and wait for the download to complete. Once downloaded, click "Next" and then "Finish."

Note
Applications included in this project should be installed as privileged ones, requiring them to be signed with the same platform keys used in the selected system image. We cannot use system images with "Google APIs", because those keys are not available in AOSP repository.

3. Starting an Android Emulator

You may launch an emulator that uses your AVD from "Device Manager" by clicking "Start" button next to it or from the console with commands below.

To get the name of your AVD:

Linux:

emulator --list-avds

Windows:

emulator -list-avds

Launch the emulator with read-only system image:

emulator @YourAVDName

Or with writable system image:

Linux:

emulator @YourAVDName --writable-system

Windows:

emulator @YourAVDName -writable-system
Note
The emulator binary is located in "<AndroidSDK>/emulator/" folder.

4. Installing a Privileged Application

Launch the emulator with writable system image as described in the previous section.

Enable remounting in writable mode (required only once):

adb root
adb disable-verity
adb reboot

Push the application to the system image:

adb root
adb remount
adb shell mkdir /system/priv-app/<AppName>
adb push ./<module>/build/outputs/apk/release/<AppName>-release.apk /system/priv-app/<AppName>/<AppName>.apk

Whitelist privileged permissions used by the application:

adb push privapp-permissions-<AppPackage>.xml /etc/permissions/

Reboot to apply changes:

adb reboot

In the majority of cases, you can apply subsequent updates to the application without remounting:

adb install ./<module>/build/outputs/apk/release/<AppName>-release.apk

or

gradlew installRelease