Merge "Handle the case where null is returned for USB_STATE intent."
This commit is contained in:
committed by
Android (Google) Code Review
commit
a5c73b423d
@@ -47,7 +47,8 @@ public class UsbBackend {
|
|||||||
public UsbBackend(Context context) {
|
public UsbBackend(Context context) {
|
||||||
Intent intent = context.registerReceiver(null,
|
Intent intent = context.registerReceiver(null,
|
||||||
new IntentFilter(UsbManager.ACTION_USB_STATE));
|
new IntentFilter(UsbManager.ACTION_USB_STATE));
|
||||||
mIsUnlocked = intent.getBooleanExtra(UsbManager.USB_DATA_UNLOCKED, false);
|
mIsUnlocked = intent == null ?
|
||||||
|
false : intent.getBooleanExtra(UsbManager.USB_DATA_UNLOCKED, false);
|
||||||
|
|
||||||
mUserManager = UserManager.get(context);
|
mUserManager = UserManager.get(context);
|
||||||
mUsbManager = context.getSystemService(UsbManager.class);
|
mUsbManager = context.getSystemService(UsbManager.class);
|
||||||
|
Reference in New Issue
Block a user