Gallery2: Set content URI as data in share intents

Edit action expects content URI in data otherwise leads to crash due to NPE.

This is similar to what I7a1254e579cea38fd70fc13da81e1dae98f5f968 is doing with
screenshot activity in fw/base.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ifdded8862e4e08dfcb05391c1cb40cf1f4f7dbd8
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index b702de3..7f69e0c 100755
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -683,7 +683,7 @@
                  if (mModel != null && mModel.getMediaItem(0) != null) {
                  Uri uri = mActivity.getDataManager().getContentUri(mModel.getMediaItem(0).getPath());
                  mActivity.isTopMenuShow = true;
-                 mShareIntent.setType(MenuExecutor.getMimeType(mModel
+                 mShareIntent.setDataAndType(uri, MenuExecutor.getMimeType(mModel
                     .getMediaItem(0).getMediaType()));
                  mShareIntent.putExtra(Intent.EXTRA_STREAM, uri);
                  String shareTitle = mActivity.getResources().
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java
index b46a393..605de39 100644
--- a/src/com/android/gallery3d/ui/ActionModeHandler.java
+++ b/src/com/android/gallery3d/ui/ActionModeHandler.java
@@ -386,7 +386,7 @@
                 intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
             } else {
                 intent.setAction(Intent.ACTION_SEND);
-                intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
+                intent.setDataAndType(uris.get(0), GalleryUtils.MIME_TYPE_PANORAMA360);
                 intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
             }
             intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
@@ -425,7 +425,7 @@
                 intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
                 intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
             } else {
-                intent.setAction(Intent.ACTION_SEND).setType(mimeType);
+                intent.setAction(Intent.ACTION_SEND).setDataAndType(uris.get(0), mimeType);
                 intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
             }
             intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);