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

Commit c9d94823 authored by chaviw's avatar chaviw
Browse files

Fix SnapshotTaskTests

Added enable_recents_screenshot to windowmanager proto file so it can be
used when testing. The test will read back this value to make sure it's
set before proceeding with taking a task snapshot.

Test: atest SnapshotTaskTests --rerun-until-failure 10
Fixes: 219750596
Change-Id: Ibd66c5f4d46e5102dbe0763f7b0b7cbcfb90a798
parent f85808dd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -382,6 +382,7 @@ message ActivityRecordProto {
    optional bool in_size_compat_mode = 32;
    optional float min_aspect_ratio = 33;
    optional bool provides_max_bounds = 34;
    optional bool enable_recents_screenshot = 35;
}

/* represents WindowToken */
+5 −3
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ import static com.android.server.wm.ActivityRecordProto.ALL_DRAWN;
import static com.android.server.wm.ActivityRecordProto.APP_STOPPED;
import static com.android.server.wm.ActivityRecordProto.CLIENT_VISIBLE;
import static com.android.server.wm.ActivityRecordProto.DEFER_HIDING_CLIENT;
import static com.android.server.wm.ActivityRecordProto.ENABLE_RECENTS_SCREENSHOT;
import static com.android.server.wm.ActivityRecordProto.FILLS_PARENT;
import static com.android.server.wm.ActivityRecordProto.FRONT_OF_TASK;
import static com.android.server.wm.ActivityRecordProto.IN_SIZE_COMPAT_MODE;
@@ -771,7 +772,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    // Last visibility state we reported to the app token.
    boolean reportedVisible;

    boolean mEnablePreviewScreenshots = true;
    boolean mEnableRecentsScreenshot = true;

    // Information about an application starting window if displayed.
    // Note: these are de-referenced before the starting window animates away.
@@ -5151,7 +5152,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     * See {@link Activity#setRecentsScreenshotEnabled}.
     */
    void setRecentsScreenshotEnabled(boolean enabled) {
        mEnablePreviewScreenshots = enabled;
        mEnableRecentsScreenshot = enabled;
    }

    /**
@@ -5163,7 +5164,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *         screenshot.
     */
    boolean shouldUseAppThemeSnapshot() {
        return !mEnablePreviewScreenshots || forAllWindows(WindowState::isSecureLocked,
        return !mEnableRecentsScreenshot || forAllWindows(WindowState::isSecureLocked,
                true /* topToBottom */);
    }

@@ -9184,6 +9185,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // Only record if max bounds sandboxing is applied, if the caller has the necessary
        // permission to access the device configs.
        proto.write(PROVIDES_MAX_BOUNDS, providesMaxBounds());
        proto.write(ENABLE_RECENTS_SCREENSHOT, mEnableRecentsScreenshot);
    }

    @Override