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

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

Merge changes I72139780,I8e563654

* changes:
  Fix screenshotting with includeDecor=true in multi-window
  Implement restoring & correct caching of snapshots
parents c1398d17 bfbd9dc9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -209,7 +209,8 @@ class BackgroundTaskLoader implements Runnable {
                            // When svelte, we trim the memory to just the visible thumbnails when
                            // leaving, so don't thrash the cache as the user scrolls (just load
                            // them from scratch each time)
                            if (config.svelteLevel < RecentsConfiguration.SVELTE_LIMIT_CACHE) {
                            if (config.svelteLevel < RecentsConfiguration.SVELTE_LIMIT_CACHE
                                    && !ActivityManager.ENABLE_TASK_SNAPSHOTS) {
                                mThumbnailCache.put(t.key, cachedThumbnailData);
                            }
                        }
@@ -553,7 +554,9 @@ public class RecentsTaskLoader {
                // Load the thumbnail from the system
                thumbnailData = ssp.getTaskThumbnail(taskKey.id);
                if (thumbnailData.thumbnail != null) {
                    if (!ActivityManager.ENABLE_TASK_SNAPSHOTS) {
                        mThumbnailCache.put(taskKey, thumbnailData);
                    }
                    return thumbnailData.thumbnail;
                }
            }
+4 −2
Original line number Diff line number Diff line
@@ -9765,15 +9765,17 @@ public class ActivityManagerService extends IActivityManager.Stub
        enforceCallingPermission(READ_FRAME_BUFFER, "getTaskSnapshot()");
        final long ident = Binder.clearCallingIdentity();
        try {
            final TaskRecord task;
            synchronized (this) {
                final TaskRecord task = mStackSupervisor.anyTaskForIdLocked(
                task = mStackSupervisor.anyTaskForIdLocked(
                        taskId, !RESTORE_FROM_RECENTS, INVALID_STACK_ID);
                if (task == null) {
                    Slog.w(TAG, "getTaskSnapshot: taskId=" + taskId + " not found");
                    return null;
                }
                return task.getSnapshot();
            }
            // Don't call this while holding the lock as this operation might hit the disk.
            return task.getSnapshot();
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
+8 −5
Original line number Diff line number Diff line
@@ -583,11 +583,14 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
        mWindowContainerController.cancelThumbnailTransition();
    }

    public TaskSnapshot getSnapshot() {
        if (mWindowContainerController == null) {
            return null;
        }
        return mWindowContainerController.getSnapshot();
    /**
     * DO NOT HOLD THE ACTIVITY MANAGER LOCK WHEN CALLING THIS METHOD!
     */
    TaskSnapshot getSnapshot() {

        // TODO: Move this to {@link TaskWindowContainerController} once recent tasks are more
        // synchronized between AM and WM.
        return mService.mWindowManager.getTaskSnapshot(taskId, userId);
    }

    void touchActiveTime() {
+1 −1
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ public class AppWindowContainerController

    private boolean createSnapshot() {
        final TaskSnapshot snapshot = mService.mTaskSnapshotController.getSnapshot(
                mContainer.mTask);
                mContainer.mTask.mTaskId, mContainer.mTask.mUserId, false /* restoreFromDisk */);

        if (snapshot == null) {
            return false;
+5 −4
Original line number Diff line number Diff line
@@ -2259,10 +2259,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                }

                // Don't include wallpaper in bounds calculation
                if (includeDecor && !stackBounds.isEmpty()) {
                    frame.set(stackBounds);
                } else if (includeDecor) {
                    mutableIncludeFullDisplay.value = true;
                if (!mutableIncludeFullDisplay.value && includeDecor) {
                    final TaskStack stack = w.getStack();
                    if (stack != null) {
                        stack.getBounds(frame);
                    }
                } else if (!mutableIncludeFullDisplay.value && !w.mIsWallpaper) {
                    final Rect wf = w.mFrame;
                    final Rect cr = w.mContentInsets;
Loading