summaryrefslogtreecommitdiff
path: root/android
AgeCommit message (Collapse)Author
2022-10-14WASM add Calc as optional build result, make it build & runBalazs Varga
Adding new config option: --with-main-module=<writer/calc> With this switcher we can build only WASM writer module or calc module. The default value is 'writer'. This commit also reverts: 26603bc9ef0116ed31c510dab82b69d3666447b5 (WASM fix orcus native exception handling (NEH)) Because Calc import is using liborcus for loading styles.xml. Change-Id: I4c330ef8eea7d08214bf357531ee0bf7383ab788 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137946 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Jenkins
2022-09-08replace egrep/fgrep calls with grep -E/grep -FRene Engelhard
as egrep/fgrep is deprecated since long amd grep 3.8+ now actually warns (e.g. "egrep: warning: egrep is obsolescent; using grep -E") Change-Id: I5b10f05dffdd09081deb05cef974e3cdb2907315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139614 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2022-08-08android: Add scrollbars.ui into APKMichael Weghorn
That UI file was added in commit 4bc62c4e9b5b4eab6e2e40577789c435dce59f66 Date: Thu Aug 4 15:33:51 2022 +0100 split SwScrollbar up for reuse of adaptor Include it for Android. Without it, trying to load/display any document would result in Android Viewer crashing or getting stuck, with this in the ADB log: 08-08 09:22:20.102 6064 6256 D libo:sal/osl/unx/file: double-slash in path: /assets//config/soffice.cfg/svt/ui/scrollbars.ui 08-08 09:22:20.102 6064 6256 E libo:sal/osl/unx/file: miss cache: failed to open /assets//config/soffice.cfg/svt/ui/scrollbars.ui 08-08 09:22:20.102 6064 6256 W vcl.builder: 23:vcl/source/window/builder.cxx:480: DBG_UNHANDLED_EXCEPTION in VclBuilder 08-08 09:22:20.102 6064 6256 W vcl.builder: when: Unable to read .ui file exception: void 08-08 09:22:20.103 6064 6256 I LOKitTileProvider: ====> mOffice.documentLoad() returned null, trying to restart 'Office' and loading again Change-Id: I0938d77dc9553d8acc7b2bdd4a72b5299b4ec1a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137943 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-08android: Drop empty main.jni.srcDirs from sourceSetsMichael Weghorn
This was shown as a recommended step in Android Studio when the update to Android Gradle Plugin 7.2.2 was suggested: > *Remove jni source directory from sourceSets* > > The jni block in an android > sourceSet does nothing, and will be removed in Android Gradle Plugin > version 8.0.0. Change-Id: I3378926047d5ad86548d0bf800e022b74efb5e09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137942 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-08android: Update Android Gradle Plugin to 7.2.2Michael Weghorn
Change-Id: I3235716498168ca5eebf71ebf6f5ee571af7a72d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137941 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-06-22Revert changes to android/mobile-config.pyIlmari Lauhakangas
made in 157298bb808a943616991927f9370a86c1f2ca48 Got Tinderbox failure with Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 263, in iterfind selector = _cache[cache_key] KeyError: ('%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s= "Filter"]/group[@%(name)s="Microsoft"]/group[@{http://openoffice.org/2001/registry} name="Import"]/prop', None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tinderbox/buildslave/source/libo-master/android/mobile-config.py", line 85, in <module> props = root.findall(microsoftImport) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 304, in findall return list(iterfind(elem, path, namespaces)) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 277, in iterfind selector.append(ops[token[0]](next, token)) KeyError: '(' Change-Id: I34a770a342417fcbfb9689e3adc4b495d5bd5fe5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136282 Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-06-22android and bin/update: make pythonicLukas
Change-Id: Iaf791bfa8d9822843b26f2a2f2c3d94c55a60a0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133358 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-06-14android: Update com.google.android.material to 1.6.1Michael Weghorn
Change-Id: If5aebe347534745065b371190abffce2421655f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135729 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-28android: Update Android Gradle Plugin to 7.2.1Michael Weghorn
Release notes [1]: > 7.2.1 (May 2022) > > This minor update corresponds to the release of Android Studio > Chipmunk Patch 1 and includes the following bug fixes: > > bundletool does not package baseline profiles correctly [2] > > To see the other bug fixes included in this release, see the Android > Studio Chipmunk Patch 1 release notes. [3] [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#7-2-0 [2] https://issuetracker.google.com/issues/230361284 [3] https://developer.android.com/studio/releases#patch-releases Change-Id: I57f37ea3786003dba4d95b291ddf6b0b44dccaa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135053 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-26android: Update compileSdkVersion/targetSdkVersion to 32Michael Weghorn
API version 32 refers to the Android 12L feature drop (Android 12.1). According to [1], "12L is a special feature drop that makes Android 12 even better on tablets and foldable devices." When getting over the list of behavior changes for apps targeting Android 12, I didn't realize anyting relevant specific to API level 32 not yet in API level 31 as well, so there seems to be no need for any special adjustments for this update on top of commit 2ab389b251744fa7f3f6b060c09746e59d87f3b1 Date: Tue Apr 19 10:33:27 2022 +0200 android: Update compileSdkVersion/targetSdkVersion to 31 [1] https://developer.android.com/about/versions/12/12L Change-Id: Ic99c4ee5b81b6584648fa4717e23cc7f3c78bdab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134988 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-26android: Update androidx.constraintlayout to 2.1.4Michael Weghorn
Change-Id: If2edff8006c3aa904d40dabf679d5ed0b0fd0127 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134987 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-26android: Update com.google.android.material to 1.6.0Michael Weghorn
Change-Id: Iac3831d400d29b45be82d2585ca1454ed22676be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134986 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-21android: Drop 'android.enableJetifier=true'Michael Weghorn
From the Android Gradle Plugin 7.2.0 release notes [1]: > Jetifier warning and check in Build Analyzer Build Analyzer now displays > a warning if your project's gradle.properties file includes > android.enableJetifier=true. This flag was introduced in a previous > version of Android Studio to enable AndroidX for libraries that don't > support AndroidX natively. However, the library ecosystem has mostly > moved to support AndroidX natively and the Jetifier flag is probably no > longer needed by your project. Additionally, the flag can lead to slower > build performance. If you see this warning, you can run a check within > Build Analyzer to confirm if the flag can be removed. Android Viewer has no dependencides requiring Android Support Libraries, so drop the `android.enableJetifier=true` flag. [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#jetifier-build-analyzer Change-Id: I6943b2e82e5b226286be288f9ed30944c541eb1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134673 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-21android: Update Android Gradle Plugin to 7.2.0Michael Weghorn
... and gradle to 7.3.3, as suggested by Android Studio. The Android Gradle plugin release notes for 7.2.0 [1] mention a new warning in Build Analyzer when `android.enableJetifier=true` is set. That will be handled in a follow-up commit. [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#jetifier-build-analyzer Change-Id: I9427f8b878346edc3c6e30be1d41fcc4dc32540e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134672 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-09Fix typo in codeAndrea Gelmini
Change-Id: I6fae9a4df450f80ee2af59e271a8cb1dd8bc918f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134047 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2022-05-08android: Don't use res Id in switch-case (ToolbarController)Michael Weghorn
Like Change-Id I9d563b6ad4ed70a891c583a82331dd80db5956dc, "android: Avoid using res ID in switch-case (FormattingController)", but for `TollbarController`. Change-Id: I40f23b6a91ddf0bb7e90c3b3b690fe332cd874ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133999 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Don't use res ID in switch-case (SearchController)Michael Weghorn
Addresses this Lint warning: > ../../src/java/org/libreoffice/SearchController.java:73: Resource IDs > will be non-final by default in Android Gradle Plugin version 8.0, avoid > using them in switch case statements There's no need to explicitly set `SearchDirection.DOWN` for `R.id.button_search_down` since it has previously been set as default value anyway. Change-Id: I283c00b97e1417f5dc3a48922238df7a29032137 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133998 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Avoid using res ID in switch-case (FormattingController)Michael Weghorn
Adresses Lint warnings like this in FormattingController: > ../../src/java/org/libreoffice/FormattingController.java:89: Resource > IDs will be non-final by default in Android Gradle Plugin version 8.0, > avoid using them in switch case statements > > 86 > 87 switch(button.getId()) { > 88 > 89 case R.id.button_insertFormatListBullets: > 90 LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:DefaultBullet")); > 91 break; Change-Id: I9d563b6ad4ed70a891c583a82331dd80db5956dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133997 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Allow setting auto font/bg colorMichael Weghorn
Add a button in the color palette UI (that can be found in the bottom toolbar under "Styles" -> "Font Color"/"Highlight Color" when experimental editing mode is enabled) which allows setting auto color for the font or the highlighting/background. This allows to unset any explicitly set color and use the automatic color. This is equivalent to the "Automatic"/"No fill color" items in the font color and character highlighting color popups in the desktop version. Add a `boolean keepAlpha` param to `sendFont{,Back}ColorChange` to be able to distinguish between "auto color" and white when -1/0xFFFFFFFF is passed as color. See also previous commit Change-Id I2e6512f32e671f92c8d31b2780c350dd74fb0747, "android: Handle auto color as such", for some more context. Change-Id: I05182a2adbc00e64b1925ff52861a51ba8dcc21f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133996 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Handle auto color as suchMichael Weghorn
When no color is explicitly set for the font/background (i.e. automatic color is used which would e.g. be black for the font if no background color is set or white if a black highlight color is set in Writer), the value for the color sent in the ".uno:Color" event for the font color and similarly for the background/highlight color (".uno:BackgroundColor" in Calc, ".uno:CharBackColor" in Impress, ".uno:BackColor" in Writer) is -1. The previous handling of that special value was problematic: 1) Where handled specifically, -1 was interpreted as "black color" rather than "auto/no color". 2) The color handled by the above-mentioned UNO events does not contain/handle the alpha channel, while Android does, so a conversion happens to add/remove the alpha layer. However, the anonymous `ColorPaletteListener`s that handle font and background color updates in their `updateColorPickerPosition` methods were not doing a logical or to add an alpha channel to the LO-provided color, but *adding* 0xFF000000 instead, which is the same for actual colors without an alpha channel set, but the actual special value of -1 (0xFFFFFFFF) would then be converted to 0xFEFFFFFF and no longer be treated as special. The way of treating -1 as black would also have the side effect that an explicit white color (0x00FFFFFF) would be converted to 0xFFFFFFFF, which is -1, and would therefore be treated as black. (So setting font color to white would result in black being shown as font color in the font color UI in experimental mode instead...) In order to actually handle auto color as such, handle the special value of -1 right in the `updateColorPickerPosition` methods: In that case, unselect any explicitly selected color (and set color to transparent for the buttons in the "Style" tab of the toolbar, `font_color_picker_button` and `font_back_color_picker_button` in `toolbar_bottom.xml`). Also, do a logical or to add the alpha layer instead of adding 0xFF000000. While at it, unify the code in the two `updateColorPickerPosition` methods a bit. Change-Id: I2e6512f32e671f92c8d31b2780c350dd74fb0747 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133992 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Don't show any color in palette as selected if none matchesMichael Weghorn
In Android Viewer with experimental editing mode enabled, doing the following resulted in black still being marked as the current font color in the "Style" -> "Font Color" UI. 1) create a new Writer doc in the desktop version with one paragraph that has the font color explicitly set to black and one with "Dark Brick 2" 2) open the doc in Android Viewer with experimental mode enabled 3) tap on the first paragraph with font color explicitly set to black 4) open the "Style" -> "Font Color" UI where the color could be changed (layout file: `toolbar_color_picker.xml`) -> black is marked as current font color (OK) 5) tap on the paragraph which has font color "Dark Brick 2" set -> black is still marked as current font color (NOK) This is because the indices of the previously set color would just remain set if the new color was not found in any of the palettes which contain a set of predefined colors. Change that to set the index for the `upperSelectedBox` palette to 0 (i.e. switch to the first palette), and the index of the `selectedBox` (i.e. color within the palette) to the special value of '-1' and don't mark any palette or color as selected in that case. The newly introduced `ColorPickerAdapter#unselectColors` will be used from elsewhere in a follow-up commit, so make it public right away. The two `ImageButton`s right in the "Style" tab in the toolbar (i.e. `font_color_picker_button` and `font_back_color_picker_button` in `toolbar_bottom.xml`) remain unchanged and keep showing the actual color, since those are not restricted to predefined colors in the palettes. For the case where no explicit font color is set (i.e. use of automatic font color, e.g. black if no background is set, but white if the background is set to black), the value '-1' is sent from the C++ side, and no color should be marked as selected in Android Viewer, which also works with this change in place in general. However, the current handling for the "automatic color" case on Android Viewer side looks suspicious in more ways that will be addressed in a follow-up commit. Change-Id: I228d57ace5341bd311761f40c477441d1e511d5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133989 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Switch order of these if/else statementsMichael Weghorn
I find if (a == b) { // statement 1 } else { // statement 2 } more straightforward than if ( a != b) { // statement 2 } else { // statement 1 } since it doesn't require logically negating twice (else block is for `!(a != b)`) in the second form), and this also prepares for a follow-up commit where one of the conditions will be extended further. Change-Id: I1d2177bdcf662994e757b626983a9f9626c66aa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133988 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Don't store selected pos in ColorPickerAdapterMichael Weghorn
The position is already set and used in `ColorPaletteAdapter` as its `upperSelectedBox` member, so stop doing the double bookkeeping in both classes and retrieve it from there instead. Change-Id: I59896b85f5d5a0285076f61599be64638fa71121 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133987 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Make Color{Palette,Picker}Adapter members privateMichael Weghorn
... and make some `final` as well. Change-Id: Ib50ff32788edaea753cc25f119f91a93e936b2ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133986 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Drop explicit type arguments when calling ctorsMichael Weghorn
Addresses these suggestions shown in Android Studio: * "Explicit type argument String can be replaced with <>" * "Explicit type argument String, ArrayList<String> can be replaced with <>" Change-Id: Ibc78364cf5b246d8c1e1d32d755c3e8dcf0e32aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133985 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Move assignment to existing loopMichael Weghorn
There is already a loop just before this one, so just move that assignment there as well. Change-Id: Ie93a0275c0940b7932973264352bad64d0489b03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133984 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Use existing Color.WHITE constantMichael Weghorn
... instead of creating the color from the RGB values manually. Change-Id: I2058de553e2e744440e7d856ca9bfaf5f9041b49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133983 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-04android: Don't use log tag longer than 23 charsMichael Weghorn
Addresses this lint error: > .../android/source/src/java/org/mozilla/gecko/gfx/SimpleScaleGestureDetector.java:146: > Error: The logging tag can be at most 23 characters, was 31 > (GeckoSimpleScaleGestureDetector) [LongLogTag] > Log.e(LOGTAG, "No gesture taking place in getFocusX()!"); Change-Id: I1d18fb3717ccea8dc36695bfef888d035efe8d55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133799 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-04android: Make clear that column index is non-negativeMichael Weghorn
Use `Cursor#getColumnIndexOrThrow` instead of `Cursor#getColumnIndex` here, as suggested in the `Cursor#getColumnIndex` doc [1]: > Returns the zero-based index for the given column name, or -1 if the > column doesn't exist. If you expect the column to exist use > getColumnIndexOrThrow(java.lang.String) instead, which will make the > error more clear. As described in the `OpenableColumns` doc [2], `OpenableColumns.DISPLAY_NAME` is one of the two standard columns that must be supported: > These are standard columns for openable URIs. Providers that serve > openable URIs must support at least these columns when queried. Addresses this lint error: > .../android/source/src/java/org/libreoffice/ui/FileUtilities.java:139: Error: Value must be ≥ 0 [Range] > displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Explanation for issues of type "Range": > Some parameters are required to in a particular numerical range; this check > makes sure that arguments passed fall within the range. For arrays, Strings > and collections this refers to the size or length. [1] https://developer.android.com/reference/android/database/Cursor#getColumnIndex(java.lang.String) [2] https://developer.android.com/reference/android/provider/OpenableColumns Change-Id: I946fcd32a905a4bb8c0527fc1199b9dcc52bccfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133798 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-04android: Call base class implementation in 'onActivityResult'Michael Weghorn
Addresses this lint error: > android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java:253: Error: > Overriding method should call super.onActivityResult [MissingSuperCall] > protected void onActivityResult(int requestCode, int resultCode, Intent data) { > ~~~~~~~~~~~~~~~~ > > Explanation for issues of type "MissingSuperCall": > Some methods, such as View#onDetachedFromWindow, require that you also call > the super implementation as part of your method. Change-Id: Iab2bdadae7a776e4f52d671a6fd47c1b8146b2a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133797 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-30android: Show Impress icon for .pps filesMichael Weghorn
For some reason, that was commented out. Opening such a PowerPoint file worked just fine, and with this commit in place, the Impress icon is shown in the "Recent Files" view as well. Change-Id: I69bce54074c084928d9aa7b95f37145a9692b847 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133649 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-30tdf#111427 android: Enable support for .ppsxMichael Weghorn
Opening the sample file of MIME type "application/vnd.openxmlformats-officedocument.presentationml.slideshow" attached to tdf#111427 worked fine now when testing in an x86_64 AVD with API level 31, so declare support for it. Change-Id: I67ace0fb6ee82c0a43624dc32671ba2d453e473c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133648 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-27android: Slightly clean up style of LOKitTileProvider#resetPartsMichael Weghorn
* Reduce scope of the `parts` variable to the if block * add an emptly line before the next method Change-Id: I22389cb4c9307f6888c4ed836056caf23ce84da6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133450 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-27android: Reuse existing LOKitTileProvider#resetPartsMichael Weghorn
... instead of duplicating what it does in `LOKitTileProvider#postLoad`. Change-Id: I0ed3d77d9f9651efec764eafeaa3f71576abcf6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133449 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-27android: Leave part names starting with "Sheet" etc. intactMichael Weghorn
It's unexpected that opening a Calc sheet with two tables called "Sheet foobar" and "Sheet 10" would result in the sheets showing up as "Sheet 1" and "Sheet 2" in the parts view instead of their real names. Therefore, leave the original names intact and show them instead of generating new generic names. The change to rename such sheets (and similar parts) has been added in commit 1239dce2595877ad64fd8c8fd927ea4285d69abe Date: Thu Nov 1 22:03:31 2018 +0300 [Pardus] language improvements on Android More hardcoded strings extrated to the resource file Few Turkish language improvements This patch is sponsored by ULAKBIM/Pardus project. where the intention seems to have been to have a localized name for the parts show up. That still happens when the part name is empty (s. lines above), but I think that explicit names should remain as they are, as e.g. also happens for Calc sheets in the desktop version of LibreOffice. Change-Id: I3073babf99a6b2309be2107141bba92236eba76d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133448 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-26android: Use 'if' instead of switch-cases with just 1 caseMichael Weghorn
... which IMHO makes this a bit more readable. Change-Id: Ica1d9416f711e75e6d6c23963ca64d13e08c138e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133428 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-26android: Drop redundant check for SDK version <= 11Michael Weghorn
minSdkVersion is 16. Change-Id: I1082cc5abd7ecc02211509e57fd41c97cf706e8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133427 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Show file chooser despite package visibility filtering in API 30Michael Weghorn
While it was working just fine in my x86_64 AVD with API level 31, opening the the file chooser on a real HW aarch64 device running Android 12 no longer worked by tapping on the TextView in `LibreOfficeUIActivity` after updating target API from 28 to 31 in commit 2ab389b251744fa7f3f6b060c09746e59d87f3b1 Date: Tue Apr 19 10:33:27 2022 +0200 android: Update compileSdkVersion/targetSdkVersion to 31 The intent.resolveActivity(getPackageManager()) != null check was failing there, so the Activity with `Intent.ACTION_OPEN_DOCUMENT` wasn't started there. This looks like an issue due to package visibility filtering introduced in target API level 30. Quoting from [1]: > When an app targets Android 11 (API level 30) or higher and queries for > information about the other apps that are installed on a device, the > system filters this information by default. The limited package > visibility reduces the number of apps that appear to be installed on a > device, from your app's perspective. > > [...] > > The limited app visibility affects the return results of methods that > give information about other apps, such as queryIntentActivities(), > getPackageInfo(), and getInstalledApplications(). The limited > visibility also affects explicit interactions with other apps, such > as starting another app's service. From how I understand it, the check is used to make sure that there is an app that can handle the Intent, as e.g. the "Android fundamentals 02.3: Implicit intents" tutorial [2] mentions it for the example using an `Intent.ACTION_VIEW`: > Use the resolveActivity() method and the Android package manager to find > an Activity that can handle your implicit Intent. Make sure that the > request resolved successfully. > > if (intent.resolveActivity(getPackageManager()) != null) { > } > > This request matches your Intent action and data with the Intent filters > for installed apps on the device. You use it to make sure there is at > least one Activity that can handle your requests. While that sounds reasonable to make sure there is an app that can view specific data passed *from* the app (and [3] describes how to add a corresponding `<queries>` element to make this use case work), it seems to be unnecessary for `Intent.ACTION_OPEN_DOCUMENT`, since that causes the system to "display the various DocumentsProvider instances installed on the device, letting the user navigate through them" and Android presumably at least provides a provider for handling local files by itself in any case. The `Intent.ACTION_GET_CONTENT` case used instead of `Intent.ACTION_OPEN_DOCUMENT` for API level < 19 should presumably be similar. Anyway, in case there should still be any case where the Intent cannot be handled: `startActivityForResult` "throws ActivityNotFoundException if there was no Activity found to run the given Intent." [4], so add a try-catch block handling that exception instead of the previous check. [1] https://developer.android.com/training/package-visibility [2] https://developer.android.com/codelabs/android-training-activity-with-implicit-intent?index=..%2F..android-training#3 [3] https://developer.android.com/training/package-visibility/use-cases#open-a-file [4] https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int) Change-Id: I7702b100d71333be2d78df1bc81ef2e5a7e016bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133272 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Slightly improve style in use of arraysMichael Weghorn
Addresses these warnings shown in Android Studio for class `LibreOfficeUIActivity`: * "Unnecessary 'Arrays.asList()' call" * "Raw use of parameterized class 'ArrayList'" * "Explicit type argument ShortcutInfo can be replaced with <>" Change-Id: I083e5fcf804209fae704b19643ce80bc92126ca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133271 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Drop unused import and extra semicolonMichael Weghorn
Change-Id: I19557b0b1d63698a31dac61ce9fde3ce07f86451 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133267 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Avoid using resource ID in switch-caseMichael Weghorn
Adresses this warning shown in Android Studio: > Resource IDs will be non-final by default in Android Gradle Plugin > version 8.0, avoid using them in switch case statements Change-Id: I8cead0ceb3b71e263b29d4283a8cfac522ed4204 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133266 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Explicitly load libc++_sharedMichael Weghorn
While it works just fine without that in newer Android versions, trying to open any doc in an x86 AVD with API level 16 failed like this: > E/AndroidRuntime( 2999): java.lang.ExceptionInInitializerError > E/AndroidRuntime( 2999): at org.libreoffice.TileProviderFactory.initialize(TileProviderFactory.java:23) > E/AndroidRuntime( 2999): at org.libreoffice.LOKitThread.<init>(LOKitThread.java:39) > E/AndroidRuntime( 2999): at org.libreoffice.LibreOfficeMainActivity.onCreate(LibreOfficeMainActivity.java:149) > E/AndroidRuntime( 2999): at android.app.Activity.performCreate(Activity.java:5008) > E/AndroidRuntime( 2999): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) > E/AndroidRuntime( 2999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) > E/AndroidRuntime( 2999): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) > E/AndroidRuntime( 2999): at android.app.ActivityThread.access$600(ActivityThread.java:130) > E/AndroidRuntime( 2999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) > E/AndroidRuntime( 2999): at android.os.Handler.dispatchMessage(Handler.java:99) > E/AndroidRuntime( 2999): at android.os.Looper.loop(Looper.java:137) > E/AndroidRuntime( 2999): at android.app.ActivityThread.main(ActivityThread.java:4745) > E/AndroidRuntime( 2999): at java.lang.reflect.Method.invokeNative(Native Method) > E/AndroidRuntime( 2999): at java.lang.reflect.Method.invoke(Method.java:511) > E/AndroidRuntime( 2999): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) > E/AndroidRuntime( 2999): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) > E/AndroidRuntime( 2999): at dalvik.system.NativeStart.main(Native Method) > E/AndroidRuntime( 2999): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 1176 could not load needed library 'libc++_shared.so' for 'liblo-native-code.so' (load_library[1093]: Library 'libc++_shared.so' not found) > E/AndroidRuntime( 2999): at java.lang.Runtime.loadLibrary(Runtime.java:370) > E/AndroidRuntime( 2999): at java.lang.System.loadLibrary(System.java:535) > E/AndroidRuntime( 2999): at org.libreoffice.kit.NativeLibLoader.load(LibreOfficeKit.java:105) > E/AndroidRuntime( 2999): at org.libreoffice.kit.LibreOfficeKit.<clinit>(LibreOfficeKit.java:82) > E/AndroidRuntime( 2999): ... 17 more > W/ActivityManager( 1421): Force finishing activity org.libreoffice/.LibreOfficeMainActivity > W/ActivityManager( 1421): Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity Change-Id: I6e383e624b9e66c0daa9ecfda4a3b176c8fa0d94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133263 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Use drawable tag already supported with API level 16Michael Weghorn
Use the `app:drawableLeftCompat` tag instead of `android:drawableLeft` to set the icon to show in the TextView. With the latter, trying to start Android Viewer in an x86 AVD with API level 16 resulted in this crash: > E/AndroidRuntime( 2510): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity}: android.view.InflateException: Binary XML file line #80: Error inflating class TextView > E/AndroidRuntime( 2510): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) > E/AndroidRuntime( 2510): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) > E/AndroidRuntime( 2510): at android.app.ActivityThread.access$600(ActivityThread.java:130) > E/AndroidRuntime( 2510): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) > E/AndroidRuntime( 2510): at android.os.Handler.dispatchMessage(Handler.java:99) > E/AndroidRuntime( 2510): at android.os.Looper.loop(Looper.java:137) > E/AndroidRuntime( 2510): at android.app.ActivityThread.main(ActivityThread.java:4745) > E/AndroidRuntime( 2510): at java.lang.reflect.Method.invokeNative(Native Method) > E/AndroidRuntime( 2510): at java.lang.reflect.Method.invoke(Method.java:511) > E/AndroidRuntime( 2510): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) > E/AndroidRuntime( 2510): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) > E/AndroidRuntime( 2510): at dalvik.system.NativeStart.main(Native Method) > E/AndroidRuntime( 2510): Caused by: android.view.InflateException: Binary XML file line #80: Error inflating class TextView > E/AndroidRuntime( 2510): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) > E/AndroidRuntime( 2510): at org.libreoffice.ui.LibreOfficeUIActivity.createUI(LibreOfficeUIActivity.java:169) > E/AndroidRuntime( 2510): at org.libreoffice.ui.LibreOfficeUIActivity.onCreate(LibreOfficeUIActivity.java:147) > E/AndroidRuntime( 2510): at android.app.Activity.performCreate(Activity.java:5008) > E/AndroidRuntime( 2510): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) > E/AndroidRuntime( 2510): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) > E/AndroidRuntime( 2510): ... 11 more > E/AndroidRuntime( 2510): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi-v4/ic_folder_grey_48dp.xml from drawable resource ID #0x7f080083 > E/AndroidRuntime( 2510): at android.content.res.Resources.loadDrawable(Resources.java:1923) > E/AndroidRuntime( 2510): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) > E/AndroidRuntime( 2510): at android.widget.TextView.<init>(TextView.java:614) > E/AndroidRuntime( 2510): at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:100) > E/AndroidRuntime( 2510): at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:95) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatViewInflater.createTextView(AppCompatViewInflater.java:194) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:115) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1551) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1602) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675) > E/AndroidRuntime( 2510): ... 26 more > E/AndroidRuntime( 2510): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector > E/AndroidRuntime( 2510): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877) > E/AndroidRuntime( 2510): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818) > E/AndroidRuntime( 2510): at android.content.res.Resources.loadDrawable(Resources.java:1920) > E/AndroidRuntime( 2510): ... 35 more > W/ActivityManager( 1421): Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity Change-Id: I4253a68f90d6c507805c7bf72aaf81011fb19339 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133256 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: use mavenCentral instead of jcenter repositoryMichael Weghorn
From the `./gradlew --warning-mode all assembleStrippedUIEditingRelease` output: > > Configure project : > The RepositoryHandler.jcenter() method has been deprecated. This is > scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset > in February 2021. Use mavenCentral() instead. Consult the upgrading > guide for further information: > https://docs.gradle.org/7.2/userguide/upgrading_version_6.html#jcenter_deprecation > at build_a6ed945jjgv6miyybz50fclhq$_run_closure1$_closure2.doCall(/home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/build.gradle:14) > (Run with --stacktrace to get the full stack trace of this deprecation warning.) Change-Id: I5db84a9778b598d1e3459dd313aa05c229060368 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133239 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Use android.ndkPath property to set path to NDKMichael Weghorn
Quoting from commit 128de1949ff120ac925dbb06e398fa992fb295ba Date: Tue Apr 19 15:18:49 2022 +0200 android: Use property instead of ANDROID_NDK_HOME env var which ported from an obsolete (no longer supported by current Gradle versions) way of setting the NDK path to a deprecated but still supported one as an intermediate step to allow upgrading Gradle: > Note however, that with this approach of using the `ndk.dir` > property instead of the suggested `android.ndkVersion` > (with the latter having the stricter requirement that > the `ndk` dir would have to be a subdir of the SDK dir), > doing the actual upgrade to a newer Gradle (plugin) version > in follow-up commit > Change-Id Ia982d72d877e229c3006c6d528b830d16c88481f > "android: Update Android Gradle Plugin to 7.1.3" > revealed that the use of the `ndk.dir` property > is deprecated in newer Gradle (plugin) versions as well, > resulting in this warning. > > > > Task :stripStrippedUIDebugDebugSymbols > > [CXX5106] NDK was located by using ndk.dir property. This method is > > deprecated and will be removed in a future release. Please delete > > ndk.dir from local.properties and set android.ndkVersion to > > [20.0.5594570] in all native modules in the project. > > https://developer.android.com/r/studio-ui/ndk-dir > > It might make sense to address that in a follow-up step, > but for now, it's an improvement and keeps it working > after the upgrade without potentially causing any incompatibility > problems with existing autogen configurations, > while support for the `ANDROID_NDK_HOME` env var that was > used so far seems to have been dropped, [...]. The release notes for Android Gradle Plugin version 4.1.0 mention yet another way of setting an explicit NDK path instead of just a version and that one is still supported and not deprecated [1]: > # Set the NDK path > You can set the path to your local NDK installation using the > android.ndkPath property in your module's build.gradle file. > > android { > ndkPath "your-custom-ndk-path" > } > > If you use this property together with the android.ndkVersion property, > then this path must contain an NDK version that matches > android.ndkVersion. Therefore, switch to setting the NDK path using the `android.ndkPath` property in liboSettings.gradle instead of the deprecated `ndk.dir` in local.properties. [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#ndk-path Change-Id: I34690ca8e15ff4742bab9a716a58b9ad85fa86e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133197 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Set archivesBaseName differently after gradle updateMichael Weghorn
Setting the archive base name in build.gradle using project.ext.set("archivesBaseName", "LibreOfficeViewer") no longer worked after commit 39326bc7d439170dd24c9d4b837c2cdb720b5d6f Date: Tue Apr 19 15:49:53 2022 +0200 android: Update Android Gradle Plugin to 7.1.3 ... and gradle to 7.2, which is what Android Studio suggested and did automatically when confirming. As a consequence, the generated .apk or .aar files would no longer have the app name in them, but be called e.g. "source-strippedUIEditing-release-unsigned.apk" instead of "LibreOfficeViewer-strippedUIEditing-release-unsigned.apk". Setting `archivesBaseName` in `android.defaultConfig` in libOSettings.gradle works, so move it there. Change-Id: Id03cbe10681aca85c35aeef64527bc7707c95736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133191 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Update dependencies to current versionsMichael Weghorn
This requires the Gradle update from Change-Id Ia982d72d877e229c3006c6d528b830d16c88481f "android: Update Android Gradle Plugin to 7.1.3" as a prerequisite, since the build would otherwise fail with > > Task :desugarStrippedUIDebugFileDependencies FAILED > D8: Method name '$private$<clinit>' in class > 'com.sun.star.frame.XMenuBarMergingAcceptor$-CC' cannot be represented > in dex format. > > FAILURE: Build failed with an exception. after updating only the dependencies. Change-Id: Ifa007fa0e520e9494ace173d1643abb7d7a5f9c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133183 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Drop obsolete "sourceCompatibility 6"Michael Weghorn
This addresses this warning when building Android Viewer: > > Task :compileStrippedUIDebugJavaWithJavac > warning: [options] source value 6 is obsolete and will be removed in a future release > warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. Change-Id: Ic1a80117e7e8c31774947729452bfafacd7a24c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133182 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Update Android Gradle Plugin to 7.1.3Michael Weghorn
... and gradle to 7.2, which is what Android Studio suggested and did automatically when confirming. Also apply the following optional, but recommended change while doing so: > Migrate from lintOptions to lint > Configuration related to lint is now performed using the lint block. Change-Id: Ia982d72d877e229c3006c6d528b830d16c88481f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133179 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Stop using ANDROID_SDK_HOME env variableMichael Weghorn
Otherwise, upgrading to Android Gradle Plugin 7.1.3 and gradle 7.2 (which will be done in a follow-up commit) would make the build fail like this: > FAILURE: Build failed with an exception. > > * Where: > Build file '/home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/build.gradle' line: 1 > > * What went wrong: > A problem occurred evaluating root project 'source'. > > Failed to apply plugin 'com.android.internal.application'. > > ANDROID_SDK_HOME is set to the root of your SDK: /home/michi/Android/Sdk > ANDROID_SDK_HOME was meant to be the parent path of the preference folder expected by the Android tools. > It is now deprecated. > > To set a custom preference folder location, use ANDROID_USER_HOME. > > It should NOT be set to the same directory as the root of your SDK. > To set a custom SDK location, use ANDROID_HOME. We don't actually rely on `ANDROID_SDK_HOME` being evaluated by the Android toolchain, but it used to be set in configure.ac, and the value was then assigned to the `sdk.dir` property written to `android/source/local.properties`. Just use a new variable name `ANDROID_SDK_DIR` and keep the mechanism otherwise unchanged for now. Change-Id: I44826621a1342119d40036fb704d8ff1eeed7c77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133178 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>