[ActivityManager] Fix NPE when start activity

Symptom:
NPE occurs in line 1184 (resultStack.sendActivityResultLocked)
because resultStack is null.

Root cause:
When starting activity with FLAG_ACTIVITY_FORWARD_RESULT flag,
the resultRecord could be updated, but the resultStack is not
updated as well. In that case, the resultStack is still be
null. The exception will occurs if the activity is not
granted to launch due to permission denied.

Solution:
Update resultStack when resultRecord updates.

Change-Id: I91634e4f713c2e8dbd1a71f358a8fd9beed83ec7
This commit is contained in:
louis_chang
2014-08-01 10:09:08 +08:00
committed by Wale Ogunwale
parent b802cd6767
commit 33bae1f496

View File

@@ -1315,7 +1315,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
}
ActivityStack resultStack = resultRecord == null ? null : resultRecord.task.stack;
final int launchFlags = intent.getFlags();
@@ -1392,6 +1391,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
final ActivityStack resultStack = resultRecord == null ? null : resultRecord.task.stack;
if (err != ActivityManager.START_SUCCESS) {
if (resultRecord != null) {
resultStack.sendActivityResultLocked(-1,