Merge "Skip wifi stats test if link layer stats is not supported" into sc-dev am: 9ac9c1d575 am: 1a1ab4a4ab
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15479880
Change-Id: I98f7f0051761e8f912f980cb23a6c7cde536a181
diff --git a/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java b/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java
index dfb03c7..47a8420 100644
--- a/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/BatteryStatsManagerTest.java
@@ -31,6 +31,7 @@
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.cts.util.CtsNetUtils;
+import android.net.wifi.WifiManager;
import android.os.BatteryStatsManager;
import android.os.Build;
import android.os.connectivity.CellularBatteryStats;
@@ -70,6 +71,7 @@
private Context mContext;
private BatteryStatsManager mBsm;
private ConnectivityManager mCm;
+ private WifiManager mWm;
private CtsNetUtils mCtsNetUtils;
@Before
@@ -77,6 +79,7 @@
mContext = getContext();
mBsm = mContext.getSystemService(BatteryStatsManager.class);
mCm = mContext.getSystemService(ConnectivityManager.class);
+ mWm = mContext.getSystemService(WifiManager.class);
mCtsNetUtils = new CtsNetUtils(mContext);
}
@@ -128,6 +131,11 @@
cellularStatsAfter -> cellularBatteryStatsIncreased(
cellularStatsBefore, cellularStatsAfter)));
+ if (!mWm.isEnhancedPowerReportingSupported()) {
+ Log.d(TAG, "Skip wifi stats test because wifi does not support link layer stats.");
+ return;
+ }
+
WifiBatteryStats wifiStatsBefore = runAsShell(UPDATE_DEVICE_STATS,
mBsm::getWifiBatteryStats);