Merge "Don't report displays that are going to be removed" into oc-dev
am: 5a270bcd66
Change-Id: Ia6ab4420855c9d1e33b7fc29985fceff7cd154fd
This commit is contained in:
@@ -1899,6 +1899,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
return true;
|
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,
|
boolean animateForIme(float interpolatedValue, float animationTarget,
|
||||||
float dividerAnimationTarget) {
|
float dividerAnimationTarget) {
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
|
|||||||
@@ -181,7 +181,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
|
|||||||
|
|
||||||
final int size = mChildren.size();
|
final int size = mChildren.size();
|
||||||
for (int i = 0; i < size; ++i) {
|
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.platform.test.annotations.Presubmit;
|
||||||
import android.support.test.filters.SmallTest;
|
import android.support.test.filters.SmallTest;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.util.SparseIntArray;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -239,7 +240,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void testFocusedWindowMultipleDisplays() throws Exception {
|
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 =
|
final WindowState window1 =
|
||||||
createWindow(null, TYPE_BASE_APPLICATION, mDisplayContent, "window1");
|
createWindow(null, TYPE_BASE_APPLICATION, mDisplayContent, "window1");
|
||||||
assertEquals(window1, sWm.mRoot.computeFocusedWindow());
|
assertEquals(window1, sWm.mRoot.computeFocusedWindow());
|
||||||
@@ -310,6 +311,24 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
assertEquals(afterStackCount - 1, mDisplayContent.getStaskPosById(PINNED_STACK_ID));
|
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,
|
private static void verifySizes(DisplayContent displayContent, int expectedBaseWidth,
|
||||||
int expectedBaseHeight, int expectedBaseDensity) {
|
int expectedBaseHeight, int expectedBaseDensity) {
|
||||||
assertEquals(displayContent.mBaseDisplayWidth, expectedBaseWidth);
|
assertEquals(displayContent.mBaseDisplayWidth, expectedBaseWidth);
|
||||||
|
|||||||
Reference in New Issue
Block a user