From 367a496587a34be0aec60765eeb1365baadf03bc Mon Sep 17 00:00:00 2001 From: mukesh agrawal Date: Thu, 23 Jun 2016 11:49:29 -0700 Subject: WifiNative: make getLocalLog() an instance method We want to add some tests that mock out WifiNative.getLocalLog(). To do that, we need getLocalLog() to be an instance method. Make it so. While there: add @NonNull annotation to getLocalLog(), to make the semantics clearer. BUG=29424414 TEST=unit tests Change-Id: Ifb224104cf54b42a945258967dcaf50541849abc --- service/java/com/android/server/wifi/WifiMonitor.java | 7 ++++--- service/java/com/android/server/wifi/WifiNative.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiMonitor.java b/service/java/com/android/server/wifi/WifiMonitor.java index 2c1bde10d..1f2b39713 100644 --- a/service/java/com/android/server/wifi/WifiMonitor.java +++ b/service/java/com/android/server/wifi/WifiMonitor.java @@ -594,7 +594,7 @@ public class WifiMonitor { while (true) { if (mWifiNative.connectToSupplicant()) { mConnected = true; - new MonitorThread().start(); + new MonitorThread(mWifiNative.getLocalLog()).start(); return true; } if (connectTries++ < 5) { @@ -723,10 +723,11 @@ public class WifiMonitor { } private class MonitorThread extends Thread { - private final LocalLog mLocalLog = mWifiNative.getLocalLog(); + private final LocalLog mLocalLog; - public MonitorThread() { + public MonitorThread(LocalLog localLog) { super("WifiMonitor"); + mLocalLog = localLog; } public void run() { diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index f268f62f6..73765eeb7 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -16,6 +16,7 @@ package com.android.server.wifi; +import android.annotation.NonNull; import android.annotation.Nullable; import android.app.AlarmManager; import android.app.PendingIntent; @@ -104,7 +105,7 @@ public class WifiNative { private static final LocalLog sLocalLog = new LocalLog(8192); - public static LocalLog getLocalLog() { + public @NonNull LocalLog getLocalLog() { return sLocalLog; } -- cgit v1.2.3