Check for valid records associated with activity tokens in
ActivityManagerService up-navigation methods.
Silly monkeys.
Fixes bug 6328725
Change-Id: Ifec3f162bdfc2e7e872a689210752c0f6b9b0ab7
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 77bec41..2be614c 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -13398,7 +13398,8 @@
@Override
public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) {
ActivityRecord srec = ActivityRecord.forToken(token);
- return srec.task.affinity != null && srec.task.affinity.equals(destAffinity);
+ return srec != null && srec.task.affinity != null &&
+ srec.task.affinity.equals(destAffinity);
}
public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode,
@@ -13407,6 +13408,9 @@
synchronized (this) {
ActivityRecord srec = ActivityRecord.forToken(token);
+ if (srec == null) {
+ return false;
+ }
ArrayList<ActivityRecord> history = srec.stack.mHistory;
final int start = history.indexOf(srec);
if (start < 0) {