Merge "Fix NPE in ActivityRecord" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-09 09:16:02 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 6 deletions

View File

@@ -863,7 +863,7 @@ final class ActivityRecord extends ConfigurationContainer {
name = intent.getComponent().flattenToShortString();
}
private static ActivityRecord tokenToActivityRecordLocked(Token token) {
private static @Nullable ActivityRecord tokenToActivityRecordLocked(Token token) {
if (token == null) {
return null;
}
@@ -891,7 +891,7 @@ final class ActivityRecord extends ConfigurationContainer {
}
}
static ActivityRecord forTokenLocked(IBinder token) {
static @Nullable ActivityRecord forTokenLocked(IBinder token) {
try {
return Token.tokenToActivityRecordLocked((Token)token);
} catch (ClassCastException e) {
@@ -2127,10 +2127,13 @@ final class ActivityRecord extends ConfigurationContainer {
static void activityResumedLocked(IBinder token) {
final ActivityRecord r = ActivityRecord.forTokenLocked(token);
if (DEBUG_SAVED_STATE) Slog.i(TAG_STATES, "Resumed activity; dropping state of: " + r);
if (r != null) {
r.icicle = null;
r.haveState = false;
if (r == null) {
// If an app reports resumed after a long delay, the record on server side might have
// been removed (e.g. destroy timeout), so the token could be null.
return;
}
r.icicle = null;
r.haveState = false;
final ActivityDisplay display = r.getDisplay();
if (display != null) {

View File

@@ -1804,7 +1804,7 @@ class ActivityStack extends ConfigurationContainer {
if (prev.finishing) {
if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Executing finish of activity: " + prev);
prev = finishCurrentActivityLocked(prev, FINISH_AFTER_VISIBLE, false,
"completedPausedLocked");
"completePausedLocked");
} else if (prev.hasProcess()) {
if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueue pending stop if needed: " + prev
+ " wasStopping=" + wasStopping + " visible=" + prev.visible);