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

Commit 6ca72767 authored by Jeff DeCew's avatar Jeff DeCew Committed by Ibrahim Yilmaz
Browse files

[RONs] Use InflationIdentity for AOD composition

AOD Skeleton does not change when font size is changed. That's why we want to add font size related configuration changes to our Composition key to use last inflated notification.
Fixes: 421965928
Flag: com.android.systemui.ui_rich_ongoing_aod_skeleton_bg_inflation
Test: Manual. Post a ron and change font size. Verification video will be added

Change-Id: I6e075302568914f4d0b85a956d0d20d3bb7f1110
parent 7649dfa9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@
    <item type="id" name="brightness_dialog_slider" />

    <item type="id" name="aod_promoted_notification_view_updater_tag" />
    <item type="id" name="aod_promoted_notification_inflation_identity" />

    <!-- id for the composable battery meter (see UnifiedBattery.kt) -->
    <item type="id" name="battery_meter_composable_view" />
+2 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ fun AODPromotedNotification(
            Log.w(TAG, "not displaying promoted notif with ineligible style on AOD")
            return
        }
        key(content.identity) {
        key(content.identity, notificationView.getTag(viewInflationIdentity)) {
            AODPromotedNotificationView(
                notificationViewFactory = { notificationView },
                content = content,
@@ -812,5 +812,6 @@ private fun scaledFontHeight(@DimenRes dimenId: Int): Dp {
}

private val viewUpdaterTagId = systemuiR.id.aod_promoted_notification_view_updater_tag
private val viewInflationIdentity = systemuiR.id.aod_promoted_notification_inflation_identity

private const val TAG = "AODPromotedNotification"
+12 −0
Original line number Diff line number Diff line
@@ -259,6 +259,8 @@ constructor(
        return contentBuilder.build()
    }

    private data class InflationIdentity(val layout: Int, val density: Float, val scale: Float)

    private fun inflateNotificationView(
        contentBuilder: PromotedNotificationContentModel.Builder,
        systemUiContext: Context,
@@ -275,6 +277,16 @@ constructor(
        trace("AODPromotedNotification#inflate") {
            contentBuilder.notificationView =
                LayoutInflater.from(systemUiContext).inflate(res, /* root= */ null)
            val inflationIdentity =
                InflationIdentity(
                    layout = res,
                    density = systemUiContext.resources.displayMetrics.density,
                    scale = systemUiContext.resources.displayMetrics.scaledDensity,
                )
            contentBuilder.notificationView?.setTag(
                com.android.systemui.res.R.id.aod_promoted_notification_inflation_identity,
                inflationIdentity,
            )
        }
    }