From 891a6b2bc38b7de60013d70d66c76df09cfec446 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Fri, 22 May 2026 00:42:54 +0000 Subject: [PATCH 1/4] Fix wifi.configure UWORKER Datastore access crash --- src/clusterfuzz/_internal/platforms/android/wifi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/clusterfuzz/_internal/platforms/android/wifi.py b/src/clusterfuzz/_internal/platforms/android/wifi.py index 2082bdbc7cb..91e95c8b1ed 100644 --- a/src/clusterfuzz/_internal/platforms/android/wifi.py +++ b/src/clusterfuzz/_internal/platforms/android/wifi.py @@ -49,6 +49,10 @@ def disable_airplane_mode(): def configure(force_enable=False): """Configure airplane mode and wifi on device.""" + # Short-circuit: UWORKERs do not have Datastore access to retrieve Wi-Fi credentials. + if environment.is_uworker(): + return + # Airplane mode should be disabled in all cases. This can get inadvertently # turned on via gestures. disable_airplane_mode() From d25267bd6fb8dba11a0635786a087bbc5056aaf9 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Fri, 22 May 2026 01:37:18 +0000 Subject: [PATCH 2/4] Fix linting errors in wifi.py Fixed line too long and trailing whitespace issues to pass the CI. --- src/clusterfuzz/_internal/platforms/android/wifi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clusterfuzz/_internal/platforms/android/wifi.py b/src/clusterfuzz/_internal/platforms/android/wifi.py index 91e95c8b1ed..1c0e4f585d1 100644 --- a/src/clusterfuzz/_internal/platforms/android/wifi.py +++ b/src/clusterfuzz/_internal/platforms/android/wifi.py @@ -49,10 +49,10 @@ def disable_airplane_mode(): def configure(force_enable=False): """Configure airplane mode and wifi on device.""" - # Short-circuit: UWORKERs do not have Datastore access to retrieve Wi-Fi credentials. + # Short-circuit: UWORKERs do not have Datastore access for Wi-Fi credentials. if environment.is_uworker(): return - + # Airplane mode should be disabled in all cases. This can get inadvertently # turned on via gestures. disable_airplane_mode() From fa03d47d52b0cf2e6073b59e3f989c071ea70f35 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Fri, 22 May 2026 01:42:33 +0000 Subject: [PATCH 3/4] Add unit test for UWORKER wifi short-circuit This adds a unit test to verify that wifi.configure() safely returns early when executed inside a UWORKER environment, preventing a crash caused by illegal Datastore queries for Wi-Fi credentials. --- .../tests/core/platforms/android/wifi_test.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py diff --git a/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py b/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py new file mode 100644 index 00000000000..567db93fd95 --- /dev/null +++ b/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py @@ -0,0 +1,40 @@ +# Copyright 2024 Google LLC +# +# 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. +"""Tests for wifi functions.""" + +import unittest + +from clusterfuzz._internal.platforms.android import wifi +from clusterfuzz._internal.tests.test_libs import helpers + + +class ConfigureTest(unittest.TestCase): + """Tests for wifi.configure.""" + + def setUp(self): + helpers.patch(self, [ + 'clusterfuzz._internal.system.environment.is_uworker', + 'clusterfuzz._internal.platforms.android.wifi.disable_airplane_mode', + 'clusterfuzz._internal.config.db_config.get', + ]) + + def test_uworker_bypass(self): + """Test that uworker environment skips wifi setup.""" + self.mock.is_uworker.return_value = True + + wifi.configure() + + # Ensure none of the subsequent functions that crash/hit Datastore are called. + self.mock.disable_airplane_mode.assert_not_called() + self.mock.get.assert_not_called() From 4c301e9f8c9d1c9d1f5321ecd84f9260c16c7c8c Mon Sep 17 00:00:00 2001 From: Ivan Barba Date: Fri, 22 May 2026 15:32:42 -0600 Subject: [PATCH 4/4] Apply suggestion from @fernandofloresg Co-authored-by: Fernando Flores --- .../_internal/tests/core/platforms/android/wifi_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py b/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py index 567db93fd95..e1a02597723 100644 --- a/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py +++ b/src/clusterfuzz/_internal/tests/core/platforms/android/wifi_test.py @@ -1,4 +1,4 @@ -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.