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

Commit 730f4cce authored by Julia Tuttle's avatar Julia Tuttle
Browse files

[AOD RONs] Don't log unextracted notifs by default

Bug: 406902745
Test: manual
Flag: android.app.ui_rich_ongoing
Change-Id: I12c155c81f83f5a1ad32e37174e940b2e69397f2
parent c8aeb045
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -84,19 +84,25 @@ constructor(
        imageModelProvider: ImageModelProvider,
    ): PromotedNotificationContentModels? {
        if (!PromotedNotificationContentModel.featureFlagEnabled()) {
            if (LOG_NOT_EXTRACTED) {
                logger.logExtractionSkipped(entry, "feature flags disabled")
            }
            return null
        }

        val notification = entry.sbn.notification
        if (notification == null) {
            if (LOG_NOT_EXTRACTED) {
                logger.logExtractionFailed(entry, "entry.sbn.notification is null")
            }
            return null
        }

        // The status bar chips rely on this extractor, so take them into account for promotion.
        if (!isPromotedForStatusBarChip(notification)) {
            if (LOG_NOT_EXTRACTED) {
                logger.logExtractionSkipped(entry, "isPromotedOngoing returned false")
            }
            return null
        }

@@ -374,6 +380,10 @@ constructor(
        // TODO: Create NotificationProgressModel.toSkeleton, or something similar.
        contentBuilder.newProgress = createProgressModel(0xffffffff.toInt(), 0xff000000.toInt())
    }

    companion object {
        private const val LOG_NOT_EXTRACTED = false
    }
}

private fun Notification.getCharSequenceExtraUnlessEmpty(key: String): CharSequence? =