[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser/tor-browser-60.3.0esr-8.5-1] Bug 28051 - Open Orbot when the notification is tapped
commit 8e5290a7ff9c70dde87e055256717feb342a8645
Author: Matthew Finkel <Matthew.Finkel@xxxxxxxxx>
Date: Wed Nov 14 17:40:15 2018 +0000
Bug 28051 - Open Orbot when the notification is tapped
---
.../base/java/org/mozilla/gecko/LauncherActivity.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
index e8f8facc24c6..4cd94ed538c7 100644
--- a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
@@ -45,6 +45,9 @@ import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_FXA_SIGNIN;
import org.mozilla.gecko.deeplink.DeepLinkContract;
+import org.torproject.android.OrbotMainActivity;
+import org.torproject.android.service.TorServiceConstants;
+
/**
* Activity that receives incoming Intents and dispatches them to the appropriate activities (e.g. browser, custom tabs, web app).
*/
@@ -67,6 +70,9 @@ public class LauncherActivity extends Activity {
} else if (isWebAppIntent(safeIntent)) {
dispatchWebAppIntent();
+ } else if (TorServiceConstants.TOR_APP_USERNAME.equals(getIntent().getAction())) {
+ dispatchOrbotIntent();
+
// If it's not a view intent, it won't be a custom tabs intent either. Just launch!
} else if (!isViewIntentWithURL(safeIntent)) {
dispatchNormalIntent();
@@ -116,6 +122,18 @@ public class LauncherActivity extends Activity {
startActivity(intent);
}
+ private void dispatchOrbotIntent() {
+ final String orbotStartAction = "android.intent.action.MAIN";
+ final Intent intent = new Intent(orbotStartAction, null, this, OrbotMainActivity.class);
+
+ //When we launch Orbot, we want a new task.
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+
+ startActivity(intent);
+ }
+
private void dispatchUrlIntent(@NonNull String url) {
Intent intent = new Intent(getIntent());
intent.setData(Uri.parse(url));
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits