summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2019-03-19 16:39:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-03-19 16:39:49 +0000
commitd0c327a079c5a0853e1774b087bad4632bc1cbf2 (patch)
treede4dc5e35402356f34dc9b388f6138d808ef7b54 /service
parent99faad92d23763eb9cbbff8065c6820f35fc7217 (diff)
parent34992a56b8056316c44d80f4b9624cb2074fddd4 (diff)
Merge "Wifi usability: add four new fields to report the latest cellular signal strength"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/CellularLinkLayerStats.java90
-rw-r--r--service/java/com/android/server/wifi/CellularLinkLayerStatsCollector.java236
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java5
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java76
4 files changed, 404 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/CellularLinkLayerStats.java b/service/java/com/android/server/wifi/CellularLinkLayerStats.java
new file mode 100644
index 000000000..25f2949a7
--- /dev/null
+++ b/service/java/com/android/server/wifi/CellularLinkLayerStats.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.wifi;
+
+import android.telephony.SignalStrength;
+import android.telephony.TelephonyManager;
+import android.telephony.TelephonyManager.NetworkType;
+
+/**
+ * A class representing the link layer statistics of the primary registered cell
+ * of cellular network
+ */
+public class CellularLinkLayerStats {
+ /** Cellular data network type currently in use on the device for data transmission */
+ private @NetworkType int mDataNetworkType =
+ TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ /**
+ * Cellular signal strength in dBm, NR: CsiRsrp, LTE: Rsrp, WCDMA/TDSCDMA: Rscp,
+ * CDMA: Rssi, EVDO: Rssi, GSM: Rssi
+ */
+ private int mSignalStrengthDbm = SignalStrength.INVALID;
+ /**
+ * Cellular signal strength in dB, NR: CsiSinr, LTE: Rsrq, WCDMA: EcNo, TDSCDMA: invalid,
+ * CDMA: Ecio, EVDO: SNR, GSM: invalid
+ */
+ private int mSignalStrengthDb = SignalStrength.INVALID;
+ /** Whether it is a new or old registered cell */
+ private boolean mIsSameRegisteredCell = false;
+
+ public void setDataNetworkType(@NetworkType int dataNetworkType) {
+ mDataNetworkType = dataNetworkType;
+ }
+
+ public void setSignalStrengthDbm(int signalStrengthDbm) {
+ mSignalStrengthDbm = signalStrengthDbm;
+ }
+
+ public void setIsSameRegisteredCell(boolean isSameRegisteredCell) {
+ mIsSameRegisteredCell = isSameRegisteredCell;
+ }
+
+ public void setSignalStrengthDb(int signalStrengthDb) {
+ mSignalStrengthDb = signalStrengthDb;
+ }
+
+ public @NetworkType int getDataNetworkType() {
+ return mDataNetworkType;
+ }
+
+ public boolean getIsSameRegisteredCell() {
+ return mIsSameRegisteredCell;
+ }
+
+ public int getSignalStrengthDb() {
+ return mSignalStrengthDb;
+ }
+
+ public int getSignalStrengthDbm() {
+ return mSignalStrengthDbm;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append(" CellularLinkLayerStats: ").append('\n')
+ .append(" Data Network Type: ")
+ .append(mDataNetworkType).append('\n')
+ .append(" Signal Strength in dBm: ")
+ .append(mSignalStrengthDbm).append('\n')
+ .append(" Signal Strength in dB: ")
+ .append(mSignalStrengthDb).append('\n')
+ .append(" Is it the same registered cell? ")
+ .append(mIsSameRegisteredCell).append('\n');
+ return sbuf.toString();
+ }
+}
diff --git a/service/java/com/android/server/wifi/CellularLinkLayerStatsCollector.java b/service/java/com/android/server/wifi/CellularLinkLayerStatsCollector.java
new file mode 100644
index 000000000..473ced3ea
--- /dev/null
+++ b/service/java/com/android/server/wifi/CellularLinkLayerStatsCollector.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.server.wifi;
+
+import static android.telephony.TelephonyManager.NETWORK_TYPE_CDMA;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_EVDO_0;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_GSM;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_LTE;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_NR;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_TD_SCDMA;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_UMTS;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN;
+
+import android.content.Context;
+import android.telephony.CellInfo;
+import android.telephony.CellInfoCdma;
+import android.telephony.CellInfoGsm;
+import android.telephony.CellInfoLte;
+import android.telephony.CellInfoNr;
+import android.telephony.CellInfoTdscdma;
+import android.telephony.CellInfoWcdma;
+import android.telephony.CellSignalStrength;
+import android.telephony.CellSignalStrengthCdma;
+import android.telephony.CellSignalStrengthGsm;
+import android.telephony.CellSignalStrengthLte;
+import android.telephony.CellSignalStrengthNr;
+import android.telephony.CellSignalStrengthTdscdma;
+import android.telephony.CellSignalStrengthWcdma;
+import android.telephony.SignalStrength;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * A class collecting the latest cellular link layer stats
+ */
+public class CellularLinkLayerStatsCollector {
+ private static final String TAG = "CellStatsCollector";
+ private static final boolean DBG = false;
+
+ private Context mContext;
+ private SubscriptionManager mSubManager = null;
+ private TelephonyManager mCachedDefaultDataTelephonyManager = null;
+ private int mCachedDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ private CellInfo mLastPrimaryCellInfo = null;
+ private int mLastDataNetworkType = NETWORK_TYPE_UNKNOWN;
+
+ public CellularLinkLayerStatsCollector(Context context) {
+ mContext = context;
+ }
+
+ /**
+ * Get the latest DataNetworkType, SignalStrength, CellInfo and other information from
+ * default data sim's TelephonyManager, parse the values of primary registered cell and return
+ * them as an instance of CellularLinkLayerStats
+ */
+ public CellularLinkLayerStats update() {
+ CellularLinkLayerStats cellStats = new CellularLinkLayerStats();
+
+ retrieveDefaultDataTelephonyManager();
+ if (mCachedDefaultDataTelephonyManager == null) {
+ if (DBG) Log.v(TAG, cellStats.toString());
+ return cellStats;
+ }
+
+ SignalStrength signalStrength = mCachedDefaultDataTelephonyManager.getSignalStrength();
+ List<CellSignalStrength> cssList = null;
+ if (signalStrength != null) cssList = signalStrength.getCellSignalStrengths();
+
+ if (mCachedDefaultDataTelephonyManager.getDataNetworkType() == NETWORK_TYPE_UNKNOWN
+ || cssList == null || cssList.size() == 0) {
+ mLastPrimaryCellInfo = null;
+ mLastDataNetworkType = NETWORK_TYPE_UNKNOWN;
+ if (DBG) Log.v(TAG, cellStats.toString());
+ return cellStats;
+ }
+ if (DBG) Log.v(TAG, "Cell Signal Strength List size = " + cssList.size());
+
+ CellSignalStrength primaryCss = cssList.get(0);
+ cellStats.setSignalStrengthDbm(primaryCss.getDbm());
+
+ updateSignalStrengthDbAndNetworkTypeOfCellStats(primaryCss, cellStats);
+
+ int networkType = cellStats.getDataNetworkType();
+ CellInfo primaryCellInfo = getPrimaryCellInfo(mCachedDefaultDataTelephonyManager,
+ networkType);
+ boolean isSameRegisteredCell = getIsSameRegisteredCell(primaryCellInfo, networkType);
+ cellStats.setIsSameRegisteredCell(isSameRegisteredCell);
+
+ // Update for the next call
+ mLastPrimaryCellInfo = primaryCellInfo;
+ mLastDataNetworkType = networkType;
+
+ if (DBG) Log.v(TAG, cellStats.toString());
+ return cellStats;
+ }
+
+ private void retrieveDefaultDataTelephonyManager() {
+ if (!initSubManager()) return;
+
+ int defaultDataSubId = mSubManager.getDefaultDataSubscriptionId();
+ if (DBG) Log.v(TAG, "default Data Sub ID = " + defaultDataSubId);
+ if (defaultDataSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ mCachedDefaultDataTelephonyManager = null;
+ return;
+ }
+
+ if (defaultDataSubId != mCachedDefaultDataSubId
+ || mCachedDefaultDataTelephonyManager == null) {
+ mCachedDefaultDataSubId = defaultDataSubId;
+ TelephonyManager defaultSubTelephonyManager = (TelephonyManager) mContext
+ .getSystemService(Context.TELEPHONY_SERVICE);
+ if (defaultDataSubId == mSubManager.getDefaultSubscriptionId()) {
+ mCachedDefaultDataTelephonyManager = defaultSubTelephonyManager;
+ } else {
+ mCachedDefaultDataTelephonyManager = defaultSubTelephonyManager
+ .createForSubscriptionId(defaultDataSubId);
+ }
+ }
+ }
+
+ private boolean initSubManager() {
+ if (mSubManager == null) {
+ mSubManager = (SubscriptionManager) mContext.getSystemService(
+ Context.TELEPHONY_SUBSCRIPTION_SERVICE);
+ }
+ return (mSubManager != null);
+ }
+
+ /**
+ * Update dB value and network type base on CellSignalStrength subclass type.
+ * It follows the same order as that in SignalStrength.getPrimary().
+ * TODO: NR may move up in the future
+ */
+ private void updateSignalStrengthDbAndNetworkTypeOfCellStats(CellSignalStrength primaryCss,
+ CellularLinkLayerStats cellStats) {
+ if (primaryCss instanceof CellSignalStrengthLte) {
+ CellSignalStrengthLte cssLte = (CellSignalStrengthLte) primaryCss;
+ cellStats.setSignalStrengthDb(cssLte.getRsrq());
+ cellStats.setDataNetworkType(NETWORK_TYPE_LTE);
+ } else if (primaryCss instanceof CellSignalStrengthCdma) {
+ CellSignalStrengthCdma cssCdma = (CellSignalStrengthCdma) primaryCss;
+ int evdoSnr = cssCdma.getEvdoSnr();
+ int cdmaEcio = cssCdma.getCdmaEcio();
+ if (evdoSnr != SignalStrength.INVALID) {
+ cellStats.setSignalStrengthDb(evdoSnr);
+ cellStats.setDataNetworkType(NETWORK_TYPE_EVDO_0);
+ } else {
+ cellStats.setSignalStrengthDb(cdmaEcio);
+ cellStats.setDataNetworkType(NETWORK_TYPE_CDMA);
+ }
+ } else if (primaryCss instanceof CellSignalStrengthTdscdma) {
+ cellStats.setDataNetworkType(NETWORK_TYPE_TD_SCDMA);
+ } else if (primaryCss instanceof CellSignalStrengthWcdma) {
+ CellSignalStrengthWcdma cssWcdma = (CellSignalStrengthWcdma) primaryCss;
+ cellStats.setSignalStrengthDb(cssWcdma.getEcNo());
+ cellStats.setDataNetworkType(NETWORK_TYPE_UMTS);
+ } else if (primaryCss instanceof CellSignalStrengthGsm) {
+ cellStats.setDataNetworkType(NETWORK_TYPE_GSM);
+ } else if (primaryCss instanceof CellSignalStrengthNr) {
+ CellSignalStrengthNr cssNr = (CellSignalStrengthNr) primaryCss;
+ cellStats.setSignalStrengthDb(cssNr.getCsiSinr());
+ cellStats.setDataNetworkType(NETWORK_TYPE_NR);
+ } else {
+ Log.e(TAG, "invalid CellSignalStrength");
+ }
+ }
+
+ private CellInfo getPrimaryCellInfo(TelephonyManager defaultDataTelephonyManager,
+ int networkType) {
+ List<CellInfo> cellInfoList = getRegisteredCellInfo(defaultDataTelephonyManager);
+ int cilSize = cellInfoList.size();
+ CellInfo primaryCellInfo = null;
+ // CellInfo.getCellConnectionStatus() should tell if it is primary serving cell.
+ // However, it currently always returns 0 (CONNECTION_NONE) for registered cells.
+ // Therefore, the workaround of deriving primary serving cell is
+ // to check if the registered cellInfo subclass type matches networkType
+ for (int i = 0; i < cilSize; ++i) {
+ CellInfo cellInfo = cellInfoList.get(i);
+ if ((cellInfo instanceof CellInfoTdscdma && networkType == NETWORK_TYPE_TD_SCDMA)
+ || (cellInfo instanceof CellInfoCdma && (networkType == NETWORK_TYPE_CDMA
+ || networkType == NETWORK_TYPE_EVDO_0))
+ || (cellInfo instanceof CellInfoLte && networkType == NETWORK_TYPE_LTE)
+ || (cellInfo instanceof CellInfoWcdma && networkType == NETWORK_TYPE_UMTS)
+ || (cellInfo instanceof CellInfoGsm && networkType == NETWORK_TYPE_GSM)
+ || (cellInfo instanceof CellInfoNr && networkType == NETWORK_TYPE_NR)) {
+ primaryCellInfo = cellInfo;
+ }
+ }
+ return primaryCellInfo;
+ }
+
+ private boolean getIsSameRegisteredCell(CellInfo primaryCellInfo, int networkType) {
+ boolean isSameRegisteredCell;
+ if (primaryCellInfo != null && mLastPrimaryCellInfo != null) {
+ isSameRegisteredCell = primaryCellInfo.getCellIdentity()
+ .equals(mLastPrimaryCellInfo.getCellIdentity());
+ } else if (primaryCellInfo == null && mLastPrimaryCellInfo == null) {
+ // This is a workaround when it can't find primaryCellInfo for two consecutive times.
+ isSameRegisteredCell = true;
+ } else {
+ // only one of them is null and it is a strong indication of primary cell change.
+ isSameRegisteredCell = false;
+ }
+
+ if (mLastDataNetworkType == NETWORK_TYPE_UNKNOWN || mLastDataNetworkType != networkType) {
+ isSameRegisteredCell = false;
+ }
+ return isSameRegisteredCell;
+ }
+
+ private List<CellInfo> getRegisteredCellInfo(TelephonyManager defaultDataTelephonyManager) {
+ List<CellInfo> allList = defaultDataTelephonyManager.getAllCellInfo();
+ List<CellInfo> cellInfoList = new ArrayList<>();
+ for (CellInfo ci : allList) {
+ if (ci.isRegistered()) cellInfoList.add(ci);
+ if (DBG) Log.v(TAG, ci.toString());
+ }
+ return cellInfoList;
+ }
+}
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 7938108c3..66a6685da 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -151,6 +151,7 @@ public class WifiInjector {
private final DppManager mDppManager;
private final LinkProbeManager mLinkProbeManager;
private final IpMemoryStore mIpMemoryStore;
+ private final CellularLinkLayerStatsCollector mCellularLinkLayerStatsCollector;
public WifiInjector(Context context) {
if (context == null) {
@@ -194,8 +195,10 @@ public class WifiInjector {
RttMetrics rttMetrics = new RttMetrics(mClock);
mWifiP2pMetrics = new WifiP2pMetrics(mClock);
mDppMetrics = new DppMetrics();
+ mCellularLinkLayerStatsCollector = new CellularLinkLayerStatsCollector(mContext);
mWifiMetrics = new WifiMetrics(mContext, mFrameworkFacade, mClock, clientModeImplLooper,
- awareMetrics, rttMetrics, new WifiPowerMetrics(), mWifiP2pMetrics, mDppMetrics);
+ awareMetrics, rttMetrics, new WifiPowerMetrics(), mWifiP2pMetrics, mDppMetrics,
+ mCellularLinkLayerStatsCollector);
// Modules interacting with Native.
mWifiMonitor = new WifiMonitor(this);
mHalDeviceManager = new HalDeviceManager(mClock);
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index 077d3db1a..ccfdbc029 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -38,6 +38,7 @@ import android.os.Message;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.provider.Settings;
+import android.telephony.TelephonyManager;
import android.util.ArrayMap;
import android.util.Base64;
import android.util.Log;
@@ -370,6 +371,8 @@ public class WifiMetrics {
private Map<Pair<Integer, Integer>, NetworkSelectionExperimentResults>
mNetworkSelectionExperimentPairNumChoicesCounts = new ArrayMap<>();
+ private final CellularLinkLayerStatsCollector mCellularLinkLayerStatsCollector;
+
@VisibleForTesting
static class NetworkSelectionExperimentResults {
public static final int MAX_CHOICES = 10;
@@ -682,7 +685,8 @@ public class WifiMetrics {
public WifiMetrics(Context context, FrameworkFacade facade, Clock clock, Looper looper,
WifiAwareMetrics awareMetrics, RttMetrics rttMetrics,
WifiPowerMetrics wifiPowerMetrics, WifiP2pMetrics wifiP2pMetrics,
- DppMetrics dppMetrics) {
+ DppMetrics dppMetrics,
+ CellularLinkLayerStatsCollector cellularLinkLayerStatsCollector) {
mContext = context;
mFacade = facade;
mClock = clock;
@@ -695,6 +699,7 @@ public class WifiMetrics {
mWifiPowerMetrics = wifiPowerMetrics;
mWifiP2pMetrics = wifiP2pMetrics;
mDppMetrics = dppMetrics;
+ mCellularLinkLayerStatsCollector = cellularLinkLayerStatsCollector;
loadSettings();
mHandler = new Handler(looper) {
public void handleMessage(Message msg) {
@@ -2759,6 +2764,10 @@ public class WifiMetrics {
line.append(",rx_link_speed_mbps=" + entry.rxLinkSpeedMbps);
line.append(",seq_num_inside_framework=" + entry.seqNumInsideFramework);
line.append(",is_same_bssid_and_freq=" + entry.isSameBssidAndFreq);
+ line.append(",cellular_data_network_type=" + entry.cellularDataNetworkType);
+ line.append(",cellular_signal_strength_dbm=" + entry.cellularSignalStrengthDbm);
+ line.append(",cellular_signal_strength_db=" + entry.cellularSignalStrengthDb);
+ line.append(",is_same_registered_cell=" + entry.isSameRegisteredCell);
pw.println(line.toString());
}
@@ -4154,6 +4163,15 @@ public class WifiMetrics {
wifiUsabilityStatsEntry.rxLinkSpeedMbps = info.getRxLinkSpeedMbps();
wifiUsabilityStatsEntry.isSameBssidAndFreq = isSameBssidAndFreq;
wifiUsabilityStatsEntry.seqNumInsideFramework = mSeqNumInsideFramework;
+
+ CellularLinkLayerStats cls = mCellularLinkLayerStatsCollector.update();
+ if (DBG) Log.v(TAG, "Latest Cellular Link Layer Stats: " + cls);
+ wifiUsabilityStatsEntry.cellularDataNetworkType =
+ parseDataNetworkTypeToProto(cls.getDataNetworkType());
+ wifiUsabilityStatsEntry.cellularSignalStrengthDbm = cls.getSignalStrengthDbm();
+ wifiUsabilityStatsEntry.cellularSignalStrengthDb = cls.getSignalStrengthDb();
+ wifiUsabilityStatsEntry.isSameRegisteredCell = cls.getIsSameRegisteredCell();
+
mWifiUsabilityStatsEntriesList.add(wifiUsabilityStatsEntry);
mWifiUsabilityStatsCounter++;
if (mWifiUsabilityStatsCounter >= NUM_WIFI_USABILITY_STATS_ENTRIES_PER_WIFI_GOOD) {
@@ -4173,6 +4191,53 @@ public class WifiMetrics {
}
}
+ private int parseDataNetworkTypeToProto(int cellularDataNetworkType) {
+ switch (cellularDataNetworkType) {
+ case TelephonyManager.NETWORK_TYPE_UNKNOWN:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_UNKNOWN;
+ case TelephonyManager.NETWORK_TYPE_GSM:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_GSM;
+ case TelephonyManager.NETWORK_TYPE_CDMA:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_CDMA;
+ case TelephonyManager.NETWORK_TYPE_EVDO_0:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_EVDO_0;
+ case TelephonyManager.NETWORK_TYPE_UMTS:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_UMTS;
+ case TelephonyManager.NETWORK_TYPE_TD_SCDMA:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_TD_SCDMA;
+ case TelephonyManager.NETWORK_TYPE_LTE:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_LTE;
+ case TelephonyManager.NETWORK_TYPE_NR:
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_NR;
+ default:
+ Log.e(TAG, "Unknown data network type : " + cellularDataNetworkType);
+ return WifiUsabilityStatsEntry.NETWORK_TYPE_UNKNOWN;
+ }
+ }
+
+ private int parseDataNetworkTypeFromProto(int cellularDataNetworkType) {
+ switch (cellularDataNetworkType) {
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_UNKNOWN:
+ return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_GSM:
+ return TelephonyManager.NETWORK_TYPE_GSM;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_CDMA:
+ return TelephonyManager.NETWORK_TYPE_CDMA;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_EVDO_0:
+ return TelephonyManager.NETWORK_TYPE_EVDO_0;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_UMTS:
+ return TelephonyManager.NETWORK_TYPE_UMTS;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_TD_SCDMA:
+ return TelephonyManager.NETWORK_TYPE_TD_SCDMA;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_LTE:
+ return TelephonyManager.NETWORK_TYPE_LTE;
+ case WifiUsabilityStatsEntry.NETWORK_TYPE_NR:
+ return TelephonyManager.NETWORK_TYPE_NR;
+ default:
+ Log.e(TAG, "Unknown data network type : " + cellularDataNetworkType);
+ return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ }
+ }
/**
* Send Wifi usability stats.
* @param seqNum
@@ -4208,6 +4273,7 @@ public class WifiMetrics {
probeStatus = android.net.wifi.WifiUsabilityStatsEntry.PROBE_STATUS_UNKNOWN;
Log.e(TAG, "Unknown link probe status: " + s.probeStatusSinceLastUpdate);
}
+ int cellularDataNetworkType = parseDataNetworkTypeFromProto(s.cellularDataNetworkType);
return new android.net.wifi.WifiUsabilityStatsEntry(s.timeStampMs, s.rssi,
s.linkSpeedMbps, s.totalTxSuccess, s.totalTxRetries,
s.totalTxBad, s.totalRxSuccess, s.totalRadioOnTimeMs,
@@ -4216,7 +4282,9 @@ public class WifiMetrics {
s.totalPnoScanTimeMs, s.totalHotspot2ScanTimeMs, s.totalCcaBusyFreqTimeMs,
s.totalRadioOnFreqTimeMs, s.totalBeaconRx, probeStatus,
s.probeElapsedTimeSinceLastUpdateMs, s.probeMcsRateSinceLastUpdate,
- s.rxLinkSpeedMbps
+ s.rxLinkSpeedMbps, cellularDataNetworkType,
+ s.cellularSignalStrengthDbm, s.cellularSignalStrengthDb,
+ s.isSameRegisteredCell
);
}
@@ -4251,6 +4319,10 @@ public class WifiMetrics {
out.rxLinkSpeedMbps = s.rxLinkSpeedMbps;
out.isSameBssidAndFreq = s.isSameBssidAndFreq;
out.seqNumInsideFramework = s.seqNumInsideFramework;
+ out.cellularDataNetworkType = s.cellularDataNetworkType;
+ out.cellularSignalStrengthDbm = s.cellularSignalStrengthDbm;
+ out.cellularSignalStrengthDb = s.cellularSignalStrengthDb;
+ out.isSameRegisteredCell = s.isSameRegisteredCell;
return out;
}