Merge "Remove views from StatusBarView when View is detached." into tm-qpr-dev am: b94e608ff9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19644306

Change-Id: Ia5693ab3ef5340321526efa433bad20dffa4c086
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Victor Truong
2022-08-23 20:33:41 +00:00
committed by Automerger Merge Worker
3 changed files with 12 additions and 1 deletions

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -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