[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 26528 - Don't allow Fennec to use UpdateService when installed through the app store
commit 1388fbe6fd988603cbfe10eec92f9f9be578a18c
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 | 2 +-
.../base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java | 2 +-
.../geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java | 5 +++--
3 files changed, 5 insertions(+), 4 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 3675afa9c052..1042a7c2c990 100644
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -663,7 +663,7 @@ public class GeckoPreferences
pref.setOnPreferenceChangeListener(this);
if (PREFS_UPDATER_AUTODOWNLOAD.equals(key)) {
- if (!AppConstants.MOZ_UPDATER || ContextUtils.isInstalledFromGooglePlay(this)) {
+ 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 c4d198ae735f..c63fad412b00 100644
--- a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java
@@ -133,7 +133,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 0228e144fd89..9a793d3c1e8b 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
@@ -13,6 +13,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() {}
@@ -37,13 +38,13 @@ 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);
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits