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

Commit c6eec7e5 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Use shell executor for TaskView"

parents cbf658e4 6673b316
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -210,6 +210,15 @@ public class TaskOrganizer extends WindowOrganizer {
        }
    }

    /**
     * Gets the executor to run callbacks on.
     * @hide
     */
    @NonNull
    public Executor getExecutor() {
        return mExecutor;
    }

    private final ITaskOrganizer mInterface = new ITaskOrganizer.Stub() {
        @Override
        public void addStartingWindow(ActivityManager.RunningTaskInfo taskInfo, IBinder appToken) {
+1 −5
Original line number Diff line number Diff line
@@ -87,16 +87,12 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback,
        super(context, null, 0, 0, true /* disableBackgroundLayer */);

        mTaskOrganizer = organizer;
        mExecutor = organizer.getExecutor();
        setUseAlpha();
        getHolder().addCallback(this);
        mGuard.open("release");
    }

    // TODO: Use TaskOrganizer executor when part of wmshell proper
    public void setExecutor(Executor executor) {
        mExecutor = executor;
    }

    /**
     * Only one listener may be set on the view, throws an exception otherwise.
     */
+0 −6
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.wm.shell.R;
import com.android.wm.shell.TaskView;
import com.android.wm.shell.common.AlphaOptimizedButton;
import com.android.wm.shell.common.HandlerExecutor;
import com.android.wm.shell.common.TriangleShape;

import java.io.FileDescriptor;
@@ -304,11 +303,6 @@ public class BubbleExpandedView extends LinearLayout {
        setLayoutDirection(LAYOUT_DIRECTION_LOCALE);
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mTaskView.setExecutor(new HandlerExecutor(getHandler()));
    }
    /**
     * Initialize {@link BubbleController} and {@link BubbleStackView} here, this method must need
     * to be called after view inflate.
+2 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -96,8 +97,8 @@ public class TaskViewTest extends ShellTestCase {
            return null;
        }).when(mExecutor).execute(any());

        when(mOrganizer.getExecutor()).thenReturn(mExecutor);
        mTaskView = new TaskView(mContext, mOrganizer);
        mTaskView.setExecutor(mExecutor);
        mTaskView.setListener(mViewListener);
    }

@@ -111,7 +112,6 @@ public class TaskViewTest extends ShellTestCase {
    @Test
    public void testSetPendingListener_throwsException() {
        TaskView taskView = new TaskView(mContext, mOrganizer);
        mTaskView.setExecutor(mExecutor);
        taskView.setListener(mViewListener);
        try {
            taskView.setListener(mViewListener);