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

Commit 81676a93 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Wifi: Use bss->age identifier for wifi scan results" into cm-11.0

parents 98155f5e 56c69be8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ public class WifiNative {
     * MASK=<N> see wpa_supplicant/src/common/wpa_ctrl.h for details
     */
    public String scanResults(int sid) {
        return doStringCommandWithoutLogging("BSS RANGE=" + sid + "- MASK=0x21987");
        return doStringCommandWithoutLogging("BSS RANGE=" + sid + "- MASK=0x21B87");
    }

    /**
+12 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The CyanogenMod Project
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1916,6 +1917,7 @@ public class WifiStateMachine extends StateMachine {
    private static final String FLAGS_STR = "flags=";
    private static final String SSID_STR = "ssid=";
    private static final String DELIMITER_STR = "====";
    private static final String AGE_STR = "age=";
    private static final String END_STR = "####";

    /**
@@ -1987,6 +1989,8 @@ public class WifiStateMachine extends StateMachine {
            final int bssidStrLen = BSSID_STR.length();
            final int flagLen = FLAGS_STR.length();

            final long now = SystemClock.elapsedRealtime();

            for (String line : lines) {
                if (line.startsWith(BSSID_STR)) {
                    bssid = new String(line.getBytes(), bssidStrLen, line.length() - bssidStrLen);
@@ -2012,6 +2016,14 @@ public class WifiStateMachine extends StateMachine {
                    } catch (NumberFormatException e) {
                        tsf = 0;
                    }
                } else if (line.startsWith(AGE_STR)) {
                    try {
                        tsf = now - Long.parseLong(line.substring(AGE_STR.length()));
                        tsf *= 1000; // Convert mS -> uS
                    } catch (NumberFormatException e) {
                        loge("Invalid timestamp: " + line);
                        tsf = 0;
                    }
                } else if (line.startsWith(FLAGS_STR)) {
                    flags = new String(line.getBytes(), flagLen, line.length() - flagLen);
                } else if (line.startsWith(SSID_STR)) {