diff options
| author | 2024-03-29 10:01:38 -0700 | |
|---|---|---|
| committer | 2024-03-29 21:37:53 +0000 | |
| commit | d51af69063f7b3d2cbbb478fcc687e85f15bbdf9 (patch) | |
| tree | c60e177ec8c812647e69991780c3dab22ff7f72e | |
| parent | bb8ac426e1c0af3c60042f50f7f1a65df60d3e70 (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/input/AmbientKeyboardBacklightController.java | 3 |
1 files changed, 3 insertions, 0 deletions
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; |