lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Threads by month
  • ----- 2026 -----
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

  • 1 participants
  • 20633 discussions
[tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 1455165 - Filter external apps out if needed. r=mcomella
by gk@torproject.org 30 Jul '18

30 Jul '18
commit 3d30d5d1f2ebbdf60af0180af435afad4ba7e773 Author: Igor Oliveira <igt0(a)torproject.org> Date: Wed Apr 18 17:16:00 2018 +0300 Bug 1455165 - Filter external apps out if needed. r=mcomella --- mobile/android/chrome/content/browser.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 5f49c07a5ca5..2dc973a15ee7 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -6235,6 +6235,10 @@ var ExternalApps = { filter: { matches: function(aElement) { + if (!Services.prefs.getBoolPref("network.protocol-handler.external-default")) { + return false; + } + let uri = ExternalApps._getMediaLink(aElement); let apps = []; if (uri) {
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 1459420 - HLS Player doesn't use the centralized Proxy Selector r=mcomella GeckoHlsPlayer uses the default http ExoPlayer handler, called DefaultHttpDataSource. It uses URL::openConnection instead of the Firefox ProxySelector.
by gk@torproject.org 30 Jul '18

30 Jul '18
commit 7aeef47671133760672f881b38117cb4070f32b3 Author: Igor Oliveira <igt0(a)torproject.org> Date: Mon Jun 4 05:15:00 2018 +0300 Bug 1459420 - HLS Player doesn't use the centralized Proxy Selector r=mcomella GeckoHlsPlayer uses the default http ExoPlayer handler, called DefaultHttpDataSource. It uses URL::openConnection instead of the Firefox ProxySelector. This patch updates the ExoPlayer DefaultHttpDataSource to use the ProxySelector. --- .../exoplayer2/upstream/DefaultHttpDataSource.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mobile/android/geckoview/src/thirdparty/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java b/mobile/android/geckoview/src/thirdparty/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java index 599cdddeb91f..75e1f675c5eb 100644 --- a/mobile/android/geckoview/src/thirdparty/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java +++ b/mobile/android/geckoview/src/thirdparty/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.ProtocolException; +import java.net.URISyntaxException; import java.net.URL; import java.util.List; import java.util.Map; @@ -38,6 +39,8 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.mozilla.gecko.util.ProxySelector; + /** * An {@link HttpDataSource} that uses Android's {@link HttpURLConnection}. * <p> @@ -193,6 +196,8 @@ public class DefaultHttpDataSource implements HttpDataSource { } catch (IOException e) { throw new HttpDataSourceException("Unable to connect to " + dataSpec.uri.toString(), e, dataSpec, HttpDataSourceException.TYPE_OPEN); + } catch (URISyntaxException e) { + throw new HttpDataSourceException("URI invalid: " + dataSpec.uri.toString(), dataSpec, HttpDataSourceException.TYPE_OPEN); } int responseCode; @@ -337,7 +342,7 @@ public class DefaultHttpDataSource implements HttpDataSource { /** * Establishes a connection, following redirects to do so where permitted. */ - private HttpURLConnection makeConnection(DataSpec dataSpec) throws IOException { + private HttpURLConnection makeConnection(DataSpec dataSpec) throws IOException, URISyntaxException { URL url = new URL(dataSpec.uri.toString()); byte[] postBody = dataSpec.postBody; long position = dataSpec.position; @@ -389,8 +394,14 @@ public class DefaultHttpDataSource implements HttpDataSource { * @param followRedirects Whether to follow redirects. */ private HttpURLConnection makeConnection(URL url, byte[] postBody, long position, - long length, boolean allowGzip, boolean followRedirects) throws IOException { - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + long length, boolean allowGzip, boolean followRedirects) throws IOException, URISyntaxException { + /** + * Tor Project modified the way the connection object was created. For the sake of + * simplicity, instead of duplicating the whole file we changed the connection object + * to use the ProxySelector. + */ + HttpURLConnection connection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(url.toURI()); + connection.setConnectTimeout(connectTimeoutMillis); connection.setReadTimeout(readTimeoutMillis); if (defaultRequestProperties != null) {
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 1474306 - Fix typo in the extension optionsType handler. r=Mossop
by gk@torproject.org 30 Jul '18

30 Jul '18
commit 63bb7813511ad99ecbbbc7f0fb610718847ff108 Author: Igor Oliveira <igt0(a)torproject.org> Date: Mon Jul 9 07:24:00 2018 +0300 Bug 1474306 - Fix typo in the extension optionsType handler. r=Mossop AddonManager.OPTIONS_INLINE_BROWSER was replaced by AddonManager.OPTIONS_TYPE_INLINE_BROWSER. --- toolkit/mozapps/extensions/internal/XPIInstall.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/mozapps/extensions/internal/XPIInstall.jsm b/toolkit/mozapps/extensions/internal/XPIInstall.jsm index 2fc1d7edbe80..659d97616dc6 100644 --- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm +++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm @@ -560,7 +560,7 @@ async function loadManifestFromRDF(aUri, aStream) { addon.hasEmbeddedWebExtension = getRDFProperty(ds, root, "hasEmbeddedWebExtension") == "true"; if (addon.optionsType && - addon.optionsType != AddonManager.OPTIONS_INLINE_BROWSER && + addon.optionsType != AddonManager.OPTIONS_TYPE_INLINE_BROWSER && addon.optionsType != AddonManager.OPTIONS_TYPE_TAB) { throw new Error("Install manifest specifies unknown optionsType: " + addon.optionsType); }
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 1459089 - Don't use OS Locale when resistFingerprinting is enabled. When the OS Locale is used, it leaks the OS language in the HTTP Accept-Language header. r=mcomella
by gk@torproject.org 30 Jul '18

30 Jul '18
commit d352f450f3edd120df9b7ab973db45069ef22bb2 Author: Igor Oliveira <igt0(a)torproject.org> Date: Thu May 3 18:28:00 2018 +0300 Bug 1459089 - Don't use OS Locale when resistFingerprinting is enabled. When the OS Locale is used, it leaks the OS language in the HTTP Accept-Language header. r=mcomella --HG-- extra : rebase_source : 7b0dc69be25c5076696a6bd9db7611cd5b0abbad --- mobile/android/chrome/content/browser.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 2dc973a15ee7..d081fde9b20e 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -2147,6 +2147,13 @@ var BrowserApp = { appLocale = appLocale.toLowerCase(); } + try { + const resistFingerprinting = Services.prefs.getBoolPref("privacy.resistFingerprinting"); + if (resistFingerprinting) { + osLocale = null; + } + } catch (e) {} + if (osLocale) { osLocale = osLocale.toLowerCase(); }
1 0
0 0
[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
by gk@torproject.org 27 Jul '18

27 Jul '18
commit 1388fbe6fd988603cbfe10eec92f9f9be578a18c Author: Igor Oliveira <igt0(a)torproject.org> 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); } }
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Orfox: Centralized proxy applied to AbstractCommunicator and BaseResources.
by gk@torproject.org 27 Jul '18

27 Jul '18
commit ebc4951c6b23a345c1cf6d99fd4be2b2a6a22e78 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Fri Jun 12 02:07:45 2015 -0400 Orfox: Centralized proxy applied to AbstractCommunicator and BaseResources. See Bug 1357997 for partial uplift. --- .../java/org/mozilla/gecko/util/ProxySelector.java | 25 +++++++++++++++++++++- .../org/mozilla/gecko/sync/net/BaseResource.java | 7 ++++++ .../service/utils/AbstractCommunicator.java | 11 +++++++--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java index 35010242b22d..f05716fe1d09 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java @@ -29,6 +29,10 @@ import java.net.URLConnection; import java.util.List; public class ProxySelector { + private static final String TOR_PROXY_ADDRESS = "127.0.0.1"; + private static final int TOR_SOCKS_PROXY_PORT = 9050; + private static final int TOR_HTTP_PROXY_PORT = 8118; + public static URLConnection openConnectionWithProxy(URI uri) throws IOException { java.net.ProxySelector ps = java.net.ProxySelector.getDefault(); Proxy proxy = Proxy.NO_PROXY; @@ -39,7 +43,26 @@ public class ProxySelector { } } - return uri.toURL().openConnection(proxy); + /* Ignore the proxy we found from the VM, only use Tor. We can probably + * safely use the logic in this class in the future. */ + return uri.toURL().openConnection(getProxy()); + } + + public static Proxy getProxy() { + // TODO make configurable + return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(TOR_PROXY_ADDRESS, TOR_SOCKS_PROXY_PORT)); + } + + public static String getProxyHostAddress() { + return TOR_PROXY_ADDRESS; + } + + public static int getSocksProxyPort() { + return TOR_SOCKS_PROXY_PORT; + } + + public static int getHttpProxyPort() { + return TOR_HTTP_PROXY_PORT; } public ProxySelector() { diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java index 6abe5efc9cb5..48d51be8b42d 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java @@ -23,9 +23,11 @@ import org.json.simple.JSONObject; import org.mozilla.gecko.background.common.GlobalConstants; import org.mozilla.gecko.background.common.log.Logger; import org.mozilla.gecko.sync.ExtendedJSONObject; +import org.mozilla.gecko.util.ProxySelector; import ch.boye.httpclientandroidlib.Header; import ch.boye.httpclientandroidlib.HttpEntity; +import ch.boye.httpclientandroidlib.HttpHost; import ch.boye.httpclientandroidlib.HttpResponse; import ch.boye.httpclientandroidlib.HttpVersion; import ch.boye.httpclientandroidlib.client.AuthCache; @@ -40,6 +42,7 @@ import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase; import ch.boye.httpclientandroidlib.client.methods.HttpUriRequest; import ch.boye.httpclientandroidlib.client.protocol.ClientContext; import ch.boye.httpclientandroidlib.conn.ClientConnectionManager; +import ch.boye.httpclientandroidlib.conn.params.ConnRoutePNames; import ch.boye.httpclientandroidlib.conn.scheme.PlainSocketFactory; import ch.boye.httpclientandroidlib.conn.scheme.Scheme; import ch.boye.httpclientandroidlib.conn.scheme.SchemeRegistry; @@ -215,6 +218,10 @@ public class BaseResource implements Resource { // We could reuse these client instances, except that we mess around // with their parameters… so we'd need a pool of some kind. client = new DefaultHttpClient(getConnectionManager()); + /* TBA: We need a HTTP Proxy here */ + HttpHost defaultProxy = new HttpHost(ProxySelector.getProxyHostAddress(), + ProxySelector.getHttpProxyPort()); + client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, defaultProxy); // TODO: Eventually we should use Apache HttpAsyncClient. It's not out of alpha yet. // Until then, we synchronously make the request, then invoke our delegate's callback. diff --git a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java index 4e30cb7deeb7..9b3ee98f89db 100644 --- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java +++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java @@ -7,6 +7,7 @@ package org.mozilla.mozstumbler.service.utils; import android.os.Build; import android.util.Log; +import org.mozilla.gecko.util.ProxySelector; import org.mozilla.mozstumbler.service.AppGlobals; import org.mozilla.mozstumbler.service.Prefs; @@ -16,7 +17,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; public abstract class AbstractCommunicator { @@ -72,8 +73,12 @@ public abstract class AbstractCommunicator { if (sMozApiKey == null || prefs != null) { sMozApiKey = prefs.getMozApiKey(); } - URL url = new URL(getUrlString() + "?key=" + sMozApiKey); - mHttpURLConnection = (HttpURLConnection) url.openConnection(); + + /* TBA: This was a URL, but the connection logic would simply + * convert the URL into a URI, and then later convert the URI back + * into a URL. Creating a URL at the beginning is only wasteful. */ + URI uri = new URI(getUrlString() + "?key=" + sMozApiKey); + mHttpURLConnection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(uri); mHttpURLConnection.setRequestMethod("POST"); } catch (MalformedURLException e) { throw new IllegalArgumentException(e);
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Orfox: add BroadcastReceiver to receive Tor status from Orbot
by gk@torproject.org 27 Jul '18

27 Jul '18
commit e3bb52052fcb1e06b8c90bcacfe456d6a5d7758f Author: Hans-Christoph Steiner <hans(a)eds.org> Date: Tue Sep 1 20:49:27 2015 +0200 Orfox: add BroadcastReceiver to receive Tor status from Orbot Run in thread so Tor status updates will be received while the Gecko event sync is blocking the main thread. This might not be the best approach since it probably means that the main UI will be frozen waiting for Tor to reach ON status. Queue URL Intents events when Orbot is not yet started Instead of failing when opening a URL and Tor is not ready, queue those Intents, then send them once we get STATUS_ON from Orbot. Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- .../base/java/org/mozilla/gecko/BrowserApp.java | 32 ++++++++++++++++++++++ .../main/java/org/mozilla/gecko/GeckoAppShell.java | 32 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 8d5bbddabc88..3cc087e66622 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -13,11 +13,13 @@ import android.app.DownloadManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; +import android.content.BroadcastReceiver; import android.content.ContentProviderClient; import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; @@ -35,6 +37,9 @@ import android.nfc.NfcEvent; import android.os.Build; import android.os.Bundle; import android.os.Environment; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Looper; import android.os.Parcel; import android.os.Parcelable; import android.os.StrictMode; @@ -1273,6 +1278,16 @@ public class BrowserApp extends GeckoApp } } + private BroadcastReceiver torStatusReceiver = new BroadcastReceiver() { + + @Override + public void onReceive(Context context, Intent intent) { + if (TextUtils.equals(intent.getAction(), OrbotHelper.ACTION_STATUS)) { + GeckoAppShell.setTorStatus(intent); + } + } + }; + public void checkStartOrbot() { if (!OrbotHelper.isOrbotInstalled(this)) { final Intent installOrbotIntent = OrbotHelper.getOrbotInstallIntent(this); @@ -1293,6 +1308,14 @@ public class BrowserApp extends GeckoApp }); builder.show(); } else { + /* run in thread so Tor status updates will be received while the + * Gecko event sync is blocking the main thread */ + HandlerThread handlerThread = new HandlerThread("torStatusReceiver"); + handlerThread.start(); + Looper looper = handlerThread.getLooper(); + Handler handler = new Handler(looper); + registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS), + null, handler); OrbotHelper.requestStartTor(this); } } @@ -1335,6 +1358,15 @@ public class BrowserApp extends GeckoApp for (BrowserAppDelegate delegate : delegates) { delegate.onPause(this); } + + if (torStatusReceiver != null) + { + try { + unregisterReceiver(torStatusReceiver); + } catch (IllegalArgumentException e) { + Log.w(LOGTAG, "Tor status receiver couldn't be unregistered", e); + } + } } @Override diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java index 7dbb286cae04..f67603f853e2 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java @@ -18,10 +18,13 @@ import java.net.Proxy; import java.net.URLConnection; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Queue; import java.util.StringTokenizer; import java.util.TreeMap; @@ -39,6 +42,8 @@ import org.mozilla.gecko.util.ProxySelector; import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.geckoview.BuildConfig; +import info.guardianproject.netcipher.proxy.OrbotHelper; + import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; @@ -110,7 +115,11 @@ public class GeckoAppShell // We have static members only. private GeckoAppShell() { } + /* Initialize as STATUS_OFF */ + private static String sTorStatus = OrbotHelper.STATUS_OFF; + private static final CrashHandler CRASH_HANDLER = new CrashHandler() { + @Override protected String getAppPackageName() { final Context appContext = getAppContext(); @@ -200,6 +209,8 @@ public class GeckoAppShell static private int sDensityDpi; static private int sScreenDepth; + static final Queue<Intent> PENDING_URL_INTENTS = new ConcurrentLinkedQueue<Intent>(); + /* Is the value in sVibrationEndTime valid? */ private static boolean sVibrationMaybePlaying; @@ -251,6 +262,16 @@ public class GeckoAppShell private static Rect sScreenSize; + static void sendPendingUrlIntents() { + try { + Context context = getApplicationContext(); + while (!PENDING_URL_INTENTS.isEmpty()) { + final Intent intent = PENDING_URL_INTENTS.poll(); + context.startActivity(intent); + } + } catch (NoSuchElementException e) {} + } + @WrapForJNI(stubName = "NotifyObservers", dispatchTo = "gecko") private static native void nativeNotifyObservers(String topic, String data); @@ -1874,4 +1895,15 @@ public class GeckoAppShell public static String getDefaultLocale() { return Locale.getDefault().toString(); } + + public static void setTorStatus(Intent intent) { + sTorStatus = intent.getStringExtra(OrbotHelper.EXTRA_STATUS); + if (OrbotHelper.STATUS_ON.equals(sTorStatus)) { + sendPendingUrlIntents(); + } + } + + public static String getTorStatus() { + return sTorStatus; + } }
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Orfox: NetCipher enabled, checks if orbot is installed
by gk@torproject.org 27 Jul '18

27 Jul '18
commit 5307039febcc2e0fcd0b2451d821197202fda8b8 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Mon Jul 20 21:46:25 2015 -0400 Orfox: NetCipher enabled, checks if orbot is installed Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- .../base/java/org/mozilla/gecko/BrowserApp.java | 38 +++- mobile/android/base/strings.xml.in | 1 + .../netcipher/proxy/OrbotHelper.java | 186 ++++++++++++++++ .../netcipher/proxy/TorServiceUtils.java | 233 +++++++++++++++++++++ mobile/android/torbrowser/strings.xml.in | 5 + 5 files changed, 458 insertions(+), 5 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 88c707cfa533..8d5bbddabc88 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -176,6 +176,8 @@ import org.mozilla.gecko.widget.GeckoActionProvider; import org.mozilla.gecko.widget.SplashScreen; import org.mozilla.geckoview.GeckoSession; +import info.guardianproject.netcipher.proxy.OrbotHelper; + import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -1271,6 +1273,30 @@ public class BrowserApp extends GeckoApp } } + public void checkStartOrbot() { + if (!OrbotHelper.isOrbotInstalled(this)) { + final Intent installOrbotIntent = OrbotHelper.getOrbotInstallIntent(this); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.install_orbot); + builder.setMessage(R.string.you_must_have_orbot); + builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + startActivity(installOrbotIntent); + } + }); + builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + } + }); + builder.show(); + } else { + OrbotHelper.requestStartTor(this); + } + } + @Override public void onResume() { super.onResume(); @@ -1279,16 +1305,18 @@ public class BrowserApp extends GeckoApp return; } - if (!mHasResumed) { - getAppEventDispatcher().unregisterUiThreadListener(this, "Prompt:ShowTop"); - mHasResumed = true; - } - processTabQueue(); for (BrowserAppDelegate delegate : delegates) { delegate.onResume(this); } + + // isInAutomation is overloaded with isTorBrowser(), but here we actually + // need to know if we are in automation. + final SafeIntent intent = new SafeIntent(getIntent()); + if (!IntentUtils.getIsInAutomationFromEnvironment(intent)) { + checkStartOrbot(); + } } @Override diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index b510012948b9..cf43a3b4c78b 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -25,6 +25,7 @@ <string name="android_package_name_for_ui">@ANDROID_PACKAGE_NAME@</string> #include ../services/strings.xml.in +#include ../torbrowser/strings.xml.in <string name="firstrun_panel_title_welcome">&firstrun_panel_title_welcome;</string> diff --git a/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/OrbotHelper.java b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/OrbotHelper.java new file mode 100644 index 000000000000..d6a632fda37d --- /dev/null +++ b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/OrbotHelper.java @@ -0,0 +1,186 @@ + +package info.guardianproject.netcipher.proxy; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.text.TextUtils; +import android.util.Log; + + +import java.util.List; + +public class OrbotHelper { + + private final static int REQUEST_CODE_STATUS = 100; + + public final static String ORBOT_PACKAGE_NAME = "org.torproject.android"; + public final static String ORBOT_MARKET_URI = "market://details?id=" + ORBOT_PACKAGE_NAME; + public final static String ORBOT_FDROID_URI = "https://f-droid.org/repository/browse/?fdid=" + + ORBOT_PACKAGE_NAME; + public final static String ORBOT_PLAY_URI = "https://play.google.com/store/apps/details?id=" + + ORBOT_PACKAGE_NAME; + + /** + * A request to Orbot to transparently start Tor services + */ + public final static String ACTION_START = "org.torproject.android.intent.action.START"; + /** + * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status + */ + public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS"; + /** + * {@code String} that contains a status constant: {@link #STATUS_ON}, + * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or + * {@link #STATUS_STOPPING} + */ + public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS"; + /** + * A {@link String} {@code packageName} for Orbot to direct its status reply + * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot + */ + public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; + + /** + * All tor-related services and daemons are stopped + */ + public final static String STATUS_OFF = "OFF"; + /** + * All tor-related services and daemons have completed starting + */ + public final static String STATUS_ON = "ON"; + public final static String STATUS_STARTING = "STARTING"; + public final static String STATUS_STOPPING = "STOPPING"; + /** + * The user has disabled the ability for background starts triggered by + * apps. Fallback to the old Intent that brings up Orbot. + */ + public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; + + public final static String ACTION_START_TOR = "org.torproject.android.START_TOR"; + public final static String ACTION_REQUEST_HS = "org.torproject.android.REQUEST_HS_PORT"; + public final static int START_TOR_RESULT = 0x048079234; + public final static int HS_REQUEST_CODE = 9999; + + private final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid"; + private final static String PLAY_PACKAGE_NAME = "com.android.vending"; + + private OrbotHelper() { + // only static utility methods, do not instantiate + } + + public static boolean isOrbotRunning(Context context) { + int procId = TorServiceUtils.findProcessId(context); + + return (procId != -1); + } + + public static boolean isOrbotInstalled(Context context) { + return isAppInstalled(context, ORBOT_PACKAGE_NAME); + } + + private static boolean isAppInstalled(Context context, String uri) { + try { + PackageManager pm = context.getPackageManager(); + pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + public static void requestHiddenServiceOnPort(Activity activity, int port) { + Intent intent = new Intent(ACTION_REQUEST_HS); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.putExtra("hs_port", port); + + activity.startActivityForResult(intent, HS_REQUEST_CODE); + } + + /** + * First, checks whether Orbot is installed. If Orbot is installed, then a + * broadcast {@link Intent} is sent to request Orbot to start transparently + * in the background. When Orbot receives this {@code Intent}, it will + * immediately reply to this all with its status via an + * {@link #ACTION_STATUS} {@code Intent} that is broadcast to the + * {@code packageName} of the provided {@link Context} (i.e. + * {@link Context#getPackageName()}. + * + * @param context the app {@link Context} will receive the reply + * @return whether the start request was sent to Orbot + */ + public static boolean requestStartTor(Context context) { + if (OrbotHelper.isOrbotInstalled(context)) { + Log.i("OrbotHelper", "requestStartTor " + context.getPackageName()); + Intent intent = getOrbotStartIntent(); + intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName()); + context.sendBroadcast(intent); + return true; + } + return false; + } + + public static Intent getOrbotStartIntent() { + Intent intent = new Intent(ACTION_START); + intent.setPackage(ORBOT_PACKAGE_NAME); + return intent; + } + + /** + * First, checks whether Orbot is installed, then checks whether Orbot is + * running. If Orbot is installed and not running, then an {@link Intent} is + * sent to request Orbot to start, which will show the main Orbot screen. + * The result will be returned in + * {@link Activity#onActivityResult(int requestCode, int resultCode, Intent data)} + * with a {@code requestCode} of {@link START_TOR_RESULT} + * + * @param activity the {@link Activity} that gets the + * {@code START_TOR_RESULT} result + * @return whether the start request was sent to Orbot + */ + public static boolean requestShowOrbotStart(Activity activity) { + if (OrbotHelper.isOrbotInstalled(activity)) { + if (!OrbotHelper.isOrbotRunning(activity)) { + Intent intent = getShowOrbotStartIntent(); + activity.startActivityForResult(intent, START_TOR_RESULT); + return true; + } + } + return false; + } + + public static Intent getShowOrbotStartIntent() { + Intent intent = new Intent(ACTION_START_TOR); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + return intent; + } + + public static Intent getOrbotInstallIntent(Context context) { + final Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(ORBOT_MARKET_URI)); + + PackageManager pm = context.getPackageManager(); + List<ResolveInfo> resInfos = pm.queryIntentActivities(intent, 0); + + String foundPackageName = null; + for (ResolveInfo r : resInfos) { + Log.i("OrbotHelper", "market: " + r.activityInfo.packageName); + if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME) + || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) { + foundPackageName = r.activityInfo.packageName; + break; + } + } + + if (foundPackageName == null) { + intent.setData(Uri.parse(ORBOT_FDROID_URI)); + } else { + intent.setPackage(foundPackageName); + } + return intent; + } +} diff --git a/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/TorServiceUtils.java b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/TorServiceUtils.java new file mode 100644 index 000000000000..e553ecac3543 --- /dev/null +++ b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/TorServiceUtils.java @@ -0,0 +1,233 @@ +/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ +/* See LICENSE for licensing information */ + +package info.guardianproject.netcipher.proxy; + +import android.content.Context; +import android.util.Log; + + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.URLEncoder; +import java.util.StringTokenizer; + +public class TorServiceUtils { + + private final static String TAG = "TorUtils"; + // various console cmds + public final static String SHELL_CMD_CHMOD = "chmod"; + public final static String SHELL_CMD_KILL = "kill -9"; + public final static String SHELL_CMD_RM = "rm"; + public final static String SHELL_CMD_PS = "ps"; + public final static String SHELL_CMD_PIDOF = "pidof"; + + public final static String CHMOD_EXE_VALUE = "700"; + + public static boolean isRootPossible() + { + + StringBuilder log = new StringBuilder(); + + try { + + // Check if Superuser.apk exists + File fileSU = new File("/system/app/Superuser.apk"); + if (fileSU.exists()) + return true; + + fileSU = new File("/system/app/superuser.apk"); + if (fileSU.exists()) + return true; + + fileSU = new File("/system/bin/su"); + if (fileSU.exists()) + { + String[] cmd = { + "su" + }; + int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); + if (exitCode != 0) + return false; + else + return true; + } + + // Check for 'su' binary + String[] cmd = { + "which su" + }; + int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); + + if (exitCode == 0) { + Log.d(TAG, "root exists, but not sure about permissions"); + return true; + + } + + } catch (IOException e) { + // this means that there is no root to be had (normally) so we won't + // log anything + Log.e(TAG, "Error checking for root access", e); + + } catch (Exception e) { + Log.e(TAG, "Error checking for root access", e); + // this means that there is no root to be had (normally) + } + + Log.e(TAG, "Could not acquire root permissions"); + + return false; + } + + public static int findProcessId(Context context) { + String dataPath = context.getFilesDir().getParentFile().getParentFile().getAbsolutePath(); + String command = dataPath + "/" + OrbotHelper.ORBOT_PACKAGE_NAME + "/app_bin/tor"; + int procId = -1; + + try { + procId = findProcessIdWithPidOf(command); + + if (procId == -1) + procId = findProcessIdWithPS(command); + } catch (Exception e) { + try { + procId = findProcessIdWithPS(command); + } catch (Exception e2) { + Log.e(TAG, "Unable to get proc id for command: " + URLEncoder.encode(command), e2); + } + } + + return procId; + } + + // use 'pidof' command + public static int findProcessIdWithPidOf(String command) throws Exception + { + + int procId = -1; + + Runtime r = Runtime.getRuntime(); + + Process procPs = null; + + String baseName = new File(command).getName(); + // fix contributed my mikos on 2010.12.10 + procPs = r.exec(new String[] { + SHELL_CMD_PIDOF, baseName + }); + // procPs = r.exec(SHELL_CMD_PIDOF); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + String line = null; + + while ((line = reader.readLine()) != null) + { + + try + { + // this line should just be the process id + procId = Integer.parseInt(line.trim()); + break; + } catch (NumberFormatException e) + { + Log.e("TorServiceUtils", "unable to parse process pid: " + line, e); + } + } + + return procId; + + } + + // use 'ps' command + public static int findProcessIdWithPS(String command) throws Exception + { + + int procId = -1; + + Runtime r = Runtime.getRuntime(); + + Process procPs = null; + + procPs = r.exec(SHELL_CMD_PS); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + String line = null; + + while ((line = reader.readLine()) != null) + { + if (line.indexOf(' ' + command) != -1) + { + + StringTokenizer st = new StringTokenizer(line, " "); + st.nextToken(); // proc owner + + procId = Integer.parseInt(st.nextToken().trim()); + + break; + } + } + + return procId; + + } + + public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, + boolean waitFor) throws Exception + { + + Process proc = null; + int exitCode = -1; + + if (runAsRoot) + proc = Runtime.getRuntime().exec("su"); + else + proc = Runtime.getRuntime().exec("sh"); + + OutputStreamWriter out = new OutputStreamWriter(proc.getOutputStream()); + + for (int i = 0; i < cmds.length; i++) + { + // TorService.logMessage("executing shell cmd: " + cmds[i] + + // "; runAsRoot=" + runAsRoot + ";waitFor=" + waitFor); + + out.write(cmds[i]); + out.write("\n"); + } + + out.flush(); + out.write("exit\n"); + out.flush(); + + if (waitFor) + { + + final char buf[] = new char[10]; + + // Consume the "stdout" + InputStreamReader reader = new InputStreamReader(proc.getInputStream()); + int read = 0; + while ((read = reader.read(buf)) != -1) { + if (log != null) + log.append(buf, 0, read); + } + + // Consume the "stderr" + reader = new InputStreamReader(proc.getErrorStream()); + read = 0; + while ((read = reader.read(buf)) != -1) { + if (log != null) + log.append(buf, 0, read); + } + + exitCode = proc.waitFor(); + + } + + return exitCode; + + } +} diff --git a/mobile/android/torbrowser/strings.xml.in b/mobile/android/torbrowser/strings.xml.in new file mode 100644 index 000000000000..e3a22974ed78 --- /dev/null +++ b/mobile/android/torbrowser/strings.xml.in @@ -0,0 +1,5 @@ +<!-- NetCipher Integration Strings, used for dialog --> + <string name="install_orbot">Install Orbot?</string> + <string name="you_must_have_orbot">You must have Orbot installed and activated to proxy traffic through it. Would you like to download it?</string> + <string name="yes">Yes</string> + <string name="no">No</string>
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Orfox: hook up default panic trigger to "quit and clear"
by gk@torproject.org 27 Jul '18

27 Jul '18
commit e7b74ce6d0559f2a9d801b7dae1117fb8ead0212 Author: Hans-Christoph Steiner <hans(a)eds.org> Date: Sat Nov 21 00:24:09 2015 +0100 Orfox: hook up default panic trigger to "quit and clear" Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/base/AndroidManifest.xml.in | 7 +++ .../base/java/org/mozilla/gecko/GeckoApp.java | 61 ++++++++++++---------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index 4f626dcc2098..c4ea9a37683e 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -168,6 +168,13 @@ <data android:pathPattern=".*\\.xpi" /> </intent-filter> + <!-- receive triggers from panickit apps --> + <intent-filter> + <action android:name="info.guardianproject.panic.action.TRIGGER" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + #ifdef MOZ_ANDROID_BEAM <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index ada3e5fa5b0c..63a136541970 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -129,6 +129,7 @@ public abstract class GeckoApp extends GeckoActivity public static final String ACTION_INIT_PW = "org.mozilla.gecko.INIT_PW"; public static final String ACTION_SWITCH_TAB = "org.mozilla.gecko.SWITCH_TAB"; public static final String ACTION_SHUTDOWN = "org.mozilla.gecko.SHUTDOWN"; + public static final String ACTION_PANIC_TRIGGER = "info.guardianproject.panic.action.TRIGGER"; public static final String INTENT_REGISTER_STUMBLER_LISTENER = "org.mozilla.gecko.STUMBLER_REGISTER_LOCAL_LISTENER"; @@ -554,42 +555,46 @@ public abstract class GeckoApp extends GeckoActivity @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.quit) { - // Make sure the Guest Browsing notification goes away when we quit. - GuestSession.hideNotification(this); + quitAndClear(); + return true; + } - final SharedPreferences prefs = getSharedPreferencesForProfile(); - final Set<String> clearSet = PrefUtils.getStringSet( - prefs, ClearOnShutdownPref.PREF, new HashSet<String>()); + return super.onOptionsItemSelected(item); + } - final GeckoBundle clearObj = new GeckoBundle(clearSet.size()); - for (final String clear : clearSet) { - clearObj.putBoolean(clear, true); - } + private void quitAndClear() { + // Make sure the Guest Browsing notification goes away when we quit. + GuestSession.hideNotification(this); - final GeckoBundle res = new GeckoBundle(2); - res.putBundle("sanitize", clearObj); + final SharedPreferences prefs = getSharedPreferencesForProfile(); + final Set<String> clearSet = PrefUtils.getStringSet( + prefs, ClearOnShutdownPref.PREF, new HashSet<String>()); - // If the user wants to clear open tabs, or else has opted out of session - // restore and does want to clear history, we also want to prevent the current - // session info from being saved. - if (clearObj.containsKey("private.data.openTabs")) { - res.putBoolean("dontSaveSession", true); - } else if (clearObj.containsKey("private.data.history")) { + final GeckoBundle clearObj = new GeckoBundle(clearSet.size()); + for (final String clear : clearSet) { + clearObj.putBoolean(clear, true); + } - final String sessionRestore = - getSessionRestorePreference(getSharedPreferences()); - res.putBoolean("dontSaveSession", "quit".equals(sessionRestore)); - } + final GeckoBundle res = new GeckoBundle(2); + res.putBundle("sanitize", clearObj); - EventDispatcher.getInstance().dispatch("Browser:Quit", res); + // If the user wants to clear open tabs, or else has opted out of session + // restore and does want to clear history, we also want to prevent the current + // session info from being saved. + if (clearObj.containsKey("private.data.openTabs")) { + res.putBoolean("dontSaveSession", true); + } else if (clearObj.containsKey("private.data.history")) { - // We don't call shutdown here because this creates a race condition which - // can cause the clearing of private data to fail. Instead, we shut down the - // UI only after we're done sanitizing. - return true; + final String sessionRestore = + getSessionRestorePreference(getSharedPreferences()); + res.putBoolean("dontSaveSession", "quit".equals(sessionRestore)); } - return super.onOptionsItemSelected(item); + EventDispatcher.getInstance().dispatch("Browser:Quit", res); + + // We don't call shutdown here because this creates a race condition which + // can cause the clearing of private data to fail. Instead, we shut down the + // UI only after we're done sanitizing. } @Override @@ -1531,6 +1536,8 @@ public abstract class GeckoApp extends GeckoActivity // Copy extras. settingsIntent.putExtras(intent.getUnsafe()); startActivity(settingsIntent); + } else if (ACTION_PANIC_TRIGGER.equals(action)) { + quitAndClear(); } mPromptService = new PromptService(this, getAppEventDispatcher());
1 0
0 0
[tor-browser/tor-browser-60.1.0esr-8.0-1] Orfox: disable screenshots and prevent page from being in "recent apps"
by gk@torproject.org 27 Jul '18

27 Jul '18
commit f44bf9a30b66b7b0ee34cc2daa89b1bde46f12d2 Author: Hans-Christoph Steiner <hans(a)eds.org> Date: Sat Nov 21 00:10:06 2015 +0100 Orfox: disable screenshots and prevent page from being in "recent apps" Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/base/java/org/mozilla/gecko/GeckoApp.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index 1f2f95490d0a..ada3e5fa5b0c 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -78,6 +78,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewTreeObserver; import android.view.Window; +import android.view.WindowManager; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; @@ -1068,6 +1069,9 @@ public abstract class GeckoApp extends GeckoActivity GeckoScreenOrientation.getInstance().update(getResources().getConfiguration().orientation); + // disable screenshots and pic in "recent apps" + getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); + setContentView(getLayout()); // Set up Gecko layout.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 1673
  • 1674
  • 1675
  • 1676
  • 1677
  • 1678
  • 1679
  • ...
  • 2064
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.