Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af6d473a authored by Badhri Jagan Sridharan's avatar Badhri Jagan Sridharan Committed by Badhri Jagan Sridharan
Browse files

Check and send usb state broadcast when devices boots

Broadcasts are not sent until BOOT_COMPLETED is received.
When the device boots with usb plugged, the UPDATE_STATE
for connted and configured would be received way before
BOOT_COMPLETED is received. Since, devices can continue
to stay in same usb configuration(set through persistent
property trigger), check and send a usb state broadcast
if needed.

BUG: 34451258
Test: Manually checked to verify the broadcasts sent.
Change-Id: I8eca5f241ad758f5c4f1afa6c9807868dfd6195a
parent c1bc0a84
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ public class UsbDeviceManager {
    private UsbDebuggingManager mDebuggingManager;
    private final UsbAlsaManager mUsbAlsaManager;
    private Intent mBroadcastedIntent;
    private boolean mPendingBootBroadcast;

    private class AdbSettingsObserver extends ContentObserver {
        public AdbSettingsObserver() {
@@ -748,6 +749,8 @@ public class UsbDeviceManager {
                        }
                        updateUsbStateBroadcastIfNeeded(false);
                        updateUsbFunctions();
                    } else {
                        mPendingBootBroadcast = true;
                    }
                    break;
                case MSG_UPDATE_HOST_STATE:
@@ -759,6 +762,8 @@ public class UsbDeviceManager {
                    updateUsbNotification();
                    if (mBootCompleted) {
                        updateUsbStateBroadcastIfNeeded(false);
                    } else {
                        mPendingBootBroadcast = true;
                    }
                    break;
                case MSG_ENABLE_ADB:
@@ -778,6 +783,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);