Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本 PR 修复在 SystemUI 功耗排查中定位到的 3 处后台/息屏空转问题:
MapImmersiveLayer(LockscreenCapsuleMotion.kt)隐藏态 60 FPS 死循环LockscreenCapsuleImmersiveHost初始化时会实例化MapImmersiveLayer并设为View.GONE,但MapImmersiveLayer.init直接启动了无条件每16 ms执行一次invalidate()的递归Runnable,且未在隐藏、息屏或detach时取消,导致未导航/息屏状态下仍在 SystemUI 主线程持续 60 FPS 调度。isAttachedToWindow && windowVisibility == VISIBLE && visibility == VISIBLE && isScreenInteractive()时驱动动画,在隐藏、息屏、detach 及destroy()时立即停止回调。锁屏小组件(
LockscreenWidget.kt)缺少息屏门控refreshRunnable每 30 秒无条件刷新一次,animationFollower在锁屏且isShown时每帧postOnAnimation,二者均未检查PowerManager.isInteractive(在开启锁屏小组件且未勾选 AOD 隐藏时尤为明显)。ACTION_SCREEN_OFF/ACTION_SCREEN_ON监听与isScreenInteractive()检查,息屏时暂停 30 秒轮询与逐帧animationFollower(保留静态视图不闪现),亮屏瞬间自动恢复,并在destroy()中反注册。状态栏显秒(
StatusBarSecondsHook.kt)缺少息屏门控isAttachedToWindow && isShown,未检查屏幕交互状态,息屏后时钟未 detach 时仍可能每秒反射调用updateTime()。PowerManager.isInteractive与亮灭屏广播控制,息屏立即停表、亮屏立即恢复。验证:HyperOS 真机重启 SystemUI 后运行稳定、零异常,上述三项功能在亮屏交互下表现与原版一致。