diff options
author | Michael Plass <mplass@google.com> | 2018-05-10 14:57:56 -0700 |
---|---|---|
committer | Michael Plass <mplass@google.com> | 2018-05-21 12:36:28 -0700 |
commit | a332e6d65efbee41e08b86d56394db4431ca6e86 (patch) | |
tree | a051fa41513e03bfa8b023b3d4b26349974cb9de /service | |
parent | 0e5fc47e8d6585855927fe8485c924cce2c5c4f7 (diff) |
WifiMetrics score experiment id
Bug: 79482323
Test: Unit tests
Test: adb shell dumpsys wifi | grep -10 scoreExperimentId
Test: adb shell settings put global wifi_score_params expid=99
Test: adb shell dumpsys wifi | grep -10 scoreExperimentId
Test: adb shell settings delete global wifi_score_params
Test: adb shell dumpsys wifi | grep -10 scoreExperimentId
Change-Id: Ib74de2dc23aa689e64662406738f0a24cf76366f
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiInjector.java | 1 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 24 |
2 files changed, 24 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index 358abd546..0e30af841 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -230,6 +230,7 @@ public class WifiInjector { mConnectivityLocalLog = new LocalLog(ActivityManager.isLowRamDeviceStatic() ? 256 : 512); mScoringParams = new ScoringParams(mContext, mFrameworkFacade, new Handler(wifiStateMachineLooper)); + mWifiMetrics.setScoringParams(mScoringParams); mWifiNetworkSelector = new WifiNetworkSelector(mContext, mScoringParams, mWifiConfigManager, mClock, mConnectivityLocalLog); diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 3097658d3..39266a638 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -109,6 +109,7 @@ public class WifiMetrics { private final PnoScanMetrics mPnoScanMetrics = new PnoScanMetrics(); private final WpsMetrics mWpsMetrics = new WpsMetrics(); private Handler mHandler; + private ScoringParams mScoringParams; private WifiConfigManager mWifiConfigManager; private WifiNetworkSelector mWifiNetworkSelector; private PasspointManager mPasspointManager; @@ -452,6 +453,11 @@ public class WifiMetrics { }; } + /** Sets internal ScoringParams member */ + public void setScoringParams(ScoringParams scoringParams) { + mScoringParams = scoringParams; + } + /** Sets internal WifiConfigManager member */ public void setWifiConfigManager(WifiConfigManager wifiConfigManager) { mWifiConfigManager = wifiConfigManager; @@ -1770,10 +1776,11 @@ public class WifiMetrics { * * @param fd unused * @param pw PrintWriter for writing dump to - * @param args unused + * @param args [wifiMetricsProto [clean]] */ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { synchronized (mLock) { + consolidateScoringParams(); if (args != null && args.length > 0 && PROTO_DUMP_ARG.equals(args[0])) { // Dump serialized WifiLog proto consolidateProto(true); @@ -2116,6 +2123,7 @@ public class WifiMetrics { mWifiWakeMetrics.dump(pw); pw.println("mWifiLogProto.isMacRandomizationOn=" + mIsMacRandomizationOn); + pw.println("mWifiLogProto.scoreExperimentId=" + mWifiLogProto.scoreExperimentId); } } } @@ -2411,6 +2419,20 @@ public class WifiMetrics { } } + /** Sets the scoring experiment id to current value */ + private void consolidateScoringParams() { + synchronized (mLock) { + if (mScoringParams != null) { + int experimentIdentifier = mScoringParams.getExperimentIdentifier(); + if (experimentIdentifier == 0) { + mWifiLogProto.scoreExperimentId = ""; + } else { + mWifiLogProto.scoreExperimentId = "x" + experimentIdentifier; + } + } + } + } + private WifiMetricsProto.NumConnectableNetworksBucket[] makeNumConnectableNetworksBucketArray( SparseIntArray sia) { WifiMetricsProto.NumConnectableNetworksBucket[] array = |