Fix NPE on WindowContainer#isOnTop
RecentsAnimationController#removeTask will use WC#isOnTop to check if can accept the remote animation task target removal. However, it may hit the timing that the parent of the task might be removed prior than removeTask called, so caued exception during WC#getParent(). Add null check in WC#inOnTop to return false when WC#getParent is null. Bug: 158937083 Test: atest WindowContainerTests Change-Id: I17b1f709722f573af6efcd00523d434766bca800
This commit is contained in:
@@ -1032,7 +1032,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
* @return Whether this child is on top of the window hierarchy.
|
||||
*/
|
||||
boolean isOnTop() {
|
||||
return getParent().getTopChild() == this && getParent().isOnTop();
|
||||
final WindowContainer parent = getParent();
|
||||
return parent != null && parent.getTopChild() == this && parent.isOnTop();
|
||||
}
|
||||
|
||||
/** Returns the top child container. */
|
||||
|
||||
Reference in New Issue
Block a user