Merge "Changes callback to a WeakReference in ActivityContainerCallback." into lmp-mr1-modular-dev
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index fecaf6f..a7864f4 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -350,10 +350,15 @@
if (activityView != null) {
final ActivityViewCallback callback = activityView.mActivityViewCallback;
if (callback != null) {
+ final WeakReference<ActivityViewCallback> callbackRef =
+ new WeakReference<>(callback);
activityView.post(new Runnable() {
@Override
public void run() {
- callback.onAllActivitiesComplete(activityView);
+ ActivityViewCallback callback = callbackRef.get();
+ if (callback != null) {
+ callback.onAllActivitiesComplete(activityView);
+ }
}
});
}