Merge "Allow foreground AppWindowToken to influence orientation." into oc-dr1-dev
This commit is contained in:
@@ -1311,7 +1311,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
|||||||
// going to the bottom. Allowing closing {@link AppWindowToken} to participate can lead to
|
// going to the bottom. Allowing closing {@link AppWindowToken} to participate can lead to
|
||||||
// an Activity in another task being started in the wrong orientation during the transition.
|
// an Activity in another task being started in the wrong orientation during the transition.
|
||||||
if (!(sendingToBottom || mService.mClosingApps.contains(this))
|
if (!(sendingToBottom || mService.mClosingApps.contains(this))
|
||||||
&& (isVisible() || mService.mOpeningApps.contains(this))) {
|
&& (isVisible() || mService.mOpeningApps.contains(this) || isOnTop())) {
|
||||||
return mOrientation;
|
return mOrientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3308,6 +3308,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
setLayoutNeeded();
|
setLayoutNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean isOnTop() {
|
||||||
|
// Considered always on top
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void positionChildAt(int position, TaskStack child, boolean includingParents) {
|
void positionChildAt(int position, TaskStack child, boolean includingParents) {
|
||||||
if (StackId.isAlwaysOnTop(child.mStackId) && position != POSITION_TOP) {
|
if (StackId.isAlwaysOnTop(child.mStackId) && position != POSITION_TOP) {
|
||||||
|
|||||||
@@ -472,6 +472,13 @@ class WindowContainer<E extends WindowContainer> implements Comparable<WindowCon
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
a * Returns whether this child is on top of the window hierarchy.
|
||||||
|
*/
|
||||||
|
boolean isOnTop() {
|
||||||
|
return getParent().getTopChild() == this && getParent().isOnTop();
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns the top child container. */
|
/** Returns the top child container. */
|
||||||
E getTopChild() {
|
E getTopChild() {
|
||||||
return mChildren.peekLast();
|
return mChildren.peekLast();
|
||||||
|
|||||||
@@ -185,6 +185,11 @@ public class AppWindowTokenTests extends WindowTestsBase {
|
|||||||
assertEquals(SCREEN_ORIENTATION_UNSET, token.getOrientation());
|
assertEquals(SCREEN_ORIENTATION_UNSET, token.getOrientation());
|
||||||
// Can specify orientation if the current orientation candidate is orientation behind.
|
// Can specify orientation if the current orientation candidate is orientation behind.
|
||||||
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, token.getOrientation(SCREEN_ORIENTATION_BEHIND));
|
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, token.getOrientation(SCREEN_ORIENTATION_BEHIND));
|
||||||
|
|
||||||
|
token.sendingToBottom = false;
|
||||||
|
token.setIsOnTop(true);
|
||||||
|
// Allow for token to provide orientation hidden if on top and not being sent to bottom.
|
||||||
|
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, token.getOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public class WindowTestUtils {
|
|||||||
|
|
||||||
/** Used so we can gain access to some protected members of the {@link AppWindowToken} class. */
|
/** Used so we can gain access to some protected members of the {@link AppWindowToken} class. */
|
||||||
public static class TestAppWindowToken extends AppWindowToken {
|
public static class TestAppWindowToken extends AppWindowToken {
|
||||||
|
boolean mOnTop = false;
|
||||||
|
|
||||||
TestAppWindowToken(DisplayContent dc) {
|
TestAppWindowToken(DisplayContent dc) {
|
||||||
super(dc.mService, new IApplicationToken.Stub() {}, false, dc, true /* fillsParent */,
|
super(dc.mService, new IApplicationToken.Stub() {}, false, dc, true /* fillsParent */,
|
||||||
@@ -125,6 +126,15 @@ public class WindowTestUtils {
|
|||||||
int positionInParent() {
|
int positionInParent() {
|
||||||
return getParent().mChildren.indexOf(this);
|
return getParent().mChildren.indexOf(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setIsOnTop(boolean onTop) {
|
||||||
|
mOnTop = onTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean isOnTop() {
|
||||||
|
return mOnTop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used so we can gain access to some protected members of the {@link WindowToken} class */
|
/* Used so we can gain access to some protected members of the {@link WindowToken} class */
|
||||||
|
|||||||
Reference in New Issue
Block a user