diff options
author | Jimmy Hu <hhhuuu@google.com> | 2022-10-24 07:03:21 +0000 |
---|---|---|
committer | Alex Stetson <alexstetson@google.com> | 2024-02-05 17:19:23 +0000 |
commit | df14c7657d15b4be4dee451e7a901152798ffc4a (patch) | |
tree | c6dadf45395a51a42e725c2af6322e6139568d53 | |
parent | bbdd201487df3a3a98f05a0ebd41071f5858de8d (diff) | |
download | base-df14c7657d15b4be4dee451e7a901152798ffc4a.tar.gz |
Fix possible NPE in StorageNotification.
Because findRecordByUuid() can return null, add a null check to avoid
NPE.
StorageNotification: Notifying about private volume: VolumeInfo{private}:
StorageNotification: type=PRIVATE diskId=null partGuid=null mountFlags=0 mountUserId=-10000
StorageNotification: state=MOUNTED
StorageNotification: fsType=null fsUuid=null fsLabel=null
StorageNotification: path=/data internalPath=null
AndroidRuntime: FATAL EXCEPTION: main
AndroidRuntime: Process: com.android.systemui, PID: 5952
AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.storage.VolumeRecord.isSnoozed()' on a null object reference
AndroidRuntime: at com.android.systemui.usb.StorageNotification.onVolumeStateChangedInternal(StorageNotification.java:337)
AndroidRuntime: at com.android.systemui.usb.StorageNotification.start(StorageNotification.java:114)
Bug: 253408750
Bug: 319775465
Test: build, boot
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a31fd420292a12cb7ca14d7518cc6b7d3ca2c296)
Merged-In: I8859d4d578ca040771bef9cf9870f91fb8d29628
Change-Id: I8859d4d578ca040771bef9cf9870f91fb8d29628
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 345fc99f8a54..f9bf17d97b8d 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -378,7 +378,7 @@ public class StorageNotification extends CoreStartable { // Don't annoy when user dismissed in past. (But make sure the disk is adoptable; we // used to allow snoozing non-adoptable disks too.) - if (rec.isSnoozed() && disk.isAdoptable()) { + if (rec == null || (rec.isSnoozed() && disk.isAdoptable())) { return null; } |