Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInLayer.kt +25 −3 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ package com.android.systemui.keyguard.ui.view.layout.sections import android.content.Context import android.view.View import android.view.ViewTreeObserver.OnPreDrawListener import androidx.constraintlayout.helper.widget.Layer class AodBurnInLayer(context: Context) : Layer(context) { class AodBurnInLayer( context: Context, ) : Layer(context) { // For setScale in Layer class, it stores it in mScaleX/Y and directly apply scale to // referenceViews instead of keeping the value in fields of View class // when we try to clone ConstraintSet, it will call getScaleX from View class and return 1.0 Loading @@ -28,13 +31,32 @@ class AodBurnInLayer(context: Context) : Layer(context) { // which cause the flicker from AOD to LS private var _scaleX = 1F private var _scaleY = 1F // As described for _scaleX and _scaleY, we have similar issue with translation private var _translationX = 1F private var _translationY = 1F private var _translationX = 0F private var _translationY = 0F private val _predrawListener = OnPreDrawListener { super.setScaleX(_scaleX) super.setScaleY(_scaleY) super.setTranslationX(_translationX) super.setTranslationY(_translationY) true } // avoid adding views with same ids override fun addView(view: View?) { view?.let { if (it.id !in referencedIds) super.addView(view) } } fun registerListener(rootView: View) { rootView.viewTreeObserver.addOnPreDrawListener(_predrawListener) } fun unregisterListener(rootView: View) { rootView.viewTreeObserver.removeOnPreDrawListener(_predrawListener) } override fun setScaleX(scaleX: Float) { _scaleX = scaleX super.setScaleX(scaleX) Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.Flags.migrateClocksToBlueprint import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.res.R import javax.inject.Inject Loading @@ -32,6 +33,7 @@ class AodBurnInSection @Inject constructor( private val context: Context, private val rootView: KeyguardRootView, private val clockViewModel: KeyguardClockViewModel, ) : KeyguardSection() { private lateinit var burnInLayer: AodBurnInLayer Loading @@ -46,6 +48,7 @@ constructor( burnInLayer = AodBurnInLayer(context).apply { id = R.id.burn_in_layer registerListener(rootView) addView(emptyView) if (!migrateClocksToBlueprint()) { val statusView = Loading @@ -70,6 +73,7 @@ constructor( } override fun removeViews(constraintLayout: ConstraintLayout) { burnInLayer.unregisterListener(rootView) constraintLayout.removeView(R.id.burn_in_layer) } } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInLayer.kt +25 −3 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ package com.android.systemui.keyguard.ui.view.layout.sections import android.content.Context import android.view.View import android.view.ViewTreeObserver.OnPreDrawListener import androidx.constraintlayout.helper.widget.Layer class AodBurnInLayer(context: Context) : Layer(context) { class AodBurnInLayer( context: Context, ) : Layer(context) { // For setScale in Layer class, it stores it in mScaleX/Y and directly apply scale to // referenceViews instead of keeping the value in fields of View class // when we try to clone ConstraintSet, it will call getScaleX from View class and return 1.0 Loading @@ -28,13 +31,32 @@ class AodBurnInLayer(context: Context) : Layer(context) { // which cause the flicker from AOD to LS private var _scaleX = 1F private var _scaleY = 1F // As described for _scaleX and _scaleY, we have similar issue with translation private var _translationX = 1F private var _translationY = 1F private var _translationX = 0F private var _translationY = 0F private val _predrawListener = OnPreDrawListener { super.setScaleX(_scaleX) super.setScaleY(_scaleY) super.setTranslationX(_translationX) super.setTranslationY(_translationY) true } // avoid adding views with same ids override fun addView(view: View?) { view?.let { if (it.id !in referencedIds) super.addView(view) } } fun registerListener(rootView: View) { rootView.viewTreeObserver.addOnPreDrawListener(_predrawListener) } fun unregisterListener(rootView: View) { rootView.viewTreeObserver.removeOnPreDrawListener(_predrawListener) } override fun setScaleX(scaleX: Float) { _scaleX = scaleX super.setScaleX(scaleX) Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.Flags.migrateClocksToBlueprint import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.res.R import javax.inject.Inject Loading @@ -32,6 +33,7 @@ class AodBurnInSection @Inject constructor( private val context: Context, private val rootView: KeyguardRootView, private val clockViewModel: KeyguardClockViewModel, ) : KeyguardSection() { private lateinit var burnInLayer: AodBurnInLayer Loading @@ -46,6 +48,7 @@ constructor( burnInLayer = AodBurnInLayer(context).apply { id = R.id.burn_in_layer registerListener(rootView) addView(emptyView) if (!migrateClocksToBlueprint()) { val statusView = Loading @@ -70,6 +73,7 @@ constructor( } override fun removeViews(constraintLayout: ConstraintLayout) { burnInLayer.unregisterListener(rootView) constraintLayout.removeView(R.id.burn_in_layer) } }