summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolo' Mazzucato <nicomazz@google.com> 2024-11-15 17:35:02 +0000
committer Nicolo' Mazzucato <nicomazz@google.com> 2024-11-21 16:12:04 +0000
commitcf51487f83ca4903070a99928a10f3f31c71a591 (patch)
treef635b0f10d95fa55dafbc6d41676c5d0c5174694
parenta13172285b16df63fb7a2c3a75bfa49866a88c6b (diff)
Remove emptyView from AodBurnInSection
When the shade window moves, the emptyView was not removed from the ConstraintLayout, resulting in an exception when addviews was called again (as it was added despite having a parent already) Bug: 362719719 Test: Moved the shade and verified this doesn't crash sysui with the flag turned on. Flag: com.android.systemui.shade_window_goes_around Change-Id: I1b144a359e3a4707788072919646bde2293d92ee
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt
index 8622ffc04601..160380bb09bc 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt
@@ -19,6 +19,7 @@ package com.android.systemui.keyguard.ui.view.layout.sections
import android.content.Context
import android.view.View
+import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
@@ -47,11 +48,15 @@ constructor(
visibility = View.GONE
}
}
+
override fun addViews(constraintLayout: ConstraintLayout) {
if (!MigrateClocksToBlueprint.isEnabled) {
return
}
-
+ if (emptyView.parent != null) {
+ // As emptyView is lazy, it might be already attached.
+ (emptyView.parent as? ViewGroup)?.removeView(emptyView)
+ }
constraintLayout.addView(emptyView)
burnInLayer =
AodBurnInLayer(context).apply {