Initial commit for Android 10, syncing up to v201
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
From b009ff6561e52e151adfc4aaa5b0b4a56a66cac3 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 14 Aug 2018 21:48:19 +0200
|
||||
Subject: [PATCH] Act as usb device when there is no hal, but we believe we are
|
||||
a device
|
||||
|
||||
Change-Id: I036090738525fd8cc63534d52d02ab1852950a7d
|
||||
---
|
||||
.../usb/UsbConnectionBroadcastReceiver.java | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java
|
||||
index 695a714528..1f2b751991 100644
|
||||
--- a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java
|
||||
+++ b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java
|
||||
@@ -76,6 +76,14 @@ public class UsbConnectionBroadcastReceiver extends BroadcastReceiver implements
|
||||
mFunctions = functions;
|
||||
mDataRole = mUsbBackend.getDataRole();
|
||||
mPowerRole = mUsbBackend.getPowerRole();
|
||||
+ //If we have no USB HAL, mDataRole is invalid
|
||||
+ //But we can't be connected AND have none data_role, so it's safe.
|
||||
+ //It would be better to fix UsbManager when no HAL is available, but that's more work
|
||||
+ if(mDataRole == UsbPortStatus.DATA_ROLE_NONE &&
|
||||
+ intent.getExtras().getBoolean(UsbManager.USB_CONNECTED) &&
|
||||
+ !intent.getExtras().getBoolean(UsbManager.USB_HOST_CONNECTED))
|
||||
+ mDataRole = UsbPortStatus.DATA_ROLE_DEVICE;
|
||||
+
|
||||
}
|
||||
} else if (UsbManager.ACTION_USB_PORT_CHANGED.equals(intent.getAction())) {
|
||||
UsbPortStatus portStatus = intent.getExtras()
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Reference in New Issue
Block a user