diff options
5 files changed, 26 insertions, 8 deletions
diff --git a/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java b/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java index 46021fdf37..8c8fcb6d89 100644 --- a/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java +++ b/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java @@ -159,6 +159,8 @@ public final class WifiUsabilityStatsEntry implements Parcelable { private final long mTxTransmittedBytes; /** The number of rx bytes transmitted on current interface */ private final long mRxTransmittedBytes; + /** The total number of LABEL_BAD event happens */ + private final int mLabelBadEventCount; /** {@hide} */ @Retention(RetentionPolicy.SOURCE) @@ -1081,7 +1083,7 @@ public final class WifiUsabilityStatsEntry implements Parcelable { int cellularSignalStrengthDbm, int cellularSignalStrengthDb, boolean isSameRegisteredCell, SparseArray<LinkStats> linkStats, int wifiLinkCount, @WifiManager.MloMode int mloMode, - long txTransmittedBytes, long rxTransmittedBytes) { + long txTransmittedBytes, long rxTransmittedBytes, int labelBadEventCount) { mTimeStampMillis = timeStampMillis; mRssi = rssi; mLinkSpeedMbps = linkSpeedMbps; @@ -1122,6 +1124,7 @@ public final class WifiUsabilityStatsEntry implements Parcelable { mMloMode = mloMode; mTxTransmittedBytes = txTransmittedBytes; mRxTransmittedBytes = rxTransmittedBytes; + mLabelBadEventCount = labelBadEventCount; } /** Implement the Parcelable interface */ @@ -1171,6 +1174,7 @@ public final class WifiUsabilityStatsEntry implements Parcelable { dest.writeInt(mMloMode); dest.writeLong(mTxTransmittedBytes); dest.writeLong(mRxTransmittedBytes); + dest.writeInt(mLabelBadEventCount); } /** Implement the Parcelable interface */ @@ -1193,7 +1197,7 @@ public final class WifiUsabilityStatsEntry implements Parcelable { in.readBoolean(), in.readInt(), in.readInt(), in.readInt(), in.readBoolean(), in.readSparseArray(LinkStats.class.getClassLoader()), in.readInt(), - in.readInt(), in.readLong(), in.readLong() + in.readInt(), in.readLong(), in.readLong(), in.readInt() ); } @@ -1913,4 +1917,9 @@ public final class WifiUsabilityStatsEntry implements Parcelable { public long getRxTransmittedBytes() { return mRxTransmittedBytes; } + + /** @hide */ + public long getLabelBadEventCount() { + return mLabelBadEventCount; + } } diff --git a/framework/tests/src/android/net/wifi/WifiManagerTest.java b/framework/tests/src/android/net/wifi/WifiManagerTest.java index 4d9b159d67..d5718fbdff 100644 --- a/framework/tests/src/android/net/wifi/WifiManagerTest.java +++ b/framework/tests/src/android/net/wifi/WifiManagerTest.java @@ -2536,7 +2536,7 @@ public class WifiManagerTest { new WifiUsabilityStatsEntry(System.currentTimeMillis(), -50, 100, 10, 0, 5, 5, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1, 100, 10, 100, 27, contentionTimeStats, rateStats, radioStats, 101, true, true, true, - 0, 10, 10, true, linkStats, 1, 0, 10, 20)); + 0, 10, 10, true, linkStats, 1, 0, 10, 20, 1)); verify(mOnWifiUsabilityStatsListener).onWifiUsabilityStats(anyInt(), anyBoolean(), any(WifiUsabilityStatsEntry.class)); } diff --git a/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java b/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java index d27bb9c994..45abed1211 100644 --- a/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java +++ b/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java @@ -110,14 +110,14 @@ public class WifiUsabilityStatsEntryTest { WifiUsabilityStatsEntry usabilityStatsEntry = new WifiUsabilityStatsEntry( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 32, contentionTimeStats, rateStats, radioStats, 100, true, - true, true, 23, 24, 25, true, linkStats, 1, 0, 10, 20); + true, true, 23, 24, 25, true, linkStats, 1, 0, 10, 20, 1); assertEquals(32, usabilityStatsEntry.getTimeSliceDutyCycleInPercent()); WifiUsabilityStatsEntry usabilityStatsEntryWithInvalidDutyCycleValue = new WifiUsabilityStatsEntry( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, contentionTimeStats, rateStats, radioStats, 101, true, true, - true, 23, 24, 25, true, linkStats, 1, 0, 10, 20); + true, 23, 24, 25, true, linkStats, 1, 0, 10, 20, 1); try { usabilityStatsEntryWithInvalidDutyCycleValue.getTimeSliceDutyCycleInPercent(); fail(); @@ -170,7 +170,7 @@ public class WifiUsabilityStatsEntryTest { return new WifiUsabilityStatsEntry( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 50, contentionTimeStats, rateStats, radioStats, 102, true, - true, true, 23, 24, 25, true, linkStats, 1, 0, 10, 20 + true, true, 23, 24, 25, true, linkStats, 1, 0, 10, 20, 1 ); } @@ -642,7 +642,7 @@ public class WifiUsabilityStatsEntryTest { WifiUsabilityStatsEntry usabilityStatsEntry = new WifiUsabilityStatsEntry( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 32, null, null, null, 100, true, - true, true, 23, 24, 25, true, linkStats, 1, 0, 10, 20); + true, true, 23, 24, 25, true, linkStats, 1, 0, 10, 20, 1); assertThrows("linkId is invalid - " + MloLink.INVALID_MLO_LINK_ID, NoSuchElementException.class, diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index ff8ede9e1d..b253161519 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -318,6 +318,7 @@ public class WifiMetrics { private int mProbeElapsedTimeSinceLastUpdateMs = -1; private int mProbeMcsRateSinceLastUpdate = -1; private long mScoreBreachLowTimeMillis = -1; + private int mAccumulatedLabelBadCount = 0; public static final int MAX_STA_EVENTS = 768; @VisibleForTesting static final int MAX_USER_ACTION_EVENTS = 200; @@ -5270,6 +5271,7 @@ public class WifiMetrics { line.append(",mlo_mode=" + entry.mloMode); line.append(",tx_transmitted_bytes" + entry.txTransmittedBytes); line.append(",rx_transmitted_bytes" + entry.rxTransmittedBytes); + line.append(",label_bad_event_count" + entry.labelBadEventCount); pw.println(line.toString()); } @@ -6113,6 +6115,7 @@ public class WifiMetrics { mProbeElapsedTimeSinceLastUpdateMs = -1; mProbeMcsRateSinceLastUpdate = -1; mScoreBreachLowTimeMillis = -1; + mAccumulatedLabelBadCount = 0; mMeteredNetworkStatsBuilder.clear(); mWifiConfigStoreReadDurationHistogram.clear(); mWifiConfigStoreWriteDurationHistogram.clear(); @@ -7306,6 +7309,7 @@ public class WifiMetrics { } } wifiUsabilityStatsEntry.mloMode = stats.wifiMloMode; + wifiUsabilityStatsEntry.labelBadEventCount = mAccumulatedLabelBadCount; } wifiUsabilityStatsEntry.timeStampMs = stats.timeStampInMs; @@ -7828,7 +7832,7 @@ public class WifiMetrics { radioStats, s.channelUtilizationRatio, s.isThroughputSufficient, s.isWifiScoringEnabled, s.isCellularDataAvailable, 0, 0, 0, false, convertLinkStats(stats, info), s.wifiLinkCount, s.mloMode, - s.txTransmittedBytes, s.rxTransmittedBytes + s.txTransmittedBytes, s.rxTransmittedBytes, s.labelBadEventCount ); } @@ -8031,6 +8035,7 @@ public class WifiMetrics { out.mloMode = s.mloMode; out.txTransmittedBytes = s.txTransmittedBytes; out.rxTransmittedBytes = s.rxTransmittedBytes; + out.labelBadEventCount = s.labelBadEventCount; return out; } @@ -8103,6 +8108,7 @@ public class WifiMetrics { createWifiUsabilityStatsWithLabel(label, triggerType, firmwareAlertCode)); } + mAccumulatedLabelBadCount++; } mWifiUsabilityStatsEntryCounter = 0; mWifiUsabilityStatsEntriesRingBuffer.clear(); diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index ea5556ff43..62e57f7e87 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -2725,6 +2725,9 @@ message WifiUsabilityStatsEntry { // The number of rx bytes transmitted on current interface optional int64 rx_transmitted_bytes = 49; + + // The total number of LABEL_BAD event happens + optional int32 label_bad_event_count = 50; } message ContentionTimeStats { |