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

Commit 7f4cd5de authored by Hyunyoung Song's avatar Hyunyoung Song Committed by android-build-merger
Browse files

Merging ub-launcher3-qt-dev, build 5456758

am: cec2df62

Change-Id: I349da99bbd5daef75c84c81b635c837d2fef346f
parents 3202c717 cec2df62
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ public final class TaskActionController {
     * @param viewHolder the task view holder to launch
     */
    public void launchTask(TaskHolder viewHolder) {
        if (viewHolder.getTask() == null) {
            return;
        }
        TaskItemView itemView = (TaskItemView) (viewHolder.itemView);
        View v = itemView.getThumbnailView();
        int left = 0;
@@ -60,6 +63,9 @@ public final class TaskActionController {
     * @param viewHolder the task view holder to remove
     */
    public void removeTask(TaskHolder viewHolder) {
        if (viewHolder.getTask() == null) {
            return;
        }
        int position = viewHolder.getAdapterPosition();
        Task task = viewHolder.getTask();
        ActivityManagerWrapper.getInstance().removeTask(task.key.id);
+32 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.quickstep.views.TaskItemView;
import com.android.systemui.shared.recents.model.Task;

import java.util.List;
import java.util.Objects;

/**
 * Recycler view adapter that dynamically inflates and binds {@link TaskHolder} instances with the
@@ -40,6 +41,7 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
    private final TaskListLoader mLoader;
    private final ArrayMap<Integer, TaskItemView> mTaskIdToViewMap = new ArrayMap<>();
    private TaskActionController mTaskActionController;
    private boolean mIsShowingLoadingUi;

    public TaskAdapter(@NonNull TaskListLoader loader) {
        mLoader = loader;
@@ -49,6 +51,18 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
        mTaskActionController = taskActionController;
    }

    /**
     * Sets all positions in the task adapter to loading views, binding new views if necessary.
     * This changes the task adapter's view of the data, so the appropriate notify events should be
     * called in addition to this method to reflect the changes.
     *
     * @param isShowingLoadingUi true to bind loading task views to all positions, false to return
     *                           to the real data
     */
    public void setIsShowingLoadingUi(boolean isShowingLoadingUi) {
        mIsShowingLoadingUi = isShowingLoadingUi;
    }

    /**
     * Get task item view for a given task id if it's attached to the view.
     *
@@ -70,6 +84,10 @@ public final class TaskAdapter extends Adapter<TaskHolder> {

    @Override
    public void onBindViewHolder(TaskHolder holder, int position) {
        if (mIsShowingLoadingUi) {
            holder.bindEmptyUi();
            return;
        }
        List<Task> tasks = mLoader.getCurrentTaskList();
        if (position >= tasks.size()) {
            // Task list has updated.
@@ -79,13 +97,13 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
        holder.bindTask(task);
        mLoader.loadTaskIconAndLabel(task, () -> {
            // Ensure holder still has the same task.
            if (task.equals(holder.getTask())) {
            if (Objects.equals(task, holder.getTask())) {
                holder.getTaskItemView().setIcon(task.icon);
                holder.getTaskItemView().setLabel(task.titleDescription);
            }
        });
        mLoader.loadTaskThumbnail(task, () -> {
            if (task.equals(holder.getTask())) {
            if (Objects.equals(task, holder.getTask())) {
                holder.getTaskItemView().setThumbnail(task.thumbnail.thumbnail);
            }
        });
@@ -93,16 +111,27 @@ public final class TaskAdapter extends Adapter<TaskHolder> {

    @Override
    public void onViewAttachedToWindow(@NonNull TaskHolder holder) {
        if (holder.getTask() == null) {
            return;
        }
        mTaskIdToViewMap.put(holder.getTask().key.id, (TaskItemView) holder.itemView);
    }

    @Override
    public void onViewDetachedFromWindow(@NonNull TaskHolder holder) {
        if (holder.getTask() == null) {
            return;
        }
        mTaskIdToViewMap.remove(holder.getTask().key.id);
    }

    @Override
    public int getItemCount() {
        if (mIsShowingLoadingUi) {
            // Show loading version of all items.
            return MAX_TASKS_TO_DISPLAY;
        } else {
            return Math.min(mLoader.getCurrentTaskList().size(), MAX_TASKS_TO_DISPLAY);
        }
    }
}
+15 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 */
package com.android.quickstep;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;

import com.android.quickstep.views.TaskItemView;
@@ -50,11 +50,23 @@ public final class TaskHolder extends ViewHolder {
    }

    /**
     * Gets the task currently bound to this view
     * Bind a generic empty UI to the holder to make it clear that the item is loading/unbound and
     * should not be expected to react to user input.
     */
    public void bindEmptyUi() {
        mTask = null;
        // TODO: Set the task view to a loading, empty UI.
        // Temporarily using the one below for visual confirmation but should be swapped out to new
        // UI later.
        mTaskItemView.resetTaskItemView();
    }

    /**
     * Gets the task currently bound to this view. May be null if task holder is in a loading state.
     *
     * @return the current task
     */
    public @NonNull Task getTask() {
    public @Nullable Task getTask() {
        return mTask;
    }
}
+13 −3
Original line number Diff line number Diff line
@@ -67,17 +67,27 @@ public final class TaskListLoader {
        return Collections.unmodifiableList(mTaskList);
    }

    /**
     * Whether or not the loader needs to load data to be up to date. This can return true if the
     * task list is already up to date OR there is already a load in progress for the task list to
     * become up to date.
     *
     * @return true if already up to date or load in progress, false otherwise
     */
    public boolean needsToLoad() {
        return !mRecentsModel.isTaskListValid(mTaskListChangeId);
    }

    /**
     * Fetches the most recent tasks and updates the task list asynchronously. This call does not
     * provide guarantees the task content (icon, thumbnail, label) are loaded but will fill in
     * what it has. May run the callback immediately if there have been no changes in the task
     * list.
     * list since the start of the last load.
     *
     * @param onLoadedCallback callback to run when task list is loaded
     */
    public void loadTaskList(@Nullable Consumer<ArrayList<Task>> onLoadedCallback) {
        if (mRecentsModel.isTaskListValid(mTaskListChangeId)) {
            // Current task list is already up to date. No need to update.
        if (!needsToLoad()) {
            if (onLoadedCallback != null) {
                onLoadedCallback.accept(mTaskList);
            }
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ public class TouchInteractionService extends Service {
            ISystemUiProxy iSystemUiProxy = ISystemUiProxy.Stub
                    .asInterface(bundle.getBinder(KEY_EXTRA_SYSUI_PROXY));
            mRecentsModel.setSystemUiProxy(iSystemUiProxy);
            mRecentsModel.onInitializeSystemUI(bundle);
        }

        @Override
Loading