Merge "Fix crash when opening overflow after dismissing stack" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-05-28 03:42:55 +00:00
committed by Android (Google) Code Review
4 changed files with 20 additions and 18 deletions

View File

@@ -657,7 +657,13 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
try {
mAddedToWindowManager = false;
mWindowManager.removeView(mStackView);
if (mStackView != null) {
mWindowManager.removeView(mStackView);
mStackView.removeView(mBubbleScrim);
mStackView = null;
} else {
Log.w(TAG, "StackView added to WindowManager, but was null when removing!");
}
} catch (IllegalArgumentException e) {
// This means the stack has already been removed - it shouldn't happen, but ignore if it
// does, since we wanted it removed anyway.

View File

@@ -306,7 +306,9 @@ public class BubbleExpandedView extends LinearLayout {
* if a view has been added or removed from on top of the ActivityView, such as the manage menu.
*/
void updateObscuredTouchableRegion() {
mActivityView.onLocationChanged();
if (mActivityView != null) {
mActivityView.onLocationChanged();
}
}
void applyThemeAttrs() {

View File

@@ -129,7 +129,7 @@ public class BubbleOverflow implements BubbleViewProvider {
return mOverflowBtn;
}
void setBtnVisible(int visible) {
void setVisible(int visible) {
mOverflowBtn.setVisibility(visible);
}

View File

@@ -1117,6 +1117,9 @@ public class BubbleStackView extends FrameLayout
super.onDetachedFromWindow();
getViewTreeObserver().removeOnPreDrawListener(mViewUpdater);
getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
if (mBubbleOverflow != null && mBubbleOverflow.getExpandedView() != null) {
mBubbleOverflow.getExpandedView().cleanUpExpandedState();
}
}
@Override
@@ -1334,21 +1337,12 @@ public class BubbleStackView extends FrameLayout
Log.d(TAG, "was asked to remove Bubble, but didn't find the view! " + bubble);
}
private void updateOverflowBtnVisibility() {
if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
private void updateOverflowVisibility() {
if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)
|| mBubbleOverflow == null) {
return;
}
if (mIsExpanded) {
if (DEBUG_BUBBLE_STACK_VIEW) {
Log.d(TAG, "Show overflow button.");
}
mBubbleOverflow.setBtnVisible(VISIBLE);
} else {
if (DEBUG_BUBBLE_STACK_VIEW) {
Log.d(TAG, "Collapsed. Hide overflow button.");
}
mBubbleOverflow.setBtnVisible(GONE);
}
mBubbleOverflow.setVisible(mIsExpanded ? VISIBLE : GONE);
}
// via BubbleData.Listener
@@ -1602,7 +1596,7 @@ public class BubbleStackView extends FrameLayout
Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(),
mExpandedBubble));
}
updateOverflowBtnVisibility();
updateOverflowVisibility();
mBubbleContainer.cancelAllAnimations();
mExpandedAnimationController.collapseBackToStack(
mStackAnimationController.getStackPositionAlongNearestHorizontalEdge()
@@ -1626,7 +1620,7 @@ public class BubbleStackView extends FrameLayout
beforeExpandedViewAnimation();
mBubbleContainer.setActiveController(mExpandedAnimationController);
updateOverflowBtnVisibility();
updateOverflowVisibility();
mExpandedAnimationController.expandFromStack(() -> {
updatePointerPosition();
afterExpandedViewAnimation();