SurfaceView: Fix null check on RemoteAccessibilityController

ImporantForAccessibility can be called from the View constructor
in which case we may not have initialized RemoteAccessibilityController
yet.

Bug: 171015133
Test: Existing tests pass. Repro from bug.
Change-Id: Iedc29a9d4270ebe600648d6ce5e17c864a662396
This commit is contained in:
Robert Carr
2020-10-16 13:12:48 -07:00
parent 4c361bbb47
commit 0d587ee61a

View File

@@ -1849,7 +1849,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
// If developers explicitly set the important mode for it, don't change the mode.
// Only change the mode to important when this SurfaceView isn't explicitly set and has
// an embedded hierarchy.
if (!mRemoteAccessibilityController.connected()
if ((mRemoteAccessibilityController!= null && !mRemoteAccessibilityController.connected())
|| mode != IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
return mode;
}