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

Commit 16771098 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Add windowing mode to task snapshot." into pi-dev

parents 2897fd31 a4fa8d5b
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -2102,18 +2102,24 @@ public class ActivityManager {
        private final GraphicBuffer mSnapshot;
        private final int mOrientation;
        private final Rect mContentInsets;
        // Whether this snapshot is a down-sampled version of the full resolution, used mainly for
        // low-ram devices
        private final boolean mReducedResolution;
        // Whether or not the snapshot is a real snapshot or an app-theme generated snapshot due to
        // the task having a secure window or having previews disabled
        private final boolean mIsRealSnapshot;
        private final int mWindowingMode;
        private final float mScale;

        public TaskSnapshot(GraphicBuffer snapshot, int orientation, Rect contentInsets,
                boolean reducedResolution, float scale, boolean isRealSnapshot) {
                boolean reducedResolution, float scale, boolean isRealSnapshot, int windowingMode) {
            mSnapshot = snapshot;
            mOrientation = orientation;
            mContentInsets = new Rect(contentInsets);
            mReducedResolution = reducedResolution;
            mScale = scale;
            mIsRealSnapshot = isRealSnapshot;
            mWindowingMode = windowingMode;
        }

        private TaskSnapshot(Parcel source) {
@@ -2123,6 +2129,7 @@ public class ActivityManager {
            mReducedResolution = source.readBoolean();
            mScale = source.readFloat();
            mIsRealSnapshot = source.readBoolean();
            mWindowingMode = source.readInt();
        }

        /**
@@ -2162,6 +2169,13 @@ public class ActivityManager {
            return mIsRealSnapshot;
        }

        /**
         * @return The windowing mode of the task when this snapshot was taken.
         */
        public int getWindowingMode() {
            return mWindowingMode;
        }

        /**
         * @return The scale this snapshot was taken in.
         */
@@ -2182,14 +2196,18 @@ public class ActivityManager {
            dest.writeBoolean(mReducedResolution);
            dest.writeFloat(mScale);
            dest.writeBoolean(mIsRealSnapshot);
            dest.writeInt(mWindowingMode);
        }

        @Override
        public String toString() {
            return "TaskSnapshot{mSnapshot=" + mSnapshot + " mOrientation=" + mOrientation
            final int width = mSnapshot != null ? mSnapshot.getWidth() : 0;
            final int height = mSnapshot != null ? mSnapshot.getHeight() : 0;
            return "TaskSnapshot{mSnapshot=" + mSnapshot + " (" + width + "x" + height + ")"
                    + " mOrientation=" + mOrientation
                    + " mContentInsets=" + mContentInsets.toShortString()
                    + " mReducedResolution=" + mReducedResolution + " mScale=" + mScale
                    + " mIsRealSnapshot=" + mIsRealSnapshot;
                    + " mIsRealSnapshot=" + mIsRealSnapshot + " mWindowingMode=" + mWindowingMode;
        }

        public static final Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.shared.recents.model;

import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_UNDEFINED;

import android.app.ActivityManager.TaskSnapshot;
import android.graphics.Bitmap;
@@ -32,6 +33,7 @@ public class ThumbnailData {
    public Rect insets;
    public boolean reducedResolution;
    public boolean isRealSnapshot;
    public int windowingMode;
    public float scale;

    public ThumbnailData() {
@@ -41,6 +43,7 @@ public class ThumbnailData {
        reducedResolution = false;
        scale = 1f;
        isRealSnapshot = true;
        windowingMode = WINDOWING_MODE_UNDEFINED;
    }

    public ThumbnailData(TaskSnapshot snapshot) {
@@ -50,5 +53,6 @@ public class ThumbnailData {
        reducedResolution = snapshot.isReducedResolution();
        scale = snapshot.getScale();
        isRealSnapshot = snapshot.isRealSnapshot();
        windowingMode = snapshot.getWindowingMode();
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -60,6 +60,16 @@ public class WindowManagerWrapper {

    public static final int ACTIVITY_TYPE_STANDARD = WindowConfiguration.ACTIVITY_TYPE_STANDARD;

    public static final int WINDOWING_MODE_UNDEFINED = WindowConfiguration.WINDOWING_MODE_UNDEFINED;
    public static final int WINDOWING_MODE_FULLSCREEN =
            WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
    public static final int WINDOWING_MODE_PINNED = WindowConfiguration.WINDOWING_MODE_PINNED;
    public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY =
            WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
    public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY =
            WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
    public static final int WINDOWING_MODE_FREEFORM = WindowConfiguration.WINDOWING_MODE_FREEFORM;

    private static final WindowManagerWrapper sInstance = new WindowManagerWrapper();

    public static WindowManagerWrapper getInstance() {
+1 −0
Original line number Diff line number Diff line
@@ -28,4 +28,5 @@
     int32 inset_right = 4;
     int32 inset_bottom = 5;
     bool is_real_snapshot = 6;
     int32 windowing_mode = 7;
 }
 No newline at end of file
+3 −4
Original line number Diff line number Diff line
@@ -273,9 +273,8 @@ class TaskSnapshotController {
            return null;
        }
        return new TaskSnapshot(buffer, top.getConfiguration().orientation,
                getInsets(mainWindow),
                isLowRamDevice /* reduced */, scaleFraction /* scale */,
                true /* isRealSnapshot */);
                getInsets(mainWindow), isLowRamDevice /* reduced */, scaleFraction /* scale */,
                true /* isRealSnapshot */, task.getWindowingMode());
    }

    private boolean shouldDisableSnapshots() {
@@ -365,7 +364,7 @@ class TaskSnapshotController {
        return new TaskSnapshot(hwBitmap.createGraphicBufferHandle(),
                topChild.getConfiguration().orientation, mainWindow.mStableInsets,
                ActivityManager.isLowRamDeviceStatic() /* reduced */, 1.0f /* scale */,
                false /* isRealSnapshot */);
                false /* isRealSnapshot */, task.getWindowingMode());
    }

    /**
Loading