Loading services/core/java/com/android/server/wm/Dimmer.java +14 −5 Original line number Diff line number Diff line Loading @@ -126,6 +126,9 @@ class Dimmer { boolean isVisible; SurfaceAnimator mSurfaceAnimator; // TODO(b/64816140): Remove after confirming dimmer layer always matches its container. final Rect mDimBounds = new Rect(); /** * Determines whether the dim layer should animate before destroying. */ Loading Loading @@ -260,11 +263,16 @@ class Dimmer { * {@link WindowContainer#prepareSurfaces}. After calling this, the container should * chain {@link WindowContainer#prepareSurfaces} down to it's children to give them * a chance to request dims to continue. * @return Non-null dim bounds if the dimmer is showing. */ void resetDimStates() { if (mDimState != null && !mDimState.mDontReset) { Rect resetDimStates() { if (mDimState == null) { return null; } if (!mDimState.mDontReset) { mDimState.mDimming = false; } return mDimState.mDimBounds; } void dontAnimateExit() { Loading @@ -275,13 +283,13 @@ class Dimmer { /** * Call after invoking {@link WindowContainer#prepareSurfaces} on children as * described in {@link #resetDimStates}. * described in {@link #resetDimStates}. The dim bounds returned by {@link #resetDimStates} * should be set before calling this method. * * @param t A transaction in which to update the dims. * @param bounds The bounds at which to dim. * @return true if any Dims were updated. */ boolean updateDims(SurfaceControl.Transaction t, Rect bounds) { boolean updateDims(SurfaceControl.Transaction t) { if (mDimState == null) { return false; } Loading @@ -297,6 +305,7 @@ class Dimmer { mDimState = null; return false; } else { final Rect bounds = mDimState.mDimBounds; // TODO: Once we use geometry from hierarchy this falls away. t.setPosition(mDimState.mDimLayer, bounds.left, bounds.top); t.setWindowCrop(mDimState.mDimLayer, bounds.width(), bounds.height()); Loading services/core/java/com/android/server/wm/DisplayArea.java +10 −7 Original line number Diff line number Diff line Loading @@ -767,7 +767,6 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { */ static class Dimmable extends DisplayArea<DisplayArea> { private final Dimmer mDimmer = new Dimmer(this); private final Rect mTmpDimBoundsRect = new Rect(); Dimmable(WindowManagerService wms, Type type, String name, int featureId) { super(wms, type, name, featureId); Loading @@ -780,11 +779,13 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { @Override void prepareSurfaces() { mDimmer.resetDimStates(); final Rect dimBounds = mDimmer.resetDimStates(); super.prepareSurfaces(); if (dimBounds != null) { // Bounds need to be relative, as the dim layer is a child. getBounds(mTmpDimBoundsRect); mTmpDimBoundsRect.offsetTo(0 /* newLeft */, 0 /* newTop */); getBounds(dimBounds); dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */); } // If SystemUI is dragging for recents, we want to reset the dim state so any dim layer // on the display level fades out. Loading @@ -792,11 +793,13 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { mDimmer.resetDimStates(); } if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) { if (dimBounds != null) { if (mDimmer.updateDims(getSyncTransaction())) { scheduleAnimation(); } } } } enum Type { /** Can only contain WindowTokens above the APPLICATION_LAYER. */ Loading services/core/java/com/android/server/wm/Task.java +12 −12 Original line number Diff line number Diff line Loading @@ -481,8 +481,6 @@ class Task extends TaskFragment { // to layout without loading all the task snapshots final PersistedTaskSnapshotData mLastTaskSnapshotData; private final Rect mTmpDimBoundsRect = new Rect(); /** @see #setCanAffectSystemUiFlags */ private boolean mCanAffectSystemUiFlags = true; Loading Loading @@ -3254,22 +3252,24 @@ class Task extends TaskFragment { @Override void prepareSurfaces() { mDimmer.resetDimStates(); final Rect dimBounds = mDimmer.resetDimStates(); super.prepareSurfaces(); getDimBounds(mTmpDimBoundsRect); if (dimBounds != null) { getDimBounds(dimBounds); // Bounds need to be relative, as the dim layer is a child. if (inFreeformWindowingMode()) { getBounds(mTmpRect); mTmpDimBoundsRect.offsetTo(mTmpDimBoundsRect.left - mTmpRect.left, mTmpDimBoundsRect.top - mTmpRect.top); dimBounds.offsetTo(dimBounds.left - mTmpRect.left, dimBounds.top - mTmpRect.top); } else { mTmpDimBoundsRect.offsetTo(0, 0); dimBounds.offsetTo(0, 0); } } final SurfaceControl.Transaction t = getSyncTransaction(); if (mDimmer.updateDims(t, mTmpDimBoundsRect)) { if (dimBounds != null && mDimmer.updateDims(t)) { scheduleAnimation(); } Loading services/core/java/com/android/server/wm/TaskFragment.java +7 −6 Original line number Diff line number Diff line Loading @@ -2923,16 +2923,17 @@ class TaskFragment extends WindowContainer<WindowContainer> { return; } mDimmer.resetDimStates(); final Rect dimBounds = mDimmer.resetDimStates(); super.prepareSurfaces(); if (dimBounds != null) { // Bounds need to be relative, as the dim layer is a child. final Rect dimBounds = getBounds(); dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */); if (mDimmer.updateDims(getSyncTransaction(), dimBounds)) { if (mDimmer.updateDims(getSyncTransaction())) { scheduleAnimation(); } } } @Override boolean fillsParent() { Loading services/core/java/com/android/server/wm/WindowState.java +8 −7 Original line number Diff line number Diff line Loading @@ -5177,13 +5177,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP @Override void prepareSurfaces() { mIsDimming = false; if (mHasSurface) { applyDims(); updateSurfacePositionNonOrganized(); // Send information to SurfaceFlinger about the priority of the current window. updateFrameRateSelectionPriorityIfNeeded(); updateScaleIfNeeded(); mWinAnimator.prepareSurfaceLocked(getSyncTransaction()); } super.prepareSurfaces(); } Loading Loading
services/core/java/com/android/server/wm/Dimmer.java +14 −5 Original line number Diff line number Diff line Loading @@ -126,6 +126,9 @@ class Dimmer { boolean isVisible; SurfaceAnimator mSurfaceAnimator; // TODO(b/64816140): Remove after confirming dimmer layer always matches its container. final Rect mDimBounds = new Rect(); /** * Determines whether the dim layer should animate before destroying. */ Loading Loading @@ -260,11 +263,16 @@ class Dimmer { * {@link WindowContainer#prepareSurfaces}. After calling this, the container should * chain {@link WindowContainer#prepareSurfaces} down to it's children to give them * a chance to request dims to continue. * @return Non-null dim bounds if the dimmer is showing. */ void resetDimStates() { if (mDimState != null && !mDimState.mDontReset) { Rect resetDimStates() { if (mDimState == null) { return null; } if (!mDimState.mDontReset) { mDimState.mDimming = false; } return mDimState.mDimBounds; } void dontAnimateExit() { Loading @@ -275,13 +283,13 @@ class Dimmer { /** * Call after invoking {@link WindowContainer#prepareSurfaces} on children as * described in {@link #resetDimStates}. * described in {@link #resetDimStates}. The dim bounds returned by {@link #resetDimStates} * should be set before calling this method. * * @param t A transaction in which to update the dims. * @param bounds The bounds at which to dim. * @return true if any Dims were updated. */ boolean updateDims(SurfaceControl.Transaction t, Rect bounds) { boolean updateDims(SurfaceControl.Transaction t) { if (mDimState == null) { return false; } Loading @@ -297,6 +305,7 @@ class Dimmer { mDimState = null; return false; } else { final Rect bounds = mDimState.mDimBounds; // TODO: Once we use geometry from hierarchy this falls away. t.setPosition(mDimState.mDimLayer, bounds.left, bounds.top); t.setWindowCrop(mDimState.mDimLayer, bounds.width(), bounds.height()); Loading
services/core/java/com/android/server/wm/DisplayArea.java +10 −7 Original line number Diff line number Diff line Loading @@ -767,7 +767,6 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { */ static class Dimmable extends DisplayArea<DisplayArea> { private final Dimmer mDimmer = new Dimmer(this); private final Rect mTmpDimBoundsRect = new Rect(); Dimmable(WindowManagerService wms, Type type, String name, int featureId) { super(wms, type, name, featureId); Loading @@ -780,11 +779,13 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { @Override void prepareSurfaces() { mDimmer.resetDimStates(); final Rect dimBounds = mDimmer.resetDimStates(); super.prepareSurfaces(); if (dimBounds != null) { // Bounds need to be relative, as the dim layer is a child. getBounds(mTmpDimBoundsRect); mTmpDimBoundsRect.offsetTo(0 /* newLeft */, 0 /* newTop */); getBounds(dimBounds); dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */); } // If SystemUI is dragging for recents, we want to reset the dim state so any dim layer // on the display level fades out. Loading @@ -792,11 +793,13 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { mDimmer.resetDimStates(); } if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) { if (dimBounds != null) { if (mDimmer.updateDims(getSyncTransaction())) { scheduleAnimation(); } } } } enum Type { /** Can only contain WindowTokens above the APPLICATION_LAYER. */ Loading
services/core/java/com/android/server/wm/Task.java +12 −12 Original line number Diff line number Diff line Loading @@ -481,8 +481,6 @@ class Task extends TaskFragment { // to layout without loading all the task snapshots final PersistedTaskSnapshotData mLastTaskSnapshotData; private final Rect mTmpDimBoundsRect = new Rect(); /** @see #setCanAffectSystemUiFlags */ private boolean mCanAffectSystemUiFlags = true; Loading Loading @@ -3254,22 +3252,24 @@ class Task extends TaskFragment { @Override void prepareSurfaces() { mDimmer.resetDimStates(); final Rect dimBounds = mDimmer.resetDimStates(); super.prepareSurfaces(); getDimBounds(mTmpDimBoundsRect); if (dimBounds != null) { getDimBounds(dimBounds); // Bounds need to be relative, as the dim layer is a child. if (inFreeformWindowingMode()) { getBounds(mTmpRect); mTmpDimBoundsRect.offsetTo(mTmpDimBoundsRect.left - mTmpRect.left, mTmpDimBoundsRect.top - mTmpRect.top); dimBounds.offsetTo(dimBounds.left - mTmpRect.left, dimBounds.top - mTmpRect.top); } else { mTmpDimBoundsRect.offsetTo(0, 0); dimBounds.offsetTo(0, 0); } } final SurfaceControl.Transaction t = getSyncTransaction(); if (mDimmer.updateDims(t, mTmpDimBoundsRect)) { if (dimBounds != null && mDimmer.updateDims(t)) { scheduleAnimation(); } Loading
services/core/java/com/android/server/wm/TaskFragment.java +7 −6 Original line number Diff line number Diff line Loading @@ -2923,16 +2923,17 @@ class TaskFragment extends WindowContainer<WindowContainer> { return; } mDimmer.resetDimStates(); final Rect dimBounds = mDimmer.resetDimStates(); super.prepareSurfaces(); if (dimBounds != null) { // Bounds need to be relative, as the dim layer is a child. final Rect dimBounds = getBounds(); dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */); if (mDimmer.updateDims(getSyncTransaction(), dimBounds)) { if (mDimmer.updateDims(getSyncTransaction())) { scheduleAnimation(); } } } @Override boolean fillsParent() { Loading
services/core/java/com/android/server/wm/WindowState.java +8 −7 Original line number Diff line number Diff line Loading @@ -5177,13 +5177,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP @Override void prepareSurfaces() { mIsDimming = false; if (mHasSurface) { applyDims(); updateSurfacePositionNonOrganized(); // Send information to SurfaceFlinger about the priority of the current window. updateFrameRateSelectionPriorityIfNeeded(); updateScaleIfNeeded(); mWinAnimator.prepareSurfaceLocked(getSyncTransaction()); } super.prepareSurfaces(); } Loading