summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2019-10-18 16:09:38 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-10-18 16:09:38 +0000
commit6fedbc9f7ae92fed69b1bb22b0b7cf76f2e502ac (patch)
tree5bf9cbc7617a2a6add8c85f1e00094d97f552f94
parentb893a872205a91ec17324493631752a35d309d97 (diff)
parenteab399a9cdfbe2e27d9fd925dbd8499aa41d2c5e (diff)
Merge "Remove CellularLinkLayerStats and CellularLinkLayerStatsCollector and their usages in wifiMetrics and WifiUsabilityEntry because they have been moved to CHS App. Leave Public API as is for now."
-rw-r--r--service/java/com/android/server/wifi/CellularLinkLayerStats.java90
-rw-r--r--service/java/com/android/server/wifi/CellularLinkLayerStatsCollector.java237
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java5
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java76
-rw-r--r--tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsCollectorTest.java319
-rw-r--r--tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsTest.java68
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java35
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java4
8 files changed, 6 insertions, 828 deletions
diff --git a/service/java/com/android/server/wifi/CellularLinkLayerStats.java b/service/java/com/android/server/wifi/CellularLinkLayerStats.java
deleted file mode 100644
index 09923e625..000000000
--- a/service/java/com/android/server/wifi/CellularLinkLayerStats.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.Annotation.NetworkType;
-import android.telephony.SignalStrength;
-import android.telephony.TelephonyManager;
-
-/**
- * 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
deleted file mode 100644
index 81d219cce..000000000
--- a/service/java/com/android/server/wifi/CellularLinkLayerStatsCollector.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * 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;
- // TODO(b/132188983): Inject this using WifiInjector
- 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 851c89fa8..a352ba181 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -152,7 +152,6 @@ public class WifiInjector {
private final DppManager mDppManager;
private final LinkProbeManager mLinkProbeManager;
private IpMemoryStore mIpMemoryStore;
- private final CellularLinkLayerStatsCollector mCellularLinkLayerStatsCollector;
private final WifiThreadRunner mWifiThreadRunner;
public WifiInjector(Context context) {
@@ -203,10 +202,8 @@ 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, wifiLooper,
- awareMetrics, rttMetrics, new WifiPowerMetrics(), mWifiP2pMetrics, mDppMetrics,
- mCellularLinkLayerStatsCollector);
+ awareMetrics, rttMetrics, new WifiPowerMetrics(), mWifiP2pMetrics, mDppMetrics);
// Modules interacting with Native.
mWifiMonitor = new WifiMonitor(this);
mHalDeviceManager = new HalDeviceManager(mClock, wifiHandler);
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index 8ce13b6ee..109129016 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -39,7 +39,6 @@ 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;
@@ -432,8 +431,6 @@ public class WifiMetrics {
private int mNetworkSelectorExperimentId;
- private final CellularLinkLayerStatsCollector mCellularLinkLayerStatsCollector;
-
/**
* Tracks the nominator for each network (i.e. which entity made the suggestion to connect).
* This object should not be cleared.
@@ -758,8 +755,7 @@ public class WifiMetrics {
public WifiMetrics(Context context, FrameworkFacade facade, Clock clock, Looper looper,
WifiAwareMetrics awareMetrics, RttMetrics rttMetrics,
WifiPowerMetrics wifiPowerMetrics, WifiP2pMetrics wifiP2pMetrics,
- DppMetrics dppMetrics,
- CellularLinkLayerStatsCollector cellularLinkLayerStatsCollector) {
+ DppMetrics dppMetrics) {
mContext = context;
mFacade = facade;
mClock = clock;
@@ -772,7 +768,6 @@ public class WifiMetrics {
mWifiPowerMetrics = wifiPowerMetrics;
mWifiP2pMetrics = wifiP2pMetrics;
mDppMetrics = dppMetrics;
- mCellularLinkLayerStatsCollector = cellularLinkLayerStatsCollector;
loadSettings();
mHandler = new Handler(looper) {
public void handleMessage(Message msg) {
@@ -2885,10 +2880,6 @@ 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);
line.append(",device_mobility_state=" + entry.deviceMobilityState);
pw.println(line.toString());
}
@@ -4354,14 +4345,6 @@ public class WifiMetrics {
wifiUsabilityStatsEntry.seqNumInsideFramework = mSeqNumInsideFramework;
wifiUsabilityStatsEntry.deviceMobilityState = mCurrentDeviceMobilityState;
- 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) {
@@ -4391,53 +4374,6 @@ 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
@@ -4473,7 +4409,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);
+ // TODO: remove the following hardcoded values once if they are removed from public API
return new android.net.wifi.WifiUsabilityStatsEntry(s.timeStampMs, s.rssi,
s.linkSpeedMbps, s.totalTxSuccess, s.totalTxRetries,
s.totalTxBad, s.totalRxSuccess, s.totalRadioOnTimeMs,
@@ -4482,9 +4418,7 @@ public class WifiMetrics {
s.totalPnoScanTimeMs, s.totalHotspot2ScanTimeMs, s.totalCcaBusyFreqTimeMs,
s.totalRadioOnFreqTimeMs, s.totalBeaconRx, probeStatus,
s.probeElapsedTimeSinceLastUpdateMs, s.probeMcsRateSinceLastUpdate,
- s.rxLinkSpeedMbps, cellularDataNetworkType,
- s.cellularSignalStrengthDbm, s.cellularSignalStrengthDb,
- s.isSameRegisteredCell
+ s.rxLinkSpeedMbps, 0, 0, 0, false
);
}
@@ -4519,10 +4453,6 @@ 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;
out.deviceMobilityState = s.deviceMobilityState;
return out;
}
diff --git a/tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsCollectorTest.java b/tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsCollectorTest.java
deleted file mode 100644
index e6d459319..000000000
--- a/tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsCollectorTest.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (C) 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 static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Mockito.validateMockitoUsage;
-
-import android.content.Context;
-import android.telephony.Annotation.NetworkType;
-import android.telephony.CellInfo;
-import android.telephony.CellInfoCdma;
-import android.telephony.CellInfoGsm;
-import android.telephony.CellInfoLte;
-import android.telephony.CellInfoTdscdma;
-import android.telephony.CellInfoWcdma;
-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 androidx.test.filters.SmallTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoSession;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Unit tests for {@link com.android.server.wifi.CellularLinkLayerStatsCollector}.
- */
-@SmallTest
-public class CellularLinkLayerStatsCollectorTest extends WifiBaseTest {
- private CellularLinkLayerStatsCollector mCollector;
- private static final String TAG = "CellCollectorTest";
- private static final int DBM_VAL = -110;
- private static final int DB_VAL = -20;
- private static final int DB_VAL_EVDO = 4;
- private static final int SUBID = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
- MockitoSession mMockingSession = null;
- @Mock Context mContext;
- @Mock TelephonyManager mTelephonyManager;
- @Mock SubscriptionManager mSubscriptionManager;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- when(mContext.getSystemService(Context.TELEPHONY_SERVICE))
- .thenReturn(mTelephonyManager);
- when(mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE))
- .thenReturn(mSubscriptionManager);
- when(mTelephonyManager.createForSubscriptionId(anyInt()))
- .thenReturn(mTelephonyManager);
- mCollector = new CellularLinkLayerStatsCollector(mContext);
- mMockingSession = mockitoSession().mockStatic(SubscriptionManager.class).startMocking();
- when(SubscriptionManager.getDefaultDataSubscriptionId()).thenReturn(SUBID);
- when(SubscriptionManager.getDefaultSubscriptionId()).thenReturn(SUBID);
- }
-
- @After
- public void cleanUp() throws Exception {
- validateMockitoUsage();
- if (mMockingSession != null) {
- mMockingSession.finishMocking();
- }
- }
-
- private List<CellInfo> generateCellInfoList(@NetworkType int networkType) {
- List<CellInfo> cil = new ArrayList<>();
- int numCellInfo = 2;
- for (int i = 0; i < numCellInfo; ++i) {
- CellInfo ci;
- if (networkType == NETWORK_TYPE_LTE) {
- ci = new CellInfoLte();
- } else if (networkType == NETWORK_TYPE_CDMA || networkType == NETWORK_TYPE_EVDO_0) {
- ci = new CellInfoCdma();
- } else if (networkType == NETWORK_TYPE_GSM) {
- ci = new CellInfoGsm();
- } else if (networkType == NETWORK_TYPE_TD_SCDMA) {
- ci = new CellInfoTdscdma();
- } else if (networkType == NETWORK_TYPE_UMTS) {
- ci = new CellInfoWcdma();
- } else if (networkType == NETWORK_TYPE_NR) {
- // TODO: CellInfoNr() is not supported yet.
- ci = new CellInfoLte();
- } else {
- ci = new CellInfoLte();
- }
- if (i == 0 && networkType != NETWORK_TYPE_UNKNOWN) {
- ci.setRegistered(true);
- } else {
- ci.setRegistered(false);
- }
- cil.add(ci);
- }
- return cil;
- }
-
- private SignalStrength generateSignalStrength(int dBmVal, int dBVal,
- @NetworkType int networkType) {
- int dummy = 1000;
- CellSignalStrengthLte mLte = new CellSignalStrengthLte();
- CellSignalStrengthNr mNr = new CellSignalStrengthNr();
- CellSignalStrengthGsm mGsm = new CellSignalStrengthGsm();
- CellSignalStrengthCdma mCdma = new CellSignalStrengthCdma();
- CellSignalStrengthTdscdma mTdscdma = new CellSignalStrengthTdscdma();
- CellSignalStrengthWcdma mWcdma = new CellSignalStrengthWcdma();
-
- if (networkType == NETWORK_TYPE_UNKNOWN) {
- return new SignalStrength();
- } else if (networkType == NETWORK_TYPE_LTE) {
- mLte = new CellSignalStrengthLte(dummy, dBmVal, dBVal, dummy, dummy, dummy);
- } else if (networkType == NETWORK_TYPE_CDMA) {
- mCdma = new CellSignalStrengthCdma(dBmVal, dBVal, dBmVal, dummy,
- SignalStrength.INVALID);
- } else if (networkType == NETWORK_TYPE_EVDO_0) {
- mCdma = new CellSignalStrengthCdma(dBmVal, dummy, dBmVal, dummy, dBVal);
- } else if (networkType == NETWORK_TYPE_TD_SCDMA) {
- mTdscdma = new CellSignalStrengthTdscdma(dummy, dummy, dBmVal);
- } else if (networkType == NETWORK_TYPE_UMTS) {
- mWcdma = new CellSignalStrengthWcdma(dummy, dummy, dBmVal, dBVal);
- } else if (networkType == NETWORK_TYPE_GSM) {
- mGsm = new CellSignalStrengthGsm(dBmVal, dummy, dummy);
- } else if (networkType == NETWORK_TYPE_NR) {
- mNr = new CellSignalStrengthNr(dBmVal, dummy, dBVal, dummy, dummy, dummy);
- } else {
- return null;
- }
- return new SignalStrength(mCdma, mGsm, mWcdma, mTdscdma, mLte, mNr);
- }
-
- private void testCollectorUpdate(@NetworkType int networkType, boolean isSignalStrengthEmpty,
- CellularLinkLayerStats trueStats) throws Exception {
- int dBmVal = DBM_VAL;
- int dBVal;
- if (networkType == NETWORK_TYPE_EVDO_0) {
- dBVal = DB_VAL_EVDO;
- } else {
- dBVal = DB_VAL;
- }
-
- SignalStrength ss = null;
- if (!isSignalStrengthEmpty) ss = generateSignalStrength(dBmVal, dBVal, networkType);
- List<CellInfo> allList = generateCellInfoList(networkType);
- when(mTelephonyManager.getSignalStrength()).thenReturn(ss);
- when(mTelephonyManager.getAllCellInfo()).thenReturn(allList);
- when(mTelephonyManager.getDataNetworkType()).thenReturn(networkType);
-
- CellularLinkLayerStats mStats = mCollector.update();
-
- assertEquals(SUBID, SubscriptionManager.getDefaultDataSubscriptionId());
- assertEquals(SUBID, SubscriptionManager.getDefaultSubscriptionId());
-
- assertEquals(trueStats.getSignalStrengthDbm(), mStats.getSignalStrengthDbm());
- assertEquals(trueStats.getSignalStrengthDb(), mStats.getSignalStrengthDb());
- assertEquals(trueStats.getDataNetworkType(), mStats.getDataNetworkType());
- assertEquals(trueStats.getIsSameRegisteredCell(), mStats.getIsSameRegisteredCell());
- }
-
- @Test
- public void testEmptySignalStrengthLte() throws Exception {
- @NetworkType int networkType;
- CellularLinkLayerStats trueStats = new CellularLinkLayerStats();
-
- networkType = NETWORK_TYPE_LTE;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(SignalStrength.INVALID);
- trueStats.setSignalStrengthDbm(SignalStrength.INVALID);
- trueStats.setDataNetworkType(NETWORK_TYPE_UNKNOWN);
- testCollectorUpdate(networkType, true, trueStats);
- }
-
- @Test
- public void testRepeatCellInfoTypeTwice() throws Exception {
- @NetworkType int networkType;
- CellularLinkLayerStats trueStats = new CellularLinkLayerStats();
-
- networkType = NETWORK_TYPE_LTE;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_LTE;
- trueStats.setIsSameRegisteredCell(true);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_EVDO_0;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL_EVDO);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_EVDO_0;
- trueStats.setIsSameRegisteredCell(true);
- trueStats.setSignalStrengthDb(DB_VAL_EVDO);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_NR;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_NR;
- trueStats.setIsSameRegisteredCell(true);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
- }
-
- @Test
- public void testLoopOverAllNetworksWithoutRepeat() throws Exception {
- @NetworkType int networkType;
- CellularLinkLayerStats trueStats = new CellularLinkLayerStats();
-
- networkType = NETWORK_TYPE_UNKNOWN;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(SignalStrength.INVALID);
- trueStats.setSignalStrengthDbm(SignalStrength.INVALID);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_LTE;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_CDMA;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_EVDO_0;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL_EVDO);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_TD_SCDMA;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(SignalStrength.INVALID);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_UMTS;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_GSM;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(SignalStrength.INVALID);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- networkType = NETWORK_TYPE_NR;
- trueStats.setIsSameRegisteredCell(false);
- trueStats.setSignalStrengthDb(DB_VAL);
- trueStats.setSignalStrengthDbm(DBM_VAL);
- trueStats.setDataNetworkType(networkType);
- testCollectorUpdate(networkType, false, trueStats);
-
- }
-}
diff --git a/tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsTest.java b/tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsTest.java
deleted file mode 100644
index 597f35447..000000000
--- a/tests/wifitests/src/com/android/server/wifi/CellularLinkLayerStatsTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 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 org.junit.Assert.assertEquals;
-
-import android.telephony.TelephonyManager;
-
-import androidx.test.filters.SmallTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Unit tests for {@link com.android.server.wifi.CellularLinkLayerStats}.
- */
-@SmallTest
-public class CellularLinkLayerStatsTest extends WifiBaseTest {
- private static final String TAG = "CellularStatsTest";
-
- CellularLinkLayerStats mStats;
-
- /**
- * Sets up for unit test
- */
- @Before
- public void setUp() throws Exception {
- mStats = new CellularLinkLayerStats();
- }
-
- @After
- public void cleanUp() throws Exception {
- }
-
- /**
- * Test all set and get methods by checking if the inputs of set() match the output of get()
- */
- @Test
- public void testAllSetGetMethods() throws Exception {
- int dataNetworkType = TelephonyManager.NETWORK_TYPE_GSM;
- mStats.setDataNetworkType(dataNetworkType);
- assertEquals(dataNetworkType, mStats.getDataNetworkType());
- int dbmVal = -100;
- mStats.setSignalStrengthDbm(dbmVal);
- assertEquals(dbmVal, mStats.getSignalStrengthDbm());
- int dbVal = -20;
- mStats.setSignalStrengthDb(dbVal);
- assertEquals(dbVal, mStats.getSignalStrengthDb());
- boolean isSameCell = true;
- mStats.setIsSameRegisteredCell(isSameCell);
- assertEquals(isSameCell, mStats.getIsSameRegisteredCell());
- }
-}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 84873d907..f0defde0c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -69,7 +69,6 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.os.test.TestLooper;
import android.provider.Settings;
-import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Pair;
import android.util.SparseIntArray;
@@ -151,19 +150,16 @@ public class WifiMetricsTest extends WifiBaseTest {
@Mock ExternalCallbackTracker<IOnWifiUsabilityStatsListener> mListenerTracker;
@Mock WifiP2pMetrics mWifiP2pMetrics;
@Mock DppMetrics mDppMetrics;
- @Mock CellularLinkLayerStatsCollector mCellularLinkLayerStatsCollector;
- @Mock CellularLinkLayerStats mCellularLinkLayerStats;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mDecodedProto = null;
when(mClock.getElapsedSinceBootMillis()).thenReturn((long) 0);
- when(mCellularLinkLayerStatsCollector.update()).thenReturn(mCellularLinkLayerStats);
mTestLooper = new TestLooper();
mWifiMetrics = new WifiMetrics(mContext, mFacade, mClock, mTestLooper.getLooper(),
new WifiAwareMetrics(mClock), new RttMetrics(mClock), mWifiPowerMetrics,
- mWifiP2pMetrics, mDppMetrics, mCellularLinkLayerStatsCollector);
+ mWifiP2pMetrics, mDppMetrics);
mWifiMetrics.setWifiConfigManager(mWcm);
mWifiMetrics.setPasspointManager(mPpm);
mWifiMetrics.setScoringParams(mScoringParams);
@@ -2859,16 +2855,6 @@ public class WifiMetricsTest extends WifiBaseTest {
when(info.getBSSID()).thenReturn("Wifi");
when(info.getFrequency()).thenReturn(5745);
- int signalStrengthDbm = -50;
- int signalStrengthDb = -10;
- boolean isSameRegisteredCell = true;
- CellularLinkLayerStats cellularStats = new CellularLinkLayerStats();
- cellularStats.setIsSameRegisteredCell(isSameRegisteredCell);
- cellularStats.setDataNetworkType(TelephonyManager.NETWORK_TYPE_LTE);
- cellularStats.setSignalStrengthDbm(signalStrengthDbm);
- cellularStats.setSignalStrengthDb(signalStrengthDb);
- when(mCellularLinkLayerStatsCollector.update()).thenReturn(cellularStats);
-
WifiLinkLayerStats stats1 = nextRandomStats(new WifiLinkLayerStats());
WifiLinkLayerStats stats2 = nextRandomStats(stats1);
mWifiMetrics.incrementWifiScoreCount(60);
@@ -2921,14 +2907,6 @@ public class WifiMetricsTest extends WifiBaseTest {
.stats[1].probeElapsedTimeSinceLastUpdateMs);
assertEquals(-1, mDecodedProto.wifiUsabilityStatsList[0]
.stats[0].probeElapsedTimeSinceLastUpdateMs);
- assertEquals(WifiUsabilityStatsEntry.NETWORK_TYPE_LTE,
- mDecodedProto.wifiUsabilityStatsList[0].stats[0].cellularDataNetworkType);
- assertEquals(signalStrengthDbm,
- mDecodedProto.wifiUsabilityStatsList[0].stats[0].cellularSignalStrengthDbm);
- assertEquals(signalStrengthDb,
- mDecodedProto.wifiUsabilityStatsList[0].stats[0].cellularSignalStrengthDb);
- assertEquals(isSameRegisteredCell,
- mDecodedProto.wifiUsabilityStatsList[0].stats[0].isSameRegisteredCell);
assertEquals(DEVICE_MOBILITY_STATE_HIGH_MVMT, mDecodedProto.wifiUsabilityStatsList[1]
.stats[mDecodedProto.wifiUsabilityStatsList[1].stats.length - 1]
.deviceMobilityState);
@@ -3226,13 +3204,6 @@ public class WifiMetricsTest extends WifiBaseTest {
when(info.getRssi()).thenReturn(nextRandInt());
when(info.getLinkSpeed()).thenReturn(nextRandInt());
- CellularLinkLayerStats cellularStats = new CellularLinkLayerStats();
- cellularStats.setIsSameRegisteredCell(false);
- cellularStats.setDataNetworkType(TelephonyManager.NETWORK_TYPE_UMTS);
- cellularStats.setSignalStrengthDbm(-100);
- cellularStats.setSignalStrengthDb(-20);
- when(mCellularLinkLayerStatsCollector.update()).thenReturn(cellularStats);
-
WifiLinkLayerStats linkLayerStats = nextRandomStats(new WifiLinkLayerStats());
mWifiMetrics.updateWifiUsabilityStatsEntries(info, linkLayerStats);
@@ -3246,10 +3217,6 @@ public class WifiMetricsTest extends WifiBaseTest {
assertEquals(usabilityStats.getValue().getTimeStampMillis(), linkLayerStats.timeStampInMs);
assertEquals(usabilityStats.getValue().getTotalRoamScanTimeMillis(),
linkLayerStats.on_time_roam_scan);
- assertEquals(usabilityStats.getValue().getCellularDataNetworkType(),
- TelephonyManager.NETWORK_TYPE_UMTS);
- assertEquals(usabilityStats.getValue().getCellularSignalStrengthDbm(), -100);
- assertEquals(usabilityStats.getValue().getCellularSignalStrengthDb(), -20);
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
index 67a54ba82..c61ceb4a9 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
@@ -77,7 +77,6 @@ import com.android.internal.app.IBatteryStats;
import com.android.internal.util.AsyncChannel;
import com.android.internal.util.Protocol;
import com.android.internal.util.test.BidirectionalAsyncChannel;
-import com.android.server.wifi.CellularLinkLayerStatsCollector;
import com.android.server.wifi.Clock;
import com.android.server.wifi.DppMetrics;
import com.android.server.wifi.FakeWifiLog;
@@ -146,7 +145,6 @@ public class WifiScanningServiceTest extends WifiBaseTest {
TestLooper mLooper;
WifiScanningServiceImpl mWifiScanningServiceImpl;
@Mock WifiP2pMetrics mWifiP2pMetrics;
- @Mock CellularLinkLayerStatsCollector mCellularLinkLayerStatsCollector;
@Before
public void setUp() throws Exception {
@@ -171,7 +169,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
mWifiMetrics = new WifiMetrics(mContext, mFrameworkFacade, mClock, mLooper.getLooper(),
new WifiAwareMetrics(mClock), new RttMetrics(mClock),
new WifiPowerMetrics(mBatteryStats),
- mWifiP2pMetrics, mDppMetrics, mCellularLinkLayerStatsCollector);
+ mWifiP2pMetrics, mDppMetrics);
when(mWifiScannerImplFactory
.create(any(), any(), any(), eq(TEST_IFACE_NAME_0)))
.thenReturn(mWifiScannerImpl0);