Merge "Intercept back press for TaskView"
This commit is contained in:
@@ -237,7 +237,7 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
// so go ahead and hide the task entirely
|
||||
updateTaskVisibility();
|
||||
}
|
||||
|
||||
mTaskOrganizer.setInterceptBackPressedOnTaskRoot(mTaskToken, true);
|
||||
// TODO: Synchronize show with the resize
|
||||
onLocationChanged();
|
||||
setResizeBackgroundColor(taskInfo.taskDescription.getBackgroundColor());
|
||||
@@ -257,6 +257,7 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
if (mListener != null) {
|
||||
mListener.onTaskRemovalStarted(taskInfo.taskId);
|
||||
}
|
||||
mTaskOrganizer.setInterceptBackPressedOnTaskRoot(mTaskToken, false);
|
||||
|
||||
// Unparent the task when this surface is destroyed
|
||||
mTransaction.reparent(mTaskLeash, null).apply();
|
||||
|
||||
@@ -215,4 +215,19 @@ public class TaskViewTest extends ShellTestCase {
|
||||
|
||||
verify(mViewListener).onBackPressedOnTaskRoot(eq(mTaskInfo.taskId));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetOnBackPressedOnTaskRoot() {
|
||||
mTaskView.onTaskAppeared(mTaskInfo, mLeash);
|
||||
verify(mOrganizer).setInterceptBackPressedOnTaskRoot(eq(mTaskInfo.token), eq(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsetOnBackPressedOnTaskRoot() {
|
||||
mTaskView.onTaskAppeared(mTaskInfo, mLeash);
|
||||
verify(mOrganizer).setInterceptBackPressedOnTaskRoot(eq(mTaskInfo.token), eq(true));
|
||||
|
||||
mTaskView.onTaskVanished(mTaskInfo);
|
||||
verify(mOrganizer).setInterceptBackPressedOnTaskRoot(eq(mTaskInfo.token), eq(false));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user