[tbb-commits] [tor-browser/tor-browser-60.3.0esr-8.5-1] Bug 28640: Reload distribution preferences when a new version of the app is installed

gk at torproject.org gk at torproject.org
Fri Nov 30 07:21:03 UTC 2018


commit 20f13426dec48e7b3b1df2cbd6cc41b3432fa267
Author: Matthew Finkel <Matthew.Finkel at gmail.com>
Date:   Thu Nov 29 20:33:14 2018 +0000

    Bug 28640: Reload distribution preferences when a new version of the app is installed
---
 .../base/java/org/mozilla/gecko/distribution/Distribution.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
index ea9534bfd741..93c325e451bd 100644
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
+++ b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
@@ -43,7 +43,9 @@ import org.mozilla.gecko.EventDispatcher;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoApplication;
 import org.mozilla.gecko.GeckoSharedPrefs;
+import org.mozilla.gecko.preferences.DistroSharedPrefsImport;
 import org.mozilla.gecko.Telemetry;
+import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.util.FileUtils;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.HardwareUtils;
@@ -246,6 +248,7 @@ public class Distribution {
                         final String preferencesJSON = FileUtils.readStringFromFile(descFile);
                         data = new GeckoBundle(1);
                         data.putString("preferences", preferencesJSON);
+                        DistroSharedPrefsImport.importPreferences(distribution.context, distribution);
 
                     } catch (IOException e) {
                         Log.e(LOGTAG, "Error getting distribution descriptor file.", e);
@@ -498,6 +501,13 @@ public class Distribution {
 
         // We've done the work once; don't do it again.
         if (this.state == STATE_SET) {
+            // If this is a new version of the app, then copy the
+            // distribution files from the APK
+            if (!AppConstants.MOZ_APP_BUILDID.equals(settings.getString(GeckoPreferences.PREFS_APP_UPDATE_LAST_BUILD_ID, null))) {
+                Log.i(LOGTAG, "Copying APK distribution file because the build ID changed.");
+                copyAndCheckAPKDistribution();
+            }
+
             // Note that we don't compute the distribution directory.
             // Call `ensureDistributionDir` if you need it.
             runReadyQueue();





More information about the tbb-commits mailing list