diff options
-rw-r--r-- | services/usb/java/com/android/server/usb/UsbDeviceManager.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 36f8063cca52..4da7285bcf2d 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -539,7 +539,8 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver // We do not show the USB notification if the primary volume supports mass storage. // The legacy mass storage UI will be used instead. final StorageManager storageManager = StorageManager.from(mContext); - final StorageVolume primary = storageManager.getPrimaryVolume(); + final StorageVolume primary = + storageManager != null ? storageManager.getPrimaryVolume() : null; boolean massStorageSupported = primary != null && primary.allowMassStorage(); mUseUsbNotification = !massStorageSupported && mContext.getResources().getBoolean( |