summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-11-30 13:16:26 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-11-30 14:40:24 +0100
commit35b7aa3a865eda90bec945ac2e11b20a75a37bd6 (patch)
tree337a3f9f248bf677b5332af82d2565f1d6d7ee0b /android
parentda82f0b5de5b5ad467a981599e4aa0680fadcdee (diff)
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 <m.weghorn@posteo.de>
Diffstat (limited to 'android')
-rw-r--r--android/Bootstrap/Makefile.shared4
-rw-r--r--android/source/src/java/org/libreoffice/AboutDialogFragment.java24
2 files changed, 12 insertions, 16 deletions
diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index 53a101074e62..c3e0257d592f 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -112,7 +112,9 @@ 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 " buildConfigField('String', 'PRIVACY_POLICY_URL', '\"$(PRIVACY_POLICY_URL)\"')" \
&& echo "}" \
) > $@
diff --git a/android/source/src/java/org/libreoffice/AboutDialogFragment.java b/android/source/src/java/org/libreoffice/AboutDialogFragment.java
index b215ab5e7601..0d9fc45856ef 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)
{