Skip to content

Commit 19e0751

Browse files
authored
feat(os): update to android 11 (#3)
Fixes #2
1 parent ec2be8d commit 19e0751

7 files changed

Lines changed: 37 additions & 20 deletions

File tree

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN mkdir /root/.android/ && \
4343

4444

4545
# Detect architecture and set environment variable
46-
RUN yes | sdkmanager --sdk_root=$ANDROID_HOME "emulator" "platform-tools" "platforms;android-29" "system-images;android-29;default;x86_64"
46+
RUN yes | sdkmanager --sdk_root=$ANDROID_HOME "emulator" "platform-tools" "platforms;android-30" "system-images;android-30;default;x86_64"
4747
# RUN if [ "$(uname -m)" = "aarch64" ]; then \
4848
# unzip /root/emulator.zip -d $ANDROID_HOME && \
4949
# mv /root/package.xml $ANDROID_HOME/emulator/package.xml && \
@@ -65,6 +65,10 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
6565
COPY first-boot.sh /root/first-boot.sh
6666
RUN chmod +x /root/first-boot.sh
6767

68+
# Copy the start-emulator script
69+
COPY start-emulator.sh /root/start-emulator.sh
70+
RUN chmod +x /root/start-emulator.sh
71+
6872
# Expose necessary ports
6973
EXPOSE 5554 5555
7074

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ services:
88
volumes:
99
- ./data:/data
1010
- ./extras:/extras
11-
- ./patch/ramdisk.img:/opt/android-sdk/system-images/android-29/default/x86_64/ramdisk.img
12-
- ./patch/ramdisk.img.backup:/opt/android-sdk/system-images/android-29/default/x86_64/ramdisk.img.backup
1311
environment:
14-
- DNS=1.1.1.1
12+
- DNS=one.one.one.one
1513
- RAM_SIZE=8192
1614
privileged: true
1715
devices:

first-boot.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ apply_settings() {
99
COMPLETED=$(adb shell getprop sys.boot_completed | tr -d '\r')
1010
sleep 5
1111
done
12+
adb root
1213
adb shell settings put global window_animation_scale 0
1314
adb shell settings put global transition_animation_scale 0
1415
adb shell settings put global animator_duration_scale 0
1516
adb shell settings put global stay_on_while_plugged_in 0
1617
adb shell settings put system screen_off_timeout 15000
18+
adb shell settings put system accelerometer_rotation 0
1719
adb shell settings put global private_dns_mode hostname
18-
adb shell settings put global private_dns_specifier dns2024.haroun.dev
19-
# adb shell svc wifi disable
20+
adb shell settings put global private_dns_specifier ${DNS:-one.one.one.one}
21+
adb shell settings put global airplane_mode_on 1
22+
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
23+
adb shell svc data disable
24+
adb shell svc wifi enable
2025
}
2126

2227
# Detect ip and forward ADB ports from the container's network
@@ -34,7 +39,7 @@ fi
3439

3540
echo "Init ADV ..."
3641

37-
echo "no" | avdmanager create avd -n test -k "system-images;android-29;default;x86_64"
42+
echo "no" | avdmanager create avd -n android -k "system-images;android-30;default;x86_64"
3843

3944
echo "Preparation ..."
4045

@@ -52,32 +57,33 @@ done
5257

5358
echo "Installing GAPPS ..."
5459

55-
wget https://deac-fra.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-10.0-pico-20220503.zip?viasf=1 -O gapps-10.zip
56-
unzip gapps-10.zip 'Core/*' -d gapps-10 && rm gapps-10.zip
57-
rm gapps-10/Core/setup*
58-
lzip -d gapps-10/Core/*.lz
59-
for f in $(ls gapps-10/Core/*.tar); do
60-
tar -x --strip-components 2 -f $f -C gapps-10
60+
wget https://netcologne.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip?viasf=1 -O gapps-11.zip
61+
unzip gapps-11.zip 'Core/*' -d gapps-11 && rm gapps-11.zip
62+
rm gapps-11/Core/setup*
63+
lzip -d gapps-11/Core/*.lz
64+
for f in $(ls gapps-11/Core/*.tar); do
65+
tar -x --strip-components 2 -f $f -C gapps-11
6166
done
6267

63-
adb push gapps-10/etc /system
64-
adb push gapps-10/framework /system
65-
adb push gapps-10/app /system
66-
adb push gapps-10/priv-app /system
68+
adb push gapps-11/etc /system
69+
adb push gapps-11/framework /system
70+
adb push gapps-11/app /system
71+
adb push gapps-11/priv-app /system
6772

6873
echo "Root Script Starting..."
6974

7075
# Root the VM
7176
git clone https://gitlab.com/newbit/rootAVD.git
7277
pushd rootAVD
7378
sed -i 's/read -t 10 choice/choice=2/' rootAVD.sh
74-
./rootAVD.sh system-images/android-29/default/x86_64/ramdisk.img
79+
./rootAVD.sh system-images/android-30/default/x86_64/ramdisk.img
80+
cp /opt/android-sdk/system-images/android-30/default/x86_64/ramdisk.img /data/android.avd/ramdisk.img
7581
popd
7682
echo "Root Done"
7783
sleep 15
7884
echo "Cleanup ..."
7985
# done
80-
rm -r gapps-10
86+
rm -r gapps-11
8187
rm -r rootAVD
8288
apply_settings
8389
touch /data/.first-boot-done

patch/ramdisk.img

-1.24 MB
Binary file not shown.

patch/ramdisk.img.backup

-877 KB
Binary file not shown.

start-emulator.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# Check if the .first-boot-done file exists
4+
if [ -f /data/.first-boot-done ]; then
5+
RAMDISK_PATH="-ramdisk /data/android.avd/ramdisk.img"
6+
fi
7+
8+
# Start the emulator with the appropriate ramdisk.img
9+
/opt/android-sdk/emulator/emulator -avd android -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot $RAMDISK_PATH -qemu -m ${RAM_SIZE:-4096}

supervisord.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ user=root
66
serverurl=unix:///var/run/supervisor.sock
77

88
[program:emulator]
9-
command=/bin/bash -c "/opt/android-sdk/emulator/emulator -avd test -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -qemu -m ${RAM_SIZE:-4096}"
9+
command=/bin/bash /root/start-emulator.sh
1010
stdout_logfile=/var/log/supervisor/emulator.out.log
1111
stderr_logfile=/var/log/supervisor/emulator.err.log
1212
autorestart=true

0 commit comments

Comments
 (0)