Refactored code

This commit is contained in:
butomo1989 2018-08-02 11:37:08 +02:00
parent d13e60a122
commit 91a4e270c6
2 changed files with 28 additions and 21 deletions

View file

@ -90,13 +90,15 @@ ARG SYS_IMG=x86
ARG IMG_TYPE=google_apis ARG IMG_TYPE=google_apis
ARG BROWSER=android ARG BROWSER=android
ARG CHROME_DRIVER=2.40 ARG CHROME_DRIVER=2.40
ARG GOOGLE_PLAY_SERVICE=12.8.74
ENV ANDROID_VERSION=$ANDROID_VERSION \ ENV ANDROID_VERSION=$ANDROID_VERSION \
API_LEVEL=$API_LEVEL \ API_LEVEL=$API_LEVEL \
PROCESSOR=$PROCESSOR \ PROCESSOR=$PROCESSOR \
SYS_IMG=$SYS_IMG \ SYS_IMG=$SYS_IMG \
IMG_TYPE=$IMG_TYPE \ IMG_TYPE=$IMG_TYPE \
BROWSER=$BROWSER \ BROWSER=$BROWSER \
CHROME_DRIVER=$CHROME_DRIVER CHROME_DRIVER=$CHROME_DRIVER \
GOOGLE_PLAY_SERVICE=$GOOGLE_PLAY_SERVICE
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN yes | sdkmanager --licenses && \ RUN yes | sdkmanager --licenses && \
@ -110,6 +112,11 @@ RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME
&& unzip -x chrome.zip \ && unzip -x chrome.zip \
&& rm chrome.zip && rm chrome.zip
#=================================================
# Download Google Play Service APK from apklinker
#=================================================
Run wget -nv -O google_play_service.apk ""https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b51570a214a8/com.google.android.gms_${GOOGLE_PLAY_SERVICE}-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk"
#================================================ #================================================
# noVNC Default Configurations # noVNC Default Configurations
# These Configurations can be changed through -e # These Configurations can be changed through -e

40
src/utils.sh Normal file → Executable file
View file

@ -1,30 +1,30 @@
#!/bin/bash #!/bin/bash
BOOT ()
{ function wait_emulator_to_be_ready () {
A=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r') boot_completed=false
while [[ $A != "1" ]]; do while [ "$boot_completed" == false ]; do
sleep 1; status=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
A=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r') echo "Boot Status: $boot_completed"
done;
if [ "$boot_completed" == "1" ]; then
boot_completed=true
else
sleep 1
fi
done
} }
Get_Google_Play_Services () function install_google_play_service () {
{ wait_emulator_to_be_ready
wget "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b51570a214a8/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk" adb install -r "/root/google_play_service.apk"
} }
Update_Google_Play_Services () function disable_animation () {
{
adb install -r "$PWD/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk"
}
Disable_animations ()
{
# this is for demonstration what other amazing staff can be done here # this is for demonstration what other amazing staff can be done here
adb shell "settings put global window_animation_scale 0.0" 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 transition_animation_scale 0.0"
adb shell "settings put global animator_duration_scale 0.0" adb shell "settings put global animator_duration_scale 0.0"
} }
BOOT
Get_Google_Play_Services install_google_play_service
Update_Google_Play_Services disable_animation
Disable_animations