Skip to content

SystemUI: Fix bad QS scrim colors due to race in brightness mirror state#1325

Open
iusmac wants to merge 1 commit into
crdroidandroid:16.0from
iusmac:systemui-fix-bad-qs-scrim-colors-due-to-race-in-brightness-mirror-state
Open

SystemUI: Fix bad QS scrim colors due to race in brightness mirror state#1325
iusmac wants to merge 1 commit into
crdroidandroid:16.0from
iusmac:systemui-fix-bad-qs-scrim-colors-due-to-race-in-brightness-mirror-state

Conversation

@iusmac

@iusmac iusmac commented Jun 23, 2026

Copy link
Copy Markdown
Member
  • When adjusting the brightness and "qs_ui_refactor_compose_fragment"
    flag is enabled, the NotificationPanelViewController (NPVC) will act
    as BrightnessMirrorShowingInteractor, which will directly animate the
    QS panel alpha when showing/hiding the brightness slider mirror.

    Currently, NPVC races with the legacy ScrimController, which manages
    the entire QS scrim lifecycle, including animating the scrim alpha
    during QS transitions (see logs below). As a result, it causes visual
    inconsistencies, such as the scrim color flashing or locking to a
    Color.BLACK when brightness mirror is gone.

    This patch adds a flag to track specifically the transitioning to/from
    BRIGHTNESS_MIRROR, preventing the ScrimController from altering scrim
    colors/alpha properties that may be already handled by NPVC.

Fixes crdroidandroid/issue_tracker#956
Fixes crdroidandroid/issue_tracker#1052


[START DRAGGING THE BRIGHTNESS SLIDER]
QS panel will disappear when showing the brightness mirror.

  D  ScrimController internalTransitionTo to state BRIGHTNESS_MIRROR
  D  ScrimController State changed to: BRIGHTNESS_MIRROR
  D  ScrimController Applying state: BRIGHTNESS_MIRROR
  D  ScrimController updating scrim behind_scrim color: 0
  D  ScrimController updating scrim behind_scrim alpha: 0.0
  D  ScrimController updating scrim notifications_scrim color: 0     <-- QS panel is now of Color.BLACK
  D  ScrimController updating scrim notifications_scrim alpha: 0.0   <-- QS panel became invisible
  D  ScrimController updating scrim front_scrim color: 0
  D  ScrimController updating scrim front_scrim alpha: 0.0
  D  ScrimController onFinished : state=BRIGHTNESS_MIRROR
  D  NotificationPanelView com.android.systemui:id/notification_panel: onBrightnessMirrorShowingChanged(isShowing=true)
  D  NotificationPanelView com.android.systemui:id/notification_panel: setAlpha(alpha=0, animate=true)

[STOP DRAGGING THE BRIGHTNESS SLIDER]
QS panel will reappear after hiding the brightness slider but the scrim color remains black.

  D  ScrimController internalTransitionTo to state KEYGUARD
  D  ScrimController State changed to: KEYGUARD
  D  ScrimController Applying state: KEYGUARD
  D  ScrimController updating scrim behind_scrim color: 0
  D  ScrimController updating scrim behind_scrim alpha: 1.0
  D  ScrimController updating scrim notifications_scrim color: 0     <-- QS panel is still of Color.BLACK
  D  ScrimController updating scrim notifications_scrim alpha: 1.0   <-- QS panel visible again
  D  ScrimController updating scrim front_scrim color: 0
  D  ScrimController updating scrim front_scrim alpha: 0.0
  D  NotificationPanelView com.android.systemui:id/notification_panel: onBrightnessMirrorShowingChanged(isShowing=false)
  D  NotificationPanelView com.android.systemui:id/notification_panel: setAlpha(alpha=255, animate=true)
  D  ScrimController onFinished : state=KEYGUARD

* When adjusting the brightness and "qs_ui_refactor_compose_fragment"
  flag is enabled, the NotificationPanelViewController (NPVC) will act
  as BrightnessMirrorShowingInteractor, which will directly animate the
  QS panel alpha when showing/hiding the brightness slider mirror.

  Currently, NPVC races with the legacy ScrimController, which manages
  the entire QS scrim lifecycle, including animating the scrim alpha
  during QS transitions (see logs below). As a result, it causes visual
  inconsistencies, such as the scrim color flashing or locking to a
  Color.BLACK when brightness mirror is gone.

  This patch adds a flag to track specifically the transitioning to/from
  BRIGHTNESS_MIRROR, preventing the ScrimController from altering scrim
  colors/alpha properties that may be already handled by NPVC.

Fixes crdroidandroid/issue_tracker#956
Fixes crdroidandroid/issue_tracker#1052

---

[START DRAGGING THE BRIGHTNESS SLIDER]
QS panel will disappear when showing the brightness mirror.

  D  ScrimController internalTransitionTo to state BRIGHTNESS_MIRROR
  D  ScrimController State changed to: BRIGHTNESS_MIRROR
  D  ScrimController Applying state: BRIGHTNESS_MIRROR
  D  ScrimController updating scrim behind_scrim color: 0
  D  ScrimController updating scrim behind_scrim alpha: 0.0
  D  ScrimController updating scrim notifications_scrim color: 0     <-- QS panel is now of Color.BLACK
  D  ScrimController updating scrim notifications_scrim alpha: 0.0   <-- QS panel became invisible
  D  ScrimController updating scrim front_scrim color: 0
  D  ScrimController updating scrim front_scrim alpha: 0.0
  D  ScrimController onFinished : state=BRIGHTNESS_MIRROR
  D  NotificationPanelView com.android.systemui:id/notification_panel: onBrightnessMirrorShowingChanged(isShowing=true)
  D  NotificationPanelView com.android.systemui:id/notification_panel: setAlpha(alpha=0, animate=true)

[STOP DRAGGING THE BRIGHTNESS SLIDER]
QS panel will reappear after hiding the brightness slider but the scrim color remains black.

  D  ScrimController internalTransitionTo to state KEYGUARD
  D  ScrimController State changed to: KEYGUARD
  D  ScrimController Applying state: KEYGUARD
  D  ScrimController updating scrim behind_scrim color: 0
  D  ScrimController updating scrim behind_scrim alpha: 1.0
  D  ScrimController updating scrim notifications_scrim color: 0     <-- QS panel is still of Color.BLACK
  D  ScrimController updating scrim notifications_scrim alpha: 1.0   <-- QS panel visible again
  D  ScrimController updating scrim front_scrim color: 0
  D  ScrimController updating scrim front_scrim alpha: 0.0
  D  NotificationPanelView com.android.systemui:id/notification_panel: onBrightnessMirrorShowingChanged(isShowing=false)
  D  NotificationPanelView com.android.systemui:id/notification_panel: setAlpha(alpha=255, animate=true)
  D  ScrimController onFinished : state=KEYGUARD

Signed-off-by: iusmac <iusico.maxim@libero.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quick Settings panel flashing black color when adjusting brightness slider Quick setting panel flashing black color

1 participant