From d3e8cc40b49741af8457985d711e092794d5cc94 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 3 May 2022 17:45:34 +0100 Subject: [PATCH] Add logs for InvariantDeviceProfile.getDeviceProfile Logged Configuration, DisplayMetrics, rotation and DisplayController.Info Bug: 231312158 Test: manual Change-Id: I03ffa80c150b1cb1a31e09ed67026a40cfe97fd2 --- .../launcher3/InvariantDeviceProfile.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 89b177165f..0373eefd09 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -61,6 +61,8 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; @@ -628,8 +630,21 @@ public class InvariantDeviceProfile { float screenWidth = config.screenWidthDp * res.getDisplayMetrics().density; float screenHeight = config.screenHeightDp * res.getDisplayMetrics().density; - return getBestMatch(screenWidth, screenHeight, - WindowManagerProxy.INSTANCE.get(context).getRotation(context)); + int rotation = WindowManagerProxy.INSTANCE.get(context).getRotation(context); + + if (Utilities.IS_DEBUG_DEVICE) { + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + DisplayController.INSTANCE.get(context).dump(printWriter); + printWriter.flush(); + Log.d("b/231312158", "getDeviceProfile -" + + "\nconfig: " + config + + "\ndisplayMetrics: " + res.getDisplayMetrics() + + "\nrotation: " + rotation + + "\n" + stringWriter.toString(), + new Exception()); + } + return getBestMatch(screenWidth, screenHeight, rotation); } /**