Merge "Address issues surrounding freezing by display." into oc-dev
This commit is contained in:
@@ -314,6 +314,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
// the display's direct children should be allowed.
|
||||
private boolean mRemovingDisplay = false;
|
||||
|
||||
// {@code false} if this display is in the processing of being created.
|
||||
private boolean mDisplayReady = false;
|
||||
|
||||
private final WindowLayersController mLayersController;
|
||||
WallpaperController mWallpaperController;
|
||||
int mInputMethodAnimLayerAdjustment;
|
||||
@@ -720,7 +723,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
*/
|
||||
DisplayContent(Display display, WindowManagerService service,
|
||||
WindowLayersController layersController, WallpaperController wallpaperController) {
|
||||
|
||||
if (service.mRoot.getDisplayContent(display.getDisplayId()) != null) {
|
||||
throw new IllegalArgumentException("Display with ID=" + display.getDisplayId()
|
||||
+ " already exists=" + service.mRoot.getDisplayContent(display.getDisplayId())
|
||||
@@ -748,6 +750,15 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
|
||||
// Add itself as a child to the root container.
|
||||
mService.mRoot.addChild(this, null);
|
||||
|
||||
// TODO(b/62541591): evaluate whether this is the best spot to declare the
|
||||
// {@link DisplayContent} ready for use.
|
||||
mDisplayReady = true;
|
||||
}
|
||||
|
||||
boolean isReady() {
|
||||
// The display is ready when the system and the individual display are both ready.
|
||||
return mService.mDisplayReady && mDisplayReady;
|
||||
}
|
||||
|
||||
int getDisplayId() {
|
||||
|
||||
@@ -108,7 +108,8 @@ public class WindowAnimator {
|
||||
}
|
||||
|
||||
void addDisplayLocked(final int displayId) {
|
||||
// Create the DisplayContentsAnimator object by retrieving it.
|
||||
// Create the DisplayContentsAnimator object by retrieving it if the associated
|
||||
// {@link DisplayContent} exists.
|
||||
getDisplayContentsAnimatorLocked(displayId);
|
||||
if (displayId == DEFAULT_DISPLAY) {
|
||||
mInitialized = true;
|
||||
@@ -356,8 +357,16 @@ public class WindowAnimator {
|
||||
}
|
||||
|
||||
private DisplayContentsAnimator getDisplayContentsAnimatorLocked(int displayId) {
|
||||
if (displayId < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId);
|
||||
if (displayAnimator == null) {
|
||||
|
||||
// It is possible that this underlying {@link DisplayContent} has been removed. In this
|
||||
// case, we do not want to create an animator associated with it as {link #animate} will
|
||||
// fail.
|
||||
if (displayAnimator == null && mService.mRoot.getDisplayContent(displayId) != null) {
|
||||
displayAnimator = new DisplayContentsAnimator();
|
||||
mDisplayContentsAnimators.put(displayId, displayAnimator);
|
||||
}
|
||||
@@ -365,8 +374,10 @@ public class WindowAnimator {
|
||||
}
|
||||
|
||||
void setScreenRotationAnimationLocked(int displayId, ScreenRotationAnimation animation) {
|
||||
if (displayId >= 0) {
|
||||
getDisplayContentsAnimatorLocked(displayId).mScreenRotationAnimation = animation;
|
||||
final DisplayContentsAnimator animator = getDisplayContentsAnimatorLocked(displayId);
|
||||
|
||||
if (animator != null) {
|
||||
animator.mScreenRotationAnimation = animation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +385,9 @@ public class WindowAnimator {
|
||||
if (displayId < 0) {
|
||||
return null;
|
||||
}
|
||||
return getDisplayContentsAnimatorLocked(displayId).mScreenRotationAnimation;
|
||||
|
||||
DisplayContentsAnimator animator = getDisplayContentsAnimatorLocked(displayId);
|
||||
return animator != null? animator.mScreenRotationAnimation : null;
|
||||
}
|
||||
|
||||
void requestRemovalOfReplacedWindows(WindowState win) {
|
||||
|
||||
@@ -5890,8 +5890,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mDisplayReady || !mPolicy.isScreenOn()) {
|
||||
// No need to freeze the screen before the system is ready or if
|
||||
if (!displayContent.isReady() || !mPolicy.isScreenOn()) {
|
||||
// No need to freeze the screen before the display is ready, system is ready, or if
|
||||
// the screen is off.
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user