Skip to content

Commit

Permalink
Settings: Skip auth for WiFi net share when unlocked in the last 60s
Browse files Browse the repository at this point in the history
So it matches with the QS tile behavior
  • Loading branch information
idoybh authored and GuidixX committed Jun 24, 2024
1 parent a81cc8c commit 1bfb828
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit 1bfb828

Please sign in to comment.