trusty: tui: assume device params apply rotation to dimensions am: 86ad857973 am: 4d594ac72d
Original change: https://android-review.googlesource.com/c/trusty/app/confirmationui/+/2646621
Change-Id: Iffca0f1d3068ccb3d01614f9f3946a247fcebab2
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/src/trusty_confirmation_ui.cpp b/src/trusty_confirmation_ui.cpp
index 997abd7..f2c35d3 100644
--- a/src/trusty_confirmation_ui.cpp
+++ b/src/trusty_confirmation_ui.cpp
@@ -146,23 +146,26 @@
return ResponseCode::UIError;
}
- /* Check the layout context and framebuffer agree on dimensions,
- * ignoring rotation for now.
- */
- if (*ctx->getParam<RightEdgeOfScreen>() != pxs(fb_info_[i].width) ||
- *ctx->getParam<BottomOfScreen>() != pxs(fb_info_[i].height)) {
+ /* Get rotated frame buffer dimensions */
+ uint32_t rwidth, rheight;
+
+ if (fb_info_[i].rotation == TTUI_DRAW_ROTATION_90 ||
+ fb_info_[i].rotation == TTUI_DRAW_ROTATION_270) {
+ rwidth = fb_info_[i].height;
+ rheight = fb_info_[i].width;
+ } else {
+ rwidth = fb_info_[i].width;
+ rheight = fb_info_[i].height;
+ }
+
+ /* Check the layout context and framebuffer agree on dimensions */
+ if (*ctx->getParam<RightEdgeOfScreen>() != pxs(rwidth) ||
+ *ctx->getParam<BottomOfScreen>() != pxs(rheight)) {
TLOGE("Framebuffer dimensions do not match panel configuration\n");
stop();
return ResponseCode::UIError;
}
- /* Swap dimensions if rotating */
- if (fb_info_[i].rotation == TTUI_DRAW_ROTATION_90 ||
- fb_info_[i].rotation == TTUI_DRAW_ROTATION_270) {
- ctx->setParam<RightEdgeOfScreen>(pxs(fb_info_[i].height));
- ctx->setParam<BottomOfScreen>(pxs(fb_info_[i].width));
- }
-
/* Set the colours */
updateColorScheme(&ctx.value(), inverted_);
diff --git a/test/main.cpp b/test/main.cpp
index 82968e2..094a8fc 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -133,7 +133,7 @@
"pixel coverage %" PRIu32 ".%" PRIu32 "%%",
coverage / 10, coverage % 10);
- trusty_unittest_printf("[ DATA ] %" PRIu32 "x%" PRIu32
+ trusty_unittest_printf("[ DATA ] %" PRIu32 " x %" PRIu32
", %" PRIu32
" plot calls = approx %" PRIu32
".%" PRIu32 "%% coverage\n",