Skip WiFi access in CtsJobSchedulerTestCases module if feature not supported
Test cases are using wifi manager instance which is null when WiFi feature not enabled.
This change stops the test from accessing Wifi Manager based on WiFi feature availabiliy.
Bug: 262228635
Test: Executed all CtsJobSchedulerTestCases tests on system with and without WiFi feature
Change-Id: Ie8a1be3cc338c7ac053144faa5eeea9bae99f70e
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
index f279aa56..df34a9d 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
@@ -173,7 +173,9 @@
mWifiManager = mContext.getSystemService(WifiManager.class);
mCm = mContext.getSystemService(ConnectivityManager.class);
mHasWifi = mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI);
- mInitialWiFiState = mWifiManager.isWifiEnabled();
+ if (mHasWifi) {
+ mInitialWiFiState = mWifiManager.isWifiEnabled();
+ }
mInitialAirplaneModeState = isAirplaneModeOn();
mInitialRestrictedBucketEnabled = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.ENABLE_RESTRICTED_BUCKET);