Loading core/java/android/provider/Settings.java +12 −4 Original line number Diff line number Diff line Loading @@ -3303,12 +3303,20 @@ public final class Settings { 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. * The interval in milliseconds to issue wake up scans when wifi needs * to connect. This is necessary to connect to an access point when * device is on the move and the screen is off. * @hide */ public static final String WIFI_SCAN_INTERVAL_MS = "wifi_scan_interval_ms"; public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = "wifi_framework_scan_interval_ms"; /** * The interval in milliseconds to scan as used by the wifi supplicant * @hide */ public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = "wifi_supplicant_scan_interval_ms"; /** * The interval in milliseconds at which to check packet counts on the Loading core/jni/android_net_wifi_Wifi.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -556,7 +556,7 @@ static jboolean android_net_wifi_setSuspendOptimizationsCommand(JNIEnv* env, job return doBooleanCommand(cmdstr, "OK"); } static void android_net_wifi_enableBackgroundScan(JNIEnv* env, jobject clazz, jboolean enable) static void android_net_wifi_enableBackgroundScanCommand(JNIEnv* env, jobject clazz, jboolean enable) { //Note: BGSCAN-START and BGSCAN-STOP are documented in core/res/res/values/config.xml //and will need an update if the names are changed Loading @@ -568,6 +568,16 @@ static void android_net_wifi_enableBackgroundScan(JNIEnv* env, jobject clazz, jb } } static void android_net_wifi_setScanIntervalCommand(JNIEnv* env, jobject clazz, jint scanInterval) { char cmdstr[BUF_SIZE]; int numWritten = snprintf(cmdstr, sizeof(cmdstr), "SCAN_INTERVAL %d", scanInterval); if(numWritten < (int)sizeof(cmdstr)) doBooleanCommand(cmdstr, "OK"); } // ---------------------------------------------------------------------------- /* Loading Loading @@ -635,7 +645,8 @@ static JNINativeMethod gWifiMethods[] = { (void*) android_net_wifi_setSuspendOptimizationsCommand}, { "setCountryCodeCommand", "(Ljava/lang/String;)Z", (void*) android_net_wifi_setCountryCodeCommand}, { "enableBackgroundScan", "(Z)V", (void*) android_net_wifi_enableBackgroundScan}, { "enableBackgroundScanCommand", "(Z)V", (void*) android_net_wifi_enableBackgroundScanCommand}, { "setScanIntervalCommand", "(I)V", (void*) android_net_wifi_setScanIntervalCommand}, }; int register_android_net_wifi_WifiManager(JNIEnv* env) Loading core/res/res/values/config.xml +9 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,15 @@ The driver commands needed to support the feature are BGSCAN-START and BGSCAN-STOP --> <bool translatable="false" name="config_wifi_background_scan_support">false</bool> <!-- Integer indicating wpa_supplicant scan interval in milliseconds --> <integer translatable="false" name="config_wifi_supplicant_scan_interval">15000</integer> <!-- Integer indicating the framework scan interval in milliseconds. This is used in the scenario where the chipset does not support background scanning (config_wifi_background_scan_suport is false) to set up a periodic wake up scan so that the device can connect to a new access point on the move. A value of 0 means no periodic scans will be used in the framework. --> <integer translatable="false" name="config_wifi_framework_scan_interval">300000</integer> <!-- Flag indicating whether the keyguard should be bypassed when the slider is open. This can be set or unset depending how easily the slider can be opened (for example, in a pocket or purse). --> Loading services/java/com/android/server/WifiService.java +2 −2 Original line number Diff line number Diff line Loading @@ -937,7 +937,7 @@ public class WifiService extends IWifiManager.Stub { evaluateTrafficStatsPolling(); mWifiStateMachine.enableRssiPolling(true); if (mBackgroundScanSupported) { mWifiStateMachine.enableBackgroundScan(false); mWifiStateMachine.enableBackgroundScanCommand(false); } mWifiStateMachine.enableAllNetworks(); updateWifiState(); Loading @@ -949,7 +949,7 @@ public class WifiService extends IWifiManager.Stub { evaluateTrafficStatsPolling(); mWifiStateMachine.enableRssiPolling(false); if (mBackgroundScanSupported) { mWifiStateMachine.enableBackgroundScan(true); mWifiStateMachine.enableBackgroundScanCommand(true); } /* * Set a timer to put Wi-Fi to sleep, but only if the screen is off Loading wifi/java/android/net/wifi/WifiNative.java +3 −1 Original line number Diff line number Diff line Loading @@ -171,5 +171,7 @@ public class WifiNative { */ public native static String waitForEvent(); public native static void enableBackgroundScan(boolean enable); public native static void enableBackgroundScanCommand(boolean enable); public native static void setScanIntervalCommand(int scanInterval); } Loading
core/java/android/provider/Settings.java +12 −4 Original line number Diff line number Diff line Loading @@ -3303,12 +3303,20 @@ public final class Settings { 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. * The interval in milliseconds to issue wake up scans when wifi needs * to connect. This is necessary to connect to an access point when * device is on the move and the screen is off. * @hide */ public static final String WIFI_SCAN_INTERVAL_MS = "wifi_scan_interval_ms"; public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = "wifi_framework_scan_interval_ms"; /** * The interval in milliseconds to scan as used by the wifi supplicant * @hide */ public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = "wifi_supplicant_scan_interval_ms"; /** * The interval in milliseconds at which to check packet counts on the Loading
core/jni/android_net_wifi_Wifi.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -556,7 +556,7 @@ static jboolean android_net_wifi_setSuspendOptimizationsCommand(JNIEnv* env, job return doBooleanCommand(cmdstr, "OK"); } static void android_net_wifi_enableBackgroundScan(JNIEnv* env, jobject clazz, jboolean enable) static void android_net_wifi_enableBackgroundScanCommand(JNIEnv* env, jobject clazz, jboolean enable) { //Note: BGSCAN-START and BGSCAN-STOP are documented in core/res/res/values/config.xml //and will need an update if the names are changed Loading @@ -568,6 +568,16 @@ static void android_net_wifi_enableBackgroundScan(JNIEnv* env, jobject clazz, jb } } static void android_net_wifi_setScanIntervalCommand(JNIEnv* env, jobject clazz, jint scanInterval) { char cmdstr[BUF_SIZE]; int numWritten = snprintf(cmdstr, sizeof(cmdstr), "SCAN_INTERVAL %d", scanInterval); if(numWritten < (int)sizeof(cmdstr)) doBooleanCommand(cmdstr, "OK"); } // ---------------------------------------------------------------------------- /* Loading Loading @@ -635,7 +645,8 @@ static JNINativeMethod gWifiMethods[] = { (void*) android_net_wifi_setSuspendOptimizationsCommand}, { "setCountryCodeCommand", "(Ljava/lang/String;)Z", (void*) android_net_wifi_setCountryCodeCommand}, { "enableBackgroundScan", "(Z)V", (void*) android_net_wifi_enableBackgroundScan}, { "enableBackgroundScanCommand", "(Z)V", (void*) android_net_wifi_enableBackgroundScanCommand}, { "setScanIntervalCommand", "(I)V", (void*) android_net_wifi_setScanIntervalCommand}, }; int register_android_net_wifi_WifiManager(JNIEnv* env) Loading
core/res/res/values/config.xml +9 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,15 @@ The driver commands needed to support the feature are BGSCAN-START and BGSCAN-STOP --> <bool translatable="false" name="config_wifi_background_scan_support">false</bool> <!-- Integer indicating wpa_supplicant scan interval in milliseconds --> <integer translatable="false" name="config_wifi_supplicant_scan_interval">15000</integer> <!-- Integer indicating the framework scan interval in milliseconds. This is used in the scenario where the chipset does not support background scanning (config_wifi_background_scan_suport is false) to set up a periodic wake up scan so that the device can connect to a new access point on the move. A value of 0 means no periodic scans will be used in the framework. --> <integer translatable="false" name="config_wifi_framework_scan_interval">300000</integer> <!-- Flag indicating whether the keyguard should be bypassed when the slider is open. This can be set or unset depending how easily the slider can be opened (for example, in a pocket or purse). --> Loading
services/java/com/android/server/WifiService.java +2 −2 Original line number Diff line number Diff line Loading @@ -937,7 +937,7 @@ public class WifiService extends IWifiManager.Stub { evaluateTrafficStatsPolling(); mWifiStateMachine.enableRssiPolling(true); if (mBackgroundScanSupported) { mWifiStateMachine.enableBackgroundScan(false); mWifiStateMachine.enableBackgroundScanCommand(false); } mWifiStateMachine.enableAllNetworks(); updateWifiState(); Loading @@ -949,7 +949,7 @@ public class WifiService extends IWifiManager.Stub { evaluateTrafficStatsPolling(); mWifiStateMachine.enableRssiPolling(false); if (mBackgroundScanSupported) { mWifiStateMachine.enableBackgroundScan(true); mWifiStateMachine.enableBackgroundScanCommand(true); } /* * Set a timer to put Wi-Fi to sleep, but only if the screen is off Loading
wifi/java/android/net/wifi/WifiNative.java +3 −1 Original line number Diff line number Diff line Loading @@ -171,5 +171,7 @@ public class WifiNative { */ public native static String waitForEvent(); public native static void enableBackgroundScan(boolean enable); public native static void enableBackgroundScanCommand(boolean enable); public native static void setScanIntervalCommand(int scanInterval); }