Skip wifi stats test if link layer stats is not supported

Wifi link layer is an optional feature so this test will be
failed on wifi stats check if a device does not support it.
Add a check to know if the  device supports wifi link layer
stats and skip it if it is not supported.

Ignore-AOSP-First: Needs cherry-picks
Bug: 195518957
Test: CtsNetTestCases:BatteryStatsManagerTest
Change-Id: I592dd5f1d6e13b020beadb11b9d913857a82e524
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);