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

Commit 2dde2b12 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge changes I7f7a9842,I4c74b269

* changes:
  Implement new thumbnail loading strategy
  Also store reduced resolution screenshots
parents 5c9fb3c5 6f9dbcb7
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -2177,31 +2177,62 @@ public class ActivityManager {
        private final GraphicBuffer mSnapshot;
        private final int mOrientation;
        private final Rect mContentInsets;
        private final boolean mReducedResolution;
        private final float mScale;

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

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

        /**
         * @return The graphic buffer representing the screenshot.
         */
        public GraphicBuffer getSnapshot() {
            return mSnapshot;
        }

        /**
         * @return The screen orientation the screenshot was taken in.
         */
        public int getOrientation() {
            return mOrientation;
        }

        /**
         * @return The system/content insets on the snapshot. These can be clipped off in order to
         *         remove any areas behind system bars in the snapshot.
         */
        public Rect getContentInsets() {
            return mContentInsets;
        }

        /**
         * @return Whether this snapshot is a down-sampled version of the full resolution.
         */
        public boolean isReducedResolution() {
            return mReducedResolution;
        }

        /**
         * @return The scale this snapshot was taken in.
         */
        public float getScale() {
            return mScale;
        }

        @Override
        public int describeContents() {
            return 0;
@@ -2212,12 +2243,15 @@ public class ActivityManager {
            dest.writeParcelable(mSnapshot, 0);
            dest.writeInt(mOrientation);
            dest.writeParcelable(mContentInsets, 0);
            dest.writeBoolean(mReducedResolution);
            dest.writeFloat(mScale);
        }

        @Override
        public String toString() {
            return "TaskSnapshot{mSnapshot=" + mSnapshot + " mOrientation=" + mOrientation
                    + " mContentInsets=" + mContentInsets.toShortString();
                    + " mContentInsets=" + mContentInsets.toShortString()
                    + " mReducedResolution=" + mReducedResolution + " mScale=" + mScale;
        }

        public static final Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
+4 −1
Original line number Diff line number Diff line
@@ -600,9 +600,12 @@ interface IActivityManager {
    void cancelTaskThumbnailTransition(int taskId);

    /**
     * @param taskId the id of the task to retrieve the snapshots for
     * @param reducedResolution if set, if the snapshot needs to be loaded from disk, this will load
     *                          a reduced resolution of it, which is much faster
     * @return a graphic buffer representing a screenshot of a task
     */
    ActivityManager.TaskSnapshot getTaskSnapshot(int taskId);
    ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution);

    void scheduleApplicationInfoChanged(in List<String> packageNames, int userId);
    void setPersistentVrThread(int tid);
+4 −0
Original line number Diff line number Diff line
@@ -726,6 +726,10 @@
    <!-- The alpha to apply to the recents row when it doesn't have focus -->
    <item name="recents_recents_row_dim_alpha" format="float" type="dimen">0.5</item>

    <!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
         loading full resolution screenshots. -->
    <dimen name="recents_fast_fling_velocity">600dp</dimen>

    <!-- The size of the PIP drag-to-dismiss target. -->
    <dimen name="pip_dismiss_target_size">48dp</dimen>

+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.hardware.display.DisplayManager;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -59,6 +60,7 @@ import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.component.ShowUserToastEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.HighResThumbnailLoader;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.CommandQueue;
@@ -184,6 +186,7 @@ public class Recents extends SystemUI
        return sTaskLoader;
    }


    public static SystemServicesProxy getSystemServices() {
        return sSystemServicesProxy;
    }
+3 −0
Original line number Diff line number Diff line
@@ -375,6 +375,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD

        // Notify of the next draw
        mRecentsView.getViewTreeObserver().addOnPreDrawListener(mRecentsDrawnEventListener);

        Recents.getTaskLoader().getHighResThumbnailLoader().setVisible(true);
    }

    @Override
@@ -529,6 +531,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        mReceivedNewIntent = false;
        EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
        MetricsLogger.hidden(this, MetricsEvent.OVERVIEW_ACTIVITY);
        Recents.getTaskLoader().getHighResThumbnailLoader().setVisible(false);

        if (!isChangingConfigurations()) {
            // Workaround for b/22542869, if the RecentsActivity is started again, but without going
Loading