summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-05-22 17:15:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-05-22 17:15:01 +0000
commit7b885be3a672a10babcfb6868d73c766c91d8d43 (patch)
tree239f40ae5cb5ba2f61e43475adacb677e12dbb9c /service
parent95eae9f3e621d3bd5f9b0b63b4c464533b4ba8cd (diff)
parentdacacbf69da8844232d938437b3b38471a3d2827 (diff)
Merge changes from topic "79482323-params-expid" into pi-dev
* changes: Remove wifi/ScoringParams.hexDigest WifiMetrics score experiment id Add wifi ScoringParams expid
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ScoringParams.java20
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java1
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java24
3 files changed, 44 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/ScoringParams.java b/service/java/com/android/server/wifi/ScoringParams.java
index 5b9951ff8..8f68627b7 100644
--- a/service/java/com/android/server/wifi/ScoringParams.java
+++ b/service/java/com/android/server/wifi/ScoringParams.java
@@ -70,6 +70,12 @@ public class ScoringParams {
public static final int MAX_NUD = 10;
public int nud = 8;
+ /** Experiment identifier */
+ public static final String KEY_EXPID = "expid";
+ public static final int MIN_EXPID = 0;
+ public static final int MAX_EXPID = Integer.MAX_VALUE;
+ public int expid = 0;
+
Values() {
}
@@ -85,6 +91,7 @@ public class ScoringParams {
}
horizon = source.horizon;
nud = source.nud;
+ expid = source.expid;
}
public void validate() throws IllegalArgumentException {
@@ -93,6 +100,7 @@ public class ScoringParams {
validateOrderedNonNegativeArray(pps);
validateRange(horizon, MIN_HORIZON, MAX_HORIZON);
validateRange(nud, MIN_NUD, MAX_NUD);
+ validateRange(expid, MIN_EXPID, MAX_EXPID);
}
private void validateRssiArray(int[] rssi) throws IllegalArgumentException {
@@ -131,6 +139,7 @@ public class ScoringParams {
updateIntArray(pps, parser, KEY_PPS);
horizon = updateInt(parser, KEY_HORIZON, horizon);
nud = updateInt(parser, KEY_NUD, nud);
+ expid = updateInt(parser, KEY_EXPID, expid);
}
private int updateInt(KeyValueListParser parser, String key, int defaultValue)
@@ -168,6 +177,8 @@ public class ScoringParams {
sb.append(horizon);
appendKey(sb, KEY_NUD);
sb.append(nud);
+ appendKey(sb, KEY_EXPID);
+ sb.append(expid);
return sb.toString();
}
@@ -352,6 +363,15 @@ public class ScoringParams {
return mVal.nud;
}
+ /**
+ * Returns the experiment identifier.
+ *
+ * This value may be used to tag a set of experimental settings.
+ */
+ public int getExperimentIdentifier() {
+ return mVal.expid;
+ }
+
private static final int MINIMUM_5GHZ_BAND_FREQUENCY_IN_MEGAHERTZ = 5000;
private int[] getRssiArray(int frequency) {
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 =