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

Commit 01747ec4 authored by Alon Albert's avatar Alon Albert Committed by Android (Google) Code Review
Browse files

Merge "Turn on ADB WiFi When ADB Connects if it's Enabled" into main

parents 43cf99c3 ee43c759
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.dump.DualDumpOutputStream;
import com.android.server.FgThread;
import com.android.server.adb.AdbDebuggingManager.AdbDebuggingThread.OnConnectionCallback;

import java.io.File;
import java.io.IOException;
@@ -220,11 +219,6 @@ public class AdbDebuggingManager {

    @VisibleForTesting
    static class AdbDebuggingThread extends Thread {
        interface OnConnectionCallback {
            void onConnected(AdbDebuggingThread thread);
        }

        private final OnConnectionCallback mOnConnectionCallback;
        private LocalSocket mSocket;
        private OutputStream mOutputStream;
        private InputStream mInputStream;
@@ -233,9 +227,8 @@ public class AdbDebuggingManager {
        private boolean mConnected = false;

        @VisibleForTesting
        AdbDebuggingThread(OnConnectionCallback onConnectionCallback) {
        AdbDebuggingThread() {
            super(TAG);
            mOnConnectionCallback = onConnectionCallback;
        }

        @VisibleForTesting
@@ -252,7 +245,6 @@ public class AdbDebuggingManager {
                        mConnected = false;
                        openSocketLocked();
                        mConnected = true;
                        mOnConnectionCallback.onConnected(this);
                    }

                    listenToSocket();
@@ -604,7 +596,7 @@ public class AdbDebuggingManager {
        AdbDebuggingHandler(Looper looper, AdbDebuggingThread thread) {
            super(looper);
            if (thread == null) {
                thread = new AdbDebuggingThread(new StartAdbWifiConnectionCallback());
                thread = new AdbDebuggingThread();
                thread.setHandler(this);
            }
            mThread = thread;
@@ -967,6 +959,9 @@ public class AdbDebuggingManager {
                    if (mAdbWifiEnabled) {
                        // In scenarios where adbd is restarted, the tls port may change.
                        startTLSPortPoller();
                        if (wifiLifeCycleOverAdbdauthSupported()) {
                            mThread.sendResponse(MSG_START_ADB_WIFI);
                        }
                    }
                }
                case MSG_ADBD_SOCKET_DISCONNECTED -> {
@@ -1567,13 +1562,4 @@ public class AdbDebuggingManager {
    interface Ticker {
        long currentTimeMillis();
    }

    private class StartAdbWifiConnectionCallback implements OnConnectionCallback {
        @Override
        public void onConnected(AdbDebuggingThread thread) {
            if (isAdbWifiEnabled() && wifiLifeCycleOverAdbdauthSupported()) {
                thread.sendResponse(MSG_START_ADB_WIFI);
            }
        }
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -1175,10 +1175,6 @@ public final class AdbDebuggingManagerTest {
     * indicating whether the key should be allowed to  connect.
     */
    private class AdbDebuggingThreadTest extends AdbDebuggingManager.AdbDebuggingThread {
        AdbDebuggingThreadTest() {
            super(thread -> {});
        }

        @Override
        public void sendResponse(String msg) {
            TestResult result = new TestResult(TestResult.RESULT_RESPONSE_RECEIVED, msg);