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

Commit e2a8ac2c authored by Roman Kiryanov's avatar Roman Kiryanov
Browse files

adb: skip listenToSocket if openSocketLocked fails



listenToSocket used to be called even if
openSocketLocked fails which threw an NPE
because mInputStream was null.

Bug: 418795159
Test: v2/al-eng/al_dts_hw_postsubmit
Flag: EXEMPT bugfix
Change-Id: Ib73a094a529ba59ea028234b77328a6ef501fd9f
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
parent c0b4b0cb
Loading
Loading
Loading
Loading
+8 −11
Original line number Original line Diff line number Diff line
@@ -344,19 +344,16 @@ public class AdbDebuggingManager {
        public void run() {
        public void run() {
            Slog.d(TAG, "Entering thread");
            Slog.d(TAG, "Entering thread");
            while (true) {
            while (true) {
                try {
                    synchronized (this) {
                    synchronized (this) {
                        if (mStopped) {
                        if (mStopped) {
                            Slog.d(TAG, "Exiting thread");
                            Slog.d(TAG, "Exiting thread");
                            return;
                            return;
                        }
                        }
                    try {

                        openSocketLocked();
                        openSocketLocked();
                    } catch (Exception e) {
                        /* Don't loop too fast if adbd dies, before init restarts it */
                        SystemClock.sleep(1000);
                    }
                    }
                    }
                try {

                    listenToSocket();
                    listenToSocket();
                } catch (Exception e) {
                } catch (Exception e) {
                    /* Don't loop too fast if adbd dies, before init restarts it */
                    /* Don't loop too fast if adbd dies, before init restarts it */