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

Commit f1fbd77c authored by Winson Chung's avatar Winson Chung
Browse files

Use Task last active time to ensure we don't reload items for the cache.

Change-Id: I29206de0453f5d7d1370b27a27ef6d3594eff8e7
parent 8e548f70
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -651,6 +651,12 @@ public class ActivityManager {
         */
        public int userId;

        /**
         * The last time this task was active.
         * @hide
         */
        public long lastActiveTime;

        /**
         * The recent activity values for the highest activity in the stack to have set the values.
         * {@link Activity#setTaskDescription(android.app.ActivityManager.TaskDescription)}.
@@ -688,6 +694,7 @@ public class ActivityManager {
            }
            dest.writeInt(stackId);
            dest.writeInt(userId);
            dest.writeLong(lastActiveTime);
        }

        public void readFromParcel(Parcel source) {
@@ -700,6 +707,7 @@ public class ActivityManager {
                    TaskDescription.CREATOR.createFromParcel(source) : null;
            stackId = source.readInt();
            userId = source.readInt();
            lastActiveTime = source.readLong();
        }

        public static final Creator<RecentTaskInfo> CREATOR
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.ViewStub;
import com.android.systemui.R;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.SpaceNode;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.FullscreenTransitionOverlayView;
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.recents;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import com.android.systemui.recents.model.RecentsTaskLoader;

/** Our special app widget host for the Search widget */
public class RecentsAppWidgetHost extends AppWidgetHost {
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.TaskStackView;
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recents.model;

import android.graphics.Bitmap;

/**
 * The Bitmap LRU cache.
 */
class BitmapLruCache extends KeyStoreLruCache<Bitmap> {
    public BitmapLruCache(int cacheSize) {
        super(cacheSize);
    }

    @Override
    protected int computeSize(Bitmap b) {
        // The cache size will be measured in kilobytes rather than number of items
        return b.getAllocationByteCount() / 1024;
    }
}
 No newline at end of file
Loading