Gello: Share bitmap via stream vs bitmap
High res devices run into issues when trying to share a preview of the
page as a bitmap. Use a file uri instead.
Cherry-picked from: https://github.com/CyanogenMod/android_packages_apps_Browser/commit/5eb5e2c3d36ad92e41eef66c2dadcd106f1e0e13
Change-Id: I3016a3a9844cfa581f2535935fffc530c2b34ed9
diff --git a/src/com/android/browser/FileProviderHelper.java b/src/com/android/browser/FileProviderHelper.java
new file mode 100644
index 0000000..3c40796
--- /dev/null
+++ b/src/com/android/browser/FileProviderHelper.java
@@ -0,0 +1,27 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package com.android.browser;
+
+import android.content.Context;
+import android.net.Uri;
+import android.support.v4.content.FileProvider;
+
+import org.chromium.base.ContentUriUtils;
+
+import java.io.File;
+
+/**
+ * Utilities for translating a file into content URI.
+ */
+public class FileProviderHelper implements ContentUriUtils.FileProviderUtil {
+ // Keep this variable in sync with the value defined in file_paths.xml.
+ private static final String API_AUTHORITY_SUFFIX = ".FileProvider";
+
+ @Override
+ public Uri getContentUriFromFile(Context context, File file) {
+ return FileProvider.getUriForFile(context,
+ context.getPackageName() + API_AUTHORITY_SUFFIX, file);
+ }
+}