made in 157298bb80
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>
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 2ab389b251
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
... 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>
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>
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>
... 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>
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>
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>
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>
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>
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>
* 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>
... 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>
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 1239dce259
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>
... 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>
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 2ab389b251
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>
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>
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>
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>
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>
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>
Quoting from
commit 128de1949f
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>
Setting the archive base name in build.gradle using
project.ext.set("archivesBaseName", "LibreOfficeViewer")
no longer worked after
commit 39326bc7d4
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>
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>
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>
... 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>
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>
Write an `ndk.dir` property with the directory path to
`android/source/local.properties` instead, similar
to how it's done for `sdk.dir`.
Also, rename the `ANDROID_NDK_HOME` variable that's
assigned in configure.ac that holds the corresponding
value to `ANDROID_NDK_DIR`, because the gradle warning
still shows up if that environment variable is set in
addition to having an `ndk.dir` property in `local.properties`.
This makes the following gradle warning disappear:
> > Task :stripStrippedUIDebugDebugSymbols
> WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
> Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
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, resulting in
> > Task :stripStrippedUIDebugDebugSymbols
> Unable to strip the following libraries, packaging them as they are:
> libc++_shared.so, libfreebl3.so, liblo-native-code.so, libnspr4.so,
> libnss3.so, libnssckbi.so, libnssdbm3.so, libnssutil3.so,
> libplc4.so, libplds4.so, libsmime3.so, libsoftokn3.so,
> libsqlite3.so, libssl3.so.
instead if upgrading gradle without switching to the use of the property.
Change-Id: I4a090e8736dac80777f69b0e12819b9c056f582b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133177
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Android Studio was showing an info/warning in the "Problems"
pane that this label is redundant, so remove it.
(The app name is used by default if nothing else is specified
anyway.)
Change-Id: I799c681488b95e2fffe89b59e7de18febe654dcb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133174
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Google Play now requires that apps target API level 30 or higher, and
compileSdkVersion/targetSdkVersion 31 is also needed to update
the com.google.android.material dependency to >= 1.5.0 [1].
Explicitly set the `android:exported="true"` attribute for activities
which is required when targeting Android 12 or newer; quoting from
the list of behavior changes for apps targeting Android 12 [1]:
> Safer component exporting
>
> If your app targets Android 12 or higher and contains activities,
> services, or broadcast receivers that use intent filters, you must
> explicitly declare the android:exported attribute for these app
> components. Warning: If an activity, service, or broadcast receiver
> uses intent filters and doesn't have an explicitly-declared value for
> android:exported, your app can't be installed on a device that runs
> Android 12 or higher.
>
> If the app component includes the LAUNCHER category, set
> android:exported to true. In most other cases, set android:exported
> to false.
>
> The following code snippet shows an example of a service that
> contains an intent filter whose android:exported attribute is set to
> false:
>
> <service android:name="com.example.app.backgroundService"
> android:exported="false">
> <intent-filter>
> <action android:name="com.example.app.START_BACKGROUND" />
> </intent-filter>
> </service>
The app worked fine in a quick test on an x86_64 AVD with API level 31.
[1] https://github.com/material-components/material-components-android/releases/tag/1.5.0-alpha03
Change-Id: Ibb919e4edb995740e48ebc3338ffab6ca35c1373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133167
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
`Intent.ACTION_OPEN_DOCUMENT` was introduced in API level 19,
therefore `Intent.ACTION_GET_CONTENT` is supposed to be used
for older Android versions.
The previous attempt at doing so didn't work, since no
`ActivityNotFoundException` is thrown when trying
to set the action to `Intent.ACTION_OPEN_DOCUMENT` on
older Android versions.
Fix that by using a proper version check instead.
Change-Id: Ie06fa3f39e3042b4b7161a3c937bf655eb658abd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133025
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Use the `ContentResolver#query` overload that is available from
Android API level 1 on, not the one that's only available from
API level 26 on [2], which would otherwise trigger an exception
if run on devices running Android version < 8.0, as seen
on an AVD with API level 21:
> E/AndroidRuntime( 2914): FATAL EXCEPTION: main
> E/AndroidRuntime( 2914): Process: org.libreoffice, PID: 2914
> E/AndroidRuntime( 2914): java.lang.NoSuchMethodError: No virtual method query(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor; in class Landroid/content/ContentResolver; or its super classes (declaration of 'android.content.ContentResolver' appears in /system/framework/framework.jar)
> E/AndroidRuntime( 2914): at org.libreoffice.ui.FileUtilities.retrieveDisplayNameForDocumentUri(FileUtilities.java:137)
> E/AndroidRuntime( 2914): at org.libreoffice.ui.LibreOfficeUIActivity.createUI(LibreOfficeUIActivity.java:206)
> E/AndroidRuntime( 2914): at org.libreoffice.ui.LibreOfficeUIActivity.onCreate(LibreOfficeUIActivity.java:147)
> E/AndroidRuntime( 2914): at android.app.Activity.performCreate(Activity.java:5937)
> E/AndroidRuntime( 2914): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
> E/AndroidRuntime( 2914): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
> E/AndroidRuntime( 2914): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
> E/AndroidRuntime( 2914): at android.app.ActivityThread.access$800(ActivityThread.java:144)
> E/AndroidRuntime( 2914): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
> E/AndroidRuntime( 2914): at android.os.Handler.dispatchMessage(Handler.java:102)
> E/AndroidRuntime( 2914): at android.os.Looper.loop(Looper.java:135)
> E/AndroidRuntime( 2914): at android.app.ActivityThread.main(ActivityThread.java:5221)
> E/AndroidRuntime( 2914): at java.lang.reflect.Method.invoke(Native Method)
> E/AndroidRuntime( 2914): at java.lang.reflect.Method.invoke(Method.java:372)
> E/AndroidRuntime( 2914): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
> E/AndroidRuntime( 2914): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
>
[1] https://developer.android.com/reference/android/content/ContentResolver#query(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String)
[2] https://developer.android.com/reference/android/content/ContentResolver#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)
Change-Id: I13ecc57d3d6b25a7eb2e5ff85a3420ef8064cb20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133024
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>