android/Bootstrap/Makefile.shared                                |    6 +-
 android/source/src/java/org/libreoffice/AboutDialogFragment.java |   24 
+++-------
 2 files changed, 13 insertions(+), 17 deletions(-)

New commits:
commit 35b7aa3a865eda90bec945ac2e11b20a75a37bd6
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 30 13:16:26 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 14:40:24 2023 +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 <m.wegh...@posteo.de>

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)
         {
commit da82f0b5de5b5ad467a981599e4aa0680fadcdee
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 30 13:16:09 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 14:40:17 2023 +0100

    android: Drop trailing whitespace in Makefile
    
    Change-Id: Ic68471bbbc18e5fa0a66dbf57e3e7156ef824e50
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160149
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/android/Bootstrap/Makefile.shared 
b/android/Bootstrap/Makefile.shared
index ee1908799ce5..53a101074e62 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -67,7 +67,7 @@ $(SODEST)/liblo-native-code.so : 
$(OBJLOCAL)/liblo-native-code.so
        $(STRIP) -o $(SODEST)/liblo-native-code.so 
$(OBJLOCAL)/liblo-native-code.so
        #to keep some symbols, eg.: $(STRIP) -o $(SODEST)/liblo-native-code.so 
$(OBJLOCAL)/liblo-native-code.so -w -K 'Java*'
 
-$(SODEST)/nss-libraries : 
+$(SODEST)/nss-libraries :
        mkdir -p $(SODEST)
        $(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so 
$(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
 

Reply via email to