Disable reduced scale if reduced scale config is 0
Change reduced scale implementation to toggle on/off based on
config_lowResTaskSnapshotScale=0 instead of ro.config.low_ram=true
Also, only use _reduced.jpg if reduced scale is enabled. Previously,
for task snapshots, [0-9]+_reduced.jpg would be used if reduced scale
was disabled, and [0-9]+.jpg would never be used. This patch swaps that
behavior to make the underlying system more intuitive. Now, if reduced
snapshots are disabled, store the task snapshot in [0-9]+.jpg and never
use [0-9]+_reduced.jpg.
Also, store low-res snapshots at config_lowResTaskSnapshotScale.
Prevously, low-res snapshots were stored at lowResScale * highResScale
Test: TaskSnapshotCacheTest
Test: TaskSnapshotControllerTest
Test: TaskSnapshotPersisterLoaderTest
Test: TaskSnapshotSurfaceTest
Bug: 148099851
Bug: 142063079
Change-Id: I5a0d58766347d875eaec138820323063aa1c2988
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java
index 7a2707b..20d9aff 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java
@@ -25,6 +25,7 @@
import static com.android.server.wm.TaskSnapshotController.SNAPSHOT_MODE_REAL;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -149,7 +150,6 @@
builder.setSystemUiVisibility(systemUiVisibility);
builder.setWindowingMode(windowingMode);
builder.setColorSpace(sRGB);
- builder.setIsLowResolution(true);
builder.setOrientation(orientation);
builder.setContentInsets(contentInsets);
builder.setIsTranslucent(true);
@@ -167,8 +167,9 @@
assertEquals(systemUiVisibility, snapshot.getSystemUiVisibility());
assertEquals(windowingMode, snapshot.getWindowingMode());
assertEquals(sRGB, snapshot.getColorSpace());
- assertTrue(snapshot.isLowResolution());
- assertTrue(builder.isLowResolution());
+ // Snapshots created with the Builder class are always high-res. The only way to get a
+ // low-res snapshot is to load it from the disk in TaskSnapshotLoader.
+ assertFalse(snapshot.isLowResolution());
assertEquals(orientation, snapshot.getOrientation());
assertEquals(contentInsets, snapshot.getContentInsets());
assertTrue(snapshot.isTranslucent());