From 7abff1d6fe31954c514207836a83f04fdfeec9c8 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 3 Dec 2019 11:36:41 -0800 Subject: [PATCH] WifiNetworkScoreCache: Use @hide INetworkScoreCache This version of WifiNetworkScoreCache extends the @hide AIDL callback. This will not be a part of the mainline module and will be used by settings/setupwizard. Bug: 144487252 Test: Compiles Test: Device boots up & connects to wifi networks. Change-Id: I3bf1525642329d4cc55830985ab5fb89ff651912 --- .../net/wifi/WifiNetworkScoreCache.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiNetworkScoreCache.java b/wifi/java/android/net/wifi/WifiNetworkScoreCache.java index 5a212a824452b..be37c229dd14f 100755 --- a/wifi/java/android/net/wifi/WifiNetworkScoreCache.java +++ b/wifi/java/android/net/wifi/WifiNetworkScoreCache.java @@ -22,7 +22,6 @@ import android.annotation.Nullable; import android.content.Context; import android.net.INetworkScoreCache; import android.net.NetworkKey; -import android.net.NetworkScoreManager; import android.net.ScoredNetwork; import android.os.Handler; import android.os.Process; @@ -39,10 +38,10 @@ import java.util.List; /** * {@link INetworkScoreCache} implementation for Wifi Networks. * + * TODO: This should not be part of wifi mainline module. * @hide */ -public class WifiNetworkScoreCache extends INetworkScoreCache.Stub - implements NetworkScoreManager.NetworkScoreCallback { +public class WifiNetworkScoreCache extends INetworkScoreCache.Stub { private static final String TAG = "WifiNetworkScoreCache"; private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); @@ -248,17 +247,6 @@ public class WifiNetworkScoreCache extends INetworkScoreCache.Stub } @Override protected final void dump(FileDescriptor fd, PrintWriter writer, String[] args) { - WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); - dumpWithLatestScanResults(fd, writer, args, wifiManager.getScanResults()); - } - - /** - * This is directly invoked from within Wifi-Service (on it's instance of this class), hence - * avoid making the WifiManager.getScanResults() call to avoid a deadlock. - */ - public final void dumpWithLatestScanResults( - FileDescriptor fd, PrintWriter writer, String[] args, - List latestScanResults) { mContext.enforceCallingOrSelfPermission(permission.DUMP, TAG); String header = String.format("WifiNetworkScoreCache (%s/%d)", mContext.getPackageName(), Process.myUid()); @@ -269,7 +257,8 @@ public class WifiNetworkScoreCache extends INetworkScoreCache.Stub writer.println(" " + score); } writer.println(" Network scores for latest ScanResults:"); - for (ScanResult scanResult : latestScanResults) { + WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); + for (ScanResult scanResult : wifiManager.getScanResults()) { writer.println( " " + buildNetworkKey(scanResult) + ": " + getNetworkScore(scanResult)); }