Avoid stock statusbar flash when enabling layout

This commit is contained in:
ajp_anton
2026-06-23 12:37:59 +00:00
parent 28f08eb2b2
commit d1160a2d2d
2 changed files with 14 additions and 12 deletions
@@ -153,7 +153,7 @@ final class StockClockController {
} }
runtimeContext.getModeStateRepository().addLayoutEnabledListener(enabled -> { runtimeContext.getModeStateRepository().addLayoutEnabledListener(enabled -> {
if (enabled) { if (enabled) {
restoreAllOwnedClocks(); suspendOwnedClockTickers();
} else { } else {
refreshAllClocks(); refreshAllClocks();
} }
@@ -212,23 +212,22 @@ final class StockClockController {
} }
} }
private void removeAllRowOverlays() { private void suspendOwnedClockTickers() {
for (TextView clockView : new ArrayList<>(trackedClocks)) { for (TextView clockView : new ArrayList<>(ownedClocks)) {
removeRowOverlay(clockView); stopTicker(clockView);
} }
} }
private void restoreAllOwnedClocks() {
for (TextView clockView : new ArrayList<>(trackedClocks)) {
restoreOwnedClock(clockView);
}
removeAllRowOverlays();
}
private void applyClockText(TextView clockView) { private void applyClockText(TextView clockView) {
SbtSettings settings = RuntimeSettingsCache.get(clockView.getContext()); SbtSettings settings = RuntimeSettingsCache.get(clockView.getContext());
boolean layoutEnabled = settings.clockEnabled; boolean layoutEnabled = settings.clockEnabled;
if (layoutEnabled || !hasCustomClockTextEnabled(settings)) { if (layoutEnabled) {
if (ownedClocks.contains(clockView)) {
stopTicker(clockView);
}
return;
}
if (!hasCustomClockTextEnabled(settings)) {
restoreOwnedClock(clockView); restoreOwnedClock(clockView);
return; return;
} }
@@ -237,6 +237,9 @@ final class StockUnlockedNotificationIconsController {
} }
private boolean shouldManageContainer(View view) { private boolean shouldManageContainer(View view) {
if (!isFeatureEnabled(view.getContext())) {
return false;
}
if (!isUnlockedScene()) { if (!isUnlockedScene()) {
return false; return false;
} }