Allow for a configurable WiFi restore bounce delay

Allow the post-restore WiFi bounce delay to be configured (for
example, allow it to be set to zero).

Bug: 9621727

Change-Id: I0b388aadbe3b45eeb4aa00bbe0e6d86f21731449
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 843a468..ee37045 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6041,6 +6041,16 @@
         public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
 
         /**
+         * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
+         * the caller is done with this, they should call {@link ContentResolver#delete(Uri)} to
+         * clean up any value that they may have written.
+         *
+         * @hide
+         */
+        public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
+
+
+        /**
          * Settings to backup. This is here so that it's in the same place as the settings
          * keys and easy to update.
          *
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 7b09092..45957a4 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -422,7 +422,11 @@
         // If we have wifi data to restore, post a runnable to perform the
         // bounce-and-update operation a little ways in the future.
         if (mWifiRestore != null) {
-            new Handler(getMainLooper()).postDelayed(mWifiRestore, WIFI_BOUNCE_DELAY_MILLIS);
+            long wifiBounceDelayMillis = Settings.Global.getLong(
+                    getContentResolver(),
+                    Settings.Global.WIFI_BOUNCE_DELAY_OVERRIDE_MS,
+                    WIFI_BOUNCE_DELAY_MILLIS);
+            new Handler(getMainLooper()).postDelayed(mWifiRestore, wifiBounceDelayMillis);
         }
     }