[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - desktop/source sal/android

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 08:40:06 UTC 2019


 desktop/source/lib/init.cxx      |   22 +++++++++++++++++-----
 sal/android/libreofficekit-jni.c |    6 ++++++
 2 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 2943733ea4f4080a17a45b60690367d78bc79d5c
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 14 18:38:51 2019 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Oct 9 10:39:17 2019 +0200

    android: Unregistering in runLoop() is important even on Android.
    
    Otherwise we get crashes in online Kit when attempting to shutdown
    reasonably cleanly and the poll kicks in.
    
    Change-Id: I9a1744b42fec9f8ffddc6094773bda943caedf2a
    Reviewed-on: https://gerrit.libreoffice.org/74064
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/80274
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 463371414214..a648918b750c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5192,7 +5192,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
                        LibreOfficeKitWakeCallback pWakeCallback,
                        void* pData)
 {
-#ifdef IOS // Maybe ANDROID, too?
+#if defined(IOS) || defined(ANDROID)
     Application::GetSolarMutex().acquire();
 #endif
 
@@ -5203,7 +5203,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
         Application::UpdateMainThread();
         soffice_main();
     }
-#ifdef IOS // ANDROID, too?
+#if defined(IOS) || defined(ANDROID)
     vcl::lok::unregisterPollCallbacks();
     Application::ReleaseSolarMutex();
 #endif
commit a4fc6e8d529ab4f90218188bef3515d0f04b50f1
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Apr 12 17:50:52 2019 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Oct 9 10:38:55 2019 +0200

    android: Make the tiled rendering from the loolwsd actually work.
    
    Not to break the 'old' Android app, introduce a bool that can indicate
    if we are using the LOK from the 'old' (LOK-via-JNI-based) or from the
    'new' (loolwsd-based) app.
    
    Change-Id: I38bd665cc1d5bc88018574171443ecabc46763df
    Reviewed-on: https://gerrit.libreoffice.org/70678
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/80273

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index aadafe279a43..463371414214 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2661,6 +2661,13 @@ 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,
@@ -2704,10 +2711,15 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
 
-#if !defined(ANDROID)
-    // Set background to transparent by default.
-    pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+#if defined(ANDROID)
+    if (!android_lok_from_jni)
 #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 c11f7dd4eb09..9466d2efdb3f 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -37,6 +37,7 @@ 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);
@@ -155,6 +156,11 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
     size_t data_dir_len;
 
     (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


More information about the Libreoffice-commits mailing list