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

Commit 2cf6ad83 authored by Winson Chung's avatar Winson Chung
Browse files

Removing references to hidden classes in shared lib.

- Restructure assist data receiver to not extend hidden interface
- Restructure animation spec to not use hidden spec class
- Restructure transitions apis to not use graphic buffers
- Remove direct arguments which use hidden animation start listener
- Renaming some methods to be a bit more clear
- Expose AnimateableViewBounds and task stack listener

Bug: 67510855
Test: Sysui and quickstep still build and work
Change-Id: Ibc471c34a725daa3149765960ae0731996ceb854
parent 1c5aefff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class RecentsTaskLoadPlan {
        Resources res = mContext.getResources();

        // Iterate through each of the tasks and load them according to the load conditions.
        ArrayList<Task> tasks = mStack.getStackTasks();
        ArrayList<Task> tasks = mStack.getTasks();
        int taskCount = tasks.size();
        for (int i = 0; i < taskCount; i++) {
            Task task = tasks.get(i);
+9 −17
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.shared.recents.model;
import android.content.ComponentName;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.SparseArray;

import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.utilities.AnimationProps;
@@ -92,7 +91,7 @@ public class TaskStack {
            boolean dismissRecentsIfAllRemoved) {
        if (mStackTaskList.contains(t)) {
            mStackTaskList.remove(t);
            Task newFrontMostTask = getStackFrontMostTask();
            Task newFrontMostTask = getFrontMostTask();
            if (mCb != null) {
                // Notify that a task has been removed
                mCb.onStackTaskRemoved(this, t, newFrontMostTask, animation,
@@ -183,7 +182,7 @@ public class TaskStack {

        // Only callback for the removed tasks after the stack has updated
        int removedTaskCount = removedTasks.size();
        Task newFrontMostTask = getStackFrontMostTask();
        Task newFrontMostTask = getFrontMostTask();
        for (int i = 0; i < removedTaskCount; i++) {
            mCb.onStackTaskRemoved(this, removedTasks.get(i), newFrontMostTask,
                    AnimationProps.IMMEDIATE, false /* fromDockGesture */,
@@ -205,7 +204,7 @@ public class TaskStack {
    /**
     * Gets the front-most task in the stack.
     */
    public Task getStackFrontMostTask() {
    public Task getFrontMostTask() {
        ArrayList<Task> stackTasks = mStackTaskList.getTasks();
        if (stackTasks.isEmpty()) {
            return null;
@@ -228,7 +227,7 @@ public class TaskStack {
    /**
     * Returns the set of "active" (non-historical) tasks in the stack that have been used recently.
     */
    public ArrayList<Task> getStackTasks() {
    public ArrayList<Task> getTasks() {
        return mStackTaskList.getTasks();
    }

@@ -248,13 +247,6 @@ public class TaskStack {
        return mStackTaskList.size();
    }

    /**
     * Returns the number of stack tasks.
     */
    public int getStackTaskCount() {
        return mStackTaskList.size();
    }

    /**
     * Returns the task in stack tasks which is the launch target.
     */
@@ -298,7 +290,7 @@ public class TaskStack {
        if (nextLaunchTarget != null) {
            return nextLaunchTarget;
        }
        return getStackTasks().get(getTaskCount() - 1);
        return getTasks().get(getTaskCount() - 1);
    }

    private Task getNextLaunchTargetRaw() {
@@ -306,15 +298,15 @@ public class TaskStack {
        if (taskCount == 0) {
            return null;
        }
        int launchTaskIndex = indexOfStackTask(getLaunchTarget());
        int launchTaskIndex = indexOfTask(getLaunchTarget());
        if (launchTaskIndex != -1 && launchTaskIndex > 0) {
            return getStackTasks().get(launchTaskIndex - 1);
            return getTasks().get(launchTaskIndex - 1);
        }
        return null;
    }

    /** Returns the index of this task in this current task stack */
    public int indexOfStackTask(Task t) {
    public int indexOfTask(Task t) {
        return mStackTaskList.indexOf(t);
    }

+24 −12
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.systemui.recents.views;
package com.android.systemui.shared.recents.view;

import android.graphics.Outline;
import android.graphics.Rect;
@@ -24,22 +24,19 @@ import android.view.ViewOutlineProvider;

import com.android.systemui.shared.recents.utilities.Utilities;

/* An outline provider that has a clip and outline that can be animated. */
/**
 * An outline provider that has a clip and outline that can be animated.
 */
public class AnimateableViewBounds extends ViewOutlineProvider {

    private static final float MIN_ALPHA = 0.1f;
    private static final float MAX_ALPHA = 0.8f;

    protected View mSourceView;
    @ViewDebug.ExportedProperty(category="recents")
    protected Rect mClipRect = new Rect();
    @ViewDebug.ExportedProperty(category="recents")
    protected Rect mClipBounds = new Rect();
    @ViewDebug.ExportedProperty(category="recents")
    protected Rect mLastClipBounds = new Rect();
    @ViewDebug.ExportedProperty(category="recents")
    protected int mCornerRadius;
    @ViewDebug.ExportedProperty(category="recents")
    protected float mAlpha = 1f;

    public AnimateableViewBounds(View source, int cornerRadius) {
@@ -73,7 +70,7 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
    /**
     * Sets the view outline alpha.
     */
    void setAlpha(float alpha) {
    public void setAlpha(float alpha) {
        if (Float.compare(alpha, mAlpha) != 0) {
            mAlpha = alpha;
            // TODO, If both clip and alpha change in the same frame, only invalidate once
@@ -88,28 +85,43 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
        return mAlpha;
    }

    /** Sets the top clip. */
    /**
     * Sets the top clip.
     */
    public void setClipTop(int top) {
        mClipRect.top = top;
        updateClipBounds();
    }

    /** Returns the top clip. */
    /**
     * @return the top clip.
     */
    public int getClipTop() {
        return mClipRect.top;
    }

    /** Sets the bottom clip. */
    /**
     * Sets the bottom clip.
     */
    public void setClipBottom(int bottom) {
        mClipRect.bottom = bottom;
        updateClipBounds();
    }

    /** Returns the bottom clip. */
    /**
     * @return the bottom clip.
     */
    public int getClipBottom() {
        return mClipRect.bottom;
    }

    /**
     * @return the clip bounds.
     */
    public Rect getClipBounds() {
        return mClipBounds;
    }

    protected void updateClipBounds() {
        mClipBounds.set(Math.max(0, mClipRect.left), Math.max(0, mClipRect.top),
                mSourceView.getWidth() - Math.max(0, mClipRect.right),
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.systemui.shared.recents.view;

import android.graphics.Bitmap;
import android.graphics.Rect;
import android.view.AppTransitionAnimationSpec;

/**
 * Wraps the internal app transition animation spec.
 */
public class AppTransitionAnimationSpecCompat {

    private int mTaskId;
    private Bitmap mBuffer;
    private Rect mRect;

    public AppTransitionAnimationSpecCompat(int taskId, Bitmap buffer, Rect rect) {
        mTaskId = taskId;
        mBuffer = buffer;
        mRect = rect;
    }

    public AppTransitionAnimationSpec toAppTransitionAnimationSpec() {
        return new AppTransitionAnimationSpec(mTaskId,
                mBuffer != null ? mBuffer.createGraphicBufferHandle() : null, mRect);
    }
}
+8 −6
Original line number Diff line number Diff line
@@ -32,10 +32,10 @@ import java.util.concurrent.FutureTask;
public abstract class AppTransitionAnimationSpecsFuture {

    private final Handler mHandler;
    private FutureTask<List<AppTransitionAnimationSpec>> mComposeTask = new FutureTask<>(
            new Callable<List<AppTransitionAnimationSpec>>() {
    private FutureTask<List<AppTransitionAnimationSpecCompat>> mComposeTask = new FutureTask<>(
            new Callable<List<AppTransitionAnimationSpecCompat>>() {
                @Override
                public List<AppTransitionAnimationSpec> call() throws Exception {
                public List<AppTransitionAnimationSpecCompat> call() throws Exception {
                    return composeSpecs();
                }
            });
@@ -48,13 +48,15 @@ public abstract class AppTransitionAnimationSpecsFuture {
                if (!mComposeTask.isDone()) {
                    mHandler.post(mComposeTask);
                }
                List<AppTransitionAnimationSpec> specs = mComposeTask.get();
                List<AppTransitionAnimationSpecCompat> specs = mComposeTask.get();
                if (specs == null) {
                    return null;
                }

                AppTransitionAnimationSpec[] arr = new AppTransitionAnimationSpec[specs.size()];
                specs.toArray(arr);
                for (int i = 0; i < specs.size(); i++) {
                    arr[i] = specs.get(i).toAppTransitionAnimationSpec();
                }
                return arr;
            } catch (Exception e) {
                return null;
@@ -83,5 +85,5 @@ public abstract class AppTransitionAnimationSpecsFuture {
        mComposeTask.run();
    }

    public abstract List<AppTransitionAnimationSpec> composeSpecs();
    public abstract List<AppTransitionAnimationSpecCompat> composeSpecs();
}
Loading