summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2019-07-09 18:33:50 (GMT)
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-07-25 04:12:06 (GMT)
commit497f4379084d19c2cbf7c02aef662675d0a51975 (patch)
treeef634f9d9182acf228327c453177acae87c16ec8
parent831267c6a7cff1871a28ca97a7ea3af2d6b809ec (diff)
downloadandroid_packages_apps_Trebuchet-497f4379084d19c2cbf7c02aef662675d0a51975.zip
android_packages_apps_Trebuchet-497f4379084d19c2cbf7c02aef662675d0a51975.tar.gz
android_packages_apps_Trebuchet-497f4379084d19c2cbf7c02aef662675d0a51975.tar.bz2
Copy resume callbacks list prior to making callbacks
- Starting a deferred activity can trigger a new callback to be added to the list while we are iterating it Bug: 136613192 Change-Id: I6690ab0695bb73f11bf343fb41e9fc86b4afec1b Merged-In: I6690ab0695bb73f11bf343fb41e9fc86b4afec1b (cherry picked from commit 940b0ac0157945a40d8b3b44d976da53aaeff81f) (cherry picked from commit a8971c1462f276b2b4d6daab6b18941b9dc9a94a)
-rw-r--r--src/com/android/launcher3/Launcher.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index d9af4da..bc3aa7e 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -952,10 +952,14 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
mHandler.removeCallbacks(mHandleDeferredResume);
Utilities.postAsyncCallback(mHandler, mHandleDeferredResume);
- for (OnResumeCallback cb : mOnResumeCallbacks) {
- cb.onLauncherResume();
+ if (!mOnResumeCallbacks.isEmpty()) {
+ final ArrayList<OnResumeCallback> resumeCallbacks = new ArrayList<>(mOnResumeCallbacks);
+ mOnResumeCallbacks.clear();
+ for (int i = resumeCallbacks.size() - 1; i >= 0; i--) {
+ resumeCallbacks.get(i).onLauncherResume();
+ }
+ resumeCallbacks.clear();
}
- mOnResumeCallbacks.clear();
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onResume();