From dd2914e88e27d16fe4b102c798913c841cf04fb4 Mon Sep 17 00:00:00 2001 From: Maunik Shah Date: Thu, 15 Nov 2012 14:07:54 +0530 Subject: [PATCH] Framework/base: Added synchronization block to avoid race condition Fix for the synchronization issue leading to access of an array Index out of bounds. Issue occurs due to race condition between removing the activities of a crashed process from history stack and resuming a separate activity. Change-Id: I14bb5834e778c15b674248e46fe93b0ce9f37967 --- services/java/com/android/server/am/ActivityStack.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 4546dc3a8290c..676722f130373 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -3623,7 +3623,9 @@ final class ActivityStack { } if (activityRemoved) { - resumeTopActivityLocked(null); + synchronized (mService) { + resumeTopActivityLocked(null); + } } return res;