Merge "Ensure activity view is always cleaned up" into rvc-dev am: 724bea0617

Change-Id: Id33ac71f6471478f2504dba4cebe85b3e6a6a102
This commit is contained in:
TreeHugger Robot
2020-03-27 22:44:56 +00:00
committed by Automerger Merge Worker
2 changed files with 11 additions and 16 deletions

View File

@@ -76,7 +76,6 @@ class Bubble implements BubbleViewProvider {
private BadgedImageView mIconView; private BadgedImageView mIconView;
private BubbleExpandedView mExpandedView; private BubbleExpandedView mExpandedView;
private boolean mInflated;
private BubbleViewInfoTask mInflationTask; private BubbleViewInfoTask mInflationTask;
private boolean mInflateSynchronously; private boolean mInflateSynchronously;
@@ -166,10 +165,16 @@ class Bubble implements BubbleViewProvider {
return mExpandedView; return mExpandedView;
} }
void cleanupExpandedState() { /**
* Call when the views should be removed, ensure this is called to clean up ActivityView
* content.
*/
void cleanupViews() {
if (mExpandedView != null) { if (mExpandedView != null) {
mExpandedView.cleanUpExpandedState(); mExpandedView.cleanUpExpandedState();
mExpandedView = null;
} }
mIconView = null;
} }
/** /**
@@ -213,17 +218,15 @@ class Bubble implements BubbleViewProvider {
} }
boolean isInflated() { boolean isInflated() {
return mInflated; return mIconView != null && mExpandedView != null;
} }
void stopInflation() { void stopInflation() {
if (mInflationTask == null) { if (mInflationTask == null) {
return; return;
} }
mInflationTask.cancel(/* mayInterruptIfRunning */ true); mInflationTask.cancel(true /* mayInterruptIfRunning */);
mIconView = null; cleanupViews();
mExpandedView = null;
mInflated = false;
} }
void setViewInfo(BubbleViewInfoTask.BubbleViewInfo info) { void setViewInfo(BubbleViewInfoTask.BubbleViewInfo info) {
@@ -240,9 +243,6 @@ class Bubble implements BubbleViewProvider {
mDotColor = info.dotColor; mDotColor = info.dotColor;
mDotPath = info.dotPath; mDotPath = info.dotPath;
if (mExpandedView != null && mIconView != null) {
mInflated = true;
}
if (mExpandedView != null) { if (mExpandedView != null) {
mExpandedView.update(/* bubble */ this); mExpandedView.update(/* bubble */ this);
} }
@@ -251,10 +251,6 @@ class Bubble implements BubbleViewProvider {
} }
} }
void setInflated(boolean inflated) {
mInflated = inflated;
}
/** /**
* Set visibility of bubble in the expanded state. * Set visibility of bubble in the expanded state.
* *

View File

@@ -963,8 +963,7 @@ public class BubbleStackView extends FrameLayout {
if (v instanceof BadgedImageView if (v instanceof BadgedImageView
&& ((BadgedImageView) v).getKey().equals(bubble.getKey())) { && ((BadgedImageView) v).getKey().equals(bubble.getKey())) {
mBubbleContainer.removeViewAt(i); mBubbleContainer.removeViewAt(i);
bubble.cleanupExpandedState(); bubble.cleanupViews();
bubble.setInflated(false);
logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED);
return; return;
} }