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

Commit 0872731a authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge "[RONs] Use InflationIdentity for AOD composition" into main

parents 5e44f848 6ca72767
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,
@@ -815,5 +815,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,
            )
        }
    }