Not show size compat UI when task is not visible

Before, when a size compat task was hidden, the size compat UI might
still be showing. Now, remove the UI when the task is no longer visible.

Bug: 193069342
Test: manually verify the size compat button is not showing in recents
Change-Id: Ia17a97f5e7a9af497d8da16b31bb5169dd502d53
This commit is contained in:
Chris Li
2021-07-07 14:56:37 -07:00
parent de1a9f66e8
commit adb92508c0
3 changed files with 16 additions and 2 deletions

View File

@@ -361,7 +361,8 @@ public class TaskInfo {
&& (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds()
.equals(that.configuration.windowConfiguration.getBounds()))
&& (!topActivityInSizeCompat || configuration.getLayoutDirection()
== that.configuration.getLayoutDirection());
== that.configuration.getLayoutDirection())
&& (!topActivityInSizeCompat || isVisible == that.isVisible);
}
/**

View File

@@ -497,7 +497,7 @@ public class ShellTaskOrganizer extends TaskOrganizer {
// The task is vanished or doesn't support size compat UI, notify to remove size compat UI
// on this Task if there is any.
if (taskListener == null || !taskListener.supportSizeCompatUI()
|| !taskInfo.topActivityInSizeCompat) {
|| !taskInfo.topActivityInSizeCompat || !taskInfo.isVisible) {
mSizeCompatUI.onSizeCompatInfoChanged(taskInfo.displayId, taskInfo.taskId,
null /* taskConfig */, null /* sizeCompatActivity*/,
null /* taskListener */);

View File

@@ -306,10 +306,23 @@ public class ShellTaskOrganizerTests {
taskInfo2.displayId = taskInfo1.displayId;
taskInfo2.topActivityToken = taskInfo1.topActivityToken;
taskInfo2.topActivityInSizeCompat = true;
taskInfo2.isVisible = true;
mOrganizer.onTaskInfoChanged(taskInfo2);
verify(mSizeCompatUI).onSizeCompatInfoChanged(taskInfo1.displayId, taskInfo1.taskId,
taskInfo1.configuration, taskInfo1.topActivityToken, taskListener);
// Not show size compat UI if task is not visible.
clearInvocations(mSizeCompatUI);
final RunningTaskInfo taskInfo3 =
createTaskInfo(taskInfo1.taskId, taskInfo1.getWindowingMode());
taskInfo3.displayId = taskInfo1.displayId;
taskInfo3.topActivityToken = taskInfo1.topActivityToken;
taskInfo3.topActivityInSizeCompat = true;
taskInfo3.isVisible = false;
mOrganizer.onTaskInfoChanged(taskInfo3);
verify(mSizeCompatUI).onSizeCompatInfoChanged(taskInfo1.displayId, taskInfo1.taskId,
null /* taskConfig */, null /* sizeCompatActivity*/, null /* taskListener */);
clearInvocations(mSizeCompatUI);
mOrganizer.onTaskVanished(taskInfo1);
verify(mSizeCompatUI).onSizeCompatInfoChanged(taskInfo1.displayId, taskInfo1.taskId,