Merge "Provide synchronization to setview to avoid NPE" am: b05b93a674 am: 810c31fdca

am: 621e87d72f

Change-Id: Ib5b7470db042d60593d2e545c901240a456dcada
This commit is contained in:
Gopal Krishna Shukla
2016-09-23 13:14:51 +00:00
committed by android-build-merger

View File

@@ -335,20 +335,17 @@ public final class WindowManagerGlobal {
mViews.add(view);
mRoots.add(root);
mParams.add(wparams);
}
// do this last because it fires off messages to start doing things
try {
root.setView(view, wparams, panelParentView);
} catch (RuntimeException e) {
// BadTokenException or InvalidDisplayException, clean up.
synchronized (mLock) {
final int index = findViewLocked(view, false);
// do this last because it fires off messages to start doing things
try {
root.setView(view, wparams, panelParentView);
} catch (RuntimeException e) {
// BadTokenException or InvalidDisplayException, clean up.
if (index >= 0) {
removeViewLocked(index, true);
}
throw e;
}
throw e;
}
}