diff options
| author | George Mount <mount@google.com> | 2016-03-29 10:32:56 -0700 |
|---|---|---|
| committer | George Mount <mount@google.com> | 2016-03-29 10:35:03 -0700 |
| commit | d0ca0e09842221ac8c587eda8c0c25aff61dd6f2 (patch) | |
| tree | 2444849ed7c993cf473fc9730ca775707f328a65 /core/java/android | |
| parent | f20ce4712edf7913aaabe9b722fdc429b8e853a6 (diff) | |
Ensure window has been added in isTopOfTask
Bug 27893230
When isTopOfTask is called prior to the window being added, it
will throw an IllegalArgumentException. This checks that the
window has been added before making the call.
Change-Id: Idd14c0f1051e16d96a0a1fa9f990f380a1f69911
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/Activity.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 887932a7dbbb..0d387e660f8a 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -5920,6 +5920,9 @@ public class Activity extends ContextThemeWrapper * @return true if this is the topmost, non-finishing activity in its task. */ private boolean isTopOfTask() { + if (mToken == null || mWindow == null || !mWindowAdded) { + return false; + } try { return ActivityManagerNative.getDefault().isTopOfTask(mToken); } catch (RemoteException e) { |
