From d51af69063f7b3d2cbbb478fcc687e85f15bbdf9 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Fri, 29 Mar 2024 10:01:38 -0700 Subject: Add null check for DisplayInfo of DEFAULT_DISPLAY We are getting reports of DisplayInfo being null in this part of code. The API "getDisplayInfo" is allowed to return null, so add this check here. Separately, we will discuss with the display manager team whether it's normal / reasonable for the lookup of DEFAULT_DISPLAY to fail. Bug: 331692058 Test: none Change-Id: I1e89289ffa56b0c4459079aae035073d095788c9 --- .../com/android/server/input/AmbientKeyboardBacklightController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/java/com/android/server/input/AmbientKeyboardBacklightController.java b/services/core/java/com/android/server/input/AmbientKeyboardBacklightController.java index ce868497b0e4..569322c8b501 100644 --- a/services/core/java/com/android/server/input/AmbientKeyboardBacklightController.java +++ b/services/core/java/com/android/server/input/AmbientKeyboardBacklightController.java @@ -234,6 +234,9 @@ final class AmbientKeyboardBacklightController implements DisplayManager.Display DisplayManagerInternal displayManagerInternal = LocalServices.getService( DisplayManagerInternal.class); DisplayInfo displayInfo = displayManagerInternal.getDisplayInfo(Display.DEFAULT_DISPLAY); + if (displayInfo == null) { + return; + } synchronized (sAmbientControllerLock) { if (Objects.equals(mCurrentDefaultDisplayUniqueId, displayInfo.uniqueId)) { return; -- cgit v1.2.3-59-g8ed1b