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

Commit 36f3f033 authored by Winson Chung's avatar Winson Chung
Browse files

Revert "Fixing issue with old tasks being visible in Overview"

Bug: 28908500

This reverts commit b258f6a4.

Change-Id: I9b3c04358d6ca693ed3fdcd9220af13f81eb704e
parent b258f6a4
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -6332,21 +6332,6 @@ public final class Settings {
         */
        public static final String WEB_ACTION_ENABLED = "web_action_enabled";

        /**
         * The uptime when tasks were last persisted.  This is used to adjust the previous task
         * active times to be relative to the current boot time.
         * @hide
         */
        public static final String TASK_PERSISTER_LAST_WRITE_UPTIME = "task_persister_write_uptime";

        /**
         * Used by Overview to keep track of the last visible task's active time to determine what
         * should tasks be visible.
         * @hide
         */
        public static final String OVERVIEW_LAST_VISIBLE_TASK_ACTIVE_UPTIME =
                "overview_last_visible_task_active_uptime";

        /**
         * This are the settings to be backed up.
         *
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ public final class Prefs {
        Key.QS_WORK_ADDED,
    })
    public @interface Key {
        @Deprecated
        String OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME = "OverviewLastStackTaskActiveTime";
        String DEBUG_MODE_ENABLED = "debugModeEnabled";
        String HOTSPOT_TILE_LAST_USED = "HotspotTileLastUsed";
+0 −15
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
@@ -47,7 +46,6 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.SystemUI;
@@ -252,19 +250,6 @@ public class Recents extends SystemUI
            registerWithSystemUser();
        }
        putComponent(Recents.class, this);

        // Migrate the old stack active time if necessary, otherwise, it will already be managed
        // when the tasks are loaded in the system. See TaskPersister.restoreTasksForUserLocked().
        long lastVisibleTaskActiveTime = Prefs.getLong(mContext,
                Prefs.Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME, -1);
        if (lastVisibleTaskActiveTime != -1) {
            long uptime = SystemClock.elapsedRealtime();
            Settings.Secure.putLongForUser(mContext.getContentResolver(),
                    Settings.Secure.OVERVIEW_LAST_VISIBLE_TASK_ACTIVE_UPTIME,
                    uptime - Math.max(0, System.currentTimeMillis() - lastVisibleTaskActiveTime),
                    processUser);
            Prefs.remove(mContext, Prefs.Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME);
        }
    }

    @Override
+12 −10
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.app.Activity;
import android.app.ActivityOptions;
import android.app.TaskStackBuilder;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -171,6 +170,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
            if (action.equals(Intent.ACTION_SCREEN_OFF)) {
                // When the screen turns off, dismiss Recents to Home
                dismissRecentsToHomeIfVisible(false);
            } else if (action.equals(Intent.ACTION_TIME_CHANGED)) {
                // For the time being, if the time changes, then invalidate the
                // last-stack-active-time, this ensures that we will just show the last N tasks
                // the next time that Recents loads, but prevents really old tasks from showing
                // up if the task time is set forward.
                Prefs.putLong(RecentsActivity.this, Prefs.Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME,
                        0);
            }
        }
    };
@@ -316,6 +322,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        // Register the broadcast receiver to handle messages when the screen is turned off
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(Intent.ACTION_TIME_CHANGED);
        registerReceiver(mSystemBroadcastReceiver, filter);

        getWindow().addPrivateFlags(LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION);
@@ -793,19 +800,14 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        EventBus.getDefault().dump(prefix, writer);
        Recents.getTaskLoader().dump(prefix, writer);

        ContentResolver cr = getContentResolver();
        long lastPersistUptime = Settings.Secure.getLong(cr,
                Settings.Secure.TASK_PERSISTER_LAST_WRITE_UPTIME, 0);
        long lastVisibleTaskActiveUptime = Settings.Secure.getLongForUser(cr,
                Settings.Secure.OVERVIEW_LAST_VISIBLE_TASK_ACTIVE_UPTIME,
                SystemClock.elapsedRealtime(), Recents.getSystemServices().getCurrentUser());

        String id = Integer.toHexString(System.identityHashCode(this));
        long lastStackActiveTime = Prefs.getLong(this,
                Prefs.Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME, -1);

        writer.print(prefix); writer.print(TAG);
        writer.print(" visible="); writer.print(mIsVisible ? "Y" : "N");
        writer.print(" lastPersistUptime="); writer.print(lastPersistUptime);
        writer.print(" lastVisibleTaskActiveUptime="); writer.print(lastVisibleTaskActiveUptime);
        writer.print(" lastStackTaskActiveTime="); writer.print(lastStackActiveTime);
        writer.print(" currentTime="); writer.print(System.currentTimeMillis());
        writer.print(" [0x"); writer.print(id); writer.print("]");
        writer.println();

+1 −6
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
@@ -75,7 +74,6 @@ import android.view.WindowManager.KeyboardShortcutsReceiver;
import android.view.WindowManagerGlobal;
import android.view.accessibility.AccessibilityManager;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.AssistUtils;
import com.android.internal.os.BackgroundThread;
import com.android.systemui.R;
@@ -200,9 +198,6 @@ public class SystemServicesProxy {
     */
    private List<TaskStackListener> mTaskStackListeners = new ArrayList<>();

    /** Test constructor */
    @VisibleForTesting public SystemServicesProxy() {}

    /** Private constructor */
    private SystemServicesProxy(Context context) {
        mAccm = AccessibilityManager.getInstance(context);
@@ -304,7 +299,7 @@ public class SystemServicesProxy {
                rti.baseIntent = new Intent();
                rti.baseIntent.setComponent(cn);
                rti.description = description;
                rti.firstActiveTime = rti.lastActiveTime = SystemClock.elapsedRealtime();
                rti.firstActiveTime = rti.lastActiveTime = i;
                if (i % 2 == 0) {
                    rti.taskDescription = new ActivityManager.TaskDescription(description,
                        Bitmap.createBitmap(mDummyIcon), null,
Loading