Bug 1501024 WifiScanner should use ApplicationContext r=JanH a=RyanVM-on-IRC
authorAndrei Lazar <andrei.a.lazar@softvision.ro>
Mon, 10 Dec 2018 09:33:18 +0000
changeset 508922 f9ef4b24affae8cf8b72973c6d2f76e65bd986d8
parent 508921 36b6668aef21a538ae502c32eafd7540a15d5eaa
child 508923 6d14e4da344d756c2a4ce71af61d5cb131a8e359
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJanH, RyanVM-on-IRC
bugs1501024
milestone65.0
Bug 1501024 WifiScanner should use ApplicationContext r=JanH a=RyanVM-on-IRC Fixed lint warning regarding memory leak inside WifiManager constructor. Differential Revision: https://phabricator.services.mozilla.com/D13930
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.mozstumbler.service.stumblerthread.scanners;
 
+import android.annotation.SuppressLint;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.wifi.ScanResult;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.WifiLock;
 import android.support.v4.content.LocalBroadcastManager;
@@ -206,16 +207,17 @@ public class WifiScanner extends Broadca
             return false;
         }
         if (SSIDBlockList.contains(scanResult)) {
             return false;
         }
         return true;
     }
 
+    @SuppressLint("WifiManagerPotentialLeak")
     private WifiManager getWifiManager() {
         return (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
     }
 
     private void reportScanResults(ArrayList<ScanResult> scanResults) {
         if (scanResults.isEmpty()) {
             return;
         }