Fix wake and scan behavior

- Add wakelock for driver start/stop to ensure a wifilock
  acquisition kick starts driver. Also cleaned up state machine
  driver start/stop behavior.
- Add periodic scans when driver is started to ensure wifi
  reconnections when wifilock exists or when user chooses
  never to sleep
- some minor clean up

Change-Id: I844eb70491d5aa2f8c8933b3d8dd01ba237ee534
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 56babdd2..17d4aa4 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3297,6 +3297,14 @@
         public static final String WIFI_IDLE_MS = "wifi_idle_ms";
 
         /**
+         * The interval in milliseconds to issue scans when the driver is
+         * started. This is necessary to allow wifi to connect to an
+         * access point when the driver is suspended.
+         * @hide
+         */
+        public static final String WIFI_SCAN_INTERVAL_MS = "wifi_scan_interval_ms";
+
+        /**
          * The interval in milliseconds at which to check packet counts on the
          * mobile data interface when screen is on, to detect possible data
          * connection problems.