docker-android/src/utils.sh

45 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-08-02 10:37:08 +01:00
function wait_emulator_to_be_ready () {
boot_completed=false
while [ "$boot_completed" == false ]; do
status=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
2018-08-03 14:58:07 +01:00
echo "Boot Status: $status"
2018-08-02 10:37:08 +01:00
2018-08-03 14:58:07 +01:00
if [ "$status" == "1" ]; then
2018-08-02 10:37:08 +01:00
boot_completed=true
else
sleep 1
fi
done
}
2018-08-03 14:58:07 +01:00
function change_language_if_needed() {
if [ ! -z "${LANGUAGE// }" ] && [ ! -z "${COUNTRY// }" ]; then
wait_emulator_to_be_ready
echo "Languge will be changed to ${LANGUAGE}-${COUNTRY}"
2018-08-13 14:08:20 +01:00
adb root && adb shell "setprop persist.sys.language $LANGUAGE; setprop persist.sys.country $COUNTRY; stop; start" && adb unroot
2018-08-03 14:58:07 +01:00
echo "Language is changed!"
fi
}
function install_google_play () {
2018-08-02 10:37:08 +01:00
wait_emulator_to_be_ready
2018-08-03 14:58:07 +01:00
echo "Google Play Service will be installed"
adb install -r "/root/google_play_services.apk"
echo "Google Play Store will be installed"
adb install -r "/root/google_play_store.apk"
}
2018-08-02 10:37:08 +01:00
function disable_animation () {
2018-08-03 14:58:07 +01:00
# To improve performance
adb shell "settings put global window_animation_scale 0.0"
adb shell "settings put global transition_animation_scale 0.0"
adb shell "settings put global animator_duration_scale 0.0"
}
2018-08-02 10:37:08 +01:00
2018-08-03 14:58:07 +01:00
change_language_if_needed
sleep 1
install_google_play
2018-08-02 10:37:08 +01:00
disable_animation