summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nate Jiang <qiangjiang@google.com> 2025-03-14 21:17:09 +0000
committer Nate Jiang <qiangjiang@google.com> 2025-03-19 10:47:28 -0700
commitd65e6affdb335bbea1faa0c1c46df8fd75a12bcd (patch)
tree158c53838ed0d07032d021a8639c56973f780b83
parent934f9d0a8d5636fa9f3c11860ae2cc1850b0e0be (diff)
Allow fulfill approved request even screen off
Flag: EXEMPT bugfix Bug: 403348813 Test: atest com.android.server.wifi Change-Id: I348be3a1671bf7cfa67ce9db0be4fadb31bc7900
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java8
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java1
2 files changed, 9 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index f29eb75cf6..ec4a5ca353 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -1347,6 +1347,14 @@ public class WifiNetworkFactory extends NetworkFactory {
// If there is no active request or if the user has already selected a network,
// ignore screen state changes.
if (mActiveSpecificNetworkRequest == null || !mIsPeriodicScanEnabled) return;
+ if (mSkipUserDialogue) {
+ // Allow App which bypass the user approval to fulfill the request during screen off.
+ return;
+ }
+ if (screenOn != mIsPeriodicScanPaused) {
+ // already at the expected state
+ return;
+ }
// Pause periodic scans when the screen is off & resume when the screen is on.
if (screenOn) {
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
index 21aba31784..329a7a8ef0 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
@@ -3342,6 +3342,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest {
WifiConfigurationTestUtil.createPskNetwork(), TEST_UID_1, TEST_PACKAGE_NAME_1,
new int[0]);
mWifiNetworkFactory.needNetworkFor(mNetworkRequest);
+ setScreenState(false);
// Verify we did not trigger the UI for the second request.
verify(mContext, never()).startActivityAsUser(any(), any());