Addresses this warning/suggestion shown in Android Studio:
> Field 'LOGTAG' may be 'final'
And: Drop an unused import.
Change-Id: I6ce730a80690c2701a91cc7900cc801b370dc605
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170714
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Makes this warning/suggestion disappear in Android Studio:
> Field can be converted to a local variable
Change-Id: I710cd83c19fe1f83b756b035f05560974b349d22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170709
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Port from deprecated Gradle API that is planned to
be removed in Gradle 9.0, as was warned about in the
build output previously:
> Configure project :
Script '/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle': line 22
The org.gradle.api.plugins.BasePluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#base_convention_deprecation
at liboSettings_bbauwf0uak693a4tmdwwty192$_run_closure3.doCall$original(/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle:22)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
at liboSettings_bbauwf0uak693a4tmdwwty192.run(/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle:20)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
Script '/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle': line 22
The BasePluginExtension.archivesBaseName property has been deprecated. This is scheduled to be removed in Gradle 9.0. Please use the archivesName property instead. For more information, please refer to https://docs.gradle.org/8.7/dsl/org.gradle.api.plugins.BasePluginExtension.html#org.gradle.api.plugins.BasePluginExtension:archivesName in the Gradle documentation.
at liboSettings_bbauwf0uak693a4tmdwwty192$_run_closure3.doCall$original(/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle:22)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
As described in the upgrading guide [1], use the "base"
configuration block in build.gradle instead.
[1] https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#base_convention_deprecation
Change-Id: I358569a72b508efd31d2872d5009ac4f060398d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170610
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Set the gradle property to show individual warnings during the
build. Without this, the build output showed:
> Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
>
> You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
>
> For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
Now, it shows the individual issues that need to be addressed:
> > Configure project :
> Script '/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle': line 22
> The org.gradle.api.plugins.BasePluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#base_convention_deprecation
> at liboSettings_bbauwf0uak693a4tmdwwty192$_run_closure3.doCall$original(/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle:22)
> (Run with --stacktrace to get the full stack trace of this deprecation warning.)
> at liboSettings_bbauwf0uak693a4tmdwwty192.run(/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle:20)
> (Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Script '/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle': line 22
> The BasePluginExtension.archivesBaseName property has been deprecated. This is scheduled to be removed in Gradle 9.0. Please use the archivesName property instead. For more information, please refer to https://docs.gradle.org/8.7/dsl/org.gradle.api.plugins.BasePluginExtension.html#org.gradle.api.plugins.BasePluginExtension:archivesName in the Gradle documentation.
> at liboSettings_bbauwf0uak693a4tmdwwty192$_run_closure3.doCall$original(/home/michi/development/git/libreoffice-WORKTREE-android/android/source/liboSettings.gradle:22)
> (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Actually addressing them still needs to be done separately.
Change-Id: Ib749e9e21d3d5f5893c348a5070a1e994a395c6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170609
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
In Android Viewer, forward the left/right/up/down keys
as such by adding the corresponding mapping to
`LOKitTileProvider#getKeyCode`.
This allows navigating through the document using those
keys e.g. on a hardware keyboard.
This addresses this comment from a Google Play Review:
> Editing, the cursor doesn't respond to the cursor keys
Change-Id: I688e5d0cc1db4f9315f9c9cb2139c22117a210e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170605
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Even with
commit 69189de8fa9a9d4973a4304a82780d32e79fbe6f
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Thu May 16 09:26:44 2024 +0200
tdf#157009 android: Add icon symlink for F-Droid
(and its 24-2 backport) in place, the icon is not shown
for LibreOffice Viewer in the F-Droid app and on the repo
website [1].
Revisiting the related specs [2] [3], it turns out
that the icon needs to be in an "icon" subdir in the
"graphics" directory, so add that missing "icon" subdir
and move the symlink there.
From [2]:
> └── listings
> ├── en-US (en-US is the default locale in F-Droid)
> │ ├── title.txt (app name)
> │ ├── short-description.txt (short description, max 80 chars, mandatory)
> │ ├── full-description.txt (full app description, mandatory)
> │ ├── video-url.txt (URL to a video introducing the app)
> │ ├── whatsnew (alternative changelog location; single file, no .txt)
> │ └── graphics
> │ ├── icon (app icon; mandatory if your app doesn't include any png icon)
> │ │ └── *.(png|jpg) 1 image, usually 512x512
[1] https://f-droid.org/en/packages/org.documentfoundation.libreoffice/
[2] https://f-droid.org/en/docs/All_About_Descriptions_Graphics_and_Screenshots/#triple-t-structure
[3] https://github.com/Triple-T/gradle-play-publisher?tab=readme-ov-file#uploading-graphic-based-listings
Change-Id: I43c23040bf63a34f8f9648b45fab6c47a8816b8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169700
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
For Android Viewer, set the "compact_fonts" LibreOfficeKit
option via environment variable `SAL_LOK_OPTIONS` introduced in
Change-Id: I3dc9f5de876def6e4afc09a43105b1740f7c621f
Author: Michael Meeks <michael.meeks@collabora.com>
Date: Fri May 17 21:25:29 2024 +0100
lok: stop amazing waste of repeated font sizes in each font element.
and adjust the handling in `FontController` to process
the flat lists for font names and sizes that is reported
with that options set, rather than processing
font sizes for each individual font.
(See also discussion in original Gerrit change
for the distro/collabora/co-24.04 branch: [1].).
[1] https://gerrit.libreoffice.org/c/core/+/167799
Change-Id: I85734c1876d152f4f95f9182629affd6b250fdbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167963
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Change-Id: I4058a4698582256a31ebb21379c0a66b22e2a1cc
android-viewer translated using Weblate
Japanese currently translated at 65.5% (76 of 116 strings)
Change-Id: I74e48d5d605e25ebf39e2a8bd73495274ee94855
Added translation for android-viewer using Weblate (Hebrew)
Change-Id: I491b69291975d22c0552cc20e93f2042cc70e4b0
Update translation files for android-viewer
Updated by "Cleanup translation files" hook in Weblate.
Change-Id: Iea28e4d8bf859accdb1c16bb4c6836237a4d2b26
android-viewer translated using Weblate
Japanese currently translated at 61.0% (72 of 118 strings)
Change-Id: I741c23b1048d4857605d73aad34668c29234dd6f
android-viewer translated using Weblate
Catalan currently translated at 100.0% (118 of 118 strings)
Change-Id: I9cbcf579a5c634adf0686e43aa4dca069c2dd577
Added translation for android-viewer using Weblate (Esperanto)
Change-Id: Ibcf6e82a860c5e789d6ee89dace30d1457a60c22
android-viewer translated using Weblate
Japanese currently translated at 39.8% (47 of 118 strings)
Change-Id: I9efdbae451a5313cb5b8ef4a1abca6969696969b
Co-authored-by: Adolfo Jayme Barrientos <fito@libreoffice.org>
Co-authored-by: Ekaterine Papava <papava.e@gtu.ge>
Co-authored-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
Co-authored-by: Weblate <noreply@documentfoundation.org>
Co-authored-by: Yaron Shahrabani <sh.yaron@gmail.com>
Translate-URL: https://translations.documentfoundation.org/projects/android-viewer/android-strings/
Translate-URL: https://translations.documentfoundation.org/projects/android-viewer/android-strings/ca/
Translate-URL: https://translations.documentfoundation.org/projects/android-viewer/android-strings/ja/
Translation: android-viewer/android-strings
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167895
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
multidex was enabled in
commit 037680488b56aa2c4eb21900168aa88ef35d5b07
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Dec 27 12:51:54 2022 +0100
android: Enable multidex, update com.google.android.material to 1.7.0
as it was needed when building for minSdkVersion <= 20, see [1]
and the full commit message of the above-mentioned commit
for more details.
However, since
commit c2fc2c8c7c63ca4e43bca6e8c9b82c50418422d2
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Dec 5 09:57:22 2023 +0100
android: Bump minSdkVersion to 21 (Android 5.0)
, the minSdkVersion is greater than that, so this
is no longer needed.
[1] https://developer.android.com/build/multidex
Change-Id: I31502ec74e9c4201a8a11be42820f70e5fd5a1fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167735
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Some of the issues have been addressed in
the meanwhile, so regenerate the file to
reflect that.
Change-Id: I5c0f8a112cf02a89fe652c79ed8d70213f6fbc1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167725
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
When the experimental editing mode preference
was toggled, it was processed twice:
Toggling that pref requires starting the
`SettingsActivity`, and when returning to
`LibreOfficeMainActivity`, its `onResume` method
was called which updates `mIsExperimentalMode` as needed.
In addition, the `LibreOfficeMainActivity#onSharedPreferenceChanged`
callback was called that also processed that preference.
The latter is more "targeted" and only called when a preference
actually changes.
Call `updatePreferences()` from there so other preferences
are also handled and drop the call to `updatePreferences`
from the `onResume` method, which is no longer needed
with that in place.
Change-Id: Ic0cacd8ad551137d5aea14cda6838d2ac50de8db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167724
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Let `LibreOfficeMainActivity` implement the standard
Android `SharedPreferences.OnSharedPreferenceChangeListener`
interface directly, rather than having a custom
`SettingsListenerModel.OnSettingsPreferenceChangedListener`
indirection and the `SettingsFragment` implementing the
standard interface.
This simplifies the code and removes one level of
indirection.
Drop the now unused `SettingsListenerModel`.
Change-Id: I8c7d6088e711631409f9189bba966439db3daa44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167723
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Use a `mbReadOnlyDoc` member that keeps
track of the readonly status of the document only
instead of a `mbISReadOnlyMode` that at the same
time also was taking into account whether experimental
editing features were enabled.
Let `LibreOfficeMainActivity#isReadOnlyMode()` take
experimental status into account instead.
With this in place, opening a (writable) document
with experimental editing mode disabled, then enabling
experimental editing mode makes editing possible after
clicking on the LibreOffice logo in the toolbar.
Previously, it was necessary to open the document
anew.
Change-Id: Ia5fde9b6019251d76d46df97fad2ffd64a0f5a30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167721
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Drop the possibility to manually set a UI language
introduced in
commit f2e35a695671028b32139df1824ff536e7610d35
Author: Mert Tumer <merttumer@outlook.com>
Date: Tue Sep 18 23:29:57 2018 +0300
Added language support on Android Viewer
Since
commit 5bf2ec9ed8728a2042e110122ea2b0e4ff55104a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Fri Dec 20 10:40:34 2019 +0100
android: Use system locale by default
, Android Viewer defaulted to the system
language for its UI language as well.
In addition, current Android versions allow to set
a specific language for apps: [1]
The previous approach of manually setting a language
in Android Viewer shouldn't really be necessary any more.
With the app now being available for translation on
Weblate and having been translated to more languages,
the list of available languages had become out of sync.
Additionally, the manually selected language wasn't
consistently applied everywhere:
* On the start activity where a document can be selected,
it was only applied after closing the app, then opening
it again.
* in the Settings, the language was not applied at all,
that was always using the system locale anyway
Changes to the system locale are applied immediately
and consistently, so stick to the default Android mechanism
and reduce the overall complexity and maintenance burden.
[1] https://support.google.com/android/answer/12395118?hl=en
Change-Id: Ida61650b888a563f2346ea94a14b260802b1d24d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167718
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
API used in `SettingsActivity` and `SettingsFragment` has
been deprecated, e.g. `PreferenceFragment` was deprecated in
API level 28 [1].
Port that to non-deprecated API from the androidx.preference
library [2].
This addresses these deprecation warnings:
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:14: warning: [deprecation] PreferenceFragment in android.preference has been deprecated
import android.preference.PreferenceFragment;
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:15: warning: [deprecation] PreferenceGroup in android.preference has been deprecated
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:23: warning: [deprecation] getFragmentManager() in Activity has been deprecated
getFragmentManager().beginTransaction()
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:23: warning: [deprecation] beginTransaction() in FragmentManager has been deprecated
getFragmentManager().beginTransaction()
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:24: warning: [deprecation] replace(int,Fragment) in FragmentTransaction has been deprecated
.replace(android.R.id.content, new SettingsFragment())
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:25: warning: [deprecation] commit() in FragmentTransaction has been deprecated
.commit();
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:28: warning: [deprecation] PreferenceFragment in android.preference has been deprecated
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:28: warning: [deprecation] PreferenceFragment() in PreferenceFragment has been deprecated
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:30: warning: [deprecation] onCreate(Bundle) in PreferenceFragment has been deprecated
public void onCreate(Bundle savedInstanceState) {
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:31: warning: [deprecation] onCreate(Bundle) in PreferenceFragment has been deprecated
super.onCreate(savedInstanceState);
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:32: warning: [deprecation] addPreferencesFromResource(int) in PreferenceFragment has been deprecated
addPreferencesFromResource(R.xml.libreoffice_preferences);
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:34: warning: [deprecation] PreferenceGroup in android.preference has been deprecated
PreferenceGroup generalGroup = (PreferenceGroup) findPreference("PREF_CATEGORY_GENERAL");
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:34: warning: [deprecation] PreferenceGroup in android.preference has been deprecated
PreferenceGroup generalGroup = (PreferenceGroup) findPreference("PREF_CATEGORY_GENERAL");
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:34: warning: [deprecation] findPreference(CharSequence) in PreferenceFragment has been deprecated
PreferenceGroup generalGroup = (PreferenceGroup) findPreference("PREF_CATEGORY_GENERAL");
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:35: warning: [deprecation] findPreference(CharSequence) in PreferenceGroup has been deprecated
generalGroup.removePreference(generalGroup.findPreference("ENABLE_EXPERIMENTAL"));
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:35: warning: [deprecation] removePreference(Preference) in PreferenceGroup has been deprecated
generalGroup.removePreference(generalGroup.findPreference("ENABLE_EXPERIMENTAL"));
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:36: warning: [deprecation] findPreference(CharSequence) in PreferenceGroup has been deprecated
generalGroup.removePreference(generalGroup.findPreference("ENABLE_DEVELOPER"));
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:36: warning: [deprecation] removePreference(Preference) in PreferenceGroup has been deprecated
generalGroup.removePreference(generalGroup.findPreference("ENABLE_DEVELOPER"));
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:41: warning: [deprecation] onResume() in Fragment has been deprecated
public void onResume() {
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:42: warning: [deprecation] onResume() in Fragment has been deprecated
super.onResume();
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:43: warning: [deprecation] getPreferenceScreen() in PreferenceFragment has been deprecated
getPreferenceScreen().getSharedPreferences()
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:43: warning: [deprecation] getSharedPreferences() in Preference has been deprecated
getPreferenceScreen().getSharedPreferences()
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:48: warning: [deprecation] onPause() in Fragment has been deprecated
public void onPause() {
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:49: warning: [deprecation] onPause() in Fragment has been deprecated
super.onPause();
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:50: warning: [deprecation] getPreferenceScreen() in PreferenceFragment has been deprecated
getPreferenceScreen().getSharedPreferences()
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:50: warning: [deprecation] getSharedPreferences() in Preference has been deprecated
getPreferenceScreen().getSharedPreferences()
^
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/SettingsActivity.java:58: warning: [deprecation] getActivity() in Fragment has been deprecated
[1] https://developer.android.com/reference/android/preference/PreferenceFragment
[2] https://developer.android.com/reference/androidx/preference/package-summary
Change-Id: I3365a487345787056c91fa7addf987edca38e94f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167717
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
The `android.preference.PreferenceManager` class was
deprecated in API level 29 [1].
Port to `androidx.preference.PreferenceManager` from
the AndroidX Preference library instead.
All that needs to be done for this is to add the new library
dependency and adjust the import, no further code changes
needed for this step. (There are uses of more deprecated
preferences-related classes, though. Those will have to be
dealt with separately.)
This addresses depreaction warnings like
> Task :compileStrippedUIEditingDebugJavaWithJavac
/home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java:16: warning: [deprecation] PreferenceManager in android.preference has been deprecated
import android.preference.PreferenceManager;
^
[1] https://developer.android.com/reference/android/preference/PreferenceManager
Change-Id: Ied168ffbd0591d69e0797e2a0a5bab067e133d22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167716
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
At least on recent devices (seen e.g. on an AVD
with API level 34 and a Fairphone 3 with LineageOS 20
(based on Android 13)), inserting a picture by
taking a photo using the camera didn't work,
"nothing was happening" when choosing the corresponding
option from the formatting toolbar with experimental
editing mode enabled.
This is due to the system filtering information about
other apps/packages with target API level >= 30 for
privacy reasons, see [1] for more details.
As described at [2], requesting the `CAMERA`
permission is not required:
> Users might take pictures in your app, using the pre-installed
> system camera app.
>
> In this situation, don't declare the CAMERA permission. Instead,
> invoke the ACTION_IMAGE_CAPTURE intent action.
In fact, specifying the permission is even counter-productive
and would cause this to not work, as also described at [2]:
> Note: If your app declares Manifest.permission.CAMERA
> permission and is not granted, then the action results in
> a SecurityException.
Rather than explicitly requesting the permission, just
drop it from the AndroidManifest, as it's not needed.
Also drop the additional code interacting with the package
manager, as that doesn't work with newer API
versions as described above.
With these changes in place, inserting a photo works fine
in tests in API 21 and API 34 AVDs and on the
above-mentioned Fairphone 3.
[1] https://developer.android.com/training/package-visibility
[2] https://developer.android.com/privacy-and-security/minimize-permission-requests#take-photo
Change-Id: Ia1ee4e4de577a269e2b79bf5460d08b1bf2bee56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167603
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Check for `FEATURE_CAMERA_ANY` ("The device has at least
one camera pointing in some direction, or can support an
external camera being connected to it.") [1] instead
of only the rear camera via `FEATURE_CAMERA`
("The device has a camera facing away from the screen.") [2]
when taking a photo is selected in the "Insert" menu, as
there's no need to restrict this to the rear camera.
This addresses this warning shown in Android Studio:
> You should look for any camera available on the device, not just the rear
Note however that trying to use that feature (with or
without this change in place) currently doesn't actually
work at least on a current device (e.g. an API 34 AVD),
"nothing happens" rather than the camera showing up to
be able to take a photo. This will be addressed
in an upcoming commit.
[1] https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_CAMERA_ANY
[2] https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_CAMERA
Change-Id: I52d2147df8fb3f1fdfb277376d7796380f9a8da0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167602
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
... and gradle to 8.6, as suggested by Android Studio.
Update the lint baseline file to initially ignore
new warnings that the new version reports.
These can be handled separately.
Change-Id: I6ecd7300072c16ea583b5ba19b03de89d671b87e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167586
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>