Log device profile changes in perfetto traces
This is needed to easily spot unwanted DeviceProfile changes in perfetto traces, as each one causes many new inflation and slows down the ui thread considerably.
Test: recorded trace with this log
Bug: 258214245
Change-Id: I805d56d4dfe1c08d7f28215c0462d01fcaece84e
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index f124940..e4f3614 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -1679,6 +1679,16 @@
writer.println(prefix + pxToDpStr("getCellLayoutWidth()", getCellLayoutWidth()));
}
+ /** Returns a reduced representation of this DeviceProfile. */
+ public String toSmallString() {
+ return "isTablet:" + isTablet + ", "
+ + "isMultiDisplay:" + isMultiDisplay + ", "
+ + "widthPx:" + widthPx + ", "
+ + "heightPx:" + heightPx + ", "
+ + "insets:" + mInsets + ", "
+ + "rotationHint:" + rotationHint;
+ }
+
private static Context getContext(Context c, Info info, int orientation, WindowBounds bounds) {
Configuration config = new Configuration(c.getResources().getConfiguration());
config.orientation = orientation;