Use shell executor for TaskView
Bug: 161980186 Test: atest TaskViewTest Change-Id: I85764463ada847e2f0c8e82c5744212ee8bb2a9d
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user