Merge changes I8eca5f24,I9d79c67c
* changes: Check and send usb state broadcast when devices boots Only send usb disconnect intents after boot.
This commit is contained in:
@@ -150,6 +150,7 @@ public class UsbDeviceManager {
|
|||||||
private UsbDebuggingManager mDebuggingManager;
|
private UsbDebuggingManager mDebuggingManager;
|
||||||
private final UsbAlsaManager mUsbAlsaManager;
|
private final UsbAlsaManager mUsbAlsaManager;
|
||||||
private Intent mBroadcastedIntent;
|
private Intent mBroadcastedIntent;
|
||||||
|
private boolean mPendingBootBroadcast;
|
||||||
|
|
||||||
private class AdbSettingsObserver extends ContentObserver {
|
private class AdbSettingsObserver extends ContentObserver {
|
||||||
public AdbSettingsObserver() {
|
public AdbSettingsObserver() {
|
||||||
@@ -740,13 +741,16 @@ public class UsbDeviceManager {
|
|||||||
if (UsbManager.containsFunction(mCurrentFunctions,
|
if (UsbManager.containsFunction(mCurrentFunctions,
|
||||||
UsbManager.USB_FUNCTION_ACCESSORY)) {
|
UsbManager.USB_FUNCTION_ACCESSORY)) {
|
||||||
updateCurrentAccessory();
|
updateCurrentAccessory();
|
||||||
} else if (!mConnected) {
|
|
||||||
// restore defaults when USB is disconnected
|
|
||||||
setEnabledFunctions(null, false, false);
|
|
||||||
}
|
}
|
||||||
if (mBootCompleted) {
|
if (mBootCompleted) {
|
||||||
|
if (!mConnected) {
|
||||||
|
// restore defaults when USB is disconnected
|
||||||
|
setEnabledFunctions(null, false, false);
|
||||||
|
}
|
||||||
updateUsbStateBroadcastIfNeeded(false);
|
updateUsbStateBroadcastIfNeeded(false);
|
||||||
updateUsbFunctions();
|
updateUsbFunctions();
|
||||||
|
} else {
|
||||||
|
mPendingBootBroadcast = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_UPDATE_HOST_STATE:
|
case MSG_UPDATE_HOST_STATE:
|
||||||
@@ -758,6 +762,8 @@ public class UsbDeviceManager {
|
|||||||
updateUsbNotification();
|
updateUsbNotification();
|
||||||
if (mBootCompleted) {
|
if (mBootCompleted) {
|
||||||
updateUsbStateBroadcastIfNeeded(false);
|
updateUsbStateBroadcastIfNeeded(false);
|
||||||
|
} else {
|
||||||
|
mPendingBootBroadcast = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_ENABLE_ADB:
|
case MSG_ENABLE_ADB:
|
||||||
@@ -777,6 +783,10 @@ public class UsbDeviceManager {
|
|||||||
break;
|
break;
|
||||||
case MSG_BOOT_COMPLETED:
|
case MSG_BOOT_COMPLETED:
|
||||||
mBootCompleted = true;
|
mBootCompleted = true;
|
||||||
|
if (mPendingBootBroadcast) {
|
||||||
|
updateUsbStateBroadcastIfNeeded(false);
|
||||||
|
mPendingBootBroadcast = false;
|
||||||
|
}
|
||||||
setEnabledFunctions(null, false, false);
|
setEnabledFunctions(null, false, false);
|
||||||
if (mCurrentAccessory != null) {
|
if (mCurrentAccessory != null) {
|
||||||
getCurrentSettings().accessoryAttached(mCurrentAccessory);
|
getCurrentSettings().accessoryAttached(mCurrentAccessory);
|
||||||
|
|||||||
Reference in New Issue
Block a user