Crash fix in BubbleStachedHandleViewController.

Switching between gesture nav and 3 button nav may lead to a state where
the RegionSamplingHelper is unexpectedly null.

Bug: 269670598
Test: In Settings switch navigation modes until launcher crashes.
Change-Id: I56d6eea81070f367db292c1ded9866452f6e2650
This commit is contained in:
Liran Binyamin
2023-06-07 11:55:02 -04:00
parent 62b448310e
commit 2f1b547a4b
@@ -203,12 +203,14 @@ public class BubbleStashedHandleViewController {
private void updateRegionSampling() {
boolean handleVisible = mStashedHandleView.getVisibility() == VISIBLE
&& mBubbleStashController.isStashed();
mRegionSamplingHelper.setWindowVisible(handleVisible);
if (handleVisible) {
mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion());
} else {
mRegionSamplingHelper.stop();
if (mRegionSamplingHelper != null) {
mRegionSamplingHelper.setWindowVisible(handleVisible);
if (handleVisible) {
mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion());
} else {
mRegionSamplingHelper.stop();
}
}
}