Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b45e555 authored by wilsonshih's avatar wilsonshih
Browse files

Persist high-resolution snapshots using lossless compression

The lossless compression approach provides more reliable results
against the HumanEyeMatcher comparison method.

Flag: com.android.window.flags.respect_requested_task_snapshot_resolution
Bug: 438072503
Test: nexus_image_test_platform
Change-Id: I9b736d2a444587b20fe8b82464805f568106981c
parent 2c325801
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm;

import static android.graphics.Bitmap.CompressFormat.JPEG;
import static android.graphics.Bitmap.CompressFormat.PNG;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;

import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -509,7 +510,8 @@ class SnapshotPersistQueue {

            final File lowResFile = mPersistInfoProvider.getLowResolutionBitmapFile(mId, mUserId);
            try (FileOutputStream lowResFos = new FileOutputStream(lowResFile)) {
                lowResBitmap.compress(JPEG, COMPRESS_QUALITY, lowResFos);
                lowResBitmap.compress(Flags.respectRequestedTaskSnapshotResolution() ? PNG : JPEG,
                        COMPRESS_QUALITY, lowResFos);
            } catch (IOException e) {
                Slog.e(TAG, "Unable to open " + lowResFile + " for persisting.", e);
                return false;