From 825dd5d1c68f1bb34540edbf464fa6ac600d0e0d Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Wed, 22 Jun 2022 17:33:23 +0200 Subject: [PATCH] Increase the max size of emulated displays This CL incrases the max display size that can be emulated. The previous logic would only allow a size that is maximum 2x bigger than the host device emulating the display. For screenshot diff testing, we need to emulate big devices (like Lenovo P12 Pro) on small devices/emulators, so we need to increase this maximum size. Bug: 230832101 Test: Manual Change-Id: I4b6b871b75a638a1c818931c5c8970873d886cf3 --- .../core/java/com/android/server/wm/DisplayContent.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index ad3b8ee119d31..96d9d66ab8678 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -2941,9 +2941,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Set some sort of reasonable bounds on the size of the display that we will try // to emulate. final int minSize = 200; - final int maxScale = 2; - width = Math.min(Math.max(width, minSize), mInitialDisplayWidth * maxScale); - height = Math.min(Math.max(height, minSize), mInitialDisplayHeight * maxScale); + final int maxScale = 3; + final int maxSize = Math.max(mInitialDisplayWidth, mInitialDisplayHeight) * maxScale; + width = Math.min(Math.max(width, minSize), maxSize); + height = Math.min(Math.max(height, minSize), maxSize); } Slog.i(TAG_WM, "Using new display size: " + width + "x" + height);