diff options
Diffstat (limited to 'service')
3 files changed, 66 insertions, 17 deletions
diff --git a/service/java/com/android/server/wifi/WifiDataStall.java b/service/java/com/android/server/wifi/WifiDataStall.java index b71aca921..b65f59773 100644 --- a/service/java/com/android/server/wifi/WifiDataStall.java +++ b/service/java/com/android/server/wifi/WifiDataStall.java @@ -27,7 +27,9 @@ import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log; +import com.android.server.wifi.proto.WifiStatsLog; import com.android.server.wifi.proto.nano.WifiMetricsProto.WifiIsUnusableEvent; +import com.android.server.wifi.scanner.KnownBandsChannelHelper; import com.android.server.wifi.util.InformationElementUtil.BssLoad; import com.android.wifi.resources.R; @@ -256,6 +258,8 @@ public class WifiDataStall { if (timeDeltaLastTwoPollsMs > 0 && timeDeltaLastTwoPollsMs <= maxTimeDeltaMs) { mWifiMetrics.incrementConnectionDuration(timeDeltaLastTwoPollsMs, mIsThroughputSufficient, mIsCellularDataAvailable); + reportWifiHealthStat(currFrequency, timeDeltaLastTwoPollsMs, mIsThroughputSufficient, + mIsCellularDataAvailable); } boolean possibleDataStallTx = isTxTputLow @@ -405,6 +409,42 @@ public class WifiDataStall { return possibleFalseInsufficient ? lastIsTputSufficient : isTputSufficient; } + /** + * Report the latest Wifi connection health to WestWorld + */ + private void reportWifiHealthStat(int frequency, int timeDeltaLastTwoPollsMs, + boolean isThroughputSufficient, + boolean isCellularDataAvailable) { + int band = getBand(frequency); + WifiStatsLog.write(WifiStatsLog.WIFI_HEALTH_STAT_REPORTED, timeDeltaLastTwoPollsMs, + isThroughputSufficient, isCellularDataAvailable, band); + } + + private int getBand(int frequency) { + int band; + if (frequency >= KnownBandsChannelHelper.BAND_24_GHZ_START_FREQ + && frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_2G; + } else if (frequency >= KnownBandsChannelHelper.BAND_5_GHZ_START_FREQ + && frequency <= KnownBandsChannelHelper.BAND_6_GHZ_END_FREQ) { + if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_LOW_END_FREQ) { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_5G_LOW; + } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_MID_END_FREQ) { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_5G_MIDDLE; + } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_END_FREQ) { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_5G_HIGH; + } else if (frequency <= KnownBandsChannelHelper.BAND_6_GHZ_LOW_END_FREQ) { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_6G_LOW; + } else if (frequency <= KnownBandsChannelHelper.BAND_6_GHZ_MID_END_FREQ) { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_6G_MIDDLE; + } else { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__BAND_6G_HIGH; + } + } else { + band = WifiStatsLog.WIFI_HEALTH_STAT_REPORTED__BAND__UNKNOWN; + } + return band; + } private void logd(String string) { if (mVerboseLoggingEnabled) { Log.d(TAG, string); diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 688857a70..45ddcb26b 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -82,6 +82,7 @@ import com.android.server.wifi.proto.nano.WifiMetricsProto.WifiUsabilityStats; import com.android.server.wifi.proto.nano.WifiMetricsProto.WifiUsabilityStatsEntry; import com.android.server.wifi.proto.nano.WifiMetricsProto.WpsMetrics; import com.android.server.wifi.rtt.RttMetrics; +import com.android.server.wifi.scanner.KnownBandsChannelHelper; import com.android.server.wifi.util.ExternalCallbackTracker; import com.android.server.wifi.util.InformationElementUtil; import com.android.server.wifi.util.IntCounter; @@ -179,11 +180,6 @@ public class WifiMetrics { // Maximum time that a score breaching low event stays valid. public static final int VALIDITY_PERIOD_OF_SCORE_BREACH_LOW_MS = 90 * 1000; // 1.5 minutes - public static final int BAND_2G_MAX_FREQ_MHZ = 2484; - public static final int BAND_5G_LOW_MAX_FREQ_MHZ = 5240; - public static final int BAND_5G_MID_MAX_FREQ_MHZ = 5720; - public static final int BAND_5G_HIGH_MAX_FREQ_MHZ = 5865; - private Clock mClock; private boolean mScreenOn; private int mWifiState; @@ -1700,11 +1696,11 @@ public class WifiMetrics { return; } synchronized (mLock) { - if (frequency <= BAND_2G_MAX_FREQ_MHZ) { + if (frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) { mTxLinkSpeedCount2g.increment(txLinkSpeed); - } else if (frequency <= BAND_5G_LOW_MAX_FREQ_MHZ) { + } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_LOW_END_FREQ) { mTxLinkSpeedCount5gLow.increment(txLinkSpeed); - } else if (frequency <= BAND_5G_MID_MAX_FREQ_MHZ) { + } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_MID_END_FREQ) { mTxLinkSpeedCount5gMid.increment(txLinkSpeed); } else { mTxLinkSpeedCount5gHigh.increment(txLinkSpeed); @@ -1725,11 +1721,11 @@ public class WifiMetrics { return; } synchronized (mLock) { - if (frequency <= BAND_2G_MAX_FREQ_MHZ) { + if (frequency <= KnownBandsChannelHelper.BAND_24_GHZ_END_FREQ) { mRxLinkSpeedCount2g.increment(rxLinkSpeed); - } else if (frequency <= BAND_5G_LOW_MAX_FREQ_MHZ) { + } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_LOW_END_FREQ) { mRxLinkSpeedCount5gLow.increment(rxLinkSpeed); - } else if (frequency <= BAND_5G_MID_MAX_FREQ_MHZ) { + } else if (frequency <= KnownBandsChannelHelper.BAND_5_GHZ_MID_END_FREQ) { mRxLinkSpeedCount5gMid.increment(rxLinkSpeed); } else { mRxLinkSpeedCount5gHigh.increment(rxLinkSpeed); diff --git a/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java b/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java index 6615a2627..f2a744c31 100644 --- a/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java +++ b/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java @@ -44,12 +44,25 @@ import java.util.stream.Collectors; * This allows more fine operations on channels than if band channels are not known. */ public class KnownBandsChannelHelper extends ChannelHelper { - private static final int BAND_24_GHZ_START_FREQ = 2400; - private static final int BAND_24_GHZ_END_FREQ = 2500; - private static final int BAND_5_GHZ_START_FREQ = 5100; - private static final int BAND_5_GHZ_END_FREQ = 6000; - private static final int BAND_6_GHZ_START_FREQ = 5925; - private static final int BAND_6_GHZ_END_FREQ = 7125; + public static final int BAND_24_GHZ_START_FREQ = 2400; + public static final int BAND_24_GHZ_END_FREQ = 2500; + public static final int BAND_5_GHZ_START_FREQ = 4900; + public static final int BAND_5_GHZ_END_FREQ = 5875; + public static final int BAND_6_GHZ_START_FREQ = 5925; + public static final int BAND_6_GHZ_END_FREQ = 7125; + + // 5G low includes U-NII-1 and Japan 4.9G band + public static final int BAND_5_GHZ_LOW_END_FREQ = 5240; + // 5G middle includes U-NII-2A and U-NII-2C + public static final int BAND_5_GHZ_MID_END_FREQ = 5710; + // 5G high includes U-NII-3 + public static final int BAND_5_GHZ_HIGH_END_FREQ = BAND_5_GHZ_END_FREQ; + // 6G low includes UNII-5 + public static final int BAND_6_GHZ_LOW_END_FREQ = 6425; + // 6G middle includes UNII-6 and UNII-7 + public static final int BAND_6_GHZ_MID_END_FREQ = 6875; + // 6G high includes UNII-8 + public static final int BAND_6_GHZ_HIGH_END_FREQ = BAND_6_GHZ_END_FREQ; private WifiScanner.ChannelSpec[][] mBandsToChannels; |