Merge changes from topic 'am-7c11f830c3cc4f4994e740cad00a8e97'
* changes: Check and send usb state broadcast when devices boots am:af6d473ab0am:061bceafeeam:df1df40f91am:307a387f38Only send usb disconnect intents after boot. am:c1bc0a844dam:dc9c094debam:9877c70d9dam:1064ee66d5
This commit is contained in:
committed by
Android (Google) Code Review
commit
a0325c8513
@@ -157,6 +157,7 @@ public class UsbDeviceManager {
|
||||
private final UsbAlsaManager mUsbAlsaManager;
|
||||
private final UsbSettingsManager mSettingsManager;
|
||||
private Intent mBroadcastedIntent;
|
||||
private boolean mPendingBootBroadcast;
|
||||
|
||||
private class AdbSettingsObserver extends ContentObserver {
|
||||
public AdbSettingsObserver() {
|
||||
@@ -755,13 +756,16 @@ public class UsbDeviceManager {
|
||||
if (UsbManager.containsFunction(mCurrentFunctions,
|
||||
UsbManager.USB_FUNCTION_ACCESSORY)) {
|
||||
updateCurrentAccessory();
|
||||
} else if (!mConnected) {
|
||||
// restore defaults when USB is disconnected
|
||||
setEnabledFunctions(null, false, false);
|
||||
}
|
||||
if (mBootCompleted) {
|
||||
if (!mConnected) {
|
||||
// restore defaults when USB is disconnected
|
||||
setEnabledFunctions(null, false, false);
|
||||
}
|
||||
updateUsbStateBroadcastIfNeeded(false);
|
||||
updateUsbFunctions();
|
||||
} else {
|
||||
mPendingBootBroadcast = true;
|
||||
}
|
||||
break;
|
||||
case MSG_UPDATE_HOST_STATE:
|
||||
@@ -773,6 +777,8 @@ public class UsbDeviceManager {
|
||||
updateUsbNotification();
|
||||
if (mBootCompleted) {
|
||||
updateUsbStateBroadcastIfNeeded(false);
|
||||
} else {
|
||||
mPendingBootBroadcast = true;
|
||||
}
|
||||
break;
|
||||
case MSG_ENABLE_ADB:
|
||||
@@ -792,6 +798,10 @@ public class UsbDeviceManager {
|
||||
break;
|
||||
case MSG_BOOT_COMPLETED:
|
||||
mBootCompleted = true;
|
||||
if (mPendingBootBroadcast) {
|
||||
updateUsbStateBroadcastIfNeeded(false);
|
||||
mPendingBootBroadcast = false;
|
||||
}
|
||||
setEnabledFunctions(null, false, false);
|
||||
if (mCurrentAccessory != null) {
|
||||
getCurrentSettings().accessoryAttached(mCurrentAccessory);
|
||||
|
||||
Reference in New Issue
Block a user