Modify renderComplicationToBitmap to render at full size

This patch makes renderComplicationToBitmap render the complication
based on the display's size rather than the size of the headless client.

Test: Manual testing
Bug: 285867701
Change-Id: I6575ba3575e5e835a86fe6abcb988d43fde0e2cd
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
index 307c757..3847531 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
@@ -122,7 +122,8 @@
 
     /**
      * Renders the [androidx.wear.watchface.ComplicationSlot] to a shared memory backed [Bitmap]
-     * with the given settings.
+     * with the given settings. The complication will be rendered at the same scale as it would be
+     * when the watch face is full screen.
      *
      * @param complicationSlotId The id of the complication to render
      * @param renderParameters The [RenderParameters] to draw with
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt
index 9d57c46..fd8f179 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt
@@ -22,6 +22,7 @@
 import android.content.ComponentName
 import android.content.Context
 import android.content.Intent
+import android.content.res.Resources
 import android.graphics.Bitmap
 import android.graphics.Canvas
 import android.graphics.Color
@@ -1247,7 +1248,16 @@
                     )
                 }
 
-                val bounds = it.computeBounds(renderer.screenBounds)
+                // Compute the bounds of the complication based on the display rather than
+                // the headless renderer (which may be smaller).
+                val bounds = it.computeBounds(
+                    Rect(
+                    0,
+                    0,
+                        Resources.getSystem().displayMetrics.widthPixels,
+                        Resources.getSystem().displayMetrics.heightPixels
+                    )
+                )
 
                 var prevData: ComplicationData? = null
                 val screenshotComplicationData = params.complicationData