[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-68.1.0esr-9.0-1] Bug 26528 - Don't allow Fennec to use UpdateService when installed through the app store



commit 0f0feb2c29527d262bec46e0c02f8c3b0b72839f
Author: Igor Oliveira <igt0@xxxxxxxxxxxxxx>
Date:   Wed Jun 27 12:12:22 2018 -0300

    Bug 26528 - Don't allow Fennec to use UpdateService when installed through the app store
    
    App stores such as Google Play or F-Droid have their own update service.
    
    The Fennec UpdateService should be used just when the user installs it
    by themselves.
---
 .../base/java/org/mozilla/gecko/preferences/GeckoPreferences.java    | 4 ++--
 .../base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java     | 2 +-
 .../geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
index 3b9227e52e37..cd4a7ec48e1d 100644
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -698,8 +698,8 @@ public class GeckoPreferences
                         i--;
                         continue;
                     }
-                } else  if (PREFS_UPDATER_AUTODOWNLOAD.equals(key)) {
-                    if (!AppConstants.MOZ_UPDATER || ContextUtils.isInstalledFromGooglePlay(this)) {
+                } else if (PREFS_UPDATER_AUTODOWNLOAD.equals(key)) {
+                    if (!AppConstants.MOZ_UPDATER || ContextUtils.isInstalledFromAppStore(this)) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
diff --git a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java
index df66c914769d..4ea0b6c74f55 100644
--- a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java
@@ -212,7 +212,7 @@ public class UpdateServiceHelper {
     }
 
     public static boolean isUpdaterEnabled(final Context context) {
-        return AppConstants.MOZ_UPDATER && isEnabled && !ContextUtils.isInstalledFromGooglePlay(context);
+        return AppConstants.MOZ_UPDATER && isEnabled && !ContextUtils.isInstalledFromAppStore(context);
     }
 
     public static void setUpdateUrl(Context context, String url) {
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java
index 4fb88ea41574..248763761378 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java
@@ -17,6 +17,7 @@ import android.text.TextUtils;
 
 public class ContextUtils {
     private static final String INSTALLER_GOOGLE_PLAY = "com.android.vending";
+    private static final String INSTALLER_FDROID = "org.fdroid.fdroid";
 
     private ContextUtils() {}
 
@@ -41,14 +42,14 @@ public class ContextUtils {
         }
     }
 
-    public static boolean isInstalledFromGooglePlay(final Context context) {
+    public static boolean isInstalledFromAppStore(final Context context) {
         final String installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
 
         if (TextUtils.isEmpty(installerPackageName)) {
             return false;
         }
 
-        return INSTALLER_GOOGLE_PLAY.equals(installerPackageName);
+        return INSTALLER_GOOGLE_PLAY.equals(installerPackageName) || INSTALLER_FDROID.equals(installerPackageName);
     }
 
     public static boolean isApplicationDebuggable(final @NonNull Context context) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits