Remove views from StatusBarView when View is detached.
Dreams were crashing SysUI. The MediaShellView was still attached after a dream starts so the next time Dreams came up, it would still have a parent causing SysUI to crash Bug: 242626584 Test: atest DreamOverlayStatusBarViewControllerTest Change-Id: Ibf14a10139e0c4d58c95be49e00992da138d1fc7
This commit is contained in:
@@ -113,7 +113,7 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
||||
}
|
||||
|
||||
void setExtraStatusBarItemViews(List<View> views) {
|
||||
mSystemStatusViewGroup.removeAllViews();
|
||||
removeAllStatusBarItemViews();
|
||||
views.forEach(view -> mSystemStatusViewGroup.addView(view));
|
||||
}
|
||||
|
||||
@@ -121,4 +121,8 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
||||
final View statusIcon = findViewById(resId);
|
||||
return Objects.requireNonNull(statusIcon);
|
||||
}
|
||||
|
||||
void removeAllStatusBarItemViews() {
|
||||
mSystemStatusViewGroup.removeAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
|
||||
mDreamOverlayNotificationCountProvider.ifPresent(
|
||||
provider -> provider.removeCallback(mNotificationCountCallback));
|
||||
mStatusBarItemsProvider.removeCallback(mStatusBarItemsProviderCallback);
|
||||
mView.removeAllStatusBarItemViews();
|
||||
mTouchInsetSession.clear();
|
||||
|
||||
mIsAttached = false;
|
||||
|
||||
@@ -307,6 +307,12 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase {
|
||||
verify(mDreamOverlayStatusBarItemsProvider).removeCallback(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnViewDetachedRemovesViews() {
|
||||
mController.onViewDetached();
|
||||
verify(mView).removeAllStatusBarItemViews();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWifiIconHiddenWhenWifiBecomesAvailable() {
|
||||
// Make sure wifi starts out unavailable when onViewAttached is called, and then returns
|
||||
|
||||
Reference in New Issue
Block a user