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

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

Merge changes I65fc1f65,Ibc6f5c67,I368ab47d into main

* changes:
  Explicitly hide conversation (call) icon in AOD RONs
  Don't show title twice in AOD RONs
  Add local debug flag to make AODPromotedNotificationViewModel dump content
parents 51290d7d 360155af
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -160,6 +160,8 @@ private class AODPromotedNotificationViewUpdater(root: View) {
    private var chronometerStub: ViewStub? = root.findViewById(R.id.chronometer)
    private var chronometer: Chronometer? = null
    private val closeButton: View? = root.findViewById(R.id.close_button)
    private val conversationIconContainer: View? =
        root.findViewById(R.id.conversation_icon_container)
    private val conversationText: TextView? = root.findViewById(R.id.conversation_text)
    private val expandButton: NotificationExpandButton? = root.findViewById(R.id.expand_button)
    private val headerText: TextView? = root.findViewById(R.id.header_text)
@@ -191,6 +193,7 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        alternateExpandTarget?.visibility = GONE
        bigPicture?.visibility = GONE
        closeButton?.visibility = GONE
        conversationIconContainer?.visibility = GONE
        expandButton?.visibility = GONE
        leftIcon?.visibility = GONE
        notificationProgressEndIcon?.visibility = GONE
@@ -221,7 +224,7 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        textView: ImageFloatingTextView? = null,
        showOldProgress: Boolean = true,
    ) {
        updateHeader(content)
        updateHeader(content, hideTitle = true)

        updateTitle(title, content)
        updateText(textView ?: text, content)
@@ -282,19 +285,27 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        }
    }

    private fun updateHeader(content: PromotedNotificationContentModel) {
    private fun updateHeader(
        content: PromotedNotificationContentModel,
        hideTitle: Boolean = false,
    ) {
        updateAppName(content)
        updateTextView(headerTextSecondary, content.subText)
        if (!hideTitle) {
            updateTitle(headerText, content)
        }
        updateTimeAndChronometer(content)

        updateHeaderDividers(content)
        updateHeaderDividers(content, hideTitle = hideTitle)
    }

    private fun updateHeaderDividers(content: PromotedNotificationContentModel) {
    private fun updateHeaderDividers(
        content: PromotedNotificationContentModel,
        hideTitle: Boolean = false,
    ) {
        val hasAppName = content.appName != null && content.appName.isNotEmpty()
        val hasSubText = content.subText != null && content.subText.isNotEmpty()
        val hasHeader = content.title != null && content.title.isNotEmpty()
        val hasHeader = content.title != null && content.title.isNotEmpty() && !hideTitle
        val hasTimeOrChronometer = content.time != null

        val hasTextBeforeSubText = hasAppName
@@ -314,14 +325,16 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        updateTitle(conversationText, content)
        updateAppName(content)
        updateTimeAndChronometer(content)

        updateConversationHeaderDividers(content)
        updateConversationHeaderDividers(content, hideTitle = true)

        updateTextView(verificationText, content.verificationText)
    }

    private fun updateConversationHeaderDividers(content: PromotedNotificationContentModel) {
        val hasTitle = content.title != null
    private fun updateConversationHeaderDividers(
        content: PromotedNotificationContentModel,
        hideTitle: Boolean = false,
    ) {
        val hasTitle = content.title != null && !hideTitle
        val hasAppName = content.appName != null
        val hasTimeOrChronometer = content.time != null
        val hasVerification = content.verificationIcon != null || content.verificationText != null
+13 −5
Original line number Diff line number Diff line
@@ -53,12 +53,17 @@ constructor(
    ) {
    private val hydrator = Hydrator("AODPromotedNotificationViewModel.hydrator")

    private val contentFlow =
        interactor.content.let {
            if (DUMP_CONTENT) {
                it.dumpWhileCollecting("content")
            } else {
                it
            }
        }

    val content: PromotedNotificationContentModel? by
        hydrator.hydratedStateOf(
            traceName = "content",
            initialValue = null,
            source = interactor.content,
        )
        hydrator.hydratedStateOf(traceName = "content", initialValue = null, source = contentFlow)

    private val audiblyAlertedIconVisibleUntil: Flow<Duration?> =
        interactor.content
@@ -107,5 +112,8 @@ constructor(

    companion object {
        private val RECENTLY_ALERTED_THRESHOLD = 30.seconds

        // For local debugging only!
        private const val DUMP_CONTENT = false
    }
}