android/Bootstrap/Makefile.shared | 4 + android/source/src/java/org/libreoffice/AboutDialogFragment.java | 24 +++------- 2 files changed, 12 insertions(+), 16 deletions(-)
New commits: commit 1aa6a12f4d963b6949b6958c165c47bc059ab974 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Nov 30 13:16:26 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Jan 5 15:59:37 2024 +0100 android: Separate build ID and vendor from versionName So far, the versionName for the LibreOffice APK/app bundle included the build ID and vendor, was e.g. "24.2.0.0.alpha1+/2972af9045a5/The Document Foundation". That versionName would be split again to extract the build ID and vendor to display them in the about dialog. No longer include build ID and vendor in the `versionName`, but use separate build config variables, similar to what is done for the privacy policy. This slightly simplifies the code for the about dialog. But more importantly, the previous `versionName` scheme would make it impossible to automate the F-Droid update of the app, because the scheme is not compatible with the expectations of F-Droid's update mechanism, see the F-Droid merge request to update LibreOffice Viewer to 7.6.3 [1] for more details, in particular the (eventually not merged) commit [2] mentioning what manual steps would still be needed when trying to semi-automate the update at least. [1] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/14080 [2] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/14080/diffs?commit_id=bfc062a358dc574326a29f08e01c0e80cadd80cb Change-Id: Ibede06d13095d8e83dcc88ee09a8a610d6a9de0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160150 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit 35b7aa3a865eda90bec945ac2e11b20a75a37bd6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160154 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index d1177edc1694..73621c1c39ff 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -113,6 +113,8 @@ liboSettings.gradle: $(BUILDDIR)/config_build.mk $(BUILDDIR)/config_host.mk $(SR && echo " archivesBaseName = 'LibreOfficeViewer'" \ && echo " minSdkVersion = $(ANDROID_API_LEVEL)" \ && echo " versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : $(if $(versionCode),$(versionCode),1)" \ - && echo " versionName '$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)/$(shell cd $(SRCDIR) && git log -1 --format=%h)/$(OOO_VENDOR)'" \ + && echo " versionName '$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)'" \ + && echo " buildConfigField('String', 'BUILD_ID_SHORT', '\"$(shell cd $(SRCDIR) && git log -1 --format=%h)\"')" \ + && echo " buildConfigField('String', 'VENDOR', '\"$(OOO_VENDOR)\"')" \ && echo "}" \ ) > $@ diff --git a/android/source/src/java/org/libreoffice/AboutDialogFragment.java b/android/source/src/java/org/libreoffice/AboutDialogFragment.java index 17c636629f61..c699adb61bc6 100644 --- a/android/source/src/java/org/libreoffice/AboutDialogFragment.java +++ b/android/source/src/java/org/libreoffice/AboutDialogFragment.java @@ -45,21 +45,15 @@ public class AboutDialogFragment extends DialogFragment { { String versionName = getActivity().getPackageManager() .getPackageInfo(getActivity().getPackageName(), 0).versionName; - String[] tokens = versionName.split("/"); - if (tokens.length == 3) - { - String version = String.format(getString(R.string.app_version), tokens[0], tokens[1]); - @SuppressWarnings("deprecation") // since 24 with additional option parameter - Spanned versionString = Html.fromHtml(version); - TextView versionView = messageView.findViewById(R.id.about_version); - versionView.setText(versionString); - versionView.setMovementMethod(LinkMovementMethod.getInstance()); - TextView vendorView = messageView.findViewById(R.id.about_vendor); - String vendor = getString(R.string.app_vendor).replace("$VENDOR", tokens[2]); - vendorView.setText(vendor); - } - else - throw new PackageManager.NameNotFoundException(); + String version = String.format(getString(R.string.app_version), versionName, BuildConfig.BUILD_ID_SHORT); + @SuppressWarnings("deprecation") // since 24 with additional option parameter + Spanned versionString = Html.fromHtml(version); + TextView versionView = messageView.findViewById(R.id.about_version); + versionView.setText(versionString); + versionView.setMovementMethod(LinkMovementMethod.getInstance()); + TextView vendorView = messageView.findViewById(R.id.about_vendor); + String vendor = getString(R.string.app_vendor).replace("$VENDOR", BuildConfig.VENDOR); + vendorView.setText(vendor); } catch (PackageManager.NameNotFoundException e) {
