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

Commit c4716ee7 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Correct lossless compression target

The previous change 6b45e555 mistakenly applied lossless compression to
low-resolution snapshots. This fix ensures that compression is
correctly applied to high-resolution snapshots as intended.

Flag: com.android.window.flags.respect_requested_task_snapshot_resolution
Bug: 438072503
Test: nexus_image_test_platform
Change-Id: Ie10e519a7a2ec844ba5b82bea139a5d53b3c89ea
parent 5bb54d37
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -481,7 +481,8 @@ class SnapshotPersistQueue {
            }
            final File file = mPersistInfoProvider.getHighResolutionBitmapFile(mId, mUserId);
            try (FileOutputStream fos = new FileOutputStream(file)) {
                swBitmap.compress(JPEG, COMPRESS_QUALITY, fos);
                swBitmap.compress(Flags.respectRequestedTaskSnapshotResolution() ? PNG : JPEG,
                        COMPRESS_QUALITY, fos);
            } catch (IOException e) {
                Slog.e(TAG, "Unable to open " + file + " for persisting.", e);
                return false;
@@ -510,8 +511,7 @@ class SnapshotPersistQueue {

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