Merge "Remove views from StatusBarView when View is detached." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b94e608ff9
@@ -113,7 +113,7 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setExtraStatusBarItemViews(List<View> views) {
|
void setExtraStatusBarItemViews(List<View> views) {
|
||||||
mSystemStatusViewGroup.removeAllViews();
|
removeAllStatusBarItemViews();
|
||||||
views.forEach(view -> mSystemStatusViewGroup.addView(view));
|
views.forEach(view -> mSystemStatusViewGroup.addView(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,4 +121,8 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
|||||||
final View statusIcon = findViewById(resId);
|
final View statusIcon = findViewById(resId);
|
||||||
return Objects.requireNonNull(statusIcon);
|
return Objects.requireNonNull(statusIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeAllStatusBarItemViews() {
|
||||||
|
mSystemStatusViewGroup.removeAllViews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
|
|||||||
mDreamOverlayNotificationCountProvider.ifPresent(
|
mDreamOverlayNotificationCountProvider.ifPresent(
|
||||||
provider -> provider.removeCallback(mNotificationCountCallback));
|
provider -> provider.removeCallback(mNotificationCountCallback));
|
||||||
mStatusBarItemsProvider.removeCallback(mStatusBarItemsProviderCallback);
|
mStatusBarItemsProvider.removeCallback(mStatusBarItemsProviderCallback);
|
||||||
|
mView.removeAllStatusBarItemViews();
|
||||||
mTouchInsetSession.clear();
|
mTouchInsetSession.clear();
|
||||||
|
|
||||||
mIsAttached = false;
|
mIsAttached = false;
|
||||||
|
|||||||
@@ -307,6 +307,12 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase {
|
|||||||
verify(mDreamOverlayStatusBarItemsProvider).removeCallback(any());
|
verify(mDreamOverlayStatusBarItemsProvider).removeCallback(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnViewDetachedRemovesViews() {
|
||||||
|
mController.onViewDetached();
|
||||||
|
verify(mView).removeAllStatusBarItemViews();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWifiIconHiddenWhenWifiBecomesAvailable() {
|
public void testWifiIconHiddenWhenWifiBecomesAvailable() {
|
||||||
// Make sure wifi starts out unavailable when onViewAttached is called, and then returns
|
// Make sure wifi starts out unavailable when onViewAttached is called, and then returns
|
||||||
|
|||||||
Reference in New Issue
Block a user