From de735821dcfcc56203ed8f3d11ffcdae32f53c42 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Fri, 30 Jul 2021 09:14:00 +0300 Subject: [PATCH] Update AOSP buildscript; Add webview fix --- androidOS_files/builscript.sh | 81 ++++++++++++++----------- androidOS_files/patch_fix-webview.patch | 45 ++++++++++++++ 2 files changed, 91 insertions(+), 35 deletions(-) create mode 100644 androidOS_files/patch_fix-webview.patch diff --git a/androidOS_files/builscript.sh b/androidOS_files/builscript.sh index 1770c35..6dcca33 100644 --- a/androidOS_files/builscript.sh +++ b/androidOS_files/builscript.sh @@ -8,49 +8,54 @@ # Required: aosp-devel packages # https://aur.archlinux.org/packages/aosp-devel/ +ROOTDIR="${PWD}" WORKDIR="${PWD}/aosp" -rm -rf ${WORKDIR}/out/* +if [ ! -d "${WORKDIR}" ]]; then + mkdir -p "${WORKDIR}" +fi + +rm -rf "${WORKDIR}"/out/* ln -s /usr/bin/python2 ./python export PATH=$PWD:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl -cd ${WORKDIR} - -# This takes A LOT of time, since ~280GiB must be downloaded. -# Full Android source code with all commit histories etc. This is not a shallow copy. -# TODO this manifest file contains old Android version tag. Should be replaced with android-9.0.0_r57 or newer -# For available versions, see i.e.: https://android.googlesource.com/platform/frameworks/support -repo init -u https://github.com/anbox/platform_manifests.git -b anbox -repo sync -j6 +cd "${WORKDIR}" -sudo pacman -S repo +#sudo pacman -S repo -# Check all deps of AUR pkg aosp-devel are installed (/home/fincer/ssd/arch_linux_programs/aosp-devel) +# Get & sync AOSP source code, shallow copy ~ 27.2 GB +# +repo init -u https://github.com/anbox/platform_manifests.git -b anbox --depth 1 +repo sync -j6 -c -cd /media/a2ee7134-4f0e-4aa7-a12e-ee2b949fbb0b/ +# Check manually all deps of AUR pkg aosp-devel are installed (/home/fincer/ssd/arch_linux_programs/aosp-devel) -# Not merged, as of 6th June 2020 # Audio timing fix: # https://github.com/anbox/anbox/pull/1034 -cp -f ./patch_audio01_timing.patch aosp/vendor/patch_audio01_timing.patch -cp -f ./patch_audio02_pass-messenger.patch aosp/vendor/patch_audio02_pass-messenger.patch +# Web view fix: +# https://github.com/anbox/anbox/pull/1875 -cp -f ./patch_initcgroups.patch aosp/patch_initcgroups.patch +cp -f "${ROOTDIR}"/patch_audio01_timing.patch "${WORKDIR}"/vendor/ +cp -f "${ROOTDIR}"/patch_audio02_pass-messenger.patch "${WORKDIR}"/vendor/ +cp -f "${ROOTDIR}"/patch_fix-webview.patch "${WORKDIR}"/vendor/ + +cp -f "${ROOTDIR}"/patch_initcgroups.patch "${WORKDIR}"/ # Disable foreground/background activity checks and functionality of built-in Gallery apps for Desktop use # Comment onPause and onResume functions and related parts # This helps when using multiple apps simultaneosly and playing a video/music track. Originally, # playback pauses which is not a wanted feature in desktop Android. In this patch, we disable all relevant code # parts which cause this pause. -cp -f ./patch_gallery2_no-activity-checks.patch aosp/patch_gallery2_no-activity-checks.patch +cp -f "${ROOTDIR}"/patch_gallery2_no-activity-checks.patch "${WORKDIR}"/ -cd ${WORKDIR}/vendor/anbox +cd "${WORKDIR}"/vendor/anbox patch -Np1 -i ../patch_audio01_timing.patch patch -Np1 -i ../patch_audio02_pass-messenger.patch -cd ${WORKDIR} +patch -Np1 -i ../patch_fix-webview.patch +cd "${WORKDIR}" # We don't have several cgroups in native Linux. Avoid unnecessary kernel errors. # Disabled 'schedtune' cgroup as it targets Android ARM devices. Reason for it is to @@ -63,33 +68,32 @@ cd ${WORKDIR} patch -Np1 -i ./patch_initcgroups.patch # Already merged, as of 6th June 2020 +# # Server side decoration fix: # https://github.com/anbox/anbox/pull/1415 #ln -s patch_serversidedecoration.patch aosp/vendor/patch_serversidedecoration.patch patch -Np1 -i ./patch_gallery2_no-activity-checks.patch +# archlinux-java set java-8-openjdk -archlinux-java set java-8-openjdk -cd ${WORKDIR}/ -. build/envsetup.sh -lunch anbox_x86_64-userdebug +cd "${WORKDIR}" -# Disable JACK -sed -i -r 's/(ANDROID_COMPILE_WITH_JACK := )true/\1false/' ${WORKDIR}/build/core/combo/javac.mk +source build/envsetup.sh +lunch anbox_x86_64-userdebug -#export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx2G" +export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx2G" # RUN THIS IN SEPARATE SHELL! # Jack server must be run during compilation process -#while true; do -# sleep 2 -# if [ -f aosp/out/host/linux-x86/bin/jack-admin ]; then -# aosp/out/host/linux-x86/bin/jack-admin start-server -# break -# fi -#done +while true; do + sleep 2 + if [ -f aosp/out/host/linux-x86/bin/jack-admin ]; then + aosp/out/host/linux-x86/bin/jack-admin start-server + break + fi +done LC_ALL=C make -j$(nproc --ignore 1) @@ -100,9 +104,16 @@ if [[ $? -eq 0 ]]; then rm -rf $HOME/.jack-server fi -cd $WORKDIR/vendor/anbox/ +# Once compiled, do the following: + +cd "${WORKDIR}"/vendor/anbox/ scripts/create-package.sh ${PWD}/../../out/target/product/x86_64/ramdisk.img ${PWD}/../../out/target/product/x86_64/system.img -# Image will locate at aosp/vendor/anbox/android.img +# This image will locate at aosp/vendor/anbox/android.img + + + + + diff --git a/androidOS_files/patch_fix-webview.patch b/androidOS_files/patch_fix-webview.patch new file mode 100644 index 0000000..2743a42 --- /dev/null +++ b/androidOS_files/patch_fix-webview.patch @@ -0,0 +1,45 @@ +Original commit: https://github.com/anbox/anbox/pull/1875/commits/a38b10b6bd519faa781d43d45f9740e5e82c4ca6 + +From a38b10b6bd519faa781d43d45f9740e5e82c4ca6 Mon Sep 17 00:00:00 2001 +From: kuailexs <952415538@qq.com> +Date: Wed, 28 Jul 2021 20:54:32 +0800 +Subject: [PATCH] emugl:fix webview,GL_SHADING_LANGUAGE_VERSION and + EGL_RENDERABLE_TYPE + +--- + src/anbox/graphics/emugl/RenderControl.cpp | 3 +++ + src/anbox/graphics/emugl/RendererConfig.cpp | 7 +++++++ + 2 files changed, 10 insertions(+) + +diff --git a/src/anbox/graphics/emugl/RenderControl.cpp b/src/anbox/graphics/emugl/RenderControl.cpp +index 9f2558553..99f30015d 100644 +--- a/src/anbox/graphics/emugl/RenderControl.cpp ++++ b/src/anbox/graphics/emugl/RenderControl.cpp +@@ -144,6 +144,9 @@ static EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize) { + }; + + result = filter_extensions(result, whitelisted_extensions); ++ }else if (name == GL_SHADING_LANGUAGE_VERSION) { ++ // GL_VERSION:"OpenGL ES 2.0" matched GL_SHADING_LANGUAGE_VERSION:"OpenGL ES GLSL ES 1.00" ++ result = "OpenGL ES GLSL ES 1.00"; + } + + int nextBufferSize = result.size() + 1; +diff --git a/src/anbox/graphics/emugl/RendererConfig.cpp b/src/anbox/graphics/emugl/RendererConfig.cpp +index 02b6b7882..f7027dc9d 100644 +--- a/src/anbox/graphics/emugl/RendererConfig.cpp ++++ b/src/anbox/graphics/emugl/RendererConfig.cpp +@@ -142,6 +142,13 @@ int RendererConfigList::chooseConfig(const EGLint* attribs, EGLint* configs, + mustReplaceSurfaceType = true; + } + } ++ // EGL_RENDERABLE_TYPE , fix webview ++ if (attribs[numAttribs] == EGL_RENDERABLE_TYPE) { ++ if (attribs[numAttribs + 1] > EGL_OPENGL_ES2_BIT) { ++ ERROR("EGL_RENDERABLE_TYPE can not > EGL_OPENGL_ES2_BIT"); ++ return 0; ++ } ++ } + numAttribs += 2; + } +