Fixing crash when task is already parent of activity.

- When launching an activity into a task, it's parent is already set
  which can cause the reparent call to crash.  Instead, just move the
  activity to the top.

Bug: 34933399
Test: Launch an app that doesn't support multiwindow, and engage split
      screen, or launch a PiP activity and tap to show the menu

Change-Id: Iaa36003e88f4021f2483dedc71802023369d6558
This commit is contained in:
Winson Chung
2017-02-02 10:06:09 -08:00
parent ddb80216b9
commit ba7db92d16

View File

@@ -1802,7 +1802,7 @@ class ActivityStarter {
}
private void addOrReparentStartingActivity(TaskRecord parent, String reason) {
if (mStartActivity.task == null) {
if (mStartActivity.task == null || mStartActivity.task == parent) {
parent.addActivityToTop(mStartActivity);
} else {
mStartActivity.reparent(parent, parent.mActivities.size() /* top */, reason);