For a non-fullscreen dimLayerUser, its dimLayer surface is not shared with
other dimLayerUsers and should be destroyed when we remove it from mState.
Change-Id: Iaf300178c2534b87fccca99a836ae3416605c9ca
}
void removeDimLayerUser(DimLayer.DimLayerUser dimLayerUser) {
- mState.remove(dimLayerUser);
+ DimLayerState state = mState.get(dimLayerUser);
+ if (state != null) {
+ // Destroy the surface, unless it's the shared fullscreen dim.
+ if (state.dimLayer != mSharedFullScreenDimLayer) {
+ state.dimLayer.destroySurface();
+ }
+ mState.remove(dimLayerUser);
+ }
}
void applyDimBehind(DimLayer.DimLayerUser dimLayerUser, WindowStateAnimator animator) {