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

Commit 65c851e6 authored by Winson's avatar Winson
Browse files

Fixing several regressions with affiliated tasks.

- Now that we are sorting tasks for freeform and history, ensure that
  the affiliated tasks have a useful active time (based on the task
  they are affiliated with) for sorting
- Fix issue with the initial stack and focus state not taking the
  launch task into account due to the launchTask flag not being set
  until the activity was started (now set in RecentsTaskLoadPlan)
- Fixing issue with affiliated tasks not being launched from the stack
  due to the animation trigger not firing when the action button is
  already hidden/visible
- Fixing issue with title text being occasionally hidden (something we
  only need for freeform tasks)
- Tweaking the launch/enter animations for tasks occluded affiliated
  tasks

Bug: 26685208

Change-Id: I0f6e9dbf8deec2e4fc15364e686367cc0f57b41f
parent 8aa99594
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -147,6 +147,9 @@
    <!-- The duration for animating the task decorations in after transitioning from an app. -->
    <integer name="recents_task_enter_from_app_duration">200</integer>

    <!-- The duration for animating the task decorations in after transitioning from an app. -->
    <integer name="recents_task_enter_from_affiliated_app_duration">125</integer>

    <!-- The duration for animating the task decorations out before transitioning to an app. -->
    <integer name="recents_task_exit_to_app_duration">125</integer>

+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@
    <dimen name="recents_task_view_highlight">1dp</dimen>

    <!-- The amount to offset when animating into an affiliate group. -->
    <dimen name="recents_task_view_affiliate_group_enter_offset">64dp</dimen>
    <dimen name="recents_task_view_affiliate_group_enter_offset">32dp</dimen>

    <!-- The height of a task view bar. -->
    <dimen name="recents_task_bar_height">56dp</dimen>
+7 −17
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        RecentsConfiguration config = Recents.getConfiguration();
        RecentsActivityLaunchState launchState = config.getLaunchState();
        if (!plan.hasTasks()) {
            loader.preloadTasks(plan, launchState.launchedFromHome);
            loader.preloadTasks(plan, -1, launchState.launchedFromHome);
        }
        RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
        loadOpts.runningTaskId = launchState.launchedToTaskId;
@@ -192,24 +192,14 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        loader.loadTasks(this, plan, loadOpts);

        TaskStack stack = plan.getTaskStack();
        ArrayList<Task> tasks = stack.getStackTasks();
        int taskCount = stack.getTaskCount();
        mRecentsView.setTaskStack(stack);

        // Mark the task that is the launch target
        int launchTaskIndexInStack = 0;
        if (launchState.launchedToTaskId != -1) {
            for (int j = 0; j < taskCount; j++) {
                Task t = tasks.get(j);
                if (t.key.id == launchState.launchedToTaskId) {
                    t.isLaunchTarget = true;
                    launchTaskIndexInStack = tasks.size() - j - 1;
                    break;
                }
            }
        }

        // Animate the SystemUI scrims into view
        Task launchTarget = stack.getLaunchTarget();
        int taskCount = stack.getTaskCount();
        int launchTaskIndexInStack = launchTarget != null
                ? stack.indexOfStackTask(launchTarget)
                : 0;
        boolean hasStatusBarScrim = taskCount > 0;
        boolean animateStatusBarScrim = launchState.launchedFromHome;
        boolean hasNavBarScrim = (taskCount > 0) && !config.hasTransposedNavBar;
@@ -527,7 +517,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
            launchOpts.loadThumbnails = false;
            launchOpts.onlyLoadForCache = true;
            RecentsTaskLoadPlan loadPlan = loader.createLoadPlan(this);
            loader.preloadTasks(loadPlan, false);
            loader.preloadTasks(loadPlan, -1, false);
            loader.loadTasks(this, loadPlan, launchOpts);
            EventBus.getDefault().send(new TaskStackUpdatedEvent(loadPlan.getTaskStack()));
        }
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ public class RecentsDebugFlags implements TunerService.Tunable {
        public static final boolean EnableSearchBar = false;
        // This disables the bitmap and icon caches
        public static final boolean DisableBackgroundCache = false;
        // Enables the task affiliations
        public static final boolean EnableAffiliatedTaskGroups = true;
        // Enables the simulated task affiliations
        public static final boolean EnableSimulatedTaskGroups = false;
        // Defines the number of mock task affiliations per group
+13 −24
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements

                // Load the next task only if we aren't svelte
                RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
                loader.preloadTasks(plan, true);
                loader.preloadTasks(plan, -1, true /* isTopTaskHome */);
                RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
                // This callback is made when a new activity is launched and the old one is paused
                // so ignore the current activity and try and preload the thumbnail for the
@@ -198,7 +198,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        // We can use a new plan since the caches will be the same.
        RecentsTaskLoader loader = Recents.getTaskLoader();
        RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
        loader.preloadTasks(plan, true /* isTopTaskHome */);
        loader.preloadTasks(plan, -1, true /* isTopTaskHome */);
        RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
        launchOpts.numVisibleTasks = loader.getIconCacheSize();
        launchOpts.numVisibleTaskThumbnails = loader.getThumbnailCacheSize();
@@ -370,7 +370,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        sInstanceLoadPlan = loader.createLoadPlan(mContext);
        if (topTask != null && !ssp.isRecentsTopMost(topTask, topTaskHome)) {
            sInstanceLoadPlan.preloadRawTasks(topTaskHome.value);
            loader.preloadTasks(sInstanceLoadPlan, topTaskHome.value);
            loader.preloadTasks(sInstanceLoadPlan, topTask.id, topTaskHome.value);
            TaskStack stack = sInstanceLoadPlan.getTaskStack();
            if (stack.getTaskCount() > 0) {
                // We try and draw the thumbnail transition bitmap in parallel before
@@ -399,7 +399,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        SystemServicesProxy ssp = Recents.getSystemServices();
        RecentsTaskLoader loader = Recents.getTaskLoader();
        RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
        loader.preloadTasks(plan, true /* isTopTaskHome */);
        loader.preloadTasks(plan, -1, true /* isTopTaskHome */);
        TaskStack focusedStack = plan.getTaskStack();

        // Return early if there are no tasks in the focused stack
@@ -451,7 +451,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        SystemServicesProxy ssp = Recents.getSystemServices();
        RecentsTaskLoader loader = Recents.getTaskLoader();
        RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
        loader.preloadTasks(plan, true /* isTopTaskHome */);
        loader.preloadTasks(plan, -1, true /* isTopTaskHome */);
        TaskStack focusedStack = plan.getTaskStack();

        // Return early if there are no tasks in the focused stack
@@ -756,29 +756,18 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
    private TaskViewTransform getThumbnailTransitionTransform(TaskStack stack,
            TaskStackView stackView, int runningTaskId, Task runningTaskOut) {
        // Find the running task in the TaskStack
        Task task = null;
        ArrayList<Task> tasks = stack.getStackTasks();
        if (runningTaskId != -1) {
            // Otherwise, try and find the task with the
            int taskCount = tasks.size();
            for (int i = taskCount - 1; i >= 0; i--) {
                Task t = tasks.get(i);
                if (t.key.id == runningTaskId) {
                    task = t;
                    runningTaskOut.copyFrom(t);
                    break;
                }
            }
        }
        if (task == null) {
        Task launchTask = stack.getLaunchTarget();
        if (launchTask != null) {
            runningTaskOut.copyFrom(launchTask);
        } else {
            // If no task is specified or we can not find the task just use the front most one
            task = tasks.get(tasks.size() - 1);
            runningTaskOut.copyFrom(task);
            launchTask = stack.getStackFrontMostTask();
            runningTaskOut.copyFrom(launchTask);
        }

        // Get the transform for the running task
        stackView.getScroller().setStackScrollToInitialState();
        mTmpTransform = stackView.getStackAlgorithm().getStackTransform(task,
        mTmpTransform = stackView.getStackAlgorithm().getStackTransform(launchTask,
                stackView.getScroller().getStackScroll(), mTmpTransform, null);
        return mTmpTransform;
    }
@@ -826,7 +815,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
            sInstanceLoadPlan = loader.createLoadPlan(mContext);
        }
        if (mReloadTasks || mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) {
            loader.preloadTasks(sInstanceLoadPlan, isTopTaskHome);
            loader.preloadTasks(sInstanceLoadPlan, topTask.id, isTopTaskHome);
        }
        TaskStack stack = sInstanceLoadPlan.getTaskStack();

Loading