--- a/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
@@ -17,16 +17,17 @@ import org.mozilla.gecko.widget.External
import android.app.Activity;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
+import android.os.StrictMode;
import android.provider.Browser;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.MimeTypeMap;
@@ -429,22 +430,28 @@ public final class IntentHelper implemen
message.getString("url", ""),
message.getString("mime", ""),
message.getString("action", ""),
message.getString("title", ""));
callback.sendSuccess(getHandlersForIntent(intent));
}
private void open(final GeckoBundle message) {
- openUriExternal(message.getString("url", ""),
- message.getString("mime", ""),
- message.getString("packageName", ""),
- message.getString("className", ""),
- message.getString("action", ""),
- message.getString("title", ""), false);
+ final StrictMode.VmPolicy prevPolicy = StrictMode.getVmPolicy();
+ StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX);
+ try {
+ openUriExternal(message.getString("url", ""),
+ message.getString("mime", ""),
+ message.getString("packageName", ""),
+ message.getString("className", ""),
+ message.getString("action", ""),
+ message.getString("title", ""), false);
+ } finally {
+ StrictMode.setVmPolicy(prevPolicy);
+ }
}
private void openForResult(final GeckoBundle message, final EventCallback callback) {
Intent intent = getOpenURIIntent(getContext(),
message.getString("url", ""),
message.getString("mime", ""),
message.getString("action", ""),
message.getString("title", ""));
@@ -453,20 +460,24 @@ public final class IntentHelper implemen
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
final FragmentActivity activity = getActivity();
if (activity == null) {
callback.sendError(null);
return;
}
final ResultHandler handler = new ResultHandler(callback);
+ final StrictMode.VmPolicy prevPolicy = StrictMode.getVmPolicy();
+ StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX);
try {
ActivityHandlerHelper.startIntentForActivity(activity, intent, handler);
} catch (SecurityException e) {
Log.w(LOGTAG, "Forbidden to launch activity.", e);
+ } finally {
+ StrictMode.setVmPolicy(prevPolicy);
}
}
/**
* Opens a URI without any valid handlers on device. In the best case, a package is specified
* and we can bring the user directly to the application page in an app market. If a package is
* not specified and there is a fallback url in the intent extras, we open that url. If neither
* is present, we alert the user that we were unable to open the link.