Check and send usb state broadcast when devices boots am: af6d473ab0 am: 061bceafee
am: df1df40f91
Change-Id: I28430b3de3ee91c4eb5dc4e4ef88e5924d56e2b4
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index c93acfc..00c36f9 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -150,6 +150,7 @@
private UsbDebuggingManager mDebuggingManager;
private final UsbAlsaManager mUsbAlsaManager;
private Intent mBroadcastedIntent;
+ private boolean mPendingBootBroadcast;
private class AdbSettingsObserver extends ContentObserver {
public AdbSettingsObserver() {
@@ -748,6 +749,8 @@
}
updateUsbStateBroadcastIfNeeded(false);
updateUsbFunctions();
+ } else {
+ mPendingBootBroadcast = true;
}
break;
case MSG_UPDATE_HOST_STATE:
@@ -759,6 +762,8 @@
updateUsbNotification();
if (mBootCompleted) {
updateUsbStateBroadcastIfNeeded(false);
+ } else {
+ mPendingBootBroadcast = true;
}
break;
case MSG_ENABLE_ADB:
@@ -778,6 +783,10 @@
break;
case MSG_BOOT_COMPLETED:
mBootCompleted = true;
+ if (mPendingBootBroadcast) {
+ updateUsbStateBroadcastIfNeeded(false);
+ mPendingBootBroadcast = false;
+ }
setEnabledFunctions(null, false, false);
if (mCurrentAccessory != null) {
getCurrentSettings().accessoryAttached(mCurrentAccessory);