From 0d587ee61a12c4ad9729875128fc66a12516521c Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Fri, 16 Oct 2020 13:12:48 -0700 Subject: [PATCH] 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 --- core/java/android/view/SurfaceView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 7b6a4f877d020..432d9279c48de 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -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; }