Merge "Workaround for leaked dim layer."
This commit is contained in:
committed by
Android (Google) Code Review
commit
b4fb0ca6b5
@@ -77,6 +77,8 @@ public class DimLayer {
|
||||
boolean dimFullscreen();
|
||||
/** Returns the display info. of the dim layer user. */
|
||||
DisplayInfo getDisplayInfo();
|
||||
/** Returns true if the dim layer user is currently attached to a display */
|
||||
boolean isAttachedToDisplay();
|
||||
/** Gets the bounds of the dim layer user. */
|
||||
void getDimBounds(Rect outBounds);
|
||||
String toShortString();
|
||||
|
||||
@@ -191,8 +191,21 @@ class DimLayerController {
|
||||
boolean result = false;
|
||||
|
||||
for (int i = mState.size() - 1; i >= 0; i--) {
|
||||
DimLayer.DimLayerUser user = mState.keyAt(i);
|
||||
DimLayerState state = mState.valueAt(i);
|
||||
final DimLayer.DimLayerUser user = mState.keyAt(i);
|
||||
final DimLayerState state = mState.valueAt(i);
|
||||
|
||||
if (!user.isAttachedToDisplay()) {
|
||||
// Leaked dim user that is no longer attached to the display. Go ahead and clean it
|
||||
// clean-up and log what happened.
|
||||
// TODO: This is a work around for b/34395537 as the dim user should have cleaned-up
|
||||
// it self when it was detached from the display. Need to investigate how the dim
|
||||
// user is leaking...
|
||||
Slog.wtfStack(TAG_WM, "Leaked dim user=" + user.toShortString()
|
||||
+ " state=" + state);
|
||||
removeDimLayerUser(user);
|
||||
continue;
|
||||
}
|
||||
|
||||
// We have to check that we are actually the shared fullscreen layer
|
||||
// for this path. If we began as non fullscreen and became fullscreen
|
||||
// (e.g. Docked stack closing), then we may not be the shared layer
|
||||
|
||||
@@ -834,6 +834,11 @@ public class DockedStackDividerController implements DimLayerUser {
|
||||
return mDisplayContent.getDisplayInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttachedToDisplay() {
|
||||
return mDisplayContent != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDimBounds(Rect outBounds) {
|
||||
// This dim layer user doesn't need this.
|
||||
|
||||
@@ -628,7 +628,12 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU
|
||||
|
||||
@Override
|
||||
public DisplayInfo getDisplayInfo() {
|
||||
return mStack.getDisplayContent().getDisplayInfo();
|
||||
return getDisplayContent().getDisplayInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttachedToDisplay() {
|
||||
return getDisplayContent() != null;
|
||||
}
|
||||
|
||||
void forceWindowsScaleable(boolean force) {
|
||||
|
||||
@@ -692,6 +692,11 @@ class TaskPositioner implements DimLayer.DimLayerUser {
|
||||
return mTask.mStack.getDisplayInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttachedToDisplay() {
|
||||
return mTask != null && mTask.getDisplayContent() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDimBounds(Rect out) {
|
||||
// This dim layer user doesn't need this.
|
||||
|
||||
@@ -1208,6 +1208,11 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
|
||||
return mDisplayContent.getDisplayInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttachedToDisplay() {
|
||||
return mDisplayContent != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{stackId=" + mStackId + " tasks=" + mChildren + "}";
|
||||
|
||||
Reference in New Issue
Block a user