Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1828032e authored by Julia Tuttle's avatar Julia Tuttle Committed by Android (Google) Code Review
Browse files

Merge changes I82b3e023,I2f4651bc,I7d9d3cf1 into main

* changes:
  Strip all spans from AOD RON text
  Don't crash when (un)folding with AOD RONs on
  Fix some Flexi-only AOD RON glitches
parents daee6413 ad2a2509
Loading
Loading
Loading
Loading
+27 −11
Original line number Diff line number Diff line
@@ -109,6 +109,12 @@ constructor(
                            }
                            if (isShadeLayoutWide && !isBypassEnabled) {
                                with(notificationSection) {
                                    Box(modifier = Modifier.fillMaxHeight()) {
                                        AodPromotedNotificationArea(
                                            modifier =
                                                Modifier.fillMaxWidth(0.5f)
                                                    .align(alignment = Alignment.TopStart)
                                        )
                                        Notifications(
                                            areNotificationsVisible = areNotificationsVisible,
                                            isShadeLayoutWide = true,
@@ -121,6 +127,7 @@ constructor(
                                    }
                                }
                            }
                        }

                        val aodIconPadding: Dp =
                            dimensionResource(R.dimen.below_clock_padding_start_icons)
@@ -142,9 +149,18 @@ constructor(
                                }
                            } else {
                                Column {
                                    if (!isShadeLayoutWide) {
                                        AodPromotedNotificationArea()
                                    }
                                    AodNotificationIcons(
                                        modifier = Modifier.padding(start = aodIconPadding)
                                        modifier =
                                            Modifier.padding(
                                                top =
                                                    dimensionResource(
                                                        R.dimen.keyguard_status_view_bottom_margin
                                                    ),
                                                start = aodIconPadding,
                                            )
                                    )
                                }
                            }
+10 −5
Original line number Diff line number Diff line
@@ -42,6 +42,10 @@ constructor(
) : KeyguardSection() {
    var view: ComposeView? = null

    init {
        logger.logSectionCreated(this)
    }

    override fun addViews(constraintLayout: ConstraintLayout) {
        if (!PromotedNotificationUiAod.isEnabled) {
            return
@@ -56,7 +60,7 @@ constructor(
                constraintLayout.addView(this)
            }

        logger.logSectionAddedViews()
        logger.logSectionAddedViews(this)
    }

    override fun bindData(constraintLayout: ConstraintLayout) {
@@ -68,7 +72,7 @@ constructor(

        // Do nothing; the binding happens in the AODPromotedNotification Composable.

        logger.logSectionBoundData()
        logger.logSectionBoundData(this)
    }

    override fun applyConstraints(constraintSet: ConstraintSet) {
@@ -76,7 +80,8 @@ constructor(
            return
        }

        checkNotNull(view)
        // view may have been created by a different instance of the section (!), and we don't
        // actually *need* it to set constraints, so don't check for it here.

        constraintSet.apply {
            val isShadeLayoutWide = shadeInteractor.isShadeLayoutWide.value
@@ -90,7 +95,7 @@ constructor(
            constrainHeight(viewId, ConstraintSet.WRAP_CONTENT)
        }

        logger.logSectionAppliedConstraints()
        logger.logSectionAppliedConstraints(this)
    }

    override fun removeViews(constraintLayout: ConstraintLayout) {
@@ -102,7 +107,7 @@ constructor(

        view = null

        logger.logSectionRemovedViews()
        logger.logSectionRemovedViews(this)
    }

    companion object {
+5 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        setTextViewColor(view, color)

        if (text != null && text.isNotEmpty()) {
            view?.text = text
            view?.text = text.toSkeleton()
            view?.visibility = VISIBLE
        } else {
            view?.text = ""
@@ -364,6 +364,10 @@ private class AODPromotedNotificationViewUpdater(root: View) {
    }
}

private fun CharSequence.toSkeleton(): CharSequence {
    return this.toString()
}

private enum class AodPromotedNotificationColor(colorUInt: UInt) {
    Background(0x00000000u),
    PrimaryText(0xFFFFFFFFu),
+34 −8
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.notification.promoted

import androidx.constraintlayout.widget.ConstraintSet
import com.android.systemui.keyguard.ui.view.layout.sections.AodPromotedNotificationSection
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel.ERROR
import com.android.systemui.log.core.LogLevel.INFO
@@ -25,6 +26,7 @@ import com.android.systemui.statusbar.notification.logKey
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import javax.inject.Inject

@OptIn(ExperimentalStdlibApi::class)
class PromotedNotificationLogger
@Inject
constructor(@PromotedNotificationLog private val buffer: LogBuffer) {
@@ -92,20 +94,44 @@ constructor(@PromotedNotificationLog private val buffer: LogBuffer) {
        buffer.log(AOD_VIEW_BINDER_TAG, INFO, "binder unbound notification")
    }

    fun logSectionAddedViews() {
        buffer.log(AOD_SECTION_TAG, INFO, "section added views")
    fun logSectionCreated(section: AodPromotedNotificationSection) {
        buffer.log(
            AOD_SECTION_TAG,
            INFO,
            "section ${System.identityHashCode(section).toHexString()} created",
        )
    }

    fun logSectionBoundData() {
        buffer.log(AOD_SECTION_TAG, INFO, "section bound data")
    fun logSectionAddedViews(section: AodPromotedNotificationSection) {
        buffer.log(
            AOD_SECTION_TAG,
            INFO,
            "section ${System.identityHashCode(section).toHexString()} added views",
        )
    }

    fun logSectionAppliedConstraints() {
        buffer.log(AOD_SECTION_TAG, INFO, "section applied constraints")
    fun logSectionBoundData(section: AodPromotedNotificationSection) {
        buffer.log(
            AOD_SECTION_TAG,
            INFO,
            "section ${System.identityHashCode(section).toHexString()} bound data",
        )
    }

    fun logSectionRemovedViews() {
        buffer.log(AOD_SECTION_TAG, INFO, "section removed views")
    fun logSectionAppliedConstraints(section: AodPromotedNotificationSection) {
        buffer.log(
            AOD_SECTION_TAG,
            INFO,
            "section ${System.identityHashCode(section).toHexString()} applied constraints",
        )
    }

    fun logSectionRemovedViews(section: AodPromotedNotificationSection) {
        buffer.log(
            AOD_SECTION_TAG,
            INFO,
            "section ${System.identityHashCode(section).toHexString()} removed views",
        )
    }
}