From 1bfb8285a183e9643c14d7176d4a431b01a3f495 Mon Sep 17 00:00:00 2001 From: Ido Ben-Hur Date: Mon, 24 Jun 2024 01:49:16 +0300 Subject: [PATCH] Settings: Skip auth for WiFi net share when unlocked in the last 60s So it matches with the QS tile behavior --- .../wifi/details2/WifiDetailPreferenceController2.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java index b67c84832fb..4d8854f1a26 100644 --- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java +++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java @@ -116,6 +116,9 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle private static final String TAG = "WifiDetailsPrefCtrl2"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); + private static final String WIFI_SHARING_KEY_ALIAS = "wifi_sharing_auth_key"; + private static final int MAX_UNLOCK_SECONDS = 60; + @VisibleForTesting static final String KEY_HEADER = "connection_header"; @VisibleForTesting @@ -969,6 +972,11 @@ private void launchWifiDppConfiguratorActivity() { * Share the wifi network with QR code. */ private void shareNetwork() { + if (WifiDppUtils.isUnlockedWithinSeconds(WIFI_SHARING_KEY_ALIAS, MAX_UNLOCK_SECONDS)) { + // skip the auth dialog if unlocked last minute + launchWifiDppConfiguratorActivity(); + return; + } WifiDppUtils.showLockScreen(mContext, () -> launchWifiDppConfiguratorActivity()); }