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

Commit d96cc6e2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I2ff9bd44,I946e681e,If72df07b

* changes:
  Handle content insets for snapshots
  Always remove starting window in performShow
  Initial implementation of snapshots
parents fcd0a8bd e2c77f90
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -27,3 +27,5 @@ parcelable ActivityManager.RunningTaskInfo;
parcelable ActivityManager.StackInfo;
/** @hide */
parcelable ActivityManager.TaskThumbnail;
/** @hide */
parcelable ActivityManager.TaskSnapshot;
 No newline at end of file
+67 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.annotation.TestApi;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.GraphicBuffer;
import android.graphics.Matrix;
import android.graphics.Point;
import android.os.BatteryStats;
@@ -125,6 +126,16 @@ public class ActivityManager {

    private static volatile boolean sSystemReady = false;

    /**
     * System property to enable task snapshots.
     * @hide
     */
    public final static boolean ENABLE_TASK_SNAPSHOTS;

    static {
        ENABLE_TASK_SNAPSHOTS = SystemProperties.getBoolean("persist.enable_task_snapshots", false);
    }

    static final class UidObserver extends IUidObserver.Stub {
        final OnUidImportanceListener mListener;

@@ -2115,6 +2126,62 @@ public class ActivityManager {
        };
    }

    /**
     * Represents a task snapshot.
     * @hide
     */
    public static class TaskSnapshot implements Parcelable {

        private final GraphicBuffer mSnapshot;
        private final int mOrientation;
        private final Rect mContentInsets;

        public TaskSnapshot(GraphicBuffer snapshot, int orientation, Rect contentInsets) {
            mSnapshot = snapshot;
            mOrientation = orientation;
            mContentInsets = new Rect(contentInsets);
        }

        private TaskSnapshot(Parcel source) {
            mSnapshot = source.readParcelable(null /* classLoader */);
            mOrientation = source.readInt();
            mContentInsets = source.readParcelable(null /* classLoader */);
        }

        public GraphicBuffer getSnapshot() {
            return mSnapshot;
        }

        public int getOrientation() {
            return mOrientation;
        }

        public Rect getContentInsets() {
            return mContentInsets;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeParcelable(mSnapshot, 0);
            dest.writeInt(mOrientation);
            dest.writeParcelable(mContentInsets, 0);
        }

        public static final Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
            public TaskSnapshot createFromParcel(Parcel source) {
                return new TaskSnapshot(source);
            }
            public TaskSnapshot[] newArray(int size) {
                return new TaskSnapshot[size];
            }
        };
    }

    /** @hide */
    public TaskThumbnail getTaskThumbnail(int id) throws SecurityException {
        try {
+6 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.content.pm.ProviderInfo;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
import android.graphics.Point;
import android.graphics.Rect;
import android.net.Uri;
@@ -596,6 +597,11 @@ interface IActivityManager {
    /** Cancels the thumbnail transitions for the given task. */
    void cancelTaskThumbnailTransition(int taskId);

    /**
     * @return a graphic buffer representing a screenshot of a task
     */
    ActivityManager.TaskSnapshot getTaskSnapshot(int taskId);

    // WARNING: when these transactions are updated, check if they are any callers on the native
    // side. If so, make sure they are using the correct transaction ids and arguments.
    // If a transaction which will also be used on the native side is being inserted, add it
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import android.view.InputDevice;
import android.view.IInputFilter;
import android.view.AppTransitionAnimationSpec;
import android.view.WindowContentFrameStats;
import android.view.WindowManager;

/**
 * System private interface to the window manager.
+2 −1
Original line number Diff line number Diff line
@@ -18,4 +18,5 @@
package android.view;

parcelable WindowManager.LayoutParams;
/** @hide */
parcelable WindowManager.TaskSnapshot;
Loading