android/source/src/java/org/libreoffice/LOKitThread.java | 33 +++------------ solenv/bin/native-code.py | 2 2 files changed, 10 insertions(+), 25 deletions(-)
New commits: commit e2c329d8d077e2b4baa35dc8e6094d5897ce5b00 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Apr 13 13:52:40 2022 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Apr 14 07:34:28 2022 +0200 android: Deduplicate LOKitThread#load{,New}Document After Change-Id I15ecc2eba6c5ee441f6e14f8229594cab05dbba7 "tdf#148556 android: Don't delay refresh when loading doc", the only thing that `LOKitThread#loadNewDocument` does in addition to `LOKithThread#loadDocument` is to save the newly created document (to a temp file) if loading was successful. So, have `loadDocument` return a boolean saying whether loading was successful and call that method from `loadNewDocument` to reduce duplication. Change-Id: I9b99e011b3f5105bb60f95174de393462ff08271 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132966 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit d2572dc9d6c7cda9d6e08e46c42048e12e4f04e0) diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index b4aee40c1cd3..c29f98461fb9 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -204,8 +204,9 @@ class LOKitThread extends Thread { /** * Handle load document event. * @param filePath - filePath to where the document is located + * @return Whether the document has been loaded successfully. */ - private void loadDocument(String filePath) { + private boolean loadDocument(String filePath) { mLayerClient = mContext.getLayerClient(); mInvalidationHandler = new InvalidationHandler(mContext); @@ -216,8 +217,10 @@ class LOKitThread extends Thread { updateZoomConstraints(); refresh(true); LOKitShell.hideProgressSpinner(mContext); + return true; } else { closeDocument(); + return false; } } @@ -227,20 +230,9 @@ class LOKitThread extends Thread { * @param fileType - fileType what type of new document is to be loaded */ private void loadNewDocument(String filePath, String fileType) { - mLayerClient = mContext.getLayerClient(); - - mInvalidationHandler = new InvalidationHandler(mContext); - mTileProvider = TileProviderFactory.create(mContext, mInvalidationHandler, fileType); - - if (mTileProvider.isReady()) { - LOKitShell.showProgressSpinner(mContext); - updateZoomConstraints(); - refresh(true); - LOKitShell.hideProgressSpinner(mContext); - + boolean ok = loadDocument(fileType); + if (ok) { mTileProvider.saveDocumentAs(filePath, true); - } else { - closeDocument(); } } commit 537e6f0ae333cd8e5f1f8f037d30ecabd12f0745 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Apr 13 12:59:08 2022 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Apr 14 07:34:18 2022 +0200 tdf#148556 android: Don't delay refresh when loading doc The previous way of using a separate Runnable to do the refresh and posting that to the main handler instead of doing the refresh right away resulted in a timing issue, due to which it could happen that a Calc document would not be rendered when initally loaded (but only after another tile reevaluation was triggered, e.g. by tapping on the screen). While this appears to happen mostly on fast hardware, I could reproduce on my AVD as well when increasing the minimum time that has to pass between tile reevaluations to 100 ms: --- a/android/source/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/source/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -157,7 +157,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } long currentReevaluationNanoTime = System.nanoTime(); - if ((currentReevaluationNanoTime - reevaluationNanoTime) < 25 * 1000000) { + if ((currentReevaluationNanoTime - reevaluationNanoTime) < 100 * 1000000) { return; } For the bad case, the Runnable that triggers the refresh would be taken from the message queue and run on the main thread at a point in time that resulted in `LOKitShell.sendTileReevaluationRequest` not getting called in `ComposedTileLayer#reevaluateTiles` due to the above-mentioned minimum time in between tile reevaluations. Avoid the problem and simplify the whole handling by no longer posting a Runnable to the main handler, but calling `refresh()` right away. Posting to the main handler had been introduced in commit 27326e0f587c20d8dcf1595829233de1bd3fbe9e Date: Fri Aug 3 07:13:00 2018 -0700 tdf#119082 Exception wrong thread on Android Viewer to avoid crashes due to things being done on the wrong thread when switching to another app and then back to Android Viewer (s. tdf#119082), but that is no longer a problem, because the document is no longer loaded anew in that case since commit 1bc42472200c32c9a0a10dd1c3cd6c6a8a5d47d2 Date: Fri Apr 9 13:59:43 2021 +0200 tdf#95517 android: Rework app/doc lifecycle handling , so the code path is not used there any more, but only when the document is initially loaded, triggered in `LibreOfficeMainActivity#onCreate`. After all, the problem seems to be a similar one as fixed in commit 128f67e0efa02294205a1abe1be874557ecdcecd Date: Tue May 18 14:27:51 2021 +0200 tdf#142348 android: Avoid extra refresh after loading doc , where another timing issue in the handling of a refresh event could result in a blank page instead of the Calc doc being rendered. With the refresh being done right away, the synchronization added in commit 55661298bb3e9087a89a08637e4285f090c4e0e8 Date: Wed Apr 1 09:00:13 2020 +0200 tdf#131195 android: Don't destroy doc while loading it is also no more needed, because the situation described in its commit message no longer applies: > Since the 'refresh()' in 'LOKitThread::loadDocument' is > not executed synchronously but posted to the main handler, > this needs to be synchronized to prevent the document from > being deleted while it's being used. Change-Id: I15ecc2eba6c5ee441f6e14f8229594cab05dbba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132965 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit 4476fd51a324930e832535c10979564afc6968f2) diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index a4d5ba99f1a2..b4aee40c1cd3 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -214,15 +214,7 @@ class LOKitThread extends Thread { if (mTileProvider.isReady()) { LOKitShell.showProgressSpinner(mContext); updateZoomConstraints(); - LOKitShell.getMainHandler().post(new Runnable() { - @Override - public void run() { - // synchronize to avoid deletion while loading - synchronized (LOKitThread.this) { - refresh(true); - } - } - }); + refresh(true); LOKitShell.hideProgressSpinner(mContext); } else { closeDocument(); @@ -266,8 +258,7 @@ class LOKitThread extends Thread { /** * Close the currently loaded document. */ - // needs to be synchronized to not destroy doc while it's loaded - private synchronized void closeDocument() { + private void closeDocument() { if (mTileProvider != null) { mTileProvider.close(); mTileProvider = null; commit c2efa7e7c6e0e94293eed07fa0b383a0c35e8bb2 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Apr 13 10:16:00 2022 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Apr 14 07:34:04 2022 +0200 tdf#148553 liblo-native-code: Add services for numeric controls Change-Id: I67727b8ced6c501f0e220fa2024976640ca7028a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132950 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit 827d97887a8284e09fdeb2aa2918f60f09fd1a4a) diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 63d8d33a2066..be0802de9a32 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -190,6 +190,7 @@ core_constructor_list = [ ("com_sun_star_form_OListBoxControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), ("com_sun_star_form_OListBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), ("com_sun_star_form_ONumericModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), + ("com_sun_star_form_ONumericControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), ("com_sun_star_form_ORadioButtonControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), ("com_sun_star_form_ORadioButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), ("com_sun_star_form_XForms_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS"), @@ -419,6 +420,7 @@ core_constructor_list = [ "stardiv_Toolkit_UnoDateFieldControl_get_implementation", "stardiv_Toolkit_UnoGroupBoxControl_get_implementation", "stardiv_Toolkit_UnoListBoxControl_get_implementation", + "stardiv_Toolkit_UnoNumericFieldControl_get_implementation", "stardiv_Toolkit_UnoRadioButtonControl_get_implementation", "stardiv_Toolkit_UnoSpinButtonModel_get_implementation", "stardiv_Toolkit_VCLXPointer_get_implementation",
