diff --git a/.gitignore b/.gitignore index f1e6935..247c328 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ Thumbs.db .idea/ # Docker compose data -data/ \ No newline at end of file +data*/ \ No newline at end of file diff --git a/README.md b/README.md index 80479d8..d7e0594 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Access and control the Android emulator directly in your web browser with the in - [Using Web Interface](#use-the-web-interface-to-access-the-emulator) - [Using ADB](#connect-via-adb) - [Using Desktop scrcpy](#use-scrcpy-to-mirror-the-emulator-screen) + - [Customizing Device Screen](#customizing-device-screen) - [First Boot Process](#-first-boot-process) - [Container Logs](#-container-logs) - [Roadmap](#-roadmap) @@ -134,6 +135,15 @@ scrcpy -s localhost:5555 > **Note:** Ensure `scrcpy` is installed on your host machine. [Installation Guide](https://github.com/Genymobile/scrcpy#installation) +### Customizing Device Screen + +The emulator's display can be adjusted with environment variables: + +- `SCREEN_RESOLUTION` (optional): sets the screen size in `WIDTHxHEIGHT` format. +- `SCREEN_DENSITY` (optional): overrides the device pixel density in DPI. + +Configure these variables in your `docker-compose.yml` file (the provided example contains commented entries for reference). If `SCREEN_RESOLUTION` or `SCREEN_DENSITY` are omitted, the emulator uses its default settings. + ## 🔄 **First Boot Process** The first time you start the container, it will perform a comprehensive setup process that includes: diff --git a/docker-compose.yml b/docker-compose.yml index c5a0f2a..d505122 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,4 @@ +--- services: dockerify-android: container_name: dockerify-android @@ -12,10 +13,14 @@ services: environment: - DNS=one.one.one.one - RAM_SIZE=8192 + # Optional screen resolution in WIDTHxHEIGHT format + #- SCREEN_RESOLUTION=720x720 + # Optional screen density (dpi) + #- SCREEN_DENSITY=227 privileged: true devices: - /dev/kvm - + scrcpy-web: container_name: scrcpy-web restart: unless-stopped @@ -30,4 +35,4 @@ services: sh -c " adb connect dockerify-android:5555 && npm start - " \ No newline at end of file + " diff --git a/start-emulator.sh b/start-emulator.sh index aa19835..11db5f3 100644 --- a/start-emulator.sh +++ b/start-emulator.sh @@ -5,5 +5,13 @@ if [ -f /data/.first-boot-done ]; then RAMDISK="-ramdisk /data/android.avd/ramdisk.img" fi +# Configure optional screen resolution and density +if [ -n "$SCREEN_RESOLUTION" ]; then + SCREEN_RESOLUTION_FLAG="-skin $SCREEN_RESOLUTION" +fi +if [ -n "$SCREEN_DENSITY" ]; then + SCREEN_DENSITY_FLAG="-dpi-device $SCREEN_DENSITY" +fi + # Start the emulator with the appropriate ramdisk.img -/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $RAMDISK -qemu -m ${RAM_SIZE:-4096} \ No newline at end of file +/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $SCREEN_RESOLUTION_FLAG $SCREEN_DENSITY_FLAG $RAMDISK -qemu -m "${RAM_SIZE:-4096}"