[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 9 commits - bridges/source config_host/config_features.h.in config_host.mk.in configure.ac cppuhelper/Library_cppuhelper.mk cppuhelper/source desktop/source external/cairo external/nss include/ios ios/Module_ios.mk ios/source ios/StaticLibrary_ios.mk sal/android vcl/headless vcl/inc

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Mon May 18 15:43:35 UTC 2020


 bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx     |    2 
 bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx |   12 ++-
 bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx |    8 +-
 config_host.mk.in                                     |    1 
 config_host/config_features.h.in                      |    6 +
 configure.ac                                          |   25 +++++++
 cppuhelper/Library_cppuhelper.mk                      |    1 
 cppuhelper/source/exc_thrower.cxx                     |   57 ++++++++++++++++--
 desktop/source/lib/init.cxx                           |   22 ++----
 external/cairo/UnpackedTarball_cairo.mk               |    3 
 external/nss/ExternalProject_nss.mk                   |    4 -
 external/nss/nss-android.patch.1                      |   40 ++++++++++++
 include/ios/ios.hxx                                   |   19 ------
 ios/Module_ios.mk                                     |    1 
 ios/StaticLibrary_ios.mk                              |   20 ------
 ios/source/ios.cxx                                    |   42 -------------
 sal/android/libreofficekit-jni.c                      |    8 --
 vcl/headless/svpgdi.cxx                               |    4 -
 vcl/inc/headless/svpgdi.hxx                           |    4 -
 19 files changed, 155 insertions(+), 124 deletions(-)

New commits:
commit 786911906f7377576485c7c1d0ef5c31824c3ad8
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Dec 2 12:01:05 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    lok: Fix the condition of setting the transparent background.
    
    Change-Id: I7b201296efe6541761896e0af1b230aecb534cdc
    Reviewed-on: https://gerrit.libreoffice.org/84211
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 5cc2a590f37b..7fbd42371fc6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2995,12 +2995,13 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(DeviceFormat::DEFAULT);
 
-#if HAVE_FEATURE_ANDROID_LOK
+#if defined(ANDROID) && !HAVE_FEATURE_ANDROID_LOK
+    // Don't set the transparent background in the 'old' (JNI-based) Android
+    // app - no idea why it needs avoiding this.
+    if (false)
+#endif
     // Set background to transparent by default.
-    // [Unless it is the 'old' (JNI-based) Android app - no idea why it
-    // needs avoiding this.]
     pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
-#endif
 
     pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
                 Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
commit 31efad6168d2b2c4a99a02d69d9a71fb750d1a5e
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Nov 20 17:55:43 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    android: Get rid of the 'old' vs. Online-based runtime distinction.
    
    No need for this when we have a compile-time distinction now anyway.
    
    Change-Id: Ic86c8cce38a86635ea3efb4229c08f63059c9ee6
    Reviewed-on: https://gerrit.libreoffice.org/83719
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ddb42e0f3860..5cc2a590f37b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <config_features.h>
 #include <config_folders.h>
 
 #include <stdio.h>
@@ -2957,13 +2958,6 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
     }
 }
 
-#if defined(ANDROID)
-/// For the distinction if the LOK is used for the 'old' (JNI-based) or the
-/// 'new' (loolwsd-based) app.  Default to the 'new', ie. not used from JNI as
-/// implemented in sal/android/libreofficekit-jni.c.
-bool android_lok_from_jni = false;
-#endif
-
 static void doc_paintTile(LibreOfficeKitDocument* pThis,
                           unsigned char* pBuffer,
                           const int nCanvasWidth, const int nCanvasHeight,
@@ -3001,15 +2995,12 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(DeviceFormat::DEFAULT);
 
-#if defined(ANDROID)
-    if (!android_lok_from_jni)
+#if HAVE_FEATURE_ANDROID_LOK
+    // Set background to transparent by default.
+    // [Unless it is the 'old' (JNI-based) Android app - no idea why it
+    // needs avoiding this.]
+    pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
 #endif
-    {
-        // Set background to transparent by default.
-        // [Unless it is the 'old' (JNI-based) Android app - no idea why it
-        // needs avoiding this.]
-        pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
-    }
 
     pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
                 Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index e4d7f4828a54..08827df54f07 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -37,7 +37,6 @@ extern const char* data_dir;
 extern const char* cache_dir;
 extern void* apk_file;
 extern int apk_file_size;
-extern bool android_lok_from_jni; ///< for the distinction if the LOK is used for the 'old' (JNI-based) or the 'new' (loolwsd-based) app
 AAssetManager* native_asset_manager;
 
 extern void Java_org_libreoffice_android_Bootstrap_putenv(JNIEnv* env, jobject clazz, jstring string);
@@ -164,10 +163,6 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
 
     (void) clazz;
 
-    // the 'old' app needs to avoid setting the virtual device to transparent
-    // in paintTile(), so indicate we are using the 'old' app
-    android_lok_from_jni = true;
-
     libreofficekit_initialize(env, dataDir, cacheDir, apkFile, assetManager);
 
     // LibreOfficeKit expects a path to the program/ directory
commit 7a84a0fa5a74cd1036146fdcda1ea388fc3c8eba
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 1 15:18:49 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    bridges arm64: Use [[falltrough]].
    
    Change-Id: I28d3cabab74bea6ea9f2712c240110a44643c54d
    Reviewed-on: https://gerrit.libreoffice.org/84193
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
index a07365a5943e..938011a09a2e 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
@@ -262,7 +262,7 @@ ReturnKind getReturnKind(typelib_TypeDescription const * type) {
     switch (type->eTypeClass) {
     default:
         assert(false);
-        // fall through to avoid warnings
+        [[fallthrough]];
     case typelib_TypeClass_VOID:
     case typelib_TypeClass_BOOLEAN:
     case typelib_TypeClass_BYTE:
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
index 4865f49a0421..d11a11b0c965 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
@@ -187,13 +187,13 @@ void call(
         switch (rtd->nSize) {
         case 16:
             std::memcpy(fpr + 3, static_cast<char *>(retin) + 12, 4);
-            // fall through
+            [[fallthrough]];
         case 12:
             std::memcpy(fpr + 2, static_cast<char *>(retin) + 8, 4);
-            // fall through
+            [[fallthrough]];
         case 8:
             std::memcpy(fpr + 1, static_cast<char *>(retin) + 4, 4);
-            // fall through
+            [[fallthrough]];
         case 4:
             std::memcpy(fpr, retin, 4);
             break;
@@ -286,7 +286,7 @@ extern "C" void vtableCall(
                     TYPELIB_DANGER_RELEASE(td);
                 }
             }
-            // fall through
+            [[fallthrough]];
         default:
             call(
                 proxy, desc,
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
index 32a19de020b1..f03d848521cc 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
@@ -252,13 +252,13 @@ void call(
         switch (rtd->nSize) {
         case 16:
             std::memcpy(static_cast<char *>(ret) + 12, fpr + 3, 4);
-            // fall through
+            [[fallthrough]];
         case 12:
             std::memcpy(static_cast<char *>(ret) + 8, fpr + 2, 4);
-            // fall through
+            [[fallthrough]];
         case 8:
             std::memcpy(static_cast<char *>(ret) + 4, fpr + 1, 4);
-            // fall through
+            [[fallthrough]];
         case 4:
             std::memcpy(ret, fpr, 4);
             break;
@@ -356,7 +356,7 @@ void unoInterfaceProxyDispatch(
                         TYPELIB_DANGER_RELEASE(td);
                     }
                 }
-                // fall through
+                [[fallthrough]];
             default:
                 call(
                     proxy, slot, mtd->pReturnTypeRef, mtd->nParams,
commit e97f190b700c7438b1f70eab1efa0ae24fa117de
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 1 10:57:21 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    android: Fix nss build on aarch64.
    
    Change-Id: I51c03e13fba4619a881ade27d149722698859815
    Reviewed-on: https://gerrit.libreoffice.org/81888
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index 3ff9951d6e65..57b0c961c611 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -38,8 +38,8 @@ else # OS!=WNT
 $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecutable_get_dependencies,python)
 	$(call gb_ExternalProject_run,build,\
 		$(if $(filter ANDROID FREEBSD LINUX MACOSX,$(OS)),$(if $(filter X86_64,$(CPUNAME)),USE_64=1)) \
-		$(if $(filter iOS,$(OS)),\
-			$(if $(filter arm64,$(CC)),USE_64=1)) \
+		$(if $(filter ANDROID,$(OS)),$(if $(filter AARCH64,$(CPUNAME)),USE_64=1)) \
+		$(if $(filter iOS,$(OS)),$(if $(filter ARM64,$(CPUNAME)),USE_64=1)) \
 		$(if $(filter MACOSX,$(OS)),\
 			$(if $(filter-out POWERPC,$(CPUNAME)),MACOS_SDK_DIR=$(MACOSX_SDK_PATH)) \
 			NSS_USE_SYSTEM_SQLITE=1) \
diff --git a/external/nss/nss-android.patch.1 b/external/nss/nss-android.patch.1
index 40478d34ddbf..560623080c73 100644
--- a/external/nss/nss-android.patch.1
+++ b/external/nss/nss-android.patch.1
@@ -1,11 +1,12 @@
 diff -ur nss.org/nspr/build/autoconf/config.sub nss/nspr/build/autoconf/config.sub
 --- nss.org/nspr/build/autoconf/config.sub	2017-09-07 15:29:45.031246453 +0200
 +++ nss/nspr/build/autoconf/config.sub	2017-09-07 15:32:13.087235423 +0200
-@@ -111,6 +111,10 @@
+@@ -111,6 +111,11 @@
      exit 1;;
  esac
  
 +if test $1 = "arm-unknown-linux-androideabi"; then echo $1; exit; fi
++if test $1 = "aarch64-unknown-linux-android"; then echo $1; exit; fi
 +if test $1 = "i686-pc-linux-android"; then echo $1; exit; fi
 +if test $1 = "x86_64-pc-linux-android"; then echo $1; exit; fi
 +
@@ -69,3 +70,19 @@ diff -ur nss.org/nss/Makefile nss/nss/Makefile
  
  MODULE = nss
  MAPFILE = $(OBJDIR)/nssckbi.def
+diff -ur nss/nss/coreconf/arch.mk nss/nss/coreconf/arch.mk
+--- nss/nss/coreconf/arch.mk	2019-11-01 10:29:44.933245745 +0100
++++ nss/nss/coreconf/arch.mk	2019-11-01 10:32:04.347181076 +0100
+@@ -234,7 +234,11 @@
+ #
+ # this should be  configurable from the user
+ #
+-   OS_TEST := arm
++   ifeq ($(USE_64),1)
++	OS_TEST := aarch64
++   else
++	OS_TEST := arm
++   endif
+    OS_ARCH = Android
+    ifndef OS_TARGET_RELEASE
+ 	OS_TARGET_RELEASE := 8
commit 6576d4d25742d12f5ac05f6ae6f8de9e71712487
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Nov 26 15:21:06 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    nss: fix Android build
    
    By not building some of the test code.
    
    The first hunk is necessary to avoid:
    
    /home/vmiklos/git/libreoffice/master-android/external/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpthread
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[3]: *** [Makefile:379: abstract] Error 1
    make[2]: *** [Makefile:143: build_nspr] Error 2
    make[1]: *** [/home/vmiklos/git/libreoffice/master-android/external/nss/ExternalProject_nss.mk:35: /home/vmiklos/git/libreoffice/master-android/workdir/ExternalProject/nss/build] Error 1
    make: *** [Makefile:120: nss] Error 2
    
    The second hunk avoids:
    
    cd testlib; make libs
    Traceback (most recent call last):
      File "/home/vmiklos/git/libreoffice/master-android/external/nss/nsinstall.py", line 164, in <module>
        sys.exit(nsinstall(sys.argv[1:]))
      File "/home/vmiklos/git/libreoffice/master-android/external/nss/nsinstall.py", line 112, in nsinstall
        os.makedirs(args[0])
      File "/usr/lib64/python2.7/os.py", line 157, in makedirs
        mkdir(name, mode)
    OSError: [Errno 17] File exists: 'out/..'
    make[6]: *** [../../../../coreconf/rules.mk:392: out/../anchor.o] Error 1
    make[5]: *** [../../../coreconf/rules.mk:81: libs] Error 2
    make[4]: *** [../../coreconf/rules.mk:78: libs] Error 2
    make[3]: *** [../coreconf/rules.mk:101: libs] Error 2
    make[2]: *** [coreconf/rules.mk:101: libs] Error 2
    make[1]: *** [/home/vmiklos/git/libreoffice/master-android/external/nss/ExternalProject_nss.mk:35: /home/vmiklos/git/libreoffice/master-android/workdir/ExternalProject/nss/build] Error 1
    make: *** [Makefile:120: nss] Error 2
    
    Change-Id: I11906f56ef717842778e14edf4037bd92e42cd86
    Reviewed-on: https://gerrit.libreoffice.org/83775
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/external/nss/nss-android.patch.1 b/external/nss/nss-android.patch.1
index f8b4cdaf3753..40478d34ddbf 100644
--- a/external/nss/nss-android.patch.1
+++ b/external/nss/nss-android.patch.1
@@ -48,3 +48,24 @@ diff -ur nss.org/nss/Makefile nss/nss/Makefile
                         --with-android-version=$(OS_TARGET_RELEASE) \
                         --with-android-toolchain=$(ANDROID_TOOLCHAIN) \
                         --with-android-platform=$(ANDROID_SYSROOT)
+--- nss/nss/Makefile.orig	2019-11-26 14:52:15.934561202 +0100
++++ nss/nss/Makefile	2019-11-26 14:52:20.538559612 +0100
+@@ -140,7 +140,6 @@
+ 
+ build_nspr: $(NSPR_CONFIG_STATUS)
+ 	$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
+-	$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/pr/tests
+ 
+ install_nspr: build_nspr
+ 	$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
+--- nss/nss/lib/ckfw/builtins/manifest.mn.orig	2019-11-26 15:18:22.185985193 +0100
++++ nss/nss/lib/ckfw/builtins/manifest.mn	2019-11-26 15:18:29.281982387 +0100
+@@ -5,7 +5,7 @@
+ 
+ CORE_DEPTH = ../../..
+ 
+-DIRS = testlib
++DIRS =
+ 
+ MODULE = nss
+ MAPFILE = $(OBJDIR)/nssckbi.def
commit 613bfa0d7609f049dde02d8f7f7b5472c56ff4be
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Nov 27 15:29:50 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    android: Fix location of the built freetype library.
    
    Otherwise it is not found when the the fontconfig's ./configure is
    running, which leads to linking failure during the fontconfig's
    ./configure time, which leads to an undefined HAVE_FT_GET_NEXT_CHAR
    which leads to not using the actual FT_Get_Next_Char, but instead some
    dummy code that leads to an infinite loop on the app startup; huh.
    
    Change-Id: I40b7a403fbe75582bb98f15f1afe7a4050fd13aa
    Reviewed-on: https://gerrit.libreoffice.org/83922
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 94eb59078731b2e4093d983bc618d051f4e31740)
    Reviewed-on: https://gerrit.libreoffice.org/84190
    Tested-by: Jenkins

diff --git a/configure.ac b/configure.ac
index 47714298a438..6c93da694c5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8492,7 +8492,11 @@ if test  "$test_freetype" = "yes"; then
     SYSTEM_FREETYPE=TRUE
 else
     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
-    FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
+    if test "x$ac_config_site_64bit_host" = xYES; then
+        FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
+    else
+        FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
+    fi
 fi
 AC_SUBST(FREETYPE_CFLAGS)
 AC_SUBST(FREETYPE_LIBS)
commit 6fe48de0dba576ca0ecc549b480fe3dbff93d16d
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Nov 27 15:28:59 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    android: Hint how to enable fontconfig logging.
    
    Change-Id: I8901780fa29c6d27bb53e44b07d95259b5bd02df
    Reviewed-on: https://gerrit.libreoffice.org/83920
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit f3af7708e3535d3171832aa2308d1e7f6193def4)
    Reviewed-on: https://gerrit.libreoffice.org/84189
    Tested-by: Jenkins

diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index 1307ab6a5fbb..e4d7f4828a54 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -104,6 +104,9 @@ jboolean libreofficekit_initialize(JNIEnv* env,
         close(fd);
         LOGI("Setting FONTCONFIG_FILE to %s", fontsConfPath);
         setenv("FONTCONFIG_FILE", fontsConfPath, 1);
+        // DEBUG:
+        //setenv("FC_DEBUG", "8191", 1); // log everything
+        //Java_org_libreoffice_android_Bootstrap_redirect_1stdio(NULL, NULL, JNI_TRUE);
     }
     free(fontsConfPath);
 
commit c4bbed0e22d3e512938b8e2de43a793dcf6cc50f
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 29 16:03:27 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    android: Avoid throwing exceptions through the bridges.
    
    From some reason it does not work, so let's do the same we are doing on
    iOS; at least for now.
    
    Change-Id: I915f8683a112548fc3defc1114f9dce3aa7be30e
    Reviewed-on: https://gerrit.libreoffice.org/84067
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/84204
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
index d867a04dd299..4865f49a0421 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
@@ -457,10 +457,14 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
 void bridges::cpp_uno::shared::VtableFactory::flushCode(
     unsigned char const * begin, unsigned char const * end)
 {
+#ifndef ANDROID
    static void (*clear_cache)(unsigned char const *, unsigned char const *)
        = (void (*)(unsigned char const *, unsigned char const *)) dlsym(
            RTLD_DEFAULT, "__clear_cache");
    (*clear_cache)(begin, end);
+#else
+    __builtin___clear_cache((char*)begin, (char*)end);
+#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppuhelper/Library_cppuhelper.mk b/cppuhelper/Library_cppuhelper.mk
index 67413f711cd2..5741eea6476f 100644
--- a/cppuhelper/Library_cppuhelper.mk
+++ b/cppuhelper/Library_cppuhelper.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_Library_set_soversion_script,cppuhelper,$(SRCDIR)/cppuhelper/so
 $(eval $(call gb_Library_use_internal_comprehensive_api,cppuhelper,\
 	cppuhelper \
 	udkapi \
+	offapi \
 ))
 
 $(eval $(call gb_Library_add_defs,cppuhelper,\
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
index 5e029feae982..a0e7fb32b046 100644
--- a/cppuhelper/source/exc_thrower.cxx
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -17,21 +17,22 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
 
 #include <rtl/instance.hxx>
 #include <osl/diagnose.h>
+#include <osl/doublecheckedlocking.h>
+#include <sal/log.hxx>
 #include <uno/dispatcher.hxx>
 #include <uno/lbnames.h>
 #include <uno/mapping.hxx>
 #include <cppuhelper/detail/XExceptionThrower.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <com/sun/star/ucb/NameClashException.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
 
 #include <cppuhelper/exc_hlp.hxx>
 
-#ifdef IOS
-#include <ios/ios.hxx>
-#endif
-
 using namespace ::osl;
 using namespace ::cppu;
 using namespace ::com::sun::star;
@@ -172,6 +173,46 @@ ExceptionThrower::ExceptionThrower()
 
 class theExceptionThrower : public rtl::Static<ExceptionThrower, theExceptionThrower> {};
 
+#if defined(IOS) || HAVE_FEATURE_ANDROID_LOK
+// In the native iOS / Android app, where we don't have any Java, Python,
+// BASIC, or other scripting, the only thing that would use the C++/UNO bridge
+// functionality that invokes codeSnippet() was cppu::throwException().
+//
+// codeSnippet() is part of what corresponds to the code that uses
+// run-time-generated machine code on other platforms. We can't generate code
+// at run-time on iOS, that has been known forever.
+//
+// Instead of digging in and trying to understand what is wrong, another
+// solution was chosen. It turns out that the number of types of exception
+// objects thrown by cppu::throwException() is fairly small. During startup of
+// the LibreOffice code, and loading of an .odt document, only one kind of
+// exception is thrown this way... (The lovely
+// css::ucb:InteractiveAugmentedIOException.)
+//
+// So we can simply have code that checks what the type of object being thrown
+// is, and explicitgly throws such an object then with a normal C++ throw
+// statement. Seems to work.
+template <class E> void tryThrow(css::uno::Any const& aException)
+{
+    E aSpecificException;
+    if (aException >>= aSpecificException)
+        throw aSpecificException;
+}
+
+void lo_mobile_throwException(css::uno::Any const& aException)
+{
+    assert(aException.getValueTypeClass() == css::uno::TypeClass_EXCEPTION);
+
+    tryThrow<css::ucb::InteractiveAugmentedIOException>(aException);
+    tryThrow<css::ucb::NameClashException>(aException);
+    tryThrow<css::uno::RuntimeException>(aException);
+
+    SAL_WARN("cppuhelper", "lo_mobile_throwException: Unhandled exception type: " << aException.getValueTypeName());
+
+    assert(false);
+}
+#endif // defined(IOS) || HAVE_FEATURE_ANDROID_LOK
+
 } // anonymous namespace
 
 
@@ -188,8 +229,8 @@ void SAL_CALL throwException( Any const & exc )
             "(must be derived from com::sun::star::uno::Exception)!" );
     }
 
-#ifdef IOS
-    lo_ios_throwException(exc);
+#if defined(IOS) || HAVE_FEATURE_ANDROID_LOK
+    lo_mobile_throwException(exc);
 #else
     Mapping uno2cpp(Environment(UNO_LB_UNO), Environment::getCurrent());
     if (! uno2cpp.is())
@@ -211,6 +252,9 @@ void SAL_CALL throwException( Any const & exc )
 
 Any SAL_CALL getCaughtException()
 {
+#if HAVE_FEATURE_ANDROID_LOK
+    return Any();
+#else
     Mapping cpp2uno(Environment::getCurrent(), Environment(UNO_LB_UNO));
     if (! cpp2uno.is())
     {
@@ -258,6 +302,7 @@ Any SAL_CALL getCaughtException()
         &ret, exc->pData, exc->pType, uno2cpp.get() );
     uno_any_destruct( exc, nullptr );
     return ret;
+#endif
 }
 
 }
diff --git a/include/ios/ios.hxx b/include/ios/ios.hxx
deleted file mode 100644
index d8fe4d7bd6e1..000000000000
--- a/include/ios/ios.hxx
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_IOS_IOS_HXX
-#define INCLUDED_IOS_IOS_HXX
-
-#include "com/sun/star/uno/Any.hxx"
-
-extern void lo_ios_throwException(css::uno::Any const& aException);
-
-#endif // INCLUDED_IOS_IOS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ios/Module_ios.mk b/ios/Module_ios.mk
index ea9c44644f2c..259c34ba3416 100644
--- a/ios/Module_ios.mk
+++ b/ios/Module_ios.mk
@@ -11,7 +11,6 @@ $(eval $(call gb_Module_Module,ios))
 ifeq ($(OS),iOS)
 
 $(eval $(call gb_Module_add_targets,ios,\
-	StaticLibrary_ios \
 	CustomTarget_iOS_setup \
 ))
 
diff --git a/ios/StaticLibrary_ios.mk b/ios/StaticLibrary_ios.mk
deleted file mode 100644
index 36baff4e064b..000000000000
--- a/ios/StaticLibrary_ios.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-$(eval $(call gb_StaticLibrary_StaticLibrary,ios))
-
-$(eval $(call gb_StaticLibrary_use_api,ios,\
-    udkapi \
-    offapi \
-))
-
-$(eval $(call gb_StaticLibrary_add_exception_objects,ios,\
-    ios/source/ios \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/ios/source/ios.cxx b/ios/source/ios.cxx
deleted file mode 100644
index bc89150e7ed6..000000000000
--- a/ios/source/ios.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <cassert>
-#include <iostream>
-
-#include "com/sun/star/uno/Any.hxx"
-#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
-#include "com/sun/star/ucb/NameClashException.hpp"
-#include "ios/ios.hxx"
-
-namespace
-{
-template <class E> void tryThrow(css::uno::Any const& aException)
-{
-    E aSpecificException;
-    if (aException >>= aSpecificException)
-        throw aSpecificException;
-}
-}
-
-void lo_ios_throwException(css::uno::Any const& aException)
-{
-    assert(aException.getValueTypeClass() == css::uno::TypeClass_EXCEPTION);
-
-    tryThrow<css::ucb::InteractiveAugmentedIOException>(aException);
-    tryThrow<css::ucb::NameClashException>(aException);
-    tryThrow<css::uno::RuntimeException>(aException);
-
-    std::cerr << "lo_ios_throwException: Unhandled exception type " << aException.getValueTypeName()
-              << std::endl;
-
-    assert(false);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e688b4259deacd8005d98f8497ea3101ffe4fd11
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Nov 20 16:06:13 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 18 17:43:03 2020 +0200

    android: Introduce --enable-android-lok configure switch to fix RGB vs. BGR.
    
    This indicates that the build targets the Online-based Android app, for
    which we need to avoid various tweaks that are needed for the 'old'
    Android app present in the android/ subdir of core.git.
    
    In particular, the switch used in this patch fixes a RGBA vs. BGRA
    confusion that caused yellow <-> cyan switch in the Online-based Android
    app.
    
    Change-Id: I5f394868f51ce87013677834cfafb967b9bb333e
    Reviewed-on: https://gerrit.libreoffice.org/83342
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 49002a143a4534df5f6139e07fefd06174621c59)
    Reviewed-on: https://gerrit.libreoffice.org/83718
    Tested-by: Jenkins

diff --git a/config_host.mk.in b/config_host.mk.in
index e47ca617845d..de1e44dc657b 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -118,6 +118,7 @@ export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
 export DPKG=@DPKG@
 export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
 export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@
+export ENABLE_ANDROID_LOK=@ENABLE_ANDROID_LOK@
 export ENABLE_ANDROID_EDITING=@ENABLE_ANDROID_EDITING@
 export ENABLE_AVAHI=@ENABLE_AVAHI@
 export ENABLE_BREAKPAD=@ENABLE_BREAKPAD@
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 90536560c0b4..42fc0efaa144 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -146,4 +146,10 @@
  */
 #define HAVE_FEATURE_UPDATE_MAR 0
 
+/*
+ * Whether we are avoiding the tweaks needed for the Android app from the
+ * android/ subdir.
+ */
+#define HAVE_FEATURE_ANDROID_LOK 0
+
 #endif
diff --git a/configure.ac b/configure.ac
index 29e7a815dd25..47714298a438 100644
--- a/configure.ac
+++ b/configure.ac
@@ -545,6 +545,25 @@ if test -n "$with_android_sdk"; then
 fi
 AC_SUBST(ANDROID_SDK_HOME)
 
+AC_ARG_ENABLE([android-lok],
+    AS_HELP_STRING([--enable-android-lok],
+        [The Android app from the android/ subdir needs several tweaks all
+         over the place that break the LOK when used in the Online-based
+         Android app.  This switch indicates that the intent of this build is
+         actually the Online-based, non-modified LOK.])
+)
+ENABLE_ANDROID_LOK=
+if test -n "$ANDROID_NDK_HOME" ; then
+    if test "$enable_android_lok" = yes; then
+        ENABLE_ANDROID_LOK=TRUE
+        AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
+        AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
+    else
+        AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
+    fi
+fi
+AC_SUBST([ENABLE_ANDROID_LOK])
+
 libo_FUZZ_ARG_ENABLE([android-editing],
     AS_HELP_STRING([--enable-android-editing],
         [Enable the experimental editing feature on Android.])
diff --git a/external/cairo/UnpackedTarball_cairo.mk b/external/cairo/UnpackedTarball_cairo.mk
index 9cd795fc4a0b..8e45e9c28c1d 100644
--- a/external/cairo/UnpackedTarball_cairo.mk
+++ b/external/cairo/UnpackedTarball_cairo.mk
@@ -23,7 +23,8 @@ $(eval $(call gb_UnpackedTarball_add_patches,cairo,\
 ))
 endif
 
-ifeq ($(OS),ANDROID)
+# To be applied only when ENABLE_ANDROID_LOK is not defined
+ifeq ($(OS)$(ENABLE_ANDROID_LOK),ANDROID)
 $(eval $(call gb_UnpackedTarball_add_patches,cairo,\
 	external/cairo/cairo/cairo.GL_RGBA.patch \
 ))
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index b6f59a29d6be..b6571382ccd9 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
+
 #include <memory>
 #ifndef IOS
 #include <headless/svpgdi.hxx>
@@ -228,7 +230,7 @@ namespace
             sal_uInt8* pD = pDst->mpBits + y * pDst->mnScanlineSize;
             for (long x = 0; x < nWidth; ++x)
             {
-#if defined ANDROID
+#if defined(ANDROID) && !HAVE_FEATURE_ANDROID_LOK
                 static_assert((SVP_CAIRO_FORMAT & ~ScanlineFormat::TopDown) == ScanlineFormat::N32BitTcRgba, "Expected SVP_CAIRO_FORMAT set to N32BitTcBgra");
                 static_assert((SVP_24BIT_FORMAT & ~ScanlineFormat::TopDown) == ScanlineFormat::N24BitTcRgb, "Expected SVP_24BIT_FORMAT set to N24BitTcRgb");
                 pD[0] = pS[0];
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index d06c138a0284..083ab54a30a9 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -24,6 +24,8 @@
 #error This file is not for iOS
 #endif
 
+#include <config_features.h>
+
 #include <osl/endian.h>
 #include <vcl/sysdata.hxx>
 #include <config_cairo_canvas.h>
@@ -40,7 +42,7 @@
 //cairo then matches the OpenGL GL_RGBA format so we can use it there
 //where we don't have GL_BGRA support.
 // SVP_24BIT_FORMAT is used to store 24-bit images in 3-byte pixels to conserve memory.
-#if defined ANDROID
+#if defined(ANDROID) && !HAVE_FEATURE_ANDROID_LOK
 #   define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown)
 #   define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown)
 #   define SVP_CAIRO_BLUE 1


More information about the Libreoffice-commits mailing list