Merge "Don't report displays that are going to be removed" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5a270bcd66
@@ -1899,6 +1899,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return 'true' if removal of this display content is deferred due to active animation. */
|
||||
boolean isRemovalDeferred() {
|
||||
return mDeferredRemoval;
|
||||
}
|
||||
|
||||
boolean animateForIme(float interpolatedValue, float animationTarget,
|
||||
float dividerAnimationTarget) {
|
||||
boolean updated = false;
|
||||
|
||||
@@ -181,7 +181,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
|
||||
|
||||
final int size = mChildren.size();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
displaysInFocusOrder.put(i, mChildren.get(i).getDisplayId());
|
||||
final DisplayContent displayContent = mChildren.get(i);
|
||||
if (displayContent.isRemovalDeferred()) {
|
||||
// Don't report displays that are going to be removed soon.
|
||||
continue;
|
||||
}
|
||||
displaysInFocusOrder.put(i, displayContent.getDisplayId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.content.res.Configuration;
|
||||
import android.platform.test.annotations.Presubmit;
|
||||
import android.support.test.filters.SmallTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
@@ -239,7 +240,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
@Test
|
||||
@Ignore
|
||||
public void testFocusedWindowMultipleDisplays() throws Exception {
|
||||
// Create a focusable window and check that focus is calcualted correctly
|
||||
// Create a focusable window and check that focus is calculated correctly
|
||||
final WindowState window1 =
|
||||
createWindow(null, TYPE_BASE_APPLICATION, mDisplayContent, "window1");
|
||||
assertEquals(window1, sWm.mRoot.computeFocusedWindow());
|
||||
@@ -310,6 +311,24 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
assertEquals(afterStackCount - 1, mDisplayContent.getStaskPosById(PINNED_STACK_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that WM does not report displays to AM that are pending to be removed.
|
||||
*/
|
||||
@Test
|
||||
public void testDontReportDeferredRemoval() {
|
||||
// Create a display and add an animating window to it.
|
||||
final DisplayContent dc = createNewDisplay();
|
||||
final WindowState window = createWindow(null /* parent */, TYPE_BASE_APPLICATION, dc, "w");
|
||||
window.mAnimatingExit = true;
|
||||
// Request display removal, it should be deferred.
|
||||
dc.removeIfPossible();
|
||||
// Request ordered display ids from WM.
|
||||
final SparseIntArray orderedDisplayIds = new SparseIntArray();
|
||||
sWm.getDisplaysInFocusOrder(orderedDisplayIds);
|
||||
// Make sure that display that is marked for removal is not reported.
|
||||
assertEquals(-1, orderedDisplayIds.indexOfValue(dc.getDisplayId()));
|
||||
}
|
||||
|
||||
private static void verifySizes(DisplayContent displayContent, int expectedBaseWidth,
|
||||
int expectedBaseHeight, int expectedBaseDensity) {
|
||||
assertEquals(displayContent.mBaseDisplayWidth, expectedBaseWidth);
|
||||
|
||||
Reference in New Issue
Block a user