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

Commit 670d3ff0 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Align the time of bssid comparison to avoid NPE caused by value changes." into main

parents a62f09d2 38d757b0
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.debug.AdbManager;
import android.debug.AdbNotifications;
import android.debug.AdbProtoEnums;
import android.debug.AdbTransportType;
import android.debug.IAdbTransport;
import android.debug.PairDevice;
import android.net.ConnectivityManager;
import android.net.LocalSocket;
@@ -66,6 +67,7 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.adb.AdbDebuggingManagerProto;
import android.text.TextUtils;
import android.util.AtomicFile;
import android.util.Base64;
import android.util.Slog;
@@ -679,16 +681,17 @@ public class AdbDebuggingManager {
                            return;
                        }

                        synchronized (mAdbConnectionInfo) {
                            // Check for network change
                        String bssid = wifiInfo.getBSSID();
                        if (bssid == null || bssid.isEmpty()) {
                            Slog.e(TAG, "Unable to get the wifi ap's BSSID. Disabling adbwifi.");
                            final String bssid = wifiInfo.getBSSID();
                            if (TextUtils.isEmpty(bssid)) {
                                Slog.e(TAG,
                                        "Unable to get the wifi ap's BSSID. Disabling adbwifi.");
                                Settings.Global.putInt(mContentResolver,
                                        Settings.Global.ADB_WIFI_ENABLED, 0);
                                return;
                            }
                        synchronized (mAdbConnectionInfo) {
                            if (!bssid.equals(mAdbConnectionInfo.getBSSID())) {
                            if (!TextUtils.equals(bssid, mAdbConnectionInfo.getBSSID())) {
                                Slog.i(TAG, "Detected wifi network change. Disabling adbwifi.");
                                Settings.Global.putInt(mContentResolver,
                                        Settings.Global.ADB_WIFI_ENABLED, 0);
@@ -1397,7 +1400,7 @@ public class AdbDebuggingManager {
            }

            String bssid = wifiInfo.getBSSID();
            if (bssid == null || bssid.isEmpty()) {
            if (TextUtils.isEmpty(bssid)) {
                Slog.e(TAG, "Unable to get the wifi ap's BSSID.");
                return null;
            }