summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorBryce Lee <brycelee@google.com>2017-05-23 19:46:59 +0000
committerBryce Lee <brycelee@google.com>2017-05-23 19:46:59 +0000
commit25ae100cb0cf4bb8e4bb0be59e1221b2ca42a372 (patch)
treee88262006c09807520051614b46580a2357e44c8 /core/java
parent8b49a5c0aa18f70bc59b972e888d5ad455e4d7ca (diff)
Revert "Disallow starting activities without new task from non-activity context."
This reverts commit 8b49a5c0aa18f70bc59b972e888d5ad455e4d7ca. Change-Id: I7d2da4ac72ca578942b38fccf8b151f3a2ed081f
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ContextImpl.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 8469931c91cb..424e783603ae 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -843,9 +843,8 @@ class ContextImpl extends Context {
// Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
// generally not allowed, except if the caller specifies the task id the activity should
// be launched in.
- if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == 0
- && (options == null
- || ActivityOptions.fromBundle(options).getLaunchTaskId() == -1)) {
+ if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
+ && options != null && ActivityOptions.fromBundle(options).getLaunchTaskId() == -1) {
throw new AndroidRuntimeException(
"Calling startActivity() from outside of an Activity "
+ " context requires the FLAG_ACTIVITY_NEW_TASK flag."