summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorshawnlin <shawnlin@google.com>2020-06-15 13:55:51 +0800
committershawnlin <shawnlin@google.com>2020-06-15 15:47:14 +0800
commit2806269a5a4bb08c1f8694a4b601256db90728b1 (patch)
tree695d02d4b537a97c5a4e3269bf1e94867d1faa20 /core/java/android
parent2db442459a245f885657039be1c32e9ec9feee83 (diff)
Fixed the conflict of the release methods of ActivityView & TaskEmbedder
There is a case in Bubble that we might release a un-initialized TaskEmbedder while calling ActivityView.release() (ex. create a bubble and don't expand it and then dismiss it) which will cause an exception. Allow ActivityView.release() to be called at anytime and check the initialization state before calling TaskEmbedder.release(). Bug: 155417004 Test: 1. Add bubbles and don't expands them then dimiss them 2. Check logs. Change-Id: I583ddd36f407c908cb63c109834940fc91c8d130
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityView.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index d650bbcdfa33..b749c3504811 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -360,18 +360,9 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd
}
/**
- * Release this container. Activity launching will no longer be permitted.
- * <p>Note: Calling this method is allowed after
- * {@link StateCallback#onActivityViewReady(ActivityView)} callback was triggered and before
- * {@link StateCallback#onActivityViewDestroyed(ActivityView)}.
- *
- * @see StateCallback
+ * Release this container if it is initialized. Activity launching will no longer be permitted.
*/
public void release() {
- if (!mTaskEmbedder.isInitialized()) {
- throw new IllegalStateException(
- "Trying to release container that is not initialized.");
- }
performRelease();
}
@@ -487,7 +478,9 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd
return;
}
mSurfaceView.getHolder().removeCallback(mSurfaceCallback);
- mTaskEmbedder.release();
+ if (mTaskEmbedder.isInitialized()) {
+ mTaskEmbedder.release();
+ }
mTaskEmbedder.setListener(null);
mGuard.close();