summaryrefslogtreecommitdiff
path: root/android
AgeCommit message (Collapse)Author
2023-01-06android: Enable checksum verification for gradle downloadMichael Weghorn
Follow the F-Droid Bot suggestion in [1] and set the checksum from [2] in gradle-wrapper.properties, so a downloaded gradle distribution will be verified against that, s. doc at [3]. Command used from within the `android/source` directory: ./gradlew wrapper --distribution-type all --gradle-distribution-sha256-sum cd5c2958a107ee7f0722004a12d0f8559b4564c34daad7df06cffd4d12a426d0 Note that this is the checksum for the gradle distribution, not the gradle wrapper (which is mentioned in Change-Id I3f466061aba55c5704fe251eee7e8c73f7d316aa instead.) Also note that Android Studio does not fully support the "distributionSha256Sum" attribute and requires confirming in a message saying so that the checksum is correct before syncing the project, s. [4]. [1] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12380#note_1229239229 [2] https://downloads.gradle-dn.com/distributions/gradle-7.4-all.zip.sha256 [3] https://docs.gradle.org/current/userguide/gradle_wrapper.html#configuring_checksum_verification [4] https://issuetracker.google.com/issues/129261435#comment11 Change-Id: I39902be79e7dad2ad006262efe3b6c6ab3b5de5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145105 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-06android: Update gradle wrapper to 7.4Michael Weghorn
Commit the result of running ./gradlew wrapper --distribution-type all --gradle-version 7.4 from within the `android/source` directory as described at [1]. Double-check that the sha256sum of the jar file matches what is listed on the website [2] for v7.4: $ sha256sum gradle/wrapper/gradle-wrapper.jar 575098db54a998ff1c6770b352c3b16766c09848bee7555dab09afc34e8cf590 gradle/wrapper/gradle-wrapper.jar (Interestingly, the sha256sum of the gradle-wrapper.jar used so far, e2b82129ab64751fd40437007bd2f7f2afb3c6e41a9198e628650b22d5824a14, is not the one of any listed versions there, which is what the F-Droid bot marked as error in a MR to update LibreOffice Viewer [3]). [1] https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper [2] https://gradle.org/release-checksums/ [3] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12380#note_1229239229 Change-Id: I3f466061aba55c5704fe251eee7e8c73f7d316aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145098 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-30android: Offer "Save" entry independent of edit actionsMichael Weghorn
Move the "Save" menu entry out of "group_edit_actions", which gets hidden when switching from edit to view mode when the experimental editing feature is enabled in Android Viewer. This e.g. makes sure that the "Save" entry is offered for the following scenario (just as the "Save as" entry is as well): * ensure experimental editing feature is enabled * open existing doc * edit the document * switch back to view mode by tapping the left-most item in the editing toolbar Since the doc was modified, the "Save" entry should be present then. Explicitly hide the entry when the experimental editing feature is disabled, since that no longer happens through "group_edit_actions" now. Change-Id: Ibe7736932021d7516e2fd3a09ae9276015fe0d56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144872 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Use PNG icons instead of vector image for compatibilityMichael Weghorn
Convert the drawable resources added in commit cfc73f3373f49770b859bc68cbf6bd987342f9ad Date: Fri Dec 23 23:20:26 2022 +0100 android: Add buttons to increase/decrease indent to use PNG images (PNG export of the SVG images used previously, using Inkscape) instead of vector drawables, since devices with old API versions apparently don't support these vector drawables. Trying to open any doc in an x86 AVD with API version 16 would result in LO crashing with this exception in ADB log: E/AndroidRuntime( 2948): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.libreoffice/org.libreoffice.LibreOfficeMainActivity}: android.view.InflateException: Binary XML file line #281: Error inflating class ImageButton E/AndroidRuntime( 2948): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) E/AndroidRuntime( 2948): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) E/AndroidRuntime( 2948): at android.app.ActivityThread.access$600(ActivityThread.java:130) E/AndroidRuntime( 2948): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) E/AndroidRuntime( 2948): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 2948): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 2948): at android.app.ActivityThread.main(ActivityThread.java:4745) E/AndroidRuntime( 2948): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 2948): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 2948): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) E/AndroidRuntime( 2948): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) E/AndroidRuntime( 2948): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 2948): Caused by: android.view.InflateException: Binary XML file line #281: Error inflating class ImageButton E/AndroidRuntime( 2948): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) E/AndroidRuntime( 2948): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) E/AndroidRuntime( 2948): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195) E/AndroidRuntime( 2948): at org.libreoffice.LibreOfficeMainActivity.onCreate(LibreOfficeMainActivity.java:131) E/AndroidRuntime( 2948): at android.app.Activity.performCreate(Activity.java:5008) E/AndroidRuntime( 2948): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) E/AndroidRuntime( 2948): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) E/AndroidRuntime( 2948): ... 11 more E/AndroidRuntime( 2948): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_incrementindent.xml from drawable resource ID #0x7f0800b4 E/AndroidRuntime( 2948): at android.content.res.Resources.loadDrawable(Resources.java:1923) E/AndroidRuntime( 2948): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) E/AndroidRuntime( 2948): at android.widget.ImageView.<init>(ImageView.java:120) E/AndroidRuntime( 2948): at android.widget.ImageButton.<init>(ImageButton.java:87) E/AndroidRuntime( 2948): at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78) E/AndroidRuntime( 2948): at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:226) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:141) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1569) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1620) E/AndroidRuntime( 2948): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675) E/AndroidRuntime( 2948): ... 32 more E/AndroidRuntime( 2948): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: invalid drawable tag vector E/AndroidRuntime( 2948): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877) E/AndroidRuntime( 2948): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818) E/AndroidRuntime( 2948): at android.content.res.Resources.loadDrawable(Resources.java:1920) E/AndroidRuntime( 2948): ... 42 more W/ActivityManager( 1423): Force finishing activity org.libreoffice/.LibreOfficeMainActivity W/ActivityManager( 1423): Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity Change-Id: I3580faf5e4b1f55acdc3d32caa8a233bb09a14aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144848 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Enable multidex, update com.google.android.material to 1.7.0Michael Weghorn
Release notes: https://github.com/material-components/material-components-android/releases/tag/1.7.0 With the material update in place, multidex needs to be enabled since the app has minSdkVersion 16 (i.e. smaller than 21) and now references more then 65,536 methods, see [1] for more background. Therefore, carry out the changes to support multidex as mentioned in [2]. Without enabling multidex, the build would fail like this: > Task :mergeExtDexStrippedUIDebug FAILED ERROR:D8: Cannot fit requested classes in a single dex file (# methods: 68864 > 65536) com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:151) at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:138) at com.android.build.gradle.internal.tasks.DexMergingWorkAction.merge(DexMergingTask.kt:859) at com.android.build.gradle.internal.tasks.DexMergingWorkAction.run(DexMergingTask.kt:805) at com.android.build.gradle.internal.profile.ProfileAwareWorkAction.execute(ProfileAwareWorkAction.kt:74) at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63) at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66) at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62) at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97) at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62) at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44) at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73) at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41) at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59) at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:205) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162) at org.gradle.internal.Factories$1.create(Factories.java:31) at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:124) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [1] https://developer.android.com/studio/build/multidex [2] https://developer.android.com/studio/build/multidex#mdex-gradle Change-Id: Ie5d78a54e7f69b55586d80718c04e71526ebad6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144838 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Update compileSdkVersion/targetSdkVersion to 33Michael Weghorn
API version 33 refers to Android 13. I didn't notice anything requiring changes when quickly going over the release notes for all apps running on Android 13 [1] and apps targeting Android 13 [2]. [1] https://developer.android.com/about/versions/13/behavior-changes-all [2] https://developer.android.com/about/versions/13/behavior-changes-13 Change-Id: I8b68f3bf0afc4c00ecd3412a8fdf0581f2d6bbc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144837 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Set namespace in build.gradle instead of manifestMichael Weghorn
Switch from the now deprecated way, as mentioned in commit 7347d911fa295c31262a0f576c5b2f3f14ce017d Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Dec 23 18:29:44 2022 +0100 android: Update Android Gradle Plugin to 7.3.1 ... and gradle to 7.4. Relevant entry from the release notes [1] that will be addressed in a follow-up commit: > # Package attribute in manifest file is deprecated > > Starting with AGP 7.3.0-alpha04, if you use Gradle to build your > project, AGP generates a warning if you use the package attribute in the > manifest file. To set the namespace for your app, use the namespace > property in the module-level build.gradle file. To learn more, see Set a > namespace > [https://developer.android.com/studio/build/configure-app-module#set-namespace]. > > To get help moving to the new namespace DSL, use the AGP Upgrade > Assistant (Tools > AGP Upgrade Assistant). [1] https://developer.android.com/studio/releases/gradle-plugin#7-3-0 Change-Id: I8b196e53fb9b3fb7e9314719fdb7e0f2254abd10 Note that this is unrelated to the Android application ID [1] that can be set with autogen param `--with-android-package-name`. [1] https://developer.android.com/studio/build/configure-app-module#set-application-id Change-Id: I146dab19228d83b1beb6408743c0232e1ba1d060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144836 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Include Impress's layout.xml into appMichael Weghorn
It's needed since commit daab698b346e5e40b67f1e15c796c4e399ccaf8a Date: Tue Nov 22 14:07:12 2022 +0200 sd: replace hardcoded table styles with xml file Without it being included into the app/APK, opening any presentation in Android Viewer file would fail, with this in ADB log: 12-27 10:22:45.329 9811 9862 E libo:sal/osl/unx/file: failed to open /assets/share/config/soffice.cfg/simpress/styles.xml 12-27 10:22:45.332 9811 9862 W svl.items: 1:svl/source/items/itempool.cxx:442: old secondary pool: EditEngineItemPool of pool: XOutdevItemPool must be empty. 12-27 10:22:45.337 9811 9862 I LOKitTileProvider: ====> mOffice.documentLoad() returned null, trying to restart 'Office' and loading again Change-Id: I677476bda146be2cd3ebe18da91bcb8f2a796fd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144835 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Update Android Gradle Plugin to 7.3.1Michael Weghorn
... and gradle to 7.4. Relevant entry from the release notes [1] that will be addressed in a follow-up commit: > # Package attribute in manifest file is deprecated > > Starting with AGP 7.3.0-alpha04, if you use Gradle to build your > project, AGP generates a warning if you use the package attribute in the > manifest file. To set the namespace for your app, use the namespace > property in the module-level build.gradle file. To learn more, see Set a > namespace > [https://developer.android.com/studio/build/configure-app-module#set-namespace]. > > To get help moving to the new namespace DSL, use the AGP Upgrade > Assistant (Tools > AGP Upgrade Assistant). [1] https://developer.android.com/studio/releases/gradle-plugin#7-3-0 Change-Id: I8b196e53fb9b3fb7e9314719fdb7e0f2254abd10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144834 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-23android: Add buttons to increase/decrease indentMichael Weghorn
This adds two buttons to the formatting toolbar to increase/decrease the indent, using the corresponding UNO commands. These can be used when the experimental editing mode for Android Viewer is enabled. The drawable resources were created using the corresponding sifr_svg icons (incrementindent.svg, decrementindent.svg). Change-Id: Id8f0fc9a5ea686b474ec9a4b4dcdf23407e9ac98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144789 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-20tdf#85592 android: .uno:BackColor deprecated, use .uno:CharBackColorJustin Luth
Follow-up. I didn't want to include it in the main deprecation patch. No good reason - android is just too different and untestable by me. Change-Id: I661211aea619af256e38dc685fdd0662e5aa7272 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140284 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
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>