Reduce draw-only statusbar work
This commit is contained in:
+26
@@ -104,6 +104,10 @@ final class DrawerClockTextController {
|
|||||||
untrackDisabledRoles(clockEnabled, dateEnabled);
|
untrackDisabledRoles(clockEnabled, dateEnabled);
|
||||||
|
|
||||||
SurfaceMode surfaceMode = scene != null ? scene.surfaceMode() : null;
|
SurfaceMode surfaceMode = scene != null ? scene.surfaceMode() : null;
|
||||||
|
if (!root.isLayoutRequested()
|
||||||
|
&& hasAttachedCachedCandidates(root, clockEnabled, dateEnabled, surfaceMode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (hasValidTrackedCandidates(root, clockEnabled, dateEnabled, surfaceMode)) {
|
if (hasValidTrackedCandidates(root, clockEnabled, dateEnabled, surfaceMode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -200,6 +204,28 @@ final class DrawerClockTextController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasAttachedCachedCandidates(
|
||||||
|
View root,
|
||||||
|
boolean clockEnabled,
|
||||||
|
boolean dateEnabled,
|
||||||
|
SurfaceMode surfaceMode
|
||||||
|
) {
|
||||||
|
CandidateCache cache = candidateCacheByRoot.get(root);
|
||||||
|
if (cache == null || cache.surfaceMode != surfaceMode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (!clockEnabled || isAttachedCachedCandidate(cache.clockView, Role.CLOCK))
|
||||||
|
&& (!dateEnabled || isAttachedCachedCandidate(cache.dateView, Role.DATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAttachedCachedCandidate(WeakReference<TextView> reference, Role role) {
|
||||||
|
TextView textView = reference != null ? reference.get() : null;
|
||||||
|
return textView != null
|
||||||
|
&& textView.isAttachedToWindow()
|
||||||
|
&& trackedRoles.get(textView) == role
|
||||||
|
&& ownedTexts.contains(textView);
|
||||||
|
}
|
||||||
|
|
||||||
private void track(TextView textView, Role role) {
|
private void track(TextView textView, Role role) {
|
||||||
if (textView == null || role == null) {
|
if (textView == null || role == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
+39
@@ -2402,6 +2402,16 @@ final class StockLayoutCanvasController {
|
|||||||
boolean unlockedScene = activeScene != null && activeScene.isUnlocked();
|
boolean unlockedScene = activeScene != null && activeScene.isUnlocked();
|
||||||
boolean aodScene = activeScene != null && activeScene.isAod();
|
boolean aodScene = activeScene != null && activeScene.isAod();
|
||||||
boolean rootDirty = dirtyUnlockedLayoutRoots.remove(root);
|
boolean rootDirty = dirtyUnlockedLayoutRoots.remove(root);
|
||||||
|
if (canSkipStableDrawOnlyApply(root, activeScene, rootDirty)) {
|
||||||
|
if (unlockedScene) {
|
||||||
|
syncUnlockedHostsToStockStatusBar(root, activeScene);
|
||||||
|
hideTrackedUnlockedStockSurfaces(root);
|
||||||
|
hideTrackedStatusChipSources(root);
|
||||||
|
} else {
|
||||||
|
bringUnlockedHostsAndDebugOverlayToFront(root);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean aodLayoutRoot = aodScene && isAodLayoutRoot(root, activeScene);
|
boolean aodLayoutRoot = aodScene && isAodLayoutRoot(root, activeScene);
|
||||||
boolean hasAodLayoutPlan = aodScene && unlockedIconRenderController.hasLayoutPlan(root);
|
boolean hasAodLayoutPlan = aodScene && unlockedIconRenderController.hasLayoutPlan(root);
|
||||||
boolean layoutRoot = aodScene ? aodLayoutRoot : statusBarRoot;
|
boolean layoutRoot = aodScene ? aodLayoutRoot : statusBarRoot;
|
||||||
@@ -2551,6 +2561,35 @@ final class StockLayoutCanvasController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean canSkipStableDrawOnlyApply(
|
||||||
|
View root,
|
||||||
|
SceneKey scene,
|
||||||
|
boolean rootDirty
|
||||||
|
) {
|
||||||
|
if (root == null
|
||||||
|
|| scene == null
|
||||||
|
|| (!scene.isUnlocked() && !scene.isLockscreen())
|
||||||
|
|| root.isLayoutRequested()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (rootDirty) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!hasDirectUnlockedLayoutHost(root)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!unlockedIconRenderController.hasLayoutPlan(root)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isKnownRootGeometryChanged(root)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (scene.isUnlocked() && !hasTrackedUnlockedStockSurfaces(root)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void hideTrackedUnlockedStockSurfaces(View root) {
|
private void hideTrackedUnlockedStockSurfaces(View root) {
|
||||||
if (root == null || trackedUnlockedStockSurfaces.isEmpty()) {
|
if (root == null || trackedUnlockedStockSurfaces.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user