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

Commit 250608a5 authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Separating the stack vs the historical tasks.

- Adding a notion of session to the stack.  If the history is enabled,
  the stack will now be constrained to show either tasks that were last 
  active in a window of time, or a minimum number of tasks.
- Giving the history button the full space above the stack so that it 
  looks more balanced.

Change-Id: If7b647349e8bb164ae86fd6dba3f7e974257eb5b
parent 5ac33e19
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/recents_history_button_height"
    android:layout_height="match_parent"
    android:gravity="start|center_vertical"
    android:text="@string/recents_show_history_button_label"
    android:textSize="14sp"
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ public final class Prefs {
    @StringDef({
        Key.OVERVIEW_SEARCH_APP_WIDGET_ID,
        Key.OVERVIEW_SEARCH_APP_WIDGET_PACKAGE,
        Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME,
        Key.DEBUG_MODE_ENABLED,
        Key.HOTSPOT_TILE_LAST_USED,
        Key.COLOR_INVERSION_TILE_LAST_USED,
@@ -46,6 +47,7 @@ public final class Prefs {
    public @interface Key {
        String OVERVIEW_SEARCH_APP_WIDGET_ID = "searchAppWidgetId";
        String OVERVIEW_SEARCH_APP_WIDGET_PACKAGE = "searchAppWidgetPackage";
        String OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME = "OverviewLastStackTaskActiveTime";
        String DEBUG_MODE_ENABLED = "debugModeEnabled";
        String HOTSPOT_TILE_LAST_USED = "HotspotTileLastUsed";
        String COLOR_INVERSION_TILE_LAST_USED = "ColorInversionTileLastUsed";
+3 −6
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -202,14 +201,12 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD

        TaskStack stack = plan.getTaskStack();
        launchState.launchedWithNoRecentTasks = !plan.hasTasks();
        if (!launchState.launchedWithNoRecentTasks) {
        mRecentsView.setTaskStack(stack);
        }

        // Mark the task that is the launch target
        int launchTaskIndexInStack = 0;
        if (launchState.launchedToTaskId != -1) {
            ArrayList<Task> tasks = stack.getTasks();
            ArrayList<Task> tasks = stack.getStackTasks();
            int taskCount = tasks.size();
            for (int j = 0; j < taskCount; j++) {
                Task t = tasks.get(j);
@@ -261,7 +258,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
            MetricsLogger.count(this, "overview_source_home", 1);
        }
        // Keep track of the total stack task count
        int taskCount = stack.getTaskCount();
        int taskCount = stack.getStackTaskCount();
        MetricsLogger.histogram(this, "overview_task_count", taskCount);
    }

+8 −8
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
            sInstanceLoadPlan.preloadRawTasks(topTaskHome.value);
            loader.preloadTasks(sInstanceLoadPlan, topTaskHome.value);
            TaskStack stack = sInstanceLoadPlan.getTaskStack();
            if (stack.getTaskCount() > 0) {
            if (stack.getStackTaskCount() > 0) {
                // We try and draw the thumbnail transition bitmap in parallel before
                // toggle/show recents is called
                preCacheThumbnailTransitionBitmapAsync(topTask, stack, mDummyStackView);
@@ -415,7 +415,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        TaskStack focusedStack = plan.getTaskStack();

        // Return early if there are no tasks in the focused stack
        if (focusedStack == null || focusedStack.getTaskCount() == 0) return;
        if (focusedStack == null || focusedStack.getStackTaskCount() == 0) return;

        ActivityManager.RunningTaskInfo runningTask = ssp.getTopMostTask();
        // Return early if there is no running task
@@ -423,7 +423,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements

        // Find the task in the recents list
        boolean isTopTaskHome = SystemServicesProxy.isHomeStack(runningTask.stackId);
        ArrayList<Task> tasks = focusedStack.getTasks();
        ArrayList<Task> tasks = focusedStack.getStackTasks();
        Task toTask = null;
        ActivityOptions launchOpts = null;
        int taskCount = tasks.size();
@@ -467,7 +467,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        TaskStack focusedStack = plan.getTaskStack();

        // Return early if there are no tasks in the focused stack
        if (focusedStack == null || focusedStack.getTaskCount() == 0) return;
        if (focusedStack == null || focusedStack.getStackTaskCount() == 0) return;

        ActivityManager.RunningTaskInfo runningTask = ssp.getTopMostTask();
        // Return early if there is no running task (can't determine affiliated tasks in this case)
@@ -476,7 +476,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        if (SystemServicesProxy.isHomeStack(runningTask.stackId)) return;

        // Find the task in the recents list
        ArrayList<Task> tasks = focusedStack.getTasks();
        ArrayList<Task> tasks = focusedStack.getStackTasks();
        Task toTask = null;
        ActivityOptions launchOpts = null;
        int taskCount = tasks.size();
@@ -685,7 +685,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        if (topTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
            ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>();
            stackView.getScroller().setStackScrollToInitialState();
            ArrayList<Task> tasks = stack.getTasks();
            ArrayList<Task> tasks = stack.getStackTasks();
            for (int i = tasks.size() - 1; i >= 0; i--) {
                Task task = tasks.get(i);
                if (SystemServicesProxy.isFreeformStack(task.key.stackId)) {
@@ -741,7 +741,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
            TaskStackView stackView, int runningTaskId, Task runningTaskOut) {
        // Find the running task in the TaskStack
        Task task = null;
        ArrayList<Task> tasks = stack.getTasks();
        ArrayList<Task> tasks = stack.getStackTasks();
        if (runningTaskId != -1) {
            // Otherwise, try and find the task with the
            int taskCount = tasks.size();
@@ -827,7 +827,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
            return;
        }

        boolean hasRecentTasks = stack.getTaskCount() > 0;
        boolean hasRecentTasks = stack.getStackTaskCount() > 0;
        boolean useThumbnailTransition = (topTask != null) && !isTopTaskHome && hasRecentTasks;

        if (useThumbnailTransition) {
+2 −2
Original line number Diff line number Diff line
@@ -115,9 +115,8 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd
    private LayoutInflater mLayoutInflater;
    private final List<Row> mRows = new ArrayList<>();

    public RecentsHistoryAdapter(Context context, TaskStack stack) {
    public RecentsHistoryAdapter(Context context) {
        mLayoutInflater = LayoutInflater.from(context);
        updateTasks(context, stack.getTasks());
    }

    /**
@@ -144,6 +143,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd
            }
            mRows.add(new TaskRow(task));
        }
        notifyDataSetChanged();
    }

    @Override
Loading