If the app is already removed, don't apply any more dim on the window
that's pending removal. It causes invalid DimState to be added back
to the controller, and we crash as these don't have valid dimlayers.
bug:
25570092
Change-Id: I7e3c56c6eb636fdcb01d9bba90f77b3885e216fb
}
void applyDimLayerIfNeeded() {
+ // When the app is terminated (eg. from Recents), the task might have already been
+ // removed with the window pending removal. Don't apply dim in such cases, as there
+ // will be no more updateDimLayer() calls, which leaves the dimlayer invalid.
+ final AppWindowToken token = mAppToken;
+ if (token != null && token.removed) {
+ return;
+ }
+
if (!mExiting && mAppDied) {
// If app died visible, apply a dim over the window to indicate that it's inactive
mDisplayContent.mDimLayerController.applyDimAbove(getDimLayerUser(), mWinAnimator);