summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2013-09-17 11:33:02 -0700
committerztenghui <ztenghui@google.com>2013-09-17 13:45:07 -0700
commit05804751ba07c8abcf422f57467d0ed3de95576c (patch)
treefa6732af68f44c27fb4d94b89cbdbf6c1c4f8efc /src
parentd688c0c31d4287c03b664f6fca5c6498a1e4bd7d (diff)
downloadandroid_packages_apps_Snap-05804751ba07c8abcf422f57467d0ed3de95576c.tar.gz
android_packages_apps_Snap-05804751ba07c8abcf422f57467d0ed3de95576c.tar.bz2
android_packages_apps_Snap-05804751ba07c8abcf422f57467d0ed3de95576c.zip
Use a new Intent to work around issues in framework
Framework didn't update the action provider if reusing the intent object. The work around is creating new intents here. bug:10713267 Change-Id: Iee64e84e191c8c2c2377fb5b9b95a91dae3c445c
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index fe65c0290..f55d6bc05 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -163,6 +163,9 @@ public class CameraActivity extends Activity
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
private boolean mPendingDeletion = false;
+ private Intent mVideoShareIntent;
+ private Intent mImageShareIntent;
+
public void gotoGallery() {
mFilmStripView.getController().goToNextItem();
}
@@ -359,14 +362,39 @@ public class CameraActivity extends Activity
}
private void setStandardShareIntent(Uri contentUri, String mimeType) {
- if (mStandardShareIntent == null) {
- mStandardShareIntent = new Intent(Intent.ACTION_SEND);
+ mStandardShareIntent = getShareIntentFromType(mimeType);
+ if (mStandardShareIntent != null) {
+ mStandardShareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
+ mStandardShareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ if (mStandardShareActionProvider != null) {
+ mStandardShareActionProvider.setShareIntent(mStandardShareIntent);
+ }
}
- mStandardShareIntent.setType(mimeType);
- mStandardShareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
- if (mStandardShareActionProvider != null) {
- mStandardShareActionProvider.setShareIntent(mStandardShareIntent);
+ }
+
+ /**
+ * Get the share intent according to the mimeType
+ *
+ * @param mimeType The mimeType of current data.
+ * @return the video/image's ShareIntent or null if mimeType is invalid.
+ */
+ private Intent getShareIntentFromType(String mimeType) {
+ // Lazily create the intent object.
+ if (mimeType.startsWith("video/")) {
+ if (mVideoShareIntent == null) {
+ mVideoShareIntent = new Intent(Intent.ACTION_SEND);
+ mVideoShareIntent.setType("video/*");
+ }
+ return mVideoShareIntent;
+ } else if (mimeType.startsWith("image/")) {
+ if (mImageShareIntent == null) {
+ mImageShareIntent = new Intent(Intent.ACTION_SEND);
+ mImageShareIntent.setType("image/*");
+ }
+ return mImageShareIntent;
}
+ Log.w(TAG, "unsupported mimeType " + mimeType);
+ return null;
}
private void setPanoramaShareIntent(Uri contentUri) {