diff options
author | Axesh R. Ajmera <aajmera@codeaurora.org> | 2015-05-19 11:26:18 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2015-05-22 14:18:58 -0700 |
commit | 89cf4d8d663fd388c93e92dede6ca0ad387edccc (patch) | |
tree | d68b9279bfffe4f48b71d3881edba92fbe6dc790 /src/com/android/browser/ShareDialog.java | |
parent | f36e1dbcb66431061143690721565a9a389b1f5d (diff) | |
download | android_packages_apps_Gello-89cf4d8d663fd388c93e92dede6ca0ad387edccc.tar.gz android_packages_apps_Gello-89cf4d8d663fd388c93e92dede6ca0ad387edccc.tar.bz2 android_packages_apps_Gello-89cf4d8d663fd388c93e92dede6ca0ad387edccc.zip |
Minor fixes for browser
- Fix flags for share intent
- Prevent classcast exception
Change-Id: If0257c0e34e030a2619cb5957ad8c852c5a496eb
Diffstat (limited to 'src/com/android/browser/ShareDialog.java')
-rw-r--r-- | src/com/android/browser/ShareDialog.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/browser/ShareDialog.java b/src/com/android/browser/ShareDialog.java index 4b649d57..a4bfad7b 100644 --- a/src/com/android/browser/ShareDialog.java +++ b/src/com/android/browser/ShareDialog.java @@ -40,6 +40,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.ResolveInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; +import android.os.Build; import java.util.List; import java.util.Collections; @@ -98,13 +99,22 @@ public class ShareDialog extends AppItem { ComponentName name = new android.content.ComponentName(activityInfo.applicationInfo.packageName, activityInfo.name); Intent i = new Intent(Intent.ACTION_SEND); - i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | - Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { + // This flag clears the called app from the activity stack, + // so users arrive in the expected place next time this application is restarted + i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); + } else { + // flag used from Lollipop onwards + i.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); + } + + i.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT | + Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); + i.setType("text/plain"); i.putExtra(Intent.EXTRA_TEXT, url); i.putExtra(Intent.EXTRA_SUBJECT, title); i.putExtra(EXTRA_SHARE_FAVICON, favicon); i.putExtra(EXTRA_SHARE_SCREENSHOT, screenshot); - i.setType("text/plain"); i.setComponent(name); activity.startActivity(i); } |