From 5dfd939d418db13e424aba0fdee4577a7da648b8 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 2 Nov 2022 17:39:40 +0000 Subject: [PATCH] Reland "Add logs for InvariantDeviceProfile.getDeviceProfile" This reverts commit b065b4b05a141e3a1172f3be7f85f619b2d00756. Bug: 253338238 Change-Id: Idea32130c8ec535f848ded5cff0269d97ea064e2 Test: manual --- .../android/launcher3/InvariantDeviceProfile.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index dacbe9254a..b5f46c4f87 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; @@ -632,6 +634,18 @@ public class InvariantDeviceProfile { float screenHeight = config.screenHeightDp * res.getDisplayMetrics().density; 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/253338238", "getDeviceProfile -" + + "\nconfig: " + config + + "\ndisplayMetrics: " + res.getDisplayMetrics() + + "\nrotation: " + rotation + + "\n" + stringWriter, + new Exception()); + } return getBestMatch(screenWidth, screenHeight, rotation); }