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

Commit a0fdeec6 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Reenable task preloading in recents

Make sure to call the task stack changed listener only when
app visibilities changed. This fixes the problem of too many
callbacks when just focusing another activity.

Bug: 26420341
Change-Id: I55d96ec367f7461be1f3e35bc0d12ae4b050ece0
parent d434dcbf
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -110,9 +110,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements

        /** Preloads the next task */
        public void run() {
            // TODO: Temporarily skip this if multi stack is enabled
            /*
            RecentsConfiguration config = RecentsConfiguration.getInstance();
            RecentsConfiguration config = Recents.getConfiguration();
            if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
                RecentsTaskLoader loader = Recents.getTaskLoader();
                SystemServicesProxy ssp = Recents.getSystemServices();
@@ -134,7 +132,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
                launchOpts.onlyLoadPausedActivities = true;
                loader.loadTasks(mContext, plan, launchOpts);
            }
            */
        }
    }

+7 −2
Original line number Diff line number Diff line
@@ -1179,8 +1179,12 @@ final class ActivityStack {
            prev.cpuTimeAtResume = 0; // reset it
        }

        // Notfiy when the task stack has changed
        // Notify when the task stack has changed, but only if visibilities changed (not just
        // focus).
        if (mStackSupervisor.mAppVisibilitiesChangedSinceLastPause) {
            mService.notifyTaskStackChangedLocked();
            mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = false;
        }
    }

    private void addToStopping(ActivityRecord r) {
@@ -1257,6 +1261,7 @@ final class ActivityStack {
            ActivityContainer container = containers.get(containerNdx);
            container.setVisible(visible);
        }
        mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = true;
    }

    // Find the first visible activity above the passed activity and if it is translucent return it
+6 −0
Original line number Diff line number Diff line
@@ -398,6 +398,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
    }
    private final FindTaskResult mTmpFindTaskResult = new FindTaskResult();

    /**
     * Used to keep track whether app visibilities got changed since the last pause. Useful to
     * determine whether to invoke the task stack change listener after pausing.
     */
    boolean mAppVisibilitiesChangedSinceLastPause;

    /**
     * Description of a request to start a new activity, which has been held
     * due to app switches being disabled.