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

Commit be488636 authored by Elliott Hughes's avatar Elliott Hughes Committed by Automerger Merge Worker
Browse files

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

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

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2865336



Change-Id: I5ab3120746af2e60a08424e8323e28cdee073648
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0000f3eb 670d3ff0
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;
            }