Snap for 7632648 from 47b4556fc017f3f2e51b0d916098aa24582e90bd to sc-v2-release
Change-Id: I5c0da6a2ae03b6aa07287919c570b46a94947379
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);