Avoid NPE around mReusedTask of ActivityStarter
Symptom:
System crash by NPE is observed on ActivityStarter
during phone boot-up.
Detail and sample:
ActivityStarter has possibility to be called itself recursively
by calling TaskRecord$performClearTaskLocked().
Then class variable of mReusedTask is initialized to null
after the call, because the recursive call isn't guarded by
synchronized block.
Then NPE crash occurs on next statement.
Solutions:
Call performClearTaskLocked() before assigning
intentActivity.task to mReusedTask.
Bug: 32361138
Test: builds, boots, Manual testing of condition in bug
Author: Shigeki Yokomichi <shigeki.x.yokomichi@sonymobile.com>
Change-Id: Iaea3e066a6f7134fcae4338ff864bb236241194c
(cherry picked from commit 0bd28e2c5f)
This commit is contained in:
committed by
Andrii Kulian
parent
33db4b77d5
commit
9fff53f2cb
@@ -1623,9 +1623,9 @@ class ActivityStarter {
|
|||||||
== (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) {
|
== (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) {
|
||||||
// The caller has requested to completely replace any existing task with its new
|
// The caller has requested to completely replace any existing task with its new
|
||||||
// activity. Well that should not be too hard...
|
// activity. Well that should not be too hard...
|
||||||
|
intentActivity.task.performClearTaskLocked();
|
||||||
|
intentActivity.task.setIntent(mStartActivity);
|
||||||
mReuseTask = intentActivity.task;
|
mReuseTask = intentActivity.task;
|
||||||
mReuseTask.performClearTaskLocked();
|
|
||||||
mReuseTask.setIntent(mStartActivity);
|
|
||||||
// When we clear the task - focus will be adjusted, which will bring another task
|
// When we clear the task - focus will be adjusted, which will bring another task
|
||||||
// to top before we launch the activity we need. This will temporary swap their
|
// to top before we launch the activity we need. This will temporary swap their
|
||||||
// mTaskToReturnTo values and we don't want to overwrite them accidentally.
|
// mTaskToReturnTo values and we don't want to overwrite them accidentally.
|
||||||
|
|||||||
Reference in New Issue
Block a user