Skip to content

Commit 4bde4b9

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Check for valid records associated with activity tokens in ActivityManagerService up-navigation methods."
2 parents 80193e7 + b71a5bc commit 4bde4b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13404,7 +13404,8 @@ private void saveLocaleLocked(Locale l, boolean isDiff, boolean isPersist) {
1340413404
@Override
1340513405
public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) {
1340613406
ActivityRecord srec = ActivityRecord.forToken(token);
13407-
return srec.task.affinity != null && srec.task.affinity.equals(destAffinity);
13407+
return srec != null && srec.task.affinity != null &&
13408+
srec.task.affinity.equals(destAffinity);
1340813409
}
1340913410

1341013411
public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode,
@@ -13413,6 +13414,9 @@ public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode,
1341313414

1341413415
synchronized (this) {
1341513416
ActivityRecord srec = ActivityRecord.forToken(token);
13417+
if (srec == null) {
13418+
return false;
13419+
}
1341613420
ArrayList<ActivityRecord> history = srec.stack.mHistory;
1341713421
final int start = history.indexOf(srec);
1341813422
if (start < 0) {

0 commit comments

Comments
 (0)